Example #1
0
<?php

/** Display pages list **/
$this->pageHeader = Yii::t('PagesModule.core', 'Страницы');
$this->breadcrumbs = array('Home' => $this->createUrl('/admin'), Yii::t('PagesModule.core', 'Страницы'));
$this->topButtons = $this->widget('application.modules.admin.widgets.SAdminTopButtons', array('template' => array('create'), 'elements' => array('create' => array('link' => $this->createUrl('create'), 'title' => Yii::t('PagesModule.core', 'Создать страницу'), 'options' => array('icons' => array('primary' => 'ui-icon-plus'))))));
$this->widget('ext.sgridview.SGridView', array('dataProvider' => $dataProvider, 'id' => 'pagesListGrid', 'afterAjaxUpdate' => "function(){registerFilterDatePickers()}", 'filter' => $model, 'columns' => array(array('class' => 'CCheckBoxColumn'), array('class' => 'SGridIdColumn', 'name' => 'id'), array('name' => 'title', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->title), array("update", "id"=>$data->id))'), array('name' => 'url', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->url), $data->getViewUrl(), array("target"=>"_blank"))'), array('name' => 'category_id', 'type' => 'raw', 'value' => strtr('$data->category ? $data->category->getUpdateLink(): "{no}"', array('{no}' => Yii::t('PagesModule.core', 'Нет'))), 'filter' => PageCategory::keyValueList()), array('name' => 'user_id', 'type' => 'raw', 'value' => '$data->author->getUpdateLink()'), array('name' => 'status', 'value' => 'CHtml::encode($data->statusLabel)', 'filter' => Page::statuses()), 'publish_date', array('class' => 'CButtonColumn', 'template' => '{update}{delete}'))));
Yii::app()->clientScript->registerScript("pageDatepickers", "\n\t\tfunction registerFilterDatePickers(id, data){\n\t\t\tjQuery('input[name=\"Page[publish_date]\"]').datepicker({\n\t\t\t\tdateFormat:'yy-mm-dd',\n\t\t\t\tconstrainInput: false\n\t\t\t});\n\t\t}\n\t\tregisterFilterDatePickers();\n\t");
Example #2
0
<?php

/*** Create/update page form ***/
Yii::import('zii.widgets.jui.CJuiDatePicker');
return array('id' => 'pageUpdateForm', 'showErrorSummary' => true, 'elements' => array('content' => array('type' => 'form', 'title' => Yii::t('PagesModule.core', 'Содержимое'), 'elements' => array('title' => array('type' => 'text'), 'url' => array('type' => 'text'), 'category_id' => array('type' => 'dropdownlist', 'items' => PageCategory::keyValueList(), 'empty' => '---'), 'short_description' => array('type' => 'SRichTextarea'), 'full_description' => array('type' => 'SRichTextarea'))), 'seo' => array('type' => 'form', 'title' => Yii::t('PagesModule.core', 'Мета данные'), 'elements' => array('meta_title' => array('type' => 'text'), 'meta_keywords' => array('type' => 'textarea'), 'meta_description' => array('type' => 'textarea'))), 'additional' => array('type' => 'form', 'title' => Yii::t('PagesModule.core', 'Дополнительно'), 'elements' => array('status' => array('type' => 'dropdownlist', 'items' => Page::statuses()), 'publish_date' => array('type' => 'CJuiDatePicker', 'options' => array('dateFormat' => 'yy-mm-dd ' . date('H:i:s'))), 'layout' => array('type' => 'text'), 'view' => array('type' => 'text')))));