/** * Extends parent method to prepend model namespace * * @param $episode_id * @param $event_type_id * @param $model * @return \BaseEventTypeElement */ public function getMostRecentElementInEpisode($episode_id, $event_type_id, $model) { if (strpos($model, "models") == 0) { $model = 'OEModule\\OphCiExamination\\' . $model; } return parent::getMostRecentElementInEpisode($episode_id, $event_type_id, $model); }
/** * Extends parent method to prepend model namespace. * * @param $episode_id * @param $event_type_id * @param $model * @param $before_date * @return \BaseEventTypeElement */ public function getMostRecentElementInEpisode($episode_id, $event_type_id, $model, $before_date = '') { if (strpos($model, 'models') == 0) { $model = 'OEModule\\OphCiExamination\\' . $model; } return parent::getMostRecentElementInEpisode($episode_id, $event_type_id, $model, $before_date); }
/** * Constructor * * @param $request * @throws Exception */ public function __construct($request) { parent::__construct($request); //$this->db = new mysqli('thecodingshackcom.ipagemysql.com', 'discover', 'Hithippie13!', 'discover'); $this->db = new mysqli('localhost', 'root', 'root', 'discover'); if ($this->db->connect_errno > 0) { die('Server was unable to connect to the database'); } }
} switch ($op) { case "login": // do some stuff if (login($db, $_POST['username'], $_POST['userID']) == 200) { $result = array("response" => 'User created!'); sendResponse(200, json_encode($result)); return true; } else { $result = array("response" => 'Server error: unable to create user'); sendResponse(500, json_encode($result)); return true; } break; default: break; } $result = array("response" => 'Invalid request. Not a valid operation.'); sendResponse(400, json_encode($result)); return false; } catch (Exception $e) { $error = array("response" => 'failure', "message" => 'Server exception: ' . $e->getMessage()); sendResponse(500, json_encode($error)); return false; } } } // This is the first thing that gets called when this page is loaded // Creates a new instance of the BaseAPI class and calls the doWork method $api = new BaseAPI(); $api->doWork();