if (Yii::$app->controller->action->id == "device-repear") { if (is_numeric($_GET['id'])) { $device = \backend\models\Models::findOne($_GET['id']); } else { $device = \backend\models\Models::find()->where(['url' => $_GET['id']])->one(); } return $device->date_update; } elseif (Yii::$app->controller->action->id =="device-model") { if (is_numeric($_GET['id'])) $max_update = \backend\models\Models::find()->where(['category_id' => $_GET['id']])->max('date_update'); else { $device_category = \backend\models\DeviceCategory::find()->where(['url' => $_GET['id']])->one(); $id = $device_category['id'];
if (is_numeric($_GET['id'])) { $device = \backend\models\Models::findOne($_GET['id']); } else { $device = \backend\models\Models::find()->where(['url' => $_GET['id']])->one(); } return $device->date_update; } elseif (Yii::$app->controller->action->id =="device-model") { if (is_numeric($_GET['id'])) $max_update = \backend\models\Models::find()->where(['category_id' => $_GET['id']])->max('date_update'); else {
if ($verb !== 'GET' && $verb !== 'HEAD' || $this->lastModified === null && $this->etagSeed === null) { return true; } $lastModified = $etag = null; if ($this->lastModified !== null) { $lastModified = call_user_func($this->lastModified, $action, $this->params); } if ($this->etagSeed !== null) { $seed = call_user_func($this->etagSeed, $action, $this->params); if ($seed !== null) { $etag = $this->generateEtag($seed); }
public function beforeFilter($event) { if (!$this->isActive($event->action)) { return; } $event->isValid = $this->beforeAction($event->action); if ($event->isValid) { // call afterFilter only if beforeFilter succeeds // beforeFilter and afterFilter should be properly nested $this->owner->on(Controller::EVENT_AFTER_ACTION, [$this, 'afterFilter'], null, false); } else { $event->handled = true;
$event->sender = $this; } $event->handled = false; $event->name = $name; foreach ($eventHandlers as $handler) { $event->data = $handler[1]; call_user_func($handler[0], $event); // stop further handling if the event is handled if ($event->handled) { return; } } }
* @param Action $action the action to be executed. * @return bool whether the action should continue to run. */ public function beforeAction($action) { $event = new ActionEvent($action); $this->trigger(self::EVENT_BEFORE_ACTION, $event); return $event->isValid; } /** * This method is invoked right after an action is executed. *
/** * {@inheritdoc} */ public function beforeAction($action) { if (parent::beforeAction($action)) { if ($this->enableCsrfValidation && Yii::$app->getErrorHandler()->exception === null && !$this->request->validateCsrfToken()) { throw new BadRequestHttpException(Yii::t('yii', 'Unable to verify your data submission.')); } return true; }
break; } } $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
require __DIR__ . '/../../common/config/main.php', require __DIR__ . '/../../common/config/main-local.php', require __DIR__ . '/../config/main.php', require __DIR__ . '/../config/main-local.php' ); (new yii\web\Application($config))->run();
$_GET = [ 'id' => 'remont_ipad_pro_10_5_a1701_09', ];