public function listAction() { $toCategoryId = $this->_request->getParam("toCategoryId"); if ($toCategoryId != NULL) { $thread_model = new Application_Model_Thread(); $tocategory_model = new Application_Model_Tocategory(); $info = $tocategory_model->getTocategoryById($toCategoryId); $threads = $thread_model->listThreads($toCategoryId); $sticky = array(); $unsticky = array(); if (count($threads) != 0) { for ($i = 0; $i < count($threads); $i++) { if ($threads[$i]['stick'] == 'on') { $sticky[] = $threads[$i]; } else { $unsticky[] = $threads[$i]; } } if (count($sticky) != 0) { $this->view->sticky = $sticky; } if (count($unsticky) != 0) { $this->view->unsticky = $unsticky; } } $this->view->lock = $info[0]['lock']; $this->view->toCategoryId = $toCategoryId; } }
public function editAction() { $id = $this->_request->getParam("id"); $categoryId = $this->_request->getParam("categoryId"); $form = new Application_Form_Tocategory(); $form->getElement("picture")->setRequired(false); if ($this->_request->isPost()) { if ($form->isValid($this->_request->getParams())) { $info = $form->getValues(); $category_model = new Application_Model_Tocategory(); $category_model->edittoCategory($info); $this->redirect("tocategory/list/categoryId/" . $categoryId); } } if (!empty($id)) { $category_model = new Application_Model_Tocategory(); $cat = $category_model->getTocategoryById($id); $form->populate($cat[0]); } $this->view->form = $form; $this->render('add'); }