public function delete() { if ($_SERVER['REQUEST_METHOD'] != 'POST') { echo '0'; return; } $id = (int) $_POST['id']; $cityDAO = new CityDAO(DataSource::getInstance()); $cityDAO->delete($id); echo '1'; }
public static function getInstance() { if (self::$instance == null) { self::$instance = new CityDAO(); } return self::$instance; }
/** * Override default validation * @see Phreezable::Validate() */ public function Validate() { // example of custom validation // $this->ResetValidationErrors(); // $errors = $this->GetValidationErrors(); // if ($error == true) $this->AddValidationError('FieldName', 'Error Information'); // return !$this->HasValidationErrors(); return parent::Validate(); }
case "State": //Load State VO and DAO files include '/VO/StateVO.php'; include '/DAO/StateDAO.php'; $stateDAO = new stateDAO(); //Get all states of a country $optionVO = $stateDAO->getAllByCountry($parentId); //getData break; //City case //City case case "City": //Load City VO and DAO files include '/VO/CityVO.php'; include '/DAO/CityDAO.php'; $cityDAO = new CityDAO(); //Get all cities of a state $optionVO = $cityDAO->getAllByState($parentId); //getData break; //University case //University case case "University": //Load Univeristy VO and DAO files include '/VO/UniversityVO.php'; include '/DAO/UniversityDAO.php'; $universityDAO = new universityDAO(); //Get all universities $optionVO = $universityDAO->getUniversities(); //getData break;
public function update() { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->updatePost(); } else { if ($_SERVER['REQUEST_METHOD'] == 'GET') { $this->updateGet(); } } $cityDAO = new CityDAO(DataSource::getInstance()); $this->registry->template->cities = $cityDAO->findByAll(); $this->registry->template->tile_title = 'Sửa thông tin khách hàng'; $this->registry->template->tile_content = 'admin/customer-update.php'; $this->registry->template->show('admin/layout/admin.php'); }
public function __construct() { $this->cityDAO = CityDAO::getInstance(); }