Esempio n. 1
0
 /**
  * Update a category
  *
  * @put /forum_category/:category_id
  */
 public function updateForumCategory($category_id)
 {
     $category = $this->findCategory($category_id);
     if (!\ForumPerm::has("edit_category", $category['course_id'])) {
         $this->error(401);
     }
     if (!isset($this->data['name']) || !strlen($name = trim($this->data['name']))) {
         $this->error(400, 'Category name required.');
     }
     \ForumCat::setName($category_id, $this->data['name']);
     $this->status(204);
 }
Esempio n. 2
0
 /**
  * Change the name of the submitted category
  * 
  * @param string $category_id the category to edit
  */
 function edit_category_action($category_id)
 {
     ForumPerm::checkCategoryId($this->getId(), $category_id);
     ForumPerm::check('edit_category', $this->getId());
     if (Request::isXhr()) {
         ForumCat::setName($category_id, studip_utf8decode(Request::get('name')));
         $this->render_nothing();
     } else {
         ForumCat::setName($category_id, Request::get('name'));
         $this->flash['messages'] = array('success' => _('Der Name der Kategorie wurde geändert.'));
         $this->redirect(PluginEngine::getLink('coreforum/index/index#cat_' . $category_id));
     }
 }