예제 #1
0
 /**
  * delete a category from the database
  *
  * @param object $category reference to the category to delete
  * @param bool $force
  * @return bool FALSE if failed.
  */
 function delete(&$category, $force = false)
 {
     if (strtolower(get_class($category)) != 'sfcategory') {
         return false;
     }
     // Deleting the FAQs
     $faq_handler = new sfFaqHandler($this->db);
     if (!$faq_handler->deleteAll(new Criteria('categoryid', $category->categoryid()))) {
         return false;
     }
     // Deleteing the sub categories
     $subcats =& $this->getCategories(0, 0, $category->categoryid());
     foreach ($subcats as $subcat) {
         $this->delete($subcat);
     }
     $sql = sprintf("DELETE FROM %s WHERE categoryid = %u", $this->db->prefix("smartfaq_categories"), $category->getVar('categoryid'));
     $smartModule =& sf_getModuleInfo();
     $module_id = $smartModule->getVar('mid');
     if (false != $force) {
         $result = $this->db->queryF($sql);
     } else {
         $result = $this->db->query($sql);
     }
     xoops_groupperm_deletebymoditem($module_id, "category_read", $category->categoryid());
     //xoops_groupperm_deletebymoditem ($module_id, "category_admin", $categoryObj->categoryid());
     if (!$result) {
         return false;
     }
     return true;
 }
예제 #2
0
 function store($force = true)
 {
     $faq_handler = new sfFaqHandler($this->db);
     return $faq_handler->insert($this, $force);
 }