<p class="help-block">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <fieldset> <legend><?php echo Yii::t('view', 'workshop.workshop_info_lb'); ?> </legend> <?php echo $form->dropDownListRow($model->workshop, 'workshop_cat_id', CHtml::listData(WorkshopCat::getAllCategories(), 'workshop_cat_id', 'workshop_cat_name')); ?> <?php if (!$isEmp) { ?> <?php echo $form->dropDownListRow($model->workshop, 'workshop_facilitator_id', CHtml::listData(WorkshopFacilitator::getAllFacilitators(), 'workshop_facilitator_id', 'name'), array('empty' => 'None')); ?> <?php } ?>
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('action' => Yii::app()->createUrl($this->route), 'type' => 'horizontal', 'method' => 'get')); $isAdmin = Yii::app()->user->isAdmin() || Yii::app()->user->isSuperAdmin(); ?> <fieldset> <legend><?php echo Yii::t('view', 'workshop.workshop_info_lb'); ?> </legend> <?php echo $form->textFieldRow($model, 'post_item_id', array('class' => 'span5')); ?> <?php echo $form->dropDownListRow($model, 'workshop_cat_id', CHtml::listData(WorkshopCat::getAllCategories(), 'workshop_cat_id', 'workshop_cat_name'), array('prompt' => '')); ?> <?php echo $form->dropDownListRow($model, 'workshop_facilitator_id', CHtml::listData(WorkshopFacilitator::getAllFacilitators(), 'workshop_facilitator_id', 'name'), array('prompt' => '')); ?> <?php echo $form->textFieldRow($model, 'title'); ?> <?php echo $form->textFieldRow($model, 'website', array('class' => 'span6', 'maxlength' => 100)); ?>
<?php $this->widget('bootstrap.widgets.TbGridView', array('id' => 'workshop-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('post_item_id', array('filter' => CHtml::listData(WorkshopCat::getAllCategories(), 'workshop_cat_id', 'workshop_cat_name'), 'name' => 'workshop_cat_id', 'value' => '$data->workshop_cat_name'), 'title', 'start_date:date', 'end_date:date', 'start_time:time', 'end_time:time', array('name' => 'is_approved', 'filter' => array('1' => 'Yes', '0' => 'No'), 'value' => 'Yii::app()->format->formatBoolean($data->is_approved)'), array('class' => 'bootstrap.widgets.TbButtonColumn', 'afterDelete' => 'function(link,success,data){if(success)jQuery("#alert-div").html(data);}'))));
/** * 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 = WorkshopCat::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php $this->breadcrumbs = array('Workshops'); $this->menu = array(array('label' => 'Create Workshop', 'url' => array('create')), array('label' => 'Manage Category', 'url' => array('/workshop/workshopCat/admin')), array('label' => 'Manage Facilitator', 'url' => array('/workshop/workshopFacilitator/admin')), array('label' => 'Planned Workshops'), array('label' => 'Manage', 'url' => array('/workshop/workshopPlanned/admin')), array('label' => 'New', 'url' => array('/workshop/workshopPlanned/create'))); Yii::app()->clientScript->registerScript('search', "\r\r\n\$('.search-button').click(function(){\r\r\n\t\$('.search-form').toggle();\r\r\n\treturn false;\r\r\n});\r\r\n\$('.search-form form').submit(function(){\r\r\n\t\$.fn.yiiGridView.update('workshop-grid', {\r\r\n\t\tdata: \$(this).serialize()\r\r\n\t});\r\r\n\treturn false;\r\r\n});\r\r\n"); ?> <h1>Manage Workshops</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 btn')); ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('workshop.views.common.workshop._search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('bootstrap.widgets.TbGridView', array('id' => 'workshop-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('title', array('filter' => CHtml::listData(WorkshopCat::getAllCategories(), 'workshop_cat_id', 'workshop_cat_name'), 'name' => 'workshop_cat_id', 'value' => '$data->workshop_cat_name'), 'start_date:date', 'end_date:date', 'start_time:time', 'end_time:time', array('name' => 'is_approved', 'class' => 'bootstrap.widgets.TbToggleColumn', 'toggleAction' => 'toggleApproved', 'filter' => array('1' => 'Yes', '0' => 'No')), array('name' => 'is_active', 'class' => 'bootstrap.widgets.TbToggleColumn', 'toggleAction' => 'toggleActive', 'filter' => array('1' => 'Yes', '0' => 'No')), array('name' => 'is_running', 'class' => 'bootstrap.widgets.TbToggleColumn', 'toggleAction' => 'toggleRunning', 'filter' => array('1' => 'Yes', '0' => 'No'), 'afterToggle' => 'function(success,data){ if (success) alert(data); }'), array('class' => 'bootstrap.widgets.TbButtonColumn', 'buttons' => array('delete' => array('visible' => '$data->is_active==true')))))); ?>