function onDelete(&$controller) { $item_id =& $controller->get_model_id(); require_once 'AMP/Content/Nav/Location/Location.php'; $location_source = new AMP_Content_Nav_Location(AMP_Registry::getDbcon()); $criteria = $location_source->makeCriteria(array('layout_id' => $item_id)); $locations =& $location_source->search($criteria); if (!$locations) { return false; } foreach ($locations as $location) { $location->delete(); } }
function _readLocations() { require_once 'AMP/Content/Nav/Location/Location.php'; $location = new AMP_Content_Nav_Location($this->dbcon); $criteria = $location->makeCriteria(array('layout_id' => $this->id)); $this->_locations = $location->search($criteria); if (!$this->_locations) { return false; } $results = array(); $this->_location_search =& $location->getSearchSource(); foreach ($this->_locations as $location) { $results[] = $location->getData(); } $this->mergeData(array('locations' => $results)); }