public function actionWork() { $criteria = new CDbCriteria(); $criteria->order = "id DESC"; $count = Work::model()->count($criteria); $pages = new CPagination($count); // элементов на страницу $pages->pageSize = 20; $pages->applyLimit($criteria); $work = Work::model()->findAll($criteria); $this->render('work', array('work' => $work, 'pages' => $pages)); }
?> <?php echo $form->error($model, 'description'); ?> </div> <br> <div class="row"> <?php echo $form->labelEx($modelRepairWork, 'work_id'); ?> <?php echo $form->dropDownList($modelRepairWork, 'work_id', Chtml::listData(Work::model()->findAll(array('condition' => 'active = 1 AND service_type_id=2', 'order' => 'name')), 'id', 'name'), array('prompt' => 'Seleccionar un trabajo')); ?> <?php echo CHtml::Button('Agregar +', array('id' => 'agregar', 'name' => 'agregar', 'onclick' => 'send();')); ?> <?php echo $form->error($modelRepairWork, 'work_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'finished');
/** * 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 ID of the model to be loaded */ public function loadModel($id) { $model = Work::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php echo $form->labelEx($model, 'observation'); ?> <?php echo $form->textArea($model, 'observation', array('rows' => 6, 'cols' => 50)); ?> <?php echo $form->error($model, 'observation'); ?> </div> <div class="row"> <?php echo $form->labelEx($modelDiagnosticWork, 'work_id'); ?> <?php echo $form->dropDownList($modelDiagnosticWork, 'work_id', Chtml::listData(Work::model()->findAll(array('condition' => 'active=1 AND service_type_id=' . $modelOrder->service_type_id, 'order' => 'name')), 'id', 'name'), array('prompt' => 'Seleccionar')); ?> <?php echo CHtml::Button('Agregar +', array('id' => 'agregar', 'name' => 'agregar', 'onclick' => 'send();')); ?> <?php echo $form->error($modelDiagnosticWork, 'work_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'status_order_id'); ?> <?php $statusArray = array(5, 8, 13);
public function getList() { return CHtml::listData(Work::model()->findAll(), 'id', 'name'); }
echo $form->labelEx($model, 'observation'); ?> <?php echo $form->textArea($model, 'observation', array('rows' => 6, 'cols' => 50)); ?> <?php echo $form->error($model, 'observation'); ?> </div> <div class="row"> <?php echo $form->labelEx($modelDiagnosticWork, 'work_id'); ?> <?php echo $form->dropDownList($modelDiagnosticWork, 'work_id', Chtml::listData(Work::model()->findAll('active=1'), 'id', 'name'), array('prompt' => 'Seleccionar')); ?> <?php echo CHtml::submitButton('Agregar +', array('id' => 'agregar', 'name' => 'agregar')); ?> <?php echo $form->error($modelDiagnosticWork, 'work_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'finished'); ?> <?php echo $form->checkBox($model, 'finished');