Esempio n. 1
0
 /**
  * Populate the forum with defaulta section and category
  *
  * @return  boolean
  */
 public function setup()
 {
     // Create a default section
     $section = new Section(0, $this->get('scope'), $this->get('scope_id'));
     $section->bind(array('title' => Lang::txt('COM_FORUM_SECTION_DEFAULT'), 'scope' => $this->get('scope'), 'scope_id' => $this->get('scope_id'), 'state' => 1));
     if (!$section->store(true)) {
         $this->setError($section->getError());
         return false;
     }
     // Create a default category
     $category = new Category(0);
     $category->bind(array('title' => Lang::txt('COM_FORUM_CATEGORY_DEFAULT'), 'description' => Lang::txt('COM_FORUM_CATEGORY_DEFAULT_DESCRIPTION'), 'section_id' => $section->get('id'), 'scope' => $this->get('scope'), 'scope_id' => $this->get('scope_id'), 'state' => 1));
     if (!$category->store(true)) {
         $this->setError($category->getError());
         return false;
     }
     $this->_cache['sections'] = new ItemList(array($section));
     return true;
 }