/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the primary key value. Defaults to null, meaning using the 'id' GET variable */ public function loadDonor($id = null) { if ($this->_model === null) { if ($id !== null || isset($_GET['id'])) { $this->_model = Donor::model()->findbyPk($id !== null ? $id : $_GET['id']); } if ($this->_model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } } return $this->_model; }
<div class="row"> <?php echo $form->label($model, 'program_id'); ?> <?php echo $form->dropDownList($model, 'program_id', GxHtml::listDataEx(Program::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All'))); ?> </div> <div class="row"> <?php echo $form->label($model, 'donor_id'); ?> <?php echo $form->dropDownList($model, 'donor_id', GxHtml::listDataEx(Donor::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All'))); ?> </div> <div class="row"> <?php echo $form->label($model, 'online'); ?> <?php echo $form->textField($model, 'online'); ?> </div> <div class="row"> <?php echo $form->label($model, 'title_ar');
echo $credit_label; ?> </th> <th><?php echo $actions_label; ?> </th> </tr> </thead> <tbody> <?php $debit = 0.0; $credit = 0.0; $customers = CHtml::encodeArray(CHtml::listData(Customer::model()->findAll(array('condition' => 'companyId=' . Yii::app()->user->getState('selectedCompanyId'), 'select' => 'id, CAST(CONCAT(code,\' \',name) AS CHAR CHARACTER SET utf8) as name', 'order' => 'code')), 'id', 'name')); $customers[0] = ''; $donors = CHtml::encodeArray(CHtml::listData(Donor::model()->findAll(array('condition' => 'companyId=' . Yii::app()->user->getState('selectedCompanyId'), 'select' => 'id, CAST(CONCAT(code,\' \',name) AS CHAR CHARACTER SET utf8) as name', 'order' => 'code')), 'id', 'name')); $donors[0] = ''; $accounts = CHtml::encodeArray(CHtml::listData(Account::model()->findAll(array('condition' => 'companyId=' . Yii::app()->user->getState('selectedCompanyId'), 'select' => 'id, CAST(CONCAT(code,\' \',name) AS CHAR CHARACTER SET utf8) as name', 'order' => 'code')), 'id', 'name')); foreach ($models as $n => $transrow) { ?> <tr class="<?php echo $n % 2 ? 'even' : 'odd'; ?> "> <td> <?php echo CHtml::activeDropDownList($transrow, "[{$n}]accountId", $accounts, array('style' => 'width:' . 120 * Yii::app()->user->getState('TransactionEditWidthMultiplier') . 'px')) . "<br>" . CHtml::activeDropDownList($transrow, "[{$n}]customerId", $customers, array('style' => 'width:' . 120 * Yii::app()->user->getState('TransactionEditWidthMultiplier') . 'px')) . "<br>" . CHtml::activeDropDownList($transrow, "[{$n}]donorId", $donors, array('style' => 'width:' . 120 * Yii::app()->user->getState('TransactionEditWidthMultiplier') . 'px')); ?> <td>
<?php $this->breadcrumbs = array($model->label(2) => array('index'), Yii::t('app', 'Manage')); $this->menu = array(array('label' => Yii::t('app', 'List') . ' ' . $model->label(2), 'url' => array('index')), array('label' => Yii::t('app', 'Create') . ' ' . $model->label(), 'url' => array('create'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('distribution-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1><?php echo Yii::t('app', 'Manage') . ' ' . GxHtml::encode($model->label(2)); ?> </h1> <p> You may optionally enter a comparison operator (<, <=, >, >=, <> or =) at the beginning of each of your search values to specify how the comparison should be done. </p> <?php echo GxHtml::link(Yii::t('app', 'Advanced Search'), '#', array('class' => 'search-button')); ?> <div class="search-form"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'distribution-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', 'name', array('name' => 'program_id', 'value' => 'GxHtml::valueEx($data->program)', 'filter' => GxHtml::listDataEx(Program::model()->findAllAttributes(null, true))), array('name' => 'donor_id', 'value' => 'GxHtml::valueEx($data->donor)', 'filter' => GxHtml::listDataEx(Donor::model()->findAllAttributes(null, true))), 'online', 'title_ar', array('class' => 'CButtonColumn'))));
<?php echo $form->labelEx($model, 'program_id'); ?> <?php echo $form->dropDownList($model, 'program_id', GxHtml::listDataEx(Program::model()->findAllAttributes(null, true))); ?> <?php echo $form->error($model, 'program_id'); ?> </div><!-- row --> <div class="row"> <?php echo $form->labelEx($model, 'donor_id'); ?> <?php echo $form->dropDownList($model, 'donor_id', GxHtml::listDataEx(Donor::model()->findAllAttributes(null, true))); ?> <?php echo $form->error($model, 'donor_id'); ?> </div><!-- row --> <div class="row"> <?php echo $form->labelEx($model, 'online'); ?> <?php echo $form->textField($model, 'online'); ?> <?php echo $form->error($model, 'online'); ?>