本文整理汇总了PHP中Y::controller方法的典型用法代码示例。如果您正苦于以下问题:PHP Y::controller方法的具体用法?PHP Y::controller怎么用?PHP Y::controller使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Y
的用法示例。
在下文中一共展示了Y::controller方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getListView
public function getListView(&$criteria, $return = false)
{
$dp = new EActiveDataProvider(get_class($this->model), array(
'criteria' => $criteria,
//'pagination' => $this->settings['pagination'],
));
//default params
$params = array(
'dataProvider'=>$dp,
'pager'=>array(
'id'=>$this->widgetModel->pk.'Pager', 'class'=>'LinkPager', 'htmlOptions'=>array('class'=>'pager'),
'cssFile'=>Yii::app()->baseUrl.'/css/pager.css'
),
'ajaxUpdate'=>true,
'template'=>$this->render('listTemplate', array(), true),
'afterAjaxUpdate' => ModelFactory::getAfterAjaxUpdateFunction($this->category->type),
'beforeAjaxUpdate' => ModelFactory::getBeforeAjaxUpdateFunction($this->category->type),
'category' => $this->category,
'contextWidget' => $this
);
try {
$res = Y::controller()->widget('ListView', $params, true);
} catch (CException $e) {
Y::dump($e->__toString());
}
if ($return)
return $res;
else
echo $res;
}
示例2: curBaseUrl
public static function curBaseUrl()
{
$baseUrl = '/';
if (Y::module()) {
$baseUrl .= Y::module()->id . '/';
}
$baseUrl .= Y::controller()->id;
return $baseUrl;
}
示例3: activeCaptcha
public function activeCaptcha()
{
$code = Y::controller()->createAction('captcha')->getVerifyCode();
if ($code != $this->verifyCode) {
$this->addError('verifyCode', 'Неправильный код проверки.');
}
if(!isset($_POST['ajax'])) {
Y::controller()->createAction('captcha')->getVerifyCode(true);
}
}
示例4: renderWidget
private function renderWidget($widget, $category)
{
$settings = CMap::mergeArray($widget->settings, array(
'category' => $category,
'blockModel' => $this,
'widgetModel' => $widget,
'block' => $this,
'model' => isset(Y::controller()->model) ? Y::controller()->model : null
));
return Y::controller()->widget($widget->class.'Widget', $settings, true);
}
示例5: renderContent
protected function renderContent()
{
$alias = $this->alias;
if (($menuRoot = Category::model()->menuRoot($alias)) == null) {
Y::end("Параметр alias для menu не верен. Шаблон $alias");
}
if ($this->expand) {
echo $menuRoot->makeTreeHtml($this->category, true);
} else {
$params = array(
'items' => $menuRoot->makeMenu($this->category)
);
Y::controller()->widget('CMenu', $params);
}
}
示例6: get
public function get($alias)
{
if (($menuRoot = Category::model()->menuRoot($alias)) == null) {
$this->error("Параметр tag для menu не верен. Шаблон $this->tmplAlias");
$res = $this->command;
}
$params = new CMap();
if ($params->remove('expand')) {
$res = $menuRoot->makeTreeHtml(Y::controller()->category, true);
} else {
$params['items'] = $menuRoot->makeMenu(Y::controller()->category);
$res = Y::controller()->widget('Menu', $params, true);
}
return $res;
}
示例7: init
public function init()
{
parent::init();
$this->uiDateFormat = $this->uiDateFormat ? $this->uiDateFormat : "yy-mm-dd";
$this->attribute = $this->attribute ? $this->attribute : $this->name;
$this->filter = Y::controller()->widget('ext.jui.FJuiDatePicker',
array(
'model'=>$this->model,
'attribute'=>$this->attribute,
'language'=>'ru',
'options'=>array(
'dateFormat'=>$this->uiDateFormat
)
),
true
);
}
示例8: registerClientScript
/**
* Registers necessary client scripts.
*/
public function registerClientScript()
{
parent::registerClientScript();
$cs=Yii::app()->getClientScript();
$cs->registerScriptFile($this->baseTreeTableUrl.'/javascripts/jquery.treeTable.js',CClientScript::POS_END);
$cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.core.min.js',CClientScript::POS_END);
$cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.widget.min.js',CClientScript::POS_END);
$cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.mouse.min.js',CClientScript::POS_END);
$cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.droppable.min.js',CClientScript::POS_END);
$cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.draggable.min.js',CClientScript::POS_END);
$cs->registerCssFile($this->baseTreeTableUrl.'/stylesheets/jquery.treeTable.css');
$cs->registerScript('treeTable', '
$(document).ready(function() {
$("#'.$this->getId().' .items").treeTable();
});
');
$baseUrl = '/';
if(Y::module())
$baseUrl.=Y::module()->id.'/';
$baseUrl .= Y::controller()->id.'/';
$cs->registerScript('draganddrop', '
$(document).ready(function() {
$("#'.$this->getId().' .items tr.initialized").draggable({
helper: "clone",
opacity: .75,
refreshPositions: true, // Performance?
revert: "invalid",
revertDuration: 300,
scroll: true
});
$("#'.$this->getId().' .items tr.initialized, #'.$this->getId().' .items tr.before, #'.$this->getId().' .items tr.after").droppable({
accept: ".initialized",
drop: function(e, ui) {
// Call jQuery treeTable plugin to move the branch
//$(ui.draggable).appendBranchTo(this);
if($(this).hasClass("initialized")) {
window.location.href = "'.$baseUrl.'moveNode/action/child/to/"+$(this).attr("id")+"/id/"+$(ui.draggable).attr("id");
}
if($(this).hasClass("before")) {
window.location.href = "'.$baseUrl.'moveNode/action/before/to/"+$(this).attr("id").replace("before-", "")+"/id/"+$(ui.draggable).attr("id");
}
if($(this).hasClass("after")) {
window.location.href = "'.$baseUrl.'moveNode/action/before/to/"+$(this).attr("id").replace("after-", "")+"/id/"+$(ui.draggable).attr("id");
}
},
hoverClass: "accept",
over: function(e, ui) {
// Make the droppable branch expand when a draggable node is moved over it.
if(this.id != $(ui.draggable.parents("tr")[0]).id && !$(this).is(".expanded")) {
$(this).expand();
}
},
activate: function(e, ui) {
$(".after").css("display", "table-row");
$(".before").css("display", "table-row");
},
deactivate: function(e, ui) {
$(".after").css("display", "none");
$(".before").css("display", "none");
},
});
});
');
}
示例9: getTabs
public function getTabs($id = null, $return = false)
{
$submitButton = Y::controller()->widget('AjaxSubmitButton', array(
'name'=>'saveButton',
'id'=>$id.'_save_button',
'htmlOptions'=>array('class'=>'submit-button','value'=>'Save',),
'options'=>array(
'success'=>'js:function(){$("#submit-form-result").fadeIn(400).delay(2000).fadeOut(400)}'
)
), true);
$tabs = self::controller()->widget(
'ExtTabs', array(
'tabs'=>self::$tabs,
'options'=>array(
'collapsible'=>false,
),
'id' => $id,
'htmlOptions' => array('class'=>'widget_settings_tabs', 'style'=>'height:495px'),
//add buttons to widget header
'buttons' => array ($submitButton),
'extHeaderHtml' => '<div id="submit-form-result">Сохранено</div>'
),
true
);
//clear
self::$tabs = array();
self::$curTabName = '';
//return
if ($return)
return $tabs;
else
echo $tabs;
}
示例10: widget
public function widget($widgetName, $event, $additionParams = array())
{
$params = CMap::mergeArray($event->params, $additionParams);
Y::controller()->widget($widgetName, $params);
}
示例11: makeDateFields
public static function makeDateFields($form, $model, $attributes, $dateFormat = 'yy.mm.dd', $phpDateFormat = 'd.m.Y')
{
foreach ((array)$attributes as $attr) {
echo '<div class="row">
<div class="left">'.$form->labelEx($model,$attr).'</div>
<div class="right">';
$name = get_class($model).'['.$attr.']';
if ($model->isNewRecord) {
$model->{$attr} = date('d.m.Y');
}
$time = date($phpDateFormat,strtotime($model->{$attr}));
Y::controller()->widget('zii.widgets.jui.CJuiDatePicker', array(
'attribute'=>$attr,
// 'scriptFile'=>'/js/jquery-ui.min.js',
'model'=>$model,
'language'=>Yii::app()->language,
'options'=>array(
'changeYear'=>true,
'yearRange'=>'-50:-15',
'dateFormat'=>'dd.mm.yy',
),
'htmlOptions'=>array('size'=>30,'class'=>'date')
));
echo '</div>
</div>';
}
}