public function actionSearch()
 {
     $model = new Appointment('search');
     if (!$model->app_type) {
         $model->app_type = [Appointment::TYPE_VIEWING, Appointment::TYPE_VALUATION];
     }
     if (!$model->app_notetype) {
         $model->app_notetype = Appointment::getNoteTypes();
     }
     if (!$model->app_start) {
         $model->app_start = date('d-m-Y', strtotime('-1 year'));
     }
     if (isset($_GET['Appointment']) && $_GET['Appointment']) {
         $model->attributes = $_GET['Appointment'];
     }
     $dataProvider = $model->search();
     $dataProvider->getCriteria()->select = ['t.app_status', 't.app_start', 't.app_type', 't.app_notetype', 't.app_subject', 't.app_user'];
     $dataProvider->getCriteria()->with['clients']['select'] = ['clients.cli_fname', 'clients.cli_sname'];
     $dataProvider->getCriteria()->with['_instructions']['select'] = ['_instructions.dea_id'];
     $dataProvider->getCriteria()->with['user']['select'] = ['user.use_fname', 'user.use_sname'];
     $this->render('search', compact('model', 'dataProvider'));
 }
示例#2
0
		<div class="controls">
			<?php 
echo $form->checkBoxListWithSelectOnLabel($model, 'app_type', Appointment::getTypes(), ['separator' => ' ', 'class' => 'note-types']);
?>
		</div>
		<?php 
echo $form->endControlGroup();
?>
		<?php 
echo $form->beginControlGroup($model, 'app_notetype', ['id' => 'notetypes', 'style' => 'display: none']);
?>
		<label class="control-label">Note type</label>

		<div class="controls">
			<?php 
echo $form->checkBoxListWithSelectOnLabel($model, 'app_notetype', Appointment::getNoteTypes(), ['separator' => ' ']);
?>
		</div>
		<?php 
echo $form->endControlGroup();
?>
	</div>
</fieldset>
<?php 
$this->endWidget();
$this->widget('AdminGridView', array('dataProvider' => $dataProvider, 'title' => 'SEARCH APPOINTMENT', 'id' => 'appointment-list', 'columns' => array(array('class' => 'CButtonColumn', 'header' => 'Actions', 'template' => '{edit}', 'buttons' => array('edit' => array('label' => 'Edit', 'url' => function (Appointment $data) {
    return AppointmentController::createEditLink($data->app_id);
}, 'imageUrl' => Icon::EDIT_ICON))), array('name' => 'app_status', 'htmlOptions' => ['style' => 'width: 80px;']), 'app_start' => array('name' => 'app_start', 'header' => 'start', 'htmlOptions' => ['style' => 'width: 130px;'], 'value' => function (Appointment $data) {
    return Date::formatDate('d/m/Y H:i', $data->app_start);
}), 'app_type', 'app_notetype', 'app_subject', array('name' => 'user.fullName', 'header' => 'User', 'value' => function ($data) {
    return $data->user ? $data->user->fullName : 'unassigned';