Пример #1
0
 public function actionDynamicthana()
 {
     $data = Thana::model()->findAll('district_id= ' . (int) $_POST['Youtube']['district'] . ' AND published=1');
     $data = CHtml::listData($data, 'id', 'title');
     foreach ($data as $id => $value) {
         echo CHtml::tag('option', array('value' => $id), CHtml::encode($value), true);
     }
 }
Пример #2
0
 public static function getThana($id)
 {
     $value = Thana::model()->findByAttributes(array('id' => $id));
     if (empty($value->title)) {
         return 'Not set';
     } else {
         return $value->title;
     }
 }
Пример #3
0
<?php

$this->breadcrumbs = array('Youtubes' => array('admin'), 'Manage');
$this->menu = array(array('label' => 'Manage', 'url' => array('admin'), 'active' => true, 'icon' => 'icon-home'), array('label' => 'New', 'url' => array('create'), 'active' => true, 'icon' => 'icon-file'), array('label' => '', 'class' => 'search-button', 'url' => '#', 'active' => true, 'icon' => 'icon-search search-button'));
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('youtube-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
Yii::app()->clientScript->registerScript('re-install-date-picker', "\nfunction reinstallDatePicker(id, data) {\n    \$('#datepicker1').datepicker();\n    \$('#datepicker2').datepicker();\n}\n");
?>
<div class="search-form" style="display:none">
    <?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'youtube-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'id', 'type' => 'raw', 'value' => '$data->id', 'htmlOptions' => array('style' => "text-align:left;width:80px;", 'title' => 'ID')), 'youtube_id', array('name' => 'district', 'type' => 'raw', 'value' => 'District::getDistrict($data->district)', 'filter' => CHtml::activeDropDownList($model, 'district', CHtml::listData(District::model()->findAll(array('condition' => '', "order" => "title")), 'id', 'title'), array('empty' => 'All')), 'htmlOptions' => array('style' => "text-align:left;width:150px;", 'title' => 'District')), array('name' => 'thana', 'type' => 'raw', 'value' => 'Thana::getThana($data->thana)', 'filter' => CHtml::activeDropDownList($model, 'thana', CHtml::listData(Thana::model()->findAll(array('condition' => '', "order" => "title")), 'id', 'title'), array('empty' => 'All')), 'htmlOptions' => array('style' => "text-align:left;width:150px;", 'title' => 'Thana')), array('name' => 'published', 'header' => "Status", 'value' => '$data->published?Yii::t(\'app\',\'Active\'):Yii::t(\'app\', \'Inactive\')', 'filter' => array('' => Yii::t('app', 'All'), '0' => Yii::t('app', 'Inactive'), '1' => Yii::t('app', 'Active')), 'htmlOptions' => array('style' => "text-align:center;")), array('name' => 'featured', 'value' => '$data->featured?Yii::t(\'app\',\'Yes\'):Yii::t(\'app\', \'No\')', 'filter' => array('' => Yii::t('app', 'All'), '0' => Yii::t('app', 'No'), '1' => Yii::t('app', 'Yes')), 'htmlOptions' => array('style' => "text-align:center;")), array('name' => 'created_on', 'value' => 'date("F j, Y, g:i A", strtotime($data->created_on))', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'created_on', 'htmlOptions' => array('id' => 'datepicker2', 'size' => '10'), 'i18nScriptFile' => 'jquery.ui.datepicker-en.js', 'defaultOptions' => array('showOn' => 'focus', 'dateFormat' => 'yy-mm-dd', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => false)), true), 'htmlOptions' => array('style' => "text-align:center;")), array('class' => 'bootstrap.widgets.TbButtonColumn'))));
Пример #4
0
 /**
  * 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 Thana the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Thana::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }