/** * @inheritdoc */ public function afterValidate() { if (!$this->dashboardPanel->validate()) { $this->addError(null); } parent::afterValidate(); }
/** * @param array $dashboardPanelSorts */ public function sortPanels($dashboardPanelSorts) { foreach ($dashboardPanelSorts as $region => $dashboardPanelSort) { foreach (explode(',', $dashboardPanelSort) as $k => $v) { $dashboardPanelId = str_replace('dashboard-panel-', '', $v); if ($dashboardPanelId) { $dashboardPanel = DashboardPanel::findOne($dashboardPanelId); if ($dashboardPanel) { $dashboardPanel->region = $region; $dashboardPanel->sort = $k; $dashboardPanel->save(false); } } } } }
/** * Finds the DashboardPanel model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return DashboardPanel the loaded model * @throws HttpException if the model cannot be found */ protected function findModel($id) { if (($model = DashboardPanel::findOne($id)) !== null) { return $model; } throw new HttpException(404, 'The requested page does not exist.'); }