diff --git a/common/models/ShopCategory.php b/common/models/ShopCategory.php new file mode 100644 index 0000000..cb9347b --- /dev/null +++ b/common/models/ShopCategory.php @@ -0,0 +1,86 @@ +db->createCommand(' + SELECT + `termin_relation`.termin_id_1, + `termin_relation`.termin_id_2, + `termin_lang`.termin_title + FROM `termin_relation` + INNER JOIN `termin_lang` ON `termin_lang`.termin_id = `termin_relation`.termin_id_1 + AND `termin_lang`.lang_id = '.yii::$app->lang_id.' + INNER JOIN `template` ON `template`.template_id = `termin_lang`.template_id + ORDER BY `termin_relation`.termin_id_1 ASC, `termin_relation`.termin_id_2 ASC + ')->queryAll(); + } + + // =================== + // ==== STRUCTURE ==== + // =================== + + var $mass = array (); + + public function build () + { + if ($this->mass = self::get ()) + { + return $this->getRecrusive (8); + } + } + + public function findChild ($id) + { + $mass = array (); + + foreach ($this->mass as $row) + { + if ($row['termin_id_2'] == $id) + { + $mass[] = $row; + } + } + + return $mass; + } + + public function getRecrusive ($menu_id) + { + $items = $this->findChild($menu_id); + + if (! empty ($items)) + { + echo '