本文整理汇总了PHP中Y::hooks方法的典型用法代码示例。如果您正苦于以下问题:PHP Y::hooks方法的具体用法?PHP Y::hooks怎么用?PHP Y::hooks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Y
的用法示例。
在下文中一共展示了Y::hooks方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionAdmin
public function actionAdmin($catPk, $opts = array())
{
$cat = Category::model()->findByPk($catPk);
$model = $this->loadModel($catPk, null, 'search');
$this->ajaxSetNextValue('published', $model, 'published', array(BaseDataType::PUBLISHED, BaseDataType::NOT_PUBLISHED));
$model->unsetAttributes(); // clear any default values
$model = $model->current($cat);
if (isset($_GET[get_class($model)]))
$model->attributes=$_GET[get_class($model)];
$opts['model'] = $model;
$opts['cat'] = $cat;
$opts['columns'] = array();
$opts = Y::hooks()->cmsAdminGetGridColumns($this, &$opts);
if (isset($_GET['ajax'])) {
$this->renderPartial('admingrid',$opts);
} else {
$this->render('admin',$opts);
}
}
示例2: addHandler
public function addHandler($eventName, $handler)
{
if (is_array($handler)) {
$ca = Yii::app()->createController(ucfirst($handler[0]), $this);
$handler[0] = $ca[0];
$handler[1] = 'cms'.ucfirst($handler[1]);
} else {
$handler = array($this, $handler);
}
Y::hooks()->$eventName = $handler;
}
示例3: relations
public function relations()
{
$relations = CMap::mergeArray(parent::relations(), array(
//!!!don't use this relations!!!
//use relations with functions
//need set type condition
// 'variants' => array(self::MANY_MANY, 'Variant', 'variant_relations(model_id, variant_id)'),
// 'union' => array(self::BELONGS_TO, 'Union', UnionList::getPkAttr()),
// 'subdata' => array(self::HAS_MANY, 'Subdata', Record::getPkAttr()),
// 'gallery' => array(self::HAS_MANY, 'ImageGallery', ImageGallery::getPkAttr()),
));
Y::hooks()->cmsDataTypeRelations($this, array('relations'=>&$relations));
return $relations;
}
示例4: getSystemMenu
public function getSystemMenu()
{
$menu = array(
'categories' => array('text'=>Admin::link('Категории', 'categories/admin')),
'components' => array('text'=>Admin::link('Компоненты', 'manage/componentsGallery')),
'settings' => array('text'=>Admin::link('Настройки Сайта', 'settings/admin')),
/*array('text'=>Admin::link('Пользователи', 'users/admin')),
array(
'text'=>'Списки',
'children'=>array(
array('text'=>Admin::link('Проделанные работы', 'portfolioWorks/admin')),
array('text'=>Admin::link('Виды деятельности', 'portfolioWorkTypes/admin')),
array('text'=>Admin::link('Города', 'cities/admin')),
)
),*/
//'logout' => array('text'=> Users::link('Выход', 'logout'))
);
$res = Y::hooks()->cmsAdminGetSystemMenu($this, array('menu'=>$menu));
return $res['menu'];
}
示例5: array
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'posts-form',
'enableAjaxValidation'=>true,
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
'htmlOptions' => array(
'enctype'=>'multipart/form-data'
)
));
echo $form->errorSummary($model);
Y::hooks()->cmsAdminGetTabs($this, array('model'=>$model, 'form'=>$form));
echo Y::getTabs();
$this->endWidget();
?>
</div><!-- form -->