Esempio n. 1
0
 public static function getCatalogSub2($id = 0, $array = array())
 {
     if (0 == $id) {
         return 0;
     }
     $arrayResult = array();
     $rootId = Catalog::getRootCatalogId($id, $array);
     foreach ((array) $array as $v) {
         if ($v['parent_id'] == $rootId) {
             array_push($arrayResult, $v);
         }
     }
     return $arrayResult;
 }
Esempio n. 2
0
 public function actionShow()
 {
     $id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
     if (0 >= $id) {
         $this->redirect(Yii::$app->homeUrl);
     }
     $show = Show::findOne(['id' => $id]);
     $catalog = Catalog::findOne(['id' => $show->catalog_id]);
     $templatePage = $show->template ? $show->template : $catalog->template_show ? $catalog->template_show : 'show';
     $portlet = Catalog::getCatalogSub2($id, Catalog::find()->all());
     $portletTitle = Catalog::findOne(['id' => Catalog::getRootCatalogId($id, Catalog::find()->all())])->title;
     return $this->render($templatePage, ['catalog' => $catalog, 'show' => $show, 'portlet' => $portlet, 'portletTitle' => $portletTitle]);
 }