public static function load_adapter($db_settings) { if ($db_settings["dbtype"] == "none") { return true; } $adapter = "CampaignMonitorAdapter"; self::$adapter = $adapter; self::$db_settings = $db_settings; }
/** * calls the before select hook, if the all_results var is not set * then call the api and find all the records and then filter them according to * whats set on the model filters array * @param string $CampaignMonitorModel * @return void */ public function select(CampaignMonitorModel $model) { $model->before_select(); //before hook //call the api to find everything if ($model->select_action) { $model->row = $this->all_results = $this->api($model, "select_action"); } else { $model->row = $this->all_results = $this->api($model, "get_action"); } //if filters then check data if (count($model->filters) && is_array($model->row)) { $res = array(); foreach ($model->row as $data) { //loop round each record on the model foreach ($model->filters as $filter) { //compare to each filter if (!is_array($filter["value"])) { //if the filter value is an array if ($found = $this->match_in_row($filter['name'], $filter['value'], $data, $model)) { $res[] = $found; } } } } //otherwise return all results } else { $res = $this->all_results; } return $res; }