/** * post delete function * * this function will be called by MsObject::delete() * * @return bool */ public function postDelete() { global $db, $ms; $sth = $db->prepare("\n DELETE FROM\n TABLEPREFIXassign_pipes_to_chains\n WHERE\n apc_chain_idx LIKE ?\n "); $db->execute($sth, array($this->id)); $db->freeStatement($sth); try { $chains = new \MasterShaper\Models\ChainsModel(); } catch (\Exception $e) { static::raiseError(__METHOD__ . '(), failed to load ChainsModel!', false, $e); return false; } if (!$chains->updatePositions($this->chain_netpath_idx)) { static::raiseError(get_class($chains) . '::updatePositions() returned false!'); return false; } return true; }
public function getActiveChains() { if (($netpath_idx = $this->getIdx()) === false) { static::raiseError(__CLASS__ . '::getIdx() returned false!'); return false; } try { $chains = new \MasterShaper\Models\ChainsModel(array('netpath_idx' => $netpath_idx)); } catch (\Exception $e) { static::raiseError(__METHOD__ . '(), failed to load ChainsModel!', false, $e); return false; } if (!$chains->hasItems()) { return array(); } if (($items = $chains->getItems()) === false) { static::raiseError(get_class($chains) . '::getItems() returned false!'); return false; } return $items; }
public function showEdit($id, $guid) { global $tmpl; try { $item = new \MasterShaper\Models\NetworkPathModel(array('idx' => $id, 'guid' => $guid)); } catch (\Exception $e) { static::raiseError(__METHOD__ . '(), failed to load NetworkPathModel!', false, $e); return false; } try { $chains = new \MasterShaper\Models\ChainsModel(array('host_idx' => $id)); } catch (\Exception $e) { static::raiseError(__METHOD__ . '(), failed to load ChainsModel!', false, $e); return false; } if (($this->chains = $chains->getItems()) === false) { static::raiseError(get_class($chains) . '::getItems() returned false!'); return false; } $tmpl->assign('netpath', $item); return parent::showEdit($id, $guid); }