コード例 #1
0
 /**
  * Method to remove a category
  *
  * @access public
  * @param array $cid
  * @return boolean
  */
 public function delete($cid = array())
 {
     if (count($cid)) {
         JArrayHelper::toInteger($cid);
         $cids = implode(',', $cid);
         // Check if the category is empty
         $query = 'SELECT `id` FROM `#__simplelists_categories` WHERE `category_id` IN ( ' . $cids . ' )';
         $this->_db->setQuery($query);
         $rows = $this->_db->loadAssocList();
         if (!empty($rows)) {
             $this->setError(JText::_('Category not empty'));
             return false;
         }
         // Check if this category serves as parent for others
         $query = 'SELECT `id` FROM `#__categories` WHERE `parent_id` IN ( ' . $cids . ' )';
         $this->_db->setQuery($query);
         $rows = $this->_db->loadAssocList();
         if (!empty($rows)) {
             $this->setError(JText::_('Category is still parent'));
             return false;
         }
         // Call the parent function
         if (parent::delete($cid) == false) {
             return false;
         }
         // Also remove all item/category relations
         $query = 'DELETE FROM `#__simplelists_categories` WHERE `category_id` IN (' . $cids . ')';
         $this->_db->setQuery($query);
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
     }
     return true;
 }
コード例 #2
0
ファイル: store.php プロジェクト: apiceweb/MageBridgeCore
 /**
  * Method to remove multiple items
  *
  * @access public
  * @subpackage Yireo
  * @param array $cid
  * @return bool
  */
 public function delete($cid = array())
 {
     if (is_array($cid) && in_array(0, $cid)) {
         $data = array('storegroup' => '', 'storeview' => '');
         MageBridgeModelConfig::store($data);
     }
     return parent::delete($cid);
 }
コード例 #3
0
ファイル: item.php プロジェクト: renekreijveld/SimpleLists
 /**
  * Method to remove an item
  *
  * @access public
  * @param array $cid
  * @return boolean True on success
  */
 public function delete($cid = array())
 {
     $result = false;
     if (count($cid)) {
         // Convert this array
         JArrayHelper::toInteger($cid);
         $cids = implode(',', $cid);
         // Call the parent function
         if (parent::delete($cid) == false) {
             return false;
         }
         // Also remove all item/category relations
         $query = 'DELETE FROM `#__simplelists_categories` WHERE `id` IN (' . $cids . ')';
         $this->_db->setQuery($query);
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
     }
     return true;
 }