public function executeMenuitem() { $this->module = $this->getModuleName(); $initial = $this->getRequestParameter('initial'); $department_id = $this->get_department_id(); $departmentAvailable = $this->tools->departmentAvailable($department_id); $this->criteria->add(WebMenuTypePeer::INITIAL, $initial, Criteria::EQUAL); $this->menuType = WebMenuTypePeer::doSelectOne($this->criteria); if (!$this->menuType) { echo 'Menu ' . $initial . ' not found'; } $this->criteria->add(WebMenuTypePeer::DEPARTMENT_ID, $departmentAvailable, Criteria::IN); $this->menuType = WebMenuTypePeer::doSelectOne($this->criteria); if (!$this->menuType) { echo 'Maaf, anda tidak memiliki hak untuk mengakses halaman ini.'; } $this->section = $this->get_section(); }
public function getlistbymenu($param) { $menuType = WebMenuTypePeer::retrieveByPK($param['type']); if (!$menuType) { $this->jsonwrapper->show_json_error('not found', 'Menu tidak ditemukan'); } /* if($menuType->getDepartmentId() == 1){ $this->criteria->add(WebItemCategoryPeer::DEPARTMENT_ID, 1, Criteria::EQUAL); }else{ $this->criteria->add(WebItemCategoryPeer::DEPARTMENT_ID, 0, Criteria::EQUAL); } */ $this->criteria->addAscendingOrderByColumn(WebItemCategoryPeer::PARENT_ID); $category = WebItemCategoryPeer::doSelect($this->criteria); $parentMapping = new ParentMapping(); $tree = $parentMapping->generateItemcategoryList($category); $output = array('success' => 1, 'data' => $tree); $this->jsonwrapper->print_json($output); }
$temp = $item->toArray(); $temp['section'] = $item->getDepartment()->toArray(); $items[] = $temp; } $output = array('success' => 1, 'data' => $items); $this->jsonwrapper->print_json($output); } public function getbannermenu($param) { if (empty($param['type_id'])) { $this->jsonwrapper->show_json_error('not found', 'Menu type tidak ditemukan.'); } $menuType = WebMenuTypePeer::retrieveByPK($param['type_id']); if (!$menuType) { $this->jsonwrapper->show_json_error('not found', 'Menu type tidak ditemukan.'); } /* Getting Image Category */ $categoryCriteria = new Criteria(); $categoryCriteria->add(WebSlideshowCategoryPeer::DEPARTMENT_ID, $menuType->getDepartmentId(), Criteria::EQUAL); $categoryCriteria->add(WebSlideshowCategoryPeer::INITIAL, 'banner-slideshow', Criteria::EQUAL); $category = WebSlideshowCategoryPeer::doSelectOne($categoryCriteria); $this->criteria->add(WebSlideshowPeer::SLIDESHOW_CATEGORY_ID, $category->getId(), Criteria::EQUAL); $imageTemp = WebSlideshowPeer::doSelect($this->criteria);
public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(WebMenuTypePeer::ID, $pks, Criteria::IN); $objs = WebMenuTypePeer::doSelect($criteria, $con); } return $objs; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = WebMenuTypePeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setDepartmentId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setInitial($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setTitle($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setDescription($arr[$keys[4]]); } }
public function getWebMenuType($con = null) { include_once 'lib/model/om/BaseWebMenuTypePeer.php'; if ($this->aWebMenuType === null && $this->menu_type_id !== null) { $this->aWebMenuType = WebMenuTypePeer::retrieveByPK($this->menu_type_id, $con); } return $this->aWebMenuType; }
public static function doSelectJoinAllExceptWebComponent(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } WebMenuPeer::addSelectColumns($c); $startcol2 = WebMenuPeer::NUM_COLUMNS - WebMenuPeer::NUM_LAZY_LOAD_COLUMNS + 1; WebPageTemplatesPeer::addSelectColumns($c); $startcol3 = $startcol2 + WebPageTemplatesPeer::NUM_COLUMNS; WebMenuTypePeer::addSelectColumns($c); $startcol4 = $startcol3 + WebMenuTypePeer::NUM_COLUMNS; $c->addJoin(WebMenuPeer::PAGE_TEMPLATES_ID, WebPageTemplatesPeer::ID); $c->addJoin(WebMenuPeer::MENU_TYPE_ID, WebMenuTypePeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = WebMenuPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = WebPageTemplatesPeer::getOMClass(); $cls = Propel::import($omClass); $obj2 = new $cls(); $obj2->hydrate($rs, $startcol2); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj2 = $temp_obj1->getWebPageTemplates(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addWebMenu($obj1); break; } } if ($newObject) { $obj2->initWebMenus(); $obj2->addWebMenu($obj1); } $omClass = WebMenuTypePeer::getOMClass(); $cls = Propel::import($omClass); $obj3 = new $cls(); $obj3->hydrate($rs, $startcol3); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj3 = $temp_obj1->getWebMenuType(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addWebMenu($obj1); break; } } if ($newObject) { $obj3->initWebMenus(); $obj3->addWebMenu($obj1); } $results[] = $obj1; } return $results; }
public function getlistbymenu($param) { $menuType = WebMenuTypePeer::retrieveByPK($param['type']); if (!$menuType) { $this->jsonwrapper->show_json_error('not found', 'Menu tidak ditemukan'); } $this->criteria->add(WebArticlePeer::DEPARTMENT_ID, $menuType->getDepartmentId(), Criteria::EQUAL); $this->criteria->addAscendingOrderByColumn(WebArticlePeer::TITLE); $articleTemp = WebArticlePeer::doSelect($this->criteria); $articles = array(); foreach ($articleTemp as $article) { $temp = $article->toArray(); $temp['section'] = $article->getDepartment()->toArray(); $articles[] = $temp; } $output = array('success' => 1, 'data' => $articles); $this->jsonwrapper->print_json($output); }
public function delete($param) { $department_id = $param['department_id']; $departmentAvailable = $this->tools->departmentAvailable($department_id); if (empty($param['id'])) { $this->jsonwrapper->show_json_error('param', 'Parameter id tidak ditemukan.'); } $menu = WebMenuTypePeer::retrieveByPK($param['id']); if (!$menu) { $this->jsonwrapper->show_json_error('menu', 'Menu dengan id ' . $param['id'] . ' tidak ditemukan.'); } $menu->delete(); $output = array('success' => 1, 'message' => 'success'); $this->jsonwrapper->print_json($output); }