public function seeCategoryAction() { // Set layout $this->_helper->layout->setLayout('kebudayaan'); // Param $categoryId = $this->_getParam('id'); // Model $categoryDb = new Model_DbTable_Category(); // Data $category = $categoryDb->getAllWithDescByIdLang($categoryId, $this->_languageId); $subCategories = $categoryDb->getCategoryChildList($categoryId, $this->_languageId); // View $this->view->category = $category; $this->view->subCategories = $subCategories; }
public function subCategoryAction() { // AJAX if ($this->_request->isXmlHttpRequest()) { // Disable layout dan view $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $parentCategoryId = $this->_getParam('parent_category'); $categoryDb = new Model_DbTable_Category(); $parentCategory = $categoryDb->getAllWithDescByIdLang($parentCategoryId, $this->_languageId); $category = new Model_Category(); $result = $category->getSubCategoriesForChart($parentCategoryId, $this->_languageId); $result['title'] = $this->view->translate('Total Culture per Sub Category') . ' ' . $parentCategory['name']; $result['xLabel'] = $this->view->translate('Category'); $result['yLabel'] = $this->view->translate('Total'); echo json_encode($result); } }
public function seeCategoryAction() { // Set layout $this->_helper->layout->setLayout('kebudayaan'); // Param $categoryId = $this->_getParam('id'); // Model $categoryDb = new Model_DbTable_Category(); // Data $category = $categoryDb->getAllWithDescByIdLang($categoryId, $this->_languageId); $subCategories = $categoryDb->getCategoryChildList($categoryId, $this->_languageId); // View $this->view->category = $category; $this->view->headTitle()->prepend($category['name']); $this->view->subCategories = $subCategories; $this->view->langId = $this->_languageId; array_unshift($this->_meta, $category['name'], "kategori kebudayaan", "kategori budaya"); $this->view->headMeta()->appendName('keywords', join(', ', $this->_meta)); $this->view->headMeta()->appendName('description', "Kebudayaan Indonesia - Laman referensi kebudayaan Indonesia. Turut mewujudkan bangsa Indonesia yang cerdas dan berbudaya"); }
} $result['title'] = $this->view->translate('Total Culture per Main Category'); $result['xLabel'] = $this->view->translate('Category'); $result['yLabel'] = $this->view->translate('Total'); echo json_encode($result); } } public function subCategoryAction() { // AJAX if ($this->_request->isXmlHttpRequest()) { // Disable layout dan view $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $parentCategoryId = $this->_getParam('parent_category'); $categoryDb = new Model_DbTable_Category(); $parentCategory = $categoryDb->getAllWithDescByIdLang($parentCategoryId, $this->_languageId); $category = new Model_Category(); $categories = $category->getSubCategoriesForChart($parentCategoryId, $this->_languageId); $result = array(); foreach ($categories as $category) { $result['category'][] = $category['name']; $result['total'][] = array('', (int) $category['total_culture'], $this->view->url(array('id' => $category['category_id'], 'slug' => $this->view->makeUrlFormat($category['name'])), $this->_languageId == 1 ? 'subkategori' : 'subcategory'));
/** * IS: Parameter id terdeklarasi * FS: Mengirimkan ke viewer: form, parent * Desc: Mengatur aksi yang dilakukan untuk halaman edit */ public function editAction() { $language_id = $this->_getParam('lang'); $activity_id = $this->_getParam('id'); $form = new Admin_Form_ActivityForm(); $form->setCategoryParent($language_id); $table_category = new Model_DbTable_Category(); $table_category_desc = new Model_DbTable_CategoryDescription(); $table_categorytopoi = new Model_DbTable_CategoryToPoi(); //if this is a POST request if ($this->getRequest()->isPost()) { if ($form->isValid($_POST)) { if ($language_id != 1) { $indo = $table_category_desc->checkForIndo($activity_id); if ($indo) { $data = array('category_id' => $activity_id, 'name' => $_POST['categoryName'], 'description' => $_POST['categoryDescription']); $table_category_desc->updateCategory($data, $activity_id, 2); } else { $data = array('category_id' => $activity_id, 'language_id' => $language_id, 'name' => $_POST['categoryName'], 'description' => $_POST['categoryDescription']); $table_category_desc->insertCategory($data); } } else { $data = array('parent_id' => $_POST['categoryParent'], 'image' => $_POST['categoryPicture']); $table_category->updateCategory($data, $activity_id); $data2 = array('category_id' => $activity_id, 'name' => $_POST['categoryName'], 'description' => $_POST['categoryDescription']); $table_category_desc->updateCategory($data2, $activity_id, 1); } $this->loggingaction('activity', 'edit', $activity_id, $language_id); $this->_flash->addMessage('1\\Activity Update Success!'); $this->_redirect($this->view->rootUrl('/admin/activity/')); } } //get the activity data if ($language_id != 1) { $indo = $table_category_desc->checkForIndo($activity_id); if ($indo) { $category_data = $table_category->getAllWithDescByIdLang($activity_id, $language_id); } } else { $category_data = $table_category->getAllWithDescByIdLang($activity_id, $language_id); } //set element value $form->categoryParent->setValue($category_data['parent_id']); $form->categoryName->setValue($category_data['name']); $form->categoryPicture->setValue($category_data['image']); $form->categoryDescription->setValue($category_data['description']); //send variables to the view $this->view->parent = $category_data['parent_id']; $this->view->form = $form; $this->view->langId = $language_id; }