本文整理汇总了PHP中AppController::beforeAction方法的典型用法代码示例。如果您正苦于以下问题:PHP AppController::beforeAction方法的具体用法?PHP AppController::beforeAction怎么用?PHP AppController::beforeAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppController
的用法示例。
在下文中一共展示了AppController::beforeAction方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeAction
public function beforeAction()
{
// auto find model entry when id passed
if (isset($this->params['id'])) {
if (!$this->{$this->name}->fromId($this->params['id'])) {
return false;
}
$this->data->set($this->name, $this->{$this->name});
}
// send invalid logins (invalid user group) back to loing page
if (!$this->UserLogin->loggedin() && empty($this->publicActions)) {
$this->redirect(Router::getRoute('adminLogin'));
}
// change language on users locale
if (isset($this->I18n) && $this->UserLogin->loggedin() && $this->User->hasField('locale')) {
$this->I18n->locale($this->UserLogin->User->locale);
}
// if mobile layout selected, use other action view files
if ($this->layout == 'mobile') {
// and increase number of returned model entries
if (!empty($this->{$this->name})) {
$this->{$this->name}->perPage = 50;
if (!in_array($this->action, array('edit', 'view'))) {
$this->{$this->name}->depth = 0;
}
}
$this->action .= '.mobile';
}
return parent::beforeAction();
}
示例2: beforeAction
public function beforeAction()
{
if ($this->UserLogin->loggedin()) {
$this->BlogPost->findConditions = array();
}
return parent::beforeAction();
}
示例3: beforeAction
public function beforeAction()
{
parent::beforeAction();
// VALIDATION
if (!in_array($this->action, $this->publicAccessActions) and !$this->Security->hasPermission('administradores_root')) {
$this->set_404();
}
}
示例4: beforeAction
public function beforeAction()
{
// find all nodes if logged in @todo add PermissionCheck to this
if (isset($this->Node) && $this->UserLogin->loggedin()) {
$this->Node->findConditions = array();
}
return parent::beforeAction();
}
示例5: beforeAction
public function beforeAction()
{
if (empty($this->params['unique_id'])) {
return false;
}
if (!($this->MediaFile = $this->MediaFile->findByUniqueId($this->params['unique_id']))) {
return false;
}
return parent::beforeAction();
}
示例6: beforeAction
function beforeAction()
{
parent::beforeAction();
}