Example #1
0
 public function delete()
 {
     if (!$this->id) {
         return;
     }
     $db = new PHPWS_DB('signup_sheet');
     $db->addWhere('id', $this->id);
     PHPWS_Error::logIfError($db->delete());
     Key::drop($this->key_id);
     $db = new PHPWS_DB('signup_slots');
     $db->addWhere('sheet_id', $this->id);
     PHPWS_Error::logIfError($db->delete());
     $db = new PHPWS_DB('signup_peeps');
     $db->addWhere('sheet_id', $this->id);
     PHPWS_Error::logIfError($db->delete());
 }
Example #2
0
 /**
  * Fully deletes this form and it's elements
  *
  * @access public
  */
 function delete()
 {
     if (is_array($this->_elements)) {
         foreach ($this->_elements as $value) {
             $elementInfo = explode(':', $value);
             $this->element = new $elementInfo[0]($elementInfo[1]);
             $this->element->kill();
         }
     }
     /* If the form is saved archive all data in it's table and remove the table. */
     if ($this->isSaved()) {
         $this->report = new PHAT_Report();
         PHPWS_DB::dropTable('mod_phatform_form_' . $this->getId());
     }
     Key::drop($this->_key_id);
     $this->kill();
     $_SESSION['PHAT_FormManager']->form = null;
     $_SESSION['PHAT_FormManager']->_list();
 }
Example #3
0
 public function delete()
 {
     $db = new PHPWS_DB('ps_page');
     $db->addWhere('id', $this->id);
     $result = $db->delete();
     if (PHPWS_Error::logIfError($result)) {
         return false;
     }
     Key::drop($this->key_id);
     $db = new PHPWS_DB('ps_text');
     $db->addWhere('pid', $this->id);
     $db->delete();
     $db = new PHPWS_DB('ps_block');
     $db->addWhere('pid', $this->id);
     $db->delete();
     if ($this->parent_page) {
         $db = new PHPWS_DB('ps_page');
         $db->addWhere('parent_page', $this->parent_page);
         $db->addWhere('page_order', $this->page_order, '>');
         PHPWS_Error::logIfError($db->reduceColumn('page_order'));
     }
     $this->removeShortcuts();
     return true;
 }
Example #4
0
 public function delete($permanent = false)
 {
     $db = new PHPWS_DB('ps_page');
     $db->addWhere('id', $this->id);
     if ($permanent) {
         $result = $db->delete();
         if (PHPWS_Error::logIfError($result)) {
             return false;
         }
         Key::drop($this->key_id);
         $db = new PHPWS_DB('ps_text');
         $db->addWhere('pid', $this->id);
         $result = $db->delete();
         $db = new PHPWS_DB('ps_block');
         $db->addWhere('pid', $this->id);
         $db->delete();
     } else {
         $db->addValue('deleted', 1);
         $db->addValue('last_updated', time());
         $result = $db->update();
         if (PHPWS_Error::logIfError($result)) {
             return false;
         }
         $key = new \Key($this->key_id);
         $key->active = 0;
         $key->save();
         $key->unregister();
     }
     $this->removeShortcuts();
     if ($this->parent_page) {
         $db = new PHPWS_DB('ps_page');
         $db->addWhere('parent_page', $this->parent_page);
         $db->addWhere('page_order', $this->page_order, '>');
         PHPWS_Error::logIfError($db->reduceColumn('page_order'));
     }
     return true;
 }
Example #5
0
 public function delete()
 {
     $table = $this->_schedule->getEventTable();
     Key::drop($this->key_id);
     $db = new PHPWS_DB($table);
     $db->addWhere('id', $this->id);
     // Remove any possible children
     $db->addWhere('pid', $this->id, null, 'or');
     PHPWS_Cache::clearCache();
     return $db->delete();
 }