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 _addLocation($location_data) { $location = new AMP_Content_Nav_Location($this->dbcon); $location->setDefaults(); $location->mergeData($location_data); $location->save(); return $location->id; }