
Number of downloads: 39 here/below, i wonder what should i do to my app in order to displaying the report like this,?
i really need to know how to do this on my yiiapp,
best regards for all the responses,
many thanks,
Posted 12 January 2013 - 09:41 PM
Posted 13 January 2013 - 01:07 AM
<h1>View Author <?php echo $model->id; ?></h1> <?php $this->widget('zii.widgets.CDetailView', array( 'data'=>$model, 'attributes'=>array( 'id', 'name', ), )); ?> <h4 style="margin-top:10px;"><?php echo "Posts made by ".$model->name;?></h4> <?php $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'post-grid', 'dataProvider'=>new CArrayDataProvider($model->posts),//Using CArrayDataProvider 'columns'=>array( 'id', 'title', array( 'class'=>'CButtonColumn', ), ), )); ?>
'dataProvider'=>new CActiveDataProvider("Post",array ( 'criteria'=>array('condition'=>'t.auth_id='.$model->id) ) ),
Posted 13 January 2013 - 06:01 PM
seenivasan, on 13 January 2013 - 01:07 AM, said:
<h1>View Author <?php echo $model->id; ?></h1> <?php $this->widget('zii.widgets.CDetailView', array( 'data'=>$model, 'attributes'=>array( 'id', 'name', ), )); ?> <h4 style="margin-top:10px;"><?php echo "Posts made by ".$model->name;?></h4> <?php $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'post-grid', 'dataProvider'=>new CArrayDataProvider($model->posts),//Using CArrayDataProvider 'columns'=>array( 'id', 'title', array( 'class'=>'CButtonColumn', ), ), )); ?>
'dataProvider'=>new CActiveDataProvider("Post",array ( 'criteria'=>array('condition'=>'t.auth_id='.$model->id) ) ),
'criteria'=>array('condition'=>'t.auth_id='.$model->id)
Posted 14 January 2013 - 02:09 AM
'dataProvider'=>new CActiveDataProvider("Post",array ( 'criteria'=>array( 'condition'=>'auth_id=:id', 'params'=>array(":id"=>$model->id), ), ) ),
Posted 14 January 2013 - 03:06 AM
'dataProvider'=>new CActiveDataProvider("Post",array
<?php $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'post-grid',
Posted 14 January 2013 - 05:06 AM
'dataProvider'=>new CActiveDataProvider("Post",array ( 'criteria'=>array( 'condition'=>'auth_id=:id', 'params'=>array(":id"=>$model->id), ), ) ),
<?php $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'post-grid',
public function relations() { return array( 'foods' => array(self::HAS_MANY, 'Food', 'invoice_id'), 'drinks' => array(self::HAS_MANY, 'Drink', 'invoice_id'), ); }
$invoice=Invoice::model()->findByPk(1); $invoice->foods;// All the food objects related to invoice1. $invoice->drinks://All the drinks related to invoice1.
Posted 14 January 2013 - 06:06 AM
$this->widget('zii.widgets.grid.CGridView', array( 'id'=>'invoice-grid', 'dataProvider'=>new CActiveDataProvider("Post",array ( 'criteria'=>array( 'condition'=>'invoice_id=:id', 'params'=>array(":id"=>$model->invoice_id), ), ) ), 'columns'=>array( 'idSpekLokasi', 'namaSpek', 'ketSpek', //'title', array( 'class'=>'CButtonColumn', ), ), ));
public function actionView($id) { $invoice = Invoice::model()->findByPk($id); $invoice ->foods; $invoice ->drinks; $this->render('view', array( 'invoice' => $invoice, )); //$this->render('view',array( //'model'=>$this->loadModel($id), //)); }
'foods' => array(self::HAS_MANY, 'Invoice', 'invoice_id'), 'drinks' => array(self::HAS_MANY, 'Invoice','invoice_id'),
* @var string the URL of the CSS file used by this detail view. Defaults to null, meaning using the integrated 126 * CSS file. If this is set false, you are responsible to explicitly include the necessary CSS file in your page. 127 */ 128 public $cssFile; 129 130 /** 131 * Initializes the detail view. 132 * This method will initialize required property values. 133 */ 134 public function init() 135 { 136 if($this->data===null) 137 throw new CException(Yii::t('zii','Please specify the "data" property.')); 138 if($this->attributes===null) 139 { 140 if($this->data instanceof CModel) 141 $this->attributes=$this->data->attributeNames(); 142 else if(is_array($this->data)) 143 $this->attributes=array_keys($this->data); 144 else 145 throw new CException(Yii::t('zii','Please specify the "attributes" property.')); 146 } 147 if($this->nullDisplay===null) 148 $this->nullDisplay='<span class="null">'.Yii::t('zii','Not set').'</span>'; 149 $this->htmlOptions['id']=$this->getId();
Posted 14 January 2013 - 07:50 AM
public function actionView($id) { $this->loadModel($id); $foodProvider=new CActiveDataProvider("Food",array //not "Post" Post is my example. ( 'criteria'=>array( 'condition'=>'invoice_id=:id', 'params'=>array(":id"=>$model->invoice_id), ), )); $drinkProvider=new CActiveDataProvider("Drink",array ( 'criteria'=>array( 'condition'=>'invoice_id=:id', 'params'=>array(":id"=>$model->invoice_id), ), )); $this->render('view',array('model'=>$model,'foodProvider'=>$foodProvider,'drinkProvider'=>$drinkProvider))); }
<h1>View Invoice #<?php echo $model->id; ?></h1> <?php $this->widget('zii.widgets.CDetailView', array( 'data'=>$model, 'attributes'=>array( 'invoice_id', 'reserveNumber', 'tableNumber', 'totalBill' ), )); ?> <?php $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'food-grid', 'dataProvider'=>$foodProvider 'columns'=>array( 'food_id', 'foodName', 'fdqty', 'fdprice', 'fddiscount', array( 'class'=>'CButtonColumn', ), ), )); ?> <?php $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'drink-grid', 'dataProvider'=>$drinkProvider 'columns'=>array( 'drink_id', 'drName', 'drqty', 'drprice', 'drdiscount', array( 'class'=>'CButtonColumn', ), ), )); ?>
Posted 14 January 2013 - 09:13 PM
public function actionView($id) { $this->loadModel($id); $foodProvider = new CActiveDataProvider ("Food", array ( 'criteria' => array( //i modified this part: 'condition'=>Yii::app()->db->quoteColumnName('t.invoice_id').'=:id', 'params' => array(":id" => $model->invoice_id), ),)); $this->render('view',array( 'model'=>//$model,==> // i didn't use the method because it get the error //"Please specify the "data" property. " $this->loadModel($id), 'foodProvider'=> $foodProvider, )); } // my view are the same as you bro., // and i also try to use CListView but it comes with the same result (empty displayed //result)
Posted 18 January 2013 - 12:33 AM