protected function process_sclist() { $sc_ids = array(); if (isset($_REQUEST["all_scs"])) { $model = new SupportCenters(); $scs = $model->get(); foreach ($scs as $sc) { if (isset($_REQUEST["show_disabled"])) { $sc_ids[] = (int) $sc->id; } else { //filter by disable flag if ($sc->disable == 0) { $sc_ids[] = (int) $sc->id; } } } } else { foreach ($_REQUEST as $key => $value) { if (isset($_REQUEST["sc"])) { /* if(preg_match("/^sc_(\d+)/", $key, $matches)) { $this->process_sclist_addsc($sc_ids, $matches[1]); } */ foreach ($this->getids("sc", $key, $value) as $id) { $this->process_sclist_addsc($sc_ids, $id); } } } } if (count($sc_ids) == 0) { $this->view->info = "<p class=\"warning\">Please select at least one support center.</p>"; return array(); } //filter the sc list based on user query $sc_ids = $this->process_sc_filter($sc_ids); if (count($sc_ids) == 0) { $this->view->info = "<p class=\"warning\">All support centers selected has been filtered out. Please adjust your filter.</p>"; } return $sc_ids; }
private function process_vo_filter_sc() { $vos_to_keep = array(); $model = new SupportCenters(); $list = $model->get(); foreach ($list as $sc_id => $item) { if ($this->ison("sc", $sc_id)) { //if(isset($_REQUEST["sc_".$sc_id])) { $model = new VirtualOrganization(); $vos = $model->get(array("sc_id" => $sc_id)); foreach ($vos as $vo) { if (!in_array($vo->id, $vos_to_keep)) { $vos_to_keep[] = $vo->id; } } } } return $vos_to_keep; }