예제 #1
0
 /**
  * Save changes to a category.
  */
 function updateCategory($args, &$request)
 {
     $categoryId = $request->getUserVar('categoryId') === null ? null : (int) Request::getUserVar('categoryId');
     if ($categoryId === null) {
         $this->validate();
         $category = null;
     } else {
         $categoryId = (int) $categoryId;
         $this->validate($categoryId);
         $category =& $this->category;
     }
     $this->setupTemplate($request, $category);
     import('classes.journal.categories.CategoryForm');
     $categoryForm = new CategoryForm($category);
     $categoryForm->readInputData();
     if ($categoryForm->validate()) {
         $categoryForm->execute();
         Request::redirect(null, null, 'categories');
     } else {
         $templateMgr =& TemplateManager::getManager();
         $templateMgr->append('pageHierarchy', array(Request::url(null, 'admin', 'categories'), 'admin.categories'));
         $templateMgr->assign('pageTitle', $category ? 'admin.categories.editTitle' : 'admin.categories.createTitle');
         $categoryForm->display();
     }
 }