public function getAllCategory() { $this->load->database(); $query = $this->db->query('SELECT * FROM `mk_catalog` Order By ThuTu ASC'); $result = $query->result_array(); $catList = new CatalogList(); foreach ($result as $k => $v) { $cat = new CatalogClass(); $cat->setIdLoai($v['idLoai']); $cat->setIdGroup($v['idGroup']); $cat->setTieuDe($v['TieuDe']); $cat->setTieuDeKD($v['TieuDeKD']); $cat->setUrlHinh($v['UrlHinh']); $cat->setTomTat($v['TomTat']); $cat->setDes($v['Des']); $cat->setKeyword($v['Keyword']); $cat->setParent($v['Parent']); $cat->setAnHien($v['AnHien']); $cat->setMenu($v['Menu']); $cat->setHome($v['Home']); $cat->setThuTu($v['ThuTu']); $catList->addCategory($cat); } $this->db->close(); return $catList; }
public function getCatalogTieuDe($catid, $c) { $postActive = new CatalogList(); $count = 0; foreach ($this->categoryList as $k => $v) { if ($v->getParent() == $catid) { if ($v->getAnHien() == '1' || $v->getAnHien() == 1) { $postActive->addCategory($v); if ($count > $c - 1) { break; } $count++; } } } return $postActive; }