public function __construct($activeId) { $providerDa = new ProviderDa(); $this->listProviders = $providerDa->GetListProviderBaseInfo(); $allStt = new ProductStatus('0', '-- Tất cả --'); array_unshift($this->listProviders, $allStt); $this->activeId = $activeId; }
public function init() { $providerDa = new ProviderDa(); $lstProviders = $providerDa->GetListProviders(); if (isset($lstProviders) && count($lstProviders) > 0) { foreach ($lstProviders as $provider) { $provider->Link = base_url('thuong-hieu/' . $provider->Id); $provider->LogoUrl = base_url($provider->LogoUrl); array_push($this->providers, $provider); } } $this->infor = array('logo' => array('logoLink' => base_url('/'), 'logoPath' => base_url('application/Content/Front/images/home/logo.png')), 'company' => array('name' => 'CÔNG TY TNHH THƯƠNG MẠI DỊCH VỤ XUẤT NHẬP KHẨU TAKA VIỆT NAM', 'address' => '229/61 Tây Thạnh, Phường Tây Thạnh, Quận Tân Phú, Thành phố Hồ Chí Minh', 'mst' => '0313436891')); }
public function init() { $categoryDa = new CategoryDa(); $categories = $categoryDa->getCategories(); if (isset($this->categoryId)) { $cateActiveId = $categoryDa->getCategoryLv1Active($this->categoryId); } $childs = array(); if (isset($categories) && count($categories) > 0) { foreach ($categories as $cate) { $cate->CategoryUrl = base_url('/danh-muc/' . $cate->Id); if (!isset($cate->ParentId) || $cate->ParentId == "0") { if (isset($cateActiveId) && $cate->Id == $cateActiveId) { $cate->active = true; } else { $cate->active = false; } array_push($this->listCategories, $cate); } else { array_push($childs, $cate); } } $providerDa = new ProviderDa(); if (isset($this->listCategories) && count($this->listCategories) > 0) { foreach ($this->listCategories as $parent) { $parent->groupChilds = array(0 => array()); $cnt = 1; $maxPages = 2; $limit = 15; $page = 0; $parent->groupChilds[0]['listItems'] = array(); $curChilds = array(); foreach ($childs as $child) { if ($child->ParentId == $parent->Id) { $child->isLv2 = true; array_push($curChilds, $child); foreach ($childs as $gchild) { if ($gchild->ParentId == $child->Id) { $gchild->isLv2 = false; array_push($curChilds, $gchild); } } } } $maxItems = count($curChilds); $realItemsPerPage = ceil($maxItems / $maxPages); $limit = max($realItemsPerPage, $limit); foreach ($curChilds as $child) { array_push($parent->groupChilds[$page]['listItems'], $child); if ($cnt < $limit) { $cnt++; } else { $cnt = 1; $page++; $parent->groupChilds[$page]['listItems'] = array(); } } $parent->providers = array(); $providers = $providerDa->getListProvidersByCateLv1($parent->Id); if (isset($providers) && count($providers) > 0) { foreach ($providers as $provider) { $provider->Link = base_url('thuong-hieu/' . $provider->Id); array_push($parent->providers, $provider); } } } } } }