public function actionDarsJadvali() { $keys = array_keys($_GET); $group_id = (int) $keys[0]; $days = Day::model()->findAll(); $weeks = Day::forMegalka(); $toq = $weeks[0]; $juft = $weeks[1]; $dgsts = []; foreach ($days as $day) { $dgsts[$day->id] = Dgst::model()->findAllByAttributes(['group_id' => $group_id, 'day_id' => $day->id]); } $this->renderPartial('_dars_jadvali', ['days' => $days, 'dgsts' => $dgsts, 'toq' => $toq, 'juft' => $juft]); }
<div class="row"> <?php echo $form->label($model, 'room'); ?> <?php echo $form->textField($model, 'room', array('size' => 10, 'maxlength' => 10)); ?> </div> <div class="row"> <?php echo $form->label($model, 'megalka'); ?> <?php echo $form->dropDownList($model, 'megalka', Dgst::megalka()); ?> </div> <div class="row"> <?php echo $form->label($model, 'teacher2_id'); ?> <?php echo $form->dropDownList($model, 'teacher2_id', Teacher::teachers()); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton('Search');
/** * 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 $id the ID of the model to be loaded * @return Dgst the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Dgst::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php /* @var $this DgstController */ /* @var $model Dgst */ $this->breadcrumbs = array('Dgsts' => array('index'), 'Manage'); $this->menu = array(array('label' => 'List Dgst', 'url' => array('index')), array('label' => 'Create Dgst', '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\$('#dgst-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1>Manage Dgsts</h1> <p> You may optionally enter a comparison operator (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b> or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done. </p> <?php echo CHtml::link('Advanced Search', '#', array('class' => 'search-button')); ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'dgst-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id' => ['name' => 'id', 'htmlOptions' => ['width' => 30]], 'day_id' => ['name' => 'day_id', 'value' => '$data->day->name', 'filter' => Day::days()], 'group_id' => ['name' => 'group_id', 'value' => '$data->group->name', 'filter' => Group::groups()], 'subject_id' => ['name' => 'subject_id', 'value' => '$data->subject->name', 'filter' => Subject::subjects()], 'teacher_id' => ['name' => 'teacher_id', 'value' => '$data->teacher->fio', 'filter' => Teacher::teachers()], 'para' => ['name' => 'para', 'filter' => Dgst::para()], 'megalka' => ['name' => 'megalka', 'filter' => Dgst::megalka()], 'teacher2_id' => ['name' => 'teacher2_id', 'value' => '$data->teacher->fio', 'filter' => Teacher::teachers()], array('class' => 'CButtonColumn'))));