From 5aa35456359c65eb9fd41fce1383bf63726c7eb5 Mon Sep 17 00:00:00 2001 From: andryeyev Date: Wed, 18 Nov 2015 12:22:25 +0200 Subject: [PATCH] add ShopCategory --- common/models/ShopCategory.php | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+), 0 deletions(-) create mode 100644 common/models/ShopCategory.php 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 ''; + } + + } + + // ===== + +} -- libgit2 0.21.4