public function load() { parent::load(); $this->load_daterangequery(); $model = new VirtualOrganization(); $vos = $model->getindex(); $logmodel = new OIMLog(); //grab current status as initial status foreach ($vos as $vo_id => $vo) { $vo = $vo[0]; $this->current[$vo_id] = array((int) $vo->active, (int) $vo->disable); } //get all logs for VOModel (don't worry.. for now VO doesn't get updated that often) $logs = $logmodel->getByModel("edu.iu.grid.oim.model.db.VOModel"); //apply update upto $end_time foreach ($logs as $log) { $timestamp = (int) $log->unix_timestamp; if ($timestamp > $this->view->end_time) { $this->update($log->xml); } } //now analyze current status foreach ($this->current as $vo_id => $cur) { $this->analyze($vo_id, $cur); } //now analyze the log between $start and $end foreach ($logs as $log) { $timestamp = (int) $log->unix_timestamp; if ($timestamp <= $this->view->end_time && $timestamp >= $this->view->start_time) { $vo_id = $this->update($log->xml); if ($vo_id != null) { //each time update occurs, re-analyze $this->analyze($vo_id, $cur); } } } //finally, construct various lists $this->view->active_once_vos = array(); $this->view->never_active_enabled_vos = array(); $this->view->never_never_vos = array(); foreach ($vos as $vo_id => $vo) { $vo = $vo[0]; if (in_array($vo_id, $this->active_vos)) { //has been active at least once $this->view->active_once_vos[$vo->id] = $vo; } else { if (in_array($vo_id, $this->enabled_vos)) { //never active, and enabled at least once $this->view->never_active_enabled_vos[$vo->id] = $vo; } else { //never active, and has never enabled $this->view->never_never_vos[$vo->id] = $vo; } } } $this->setpagetitle(self::default_title()); }
public function load() { parent::load(); $model = new VirtualOrganization(); $vos = $model->getindex(); $model = new VOMS(); $voms = $model->get(); $this->view->timestamp = $model->getTimestamp(); $this->view->voms_status = array(); foreach ($this->vo_ids as $vo_id) { $info = $vos[$vo_id][0]; //capitaliza to increase chance of VO name match (until we use OIM based vomses) $name = strtoupper($info->name); $this->view->voms_status[$vo_id] = array("info" => $info, "voms" => @$voms[$name]); } $this->setpagetitle(self::default_title()); }
private function process_resource_filter_voown() { $resources_to_keep = array(); $model = new VirtualOrganization(); $list = $model->get(); foreach ($list as $vo_id => $item) { if ($this->ison("voown", $vo_id)) { //if(isset($_REQUEST["voown_".$vo_id])) { $model = new VOOwnedResources(); $rs = $model->get(array("vo_id" => $vo_id)); foreach ($rs as $r) { if (!in_array($r->resource_id, $resources_to_keep)) { $resources_to_keep[] = $r->resource_id; } } } } return $resources_to_keep; }
public function legacyosgwebsiteviewAction() { $vo_ids = $this->process_volist(); header("Content-type: text/html"); echo "<html>\n<head></head>\n<body>\n\n<h3>Virtual Organizations</h3>\n\n<table width=\\'100%\\'>\n <tr><th align=left>VO Name</th><th align=left>Primary URL</th></tr>\n"; $model = new VirtualOrganization(); $vos = $model->getindex(); $scmodel = new SupportCenters(); $scs = $scmodel->getindex(); foreach ($vo_ids as $vo_id) { $vo = $vos[$vo_id][0]; $long_name = $vo->long_name; $name = $vo->name; $primary_url = $vo->primary_url; echo " <tr><td>{$long_name} ({$name})</td><td><a href=\"{$primary_url}\">{$primary_url}</a></td></tr>\n"; } echo "</table>\n\n</body>"; $this->render("none", null, true); }
private function apply_sort(&$ids) { global $sort_info, $sort_reverse; //pull user query $sort_key = "name"; if (isset($_REQUEST["sort_key"])) { $sort_key = $_REQUEST["sort_key"]; } $sort_reverse = false; if (isset($_REQUEST["sort_reverse"])) { $sort_reverse = true; } $sort_info = array(); switch ($sort_key) { case "name": $model = new VirtualOrganization(); foreach ($model->getindex() as $id => $vo) { $vo[0]->header = $vo[0]->name; $sort_info[$id] = strtoupper($vo[0]->name); } break; case "long_name": $model = new VirtualOrganization(); foreach ($model->getindex() as $id => $vo) { $vo[0]->header = $vo[0]->long_name; $sort_info[$id] = strtoupper($vo[0]->long_name); } break; case "sc": $scmodel = new SupportCenters(); $scs = $scmodel->getindex(); $model = new VirtualOrganization(); foreach ($model->getindex() as $id => $vo) { $vo[0]->header = $scs[$vo[0]->sc_id][0]->name; $sort_info[$id] = strtoupper($scs[$vo[0]->sc_id][0]->name); } break; default: elog("Unknown sort_key given for mysort: VoController: " . $sort_key); } usort($ids, "mysort"); }