コード例 #1
0
 /** 
  * Finds the RReklama model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return RReklama the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = RReklama::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #2
0
ファイル: SiteController.php プロジェクト: a7000q/yasvoboden
 public function actionIndex()
 {
     $get = Yii::$app->request->get();
     $parent_cat = false;
     $params = "";
     if (isset($get["cat"])) {
         $cat_id = $get["cat"];
         $parent_cat = FCategory::findOne($cat_id);
         $brandChumbs = $parent_cat->brandChumbs;
         $cat_name = $parent_cat->name;
         if (count($brandChumbs) > 0) {
             foreach ($brandChumbs as $val) {
                 $params['breadcrumbs'][] = ['label' => $val["name"], 'url' => [$val["url"], "cat" => $val["id"]]];
             }
         }
     } else {
         $cat_id = 0;
     }
     $FCategory = FCategory::find()->where(['parent_id' => $cat_id])->orderBy('sort, name')->all();
     $RReklama = RReklama::find()->all();
     return $this->render('index', ['category' => $FCategory, 'parent_cat' => $parent_cat, 'params' => $params, 'reklama' => $RReklama]);
 }