public function __construct() { parent::__construct(); $result = $this->db->query('SELECT * FROM `topics` ORDER BY `id` ASC'); while (($item = $result->fetch_assoc()) !== null) { $this->view->subMenu[] = ['name' => $item['name'], 'route' => ['pizza/topic', 'topic' => $item['urlName']]]; } }
public function __construct() { //путь до папки шаблонов $this->path = __DIR__ . '/../Views/orders/'; parent::__construct(); if (!App::isAdmin()) { throw new E403Exception('403. Доступ запрещен.'); } }
public function behaviors() { return array_merge(parent::behaviors(), ['verbs' => ['class' => 'yii\\filters\\VerbFilter', 'actions' => ['delete' => ['post']]], 'access' => ['class' => 'yii\\filters\\AccessControl', 'rules' => [['allow' => true, 'verbs' => ['GET'], 'actions' => ['index', 'update'], 'roles' => ['state_view']], ['allow' => true, 'verbs' => ['POST'], 'roles' => ['state_manage']]]]]); }
public function __construct() { //путь до папки шаблонов $this->path = __DIR__ . '/../Views/news/'; parent::__construct(); }
public function behaviors() { return array_merge(parent::behaviors(), ['verbs' => ['class' => 'yii\\filters\\VerbFilter', 'actions' => ['delete' => ['post']]], 'access' => ['class' => 'yii\\filters\\AccessControl', 'only' => ['index', 'create', 'delete', 'act_on_behalf'], 'rules' => [['allow' => true, 'verbs' => ['GET'], 'actions' => ['index'], 'roles' => ['user_view']], ['allow' => true, 'verbs' => ['POST'], 'actions' => ['act-on-behalf'], 'roles' => ['user_act_on_behalf']], ['allow' => true, 'actions' => ['create', 'delete'], 'roles' => ['user_manage']]]]]); }
/** * @inheritdoc */ public function behaviors() { return array_merge(parent::behaviors(), ['access' => ['class' => 'yii\\filters\\AccessControl', 'rules' => [['allow' => true, 'actions' => ['export'], 'matchCallback' => function ($rule, $action) { return true; }]]]]); }
public function init() { $this->_cart = Yii::$app->cart; parent::init(); }