public function findallAction() { if ($value_id = $this->getRequest()->getParam('value_id')) { try { $category_id = $this->getRequest()->getParam('category_id'); $current_category = new Folder_Model_Category(); if ($category_id) { $current_category->find($category_id, 'category_id'); } $object = $this->getCurrentOptionValue()->getObject(); if (!$object->getId() or $current_category->getId() and $current_category->getRootCategoryId() != $object->getRootCategoryId()) { throw new Exception($this->_('An error occurred during process. Please try again later.')); } if (!$current_category->getId()) { $current_category = $object->getRootCategory(); } $data = array("folders" => array()); $subcategories = $current_category->getChildren(); foreach ($subcategories as $subcategory) { $data["folders"][] = array("title" => $subcategory->getTitle(), "subtitle" => $subcategory->getSubtitle(), "picture" => $subcategory->getPictureUrl(), "url" => $this->getPath("folder/mobile_list", array("value_id" => $value_id, "category_id" => $subcategory->getId()))); } $pages = $current_category->getPages(); $color = $this->getApplication()->getBlock('background')->getImageColor(); foreach ($pages as $page) { $data["folders"][] = array("title" => $page->getTabbarName(), "subtitle" => "", "picture" => $this->_getColorizedImage($page->getIconId(), $color), 'is_link' => !$page->getIsAjax(), "url" => $page->getPath(null, array('value_id' => $page->getId()), false), "code" => $page->getCode(), "is_locked" => $page->isLocked()); } $data["cover"] = array("title" => $current_category->getTitle(), "subtitle" => $current_category->getSubtitle(), "picture" => $current_category->getPictureUrl()); $data["page_title"] = $current_category->getTitle(); } catch (Exception $e) { $data = array('error' => 1, 'message' => $e->getMessage()); } $this->_sendHtml($data); } }
public function findchildrenAction() { if ($category_id = $this->getRequest()->getParam('category_id')) { try { $current_category = new Folder_Model_Category(); $current_category->find($category_id, 'category_id'); $object = $this->getCurrentOptionValue()->getObject(); if (!$current_category->getId() or !$object->getId() or $current_category->getRootCategoryId() != $object->getRootCategoryId()) { throw new Exception($this->_('An error occurred during process. Please try again later.')); } $html = $this->getLayout()->addPartial('category_' . $current_category->getCategoryId(), 'core_view_mobile_default', 'folder/l1/view/category.phtml')->setCurrentOptionValue($this->getCurrentOptionValue())->setCurrentCategory($current_category)->setId($current_category->getId() == $object->getRootCategoryId() ? $object->getValueId() : 'subcategory_' . $current_category->getId())->toHtml(); $html = array('html' => mb_convert_encoding($html, 'UTF-8', 'UTF-8'), 'title' => $current_category->getTitle()); if ($this->getCurrentOptionValue()->getCode() == 'm_commerce') { $html = array_merge($html, array('next_button_title' => $this->_('Cart'), 'next_button_arrow_is_visible' => 1)); } if ($url = $this->getCurrentOptionValue()->getBackgroundImageUrl()) { $html['background_image_url'] = $url; } } catch (Exception $e) { $html = array('error' => 1, 'message' => $e->getMessage()); } $this->_sendHtml($html); } }