Ejemplo n.º 1
0
 /**
  */
 public function delete()
 {
     parent::delete();
     Sobi::Trigger($this->name(), ucfirst(__FUNCTION__), array($this->id));
     foreach ($this->fields as $field) {
         $field->deleteData($this->id);
     }
     SPFactory::cache()->purgeSectionVars();
     SPFactory::cache()->deleteObj('entry', $this->id);
 }
Ejemplo n.º 2
0
 /**
  */
 public function delete()
 {
     $childs = $this->getChilds('all', true);
     Sobi::Trigger('Section', ucfirst(__FUNCTION__), array(&$this->id));
     if (count($childs)) {
         Sobi::Redirect(Sobi::GetUserState('back_url', Sobi::Url()), Sobi::Txt('SEC.DEL_WARN'), SPC::ERROR_MSG, true);
     } else {
         Sobi::Trigger('delete', $this->name(), array(&$this));
         $db = SPFactory::db();
         try {
             $db->delete('spdb_relations', "id = {$this->id} OR pid = {$this->id}");
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
         }
         try {
             $db->delete('spdb_config', array('section' => $this->id))->delete('spdb_plugin_section', array('section' => $this->id))->delete('spdb_permissions_map', array('sid' => $this->id));
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
         }
         try {
             $fids = $db->select('fid', 'spdb_field', array('section' => $this->id))->loadResultArray();
             if (count($fids)) {
                 foreach ($fids as $fid) {
                     try {
                         $db->select('*', $db->join(array(array('table' => 'spdb_field', 'as' => 'sField', 'key' => 'fieldType'), array('table' => 'spdb_field_types', 'as' => 'sType', 'key' => 'tid'))), array('fid' => $fid));
                         $f = $db->loadObject();
                     } catch (SPException $x) {
                         Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
                     }
                     $field =& SPFactory::Model('field', true);
                     $field->extend($f);
                     $field->delete();
                 }
             }
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
         }
         parent::delete();
         Sobi::Trigger('afterDelete', $this->name(), array(&$this));
     }
 }
Ejemplo n.º 3
0
 /**
  * (non-PHPdoc)
  * @see Site/lib/models/SPDBObject#delete()
  * @param bool $childs - update child entries parent
  */
 public function delete($childs = true)
 {
     parent::delete();
     SPFactory::cache()->cleanSection();
     SPFactory::cache()->deleteObj('category', $this->id);
     try {
         /* get all child cats and delete these too */
         $childs = $this->getChilds('category', true);
         if (count($childs)) {
             foreach ($childs as $child) {
                 $cat = new self();
                 $cat->init($child);
                 $cat->delete(false);
             }
         }
         $childs[$this->id] = $this->id;
         SPFactory::db()->delete('spdb_category', array('id' => $this->id));
         if ($childs) {
             SPFactory::db()->update('spdb_object', array('parent' => Sobi::Section()), array('parent' => $childs));
         }
     } catch (SPException $x) {
         Sobi::Error($this->name(), SPLang::e('CANNOT_DELETE_CATEGORY_DB_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
     }
 }
Ejemplo n.º 4
0
 /**
  */
 public function delete()
 {
     parent::delete();
     Sobi::Trigger($this->name(), ucfirst(__FUNCTION__), array($this->id));
     foreach ($this->fields as $field) {
         $field->deleteData($this->id);
     }
     /** Thu, Jul 30, 2015 10:11:57 - delete history */
     SPFactory::db()->delete('spdb_history', array('sid' => $this->id));
     /** Thu, Jul 30, 2015 10:22:38 - delete payments */
     SPFactory::payment()->deletePayments($this->id);
     /** Thu, Jul 30, 2015 11:32:45 - delete counters */
     SPFactory::db()->delete('spdb_counter', array('sid' => $this->id));
     SPFactory::cache()->purgeSectionVars();
     SPFactory::cache()->deleteObj('entry', $this->id);
 }