本文整理汇总了PHP中Service::getindex方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::getindex方法的具体用法?PHP Service::getindex怎么用?PHP Service::getindex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Service
的用法示例。
在下文中一共展示了Service::getindex方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
public function load()
{
parent::load();
$model = new Metric();
$this->view->metrics = $model->getindex();
//additional info
if (isset($_REQUEST["metric_attrs_showservices"])) {
$model = new MetricService();
$this->view->metricservices = $model->getgroupby("metric_id");
$model = new Service();
$this->view->services = $model->getindex();
}
$this->setpagetitle(self::default_title());
}
示例2: load
public function load()
{
parent::load();
$this->view->rgs = $this->rgs;
$model = new ResourceGroup();
$this->view->resource_groups = $model->getindex();
$service_type_model = new Service();
$this->view->service_info = $service_type_model->getindex();
///////////////////////////////////////////////////////////////////////
// Load graph inforamtion
$this->view->services = array();
foreach ($this->rgs as $rgid => $rg) {
foreach ($rg as $rid => $resource) {
//pull A&R history
$model = new ServiceAR();
$params["start_time"] = $this->view->start_time;
$params["end_time"] = $this->view->end_time;
$params["resource_ids"] = array($rid);
$this->view->services[$rid] = $model->getgroupby("service_id", $params);
}
}
$this->setpagetitle(self::default_title());
}
示例3: load
public function load()
{
parent::load();
$model = new ResourceGroup();
$this->view->resource_groups_by_gridtype = $model->getgroupby("osg_grid_type_id");
$model = new Resource();
$this->view->resources_by_resource_group = $model->getgroupby("resource_group_id");
$model = new GridTypes();
$this->view->grid_types = $model->getindex();
$model = new Service();
$this->view->services = $model->getindex();
$model = new ResourceServices();
$this->view->services_by_resource = $model->getgroupby("resource_id");
$this->view->counts = array();
//filter service groups
$this->view->service_groups = array();
$model = new ServiceGroup();
$service_groups = $model->getindex();
foreach ($service_groups as $id => $service_group) {
if (isset($_REQUEST["count_sg_" . $id])) {
$this->view->service_groups[$id] = $service_group;
}
}
$this->view->resource_counts = array();
//for each grid type
foreach ($this->view->resource_groups_by_gridtype as $grid_type_id => $resource_groups) {
$resource_counts = 0;
//for each resource groups,
foreach ($resource_groups as $resource_group) {
$resources = $this->view->resources_by_resource_group[$resource_group->id];
//for each resource
foreach ($resources as $resource) {
//apply filter
if (isset($_REQUEST["count_active"])) {
if ($resource->active == 0) {
continue;
}
}
if (isset($_REQUEST["count_enabled"])) {
if ($resource->disable == 1) {
continue;
}
}
$resource_counts++;
//pull counter for current grid type
//$services = $this->services_by_resource[$resource->id];
if (!isset($this->view->counts[$grid_type_id])) {
$this->view->counts[$grid_type_id] = array();
}
$count_service = $this->view->counts[$grid_type_id];
//for each services
if (isset($this->view->services_by_resource[$resource->id])) {
foreach ($this->view->services_by_resource[$resource->id] as $service) {
if (!isset($count_service[$service->id])) {
$count_service[$service->id] = 0;
}
$count_service[$service->id] = $count_service[$service->id] + 1;
}
}
$this->view->counts[$grid_type_id] = $count_service;
}
}
$this->view->resource_counts[$grid_type_id] = $resource_counts;
}
$this->setpagetitle(self::default_title());
}
示例4: formatInfo
function formatInfo($downtime_recs)
{
if ($downtime_recs === null) {
return array();
}
$downtimes = array();
$resource_model = new Resource();
$resources = $resource_model->getindex();
$downtime_service_model = new DowntimeService();
$downtime_services = $downtime_service_model->get();
$model = new ResourceGroup();
$rg_info = $model->getindex();
$model = new Service();
$service_info = $model->getindex();
$model = new DowntimeClass();
$downtime_class = $model->getindex();
$model = new DowntimeSeverity();
$downtime_severity = $model->getindex();
$model = new DN();
$dns = $model->getindex();
//include disabled
$model = new Contact();
$contacts = $model->getindex();
//pull all resource ids that we are interested in
$resource_ids = array();
foreach ($this->rgs as $rgid => $rg) {
foreach ($rg as $rid => $resource) {
$resource_ids[] = $rid;
}
}
foreach ($downtime_recs as $downtime) {
if (in_array($downtime->resource_id, $resource_ids)) {
//only show event that we have pulled resource for
$resource = $resources[$downtime->resource_id];
$resource_name = $resource[0]->name;
$resource_fqdn = $resource[0]->fqdn;
$rg_id = $resource[0]->resource_group_id;
$rg_name = $rg_info[$resource[0]->resource_group_id][0]->name;
if ($resource_name !== null) {
$start = date(config()->date_format_full, $downtime->unix_start_time);
$end = date(config()->date_format_full, $downtime->unix_end_time);
$timestamp = date(config()->date_format_full, $downtime->unix_timestamp);
//get affected services
$affected_services = array();
foreach ($downtime_services as $service) {
if ($service->resource_downtime_id == $downtime->id) {
$info = $service_info[$service->service_id][0];
$affected_services[] = $info;
}
}
$desc = $downtime->downtime_summary;
//slog($desc);
$severity = $downtime_severity[$downtime->downtime_severity_id][0]->name;
$class = $downtime_class[$downtime->downtime_class_id][0]->name;
if (isset($dns[$downtime->dn_id])) {
$dn = $dns[$downtime->dn_id][0]->dn_string;
$contact_id = $dns[$downtime->dn_id][0]->contact_id;
$contact_name = $contacts[$contact_id][0]->name;
} else {
error_log("can't find dn with id " . $downtime->dn_id . " on dns list");
}
$downtimes[] = array("id" => $downtime->id, "name" => $resource_name, "fqdn" => $resource_fqdn, "rg_name" => $rg_name, "rg_id" => $rg_id, "resource_id" => $downtime->resource_id, "desc" => $desc, "severity" => $severity, "class" => $class, "services" => $affected_services, "unix_start_time" => $downtime->unix_start_time, "unix_end_time" => $downtime->unix_end_time, "start_time" => $start, "dn" => $dn, "timestamp" => $timestamp, "contact_name" => $contact_name, "end_time" => $end);
}
}
}
return $downtimes;
}
示例5: load
public function load()
{
parent::load();
$this->view->rgs = $this->rgs;
$model = new ResourceGroup();
$this->view->resource_groups = $model->getindex();
$service_type_model = new Service();
$this->view->services = $service_type_model->getindex();
//load AR history
$model = new ServiceAR();
$params = array();
$params["start_time"] = $this->view->start_time;
$params["end_time"] = $this->view->end_time;
//get list of resource ids that we are interested in
$resource_ids = array();
foreach ($this->rgs as $rgid => $rg) {
foreach ($rg as $rid => $resource) {
$resource_ids[] = $rid;
}
}
//group by resource/service_id
$ar_resource_service = array();
if (!empty($resource_ids)) {
$params["resource_ids"] = $resource_ids;
$ar = $model->get($params);
foreach ($ar as $a) {
$r_id = (int) $a->resource_id;
if (!isset($ar_resource_service[$r_id])) {
$ar_resource_service[$r_id] = array();
}
$service_id = (int) $a->service_id;
if (!isset($ar_resource_service[$r_id][$service_id])) {
$ar_resource_service[$r_id][$service_id] = array();
}
$ar_resource_service[$r_id][$service_id][] = $a;
}
}
$data = array();
foreach ($ar_resource_service as $rid => $resource) {
//filter by resource_id
if (!in_array($rid, $resource_ids)) {
continue;
}
$data[$rid] = array();
foreach ($resource as $service_id => $service) {
$count = 0;
$a_total = 0;
$r_total = 0;
foreach ($service as $rec) {
$count++;
$a_total += (double) $rec->availability;
$r_total += (double) $rec->reliability;
}
//store data
if ($count != 0) {
$data[$rid][$service_id] = array("availability" => $a_total / $count, "reliability" => $r_total / $count);
}
}
}
//sort data
if (isset($_REQUEST["sort"])) {
$dirty_sort = $_REQUEST["sort"];
switch ($dirty_sort) {
case "resource_name":
break;
case "a":
uasort($data, "cmp_availability");
break;
case "r":
uasort($data, "cmp_reliability");
break;
}
}
$this->view->data = $data;
$this->setpagetitle(self::default_title());
}
示例6: load
public function load()
{
parent::load();
$this->view->rgs = $this->rgs;
//pull commonly needed information
$gridtype_model = new GridTypes();
$this->view->gridtypes = $gridtype_model->getindex();
$model = new ResourceGroup();
$this->view->resourcegroups = $model->getgroupby("id");
///////////////////////////////////////////////////////////////////////////////////////////
//pull other optional stuff
if (isset($_REQUEST["summary_attrs_showservice"])) {
$servicetype_model = new Service();
$this->view->servicetypes = $servicetype_model->getindex();
$resourceservice_model = new ServiceByResourceID();
$this->view->resource_services = $resourceservice_model->getindex();
//load details (all of them for now..) and attach it to resource_services
$detail_model = new ResourceServiceDetail();
$resource_service_details = $detail_model->get();
foreach ($this->view->resource_services as $rid => $services) {
foreach ($services as $service) {
$service->details = array();
//search for details for this service
foreach ($resource_service_details as $detail) {
if ($detail->resource_id == $rid && $detail->service_id == $service->service_id) {
$service->details[$detail->key] = $detail->value;
}
}
}
}
}
if (isset($_REQUEST["summary_attrs_showrsvstatus"])) {
$model = new LatestResourceStatus();
$this->view->resource_status = $model->getgroupby("resource_id");
$downtime_model = new Downtime();
$this->view->downtime = $downtime_model->getindex(array("start_time" => time(), "end_time" => time()));
}
if (isset($_REQUEST["summary_attrs_showgipstatus"])) {
$model = new LDIF();
$this->view->gipstatus = $model->getValidationSummary();
}
if (isset($_REQUEST["summary_attrs_showvomembership"])) {
$cache_filename = config()->vomatrix_xml_cache;
$cache_xml = file_get_contents($cache_filename);
$vocache = new SimpleXMLElement($cache_xml);
$resourcegrouped = $vocache->ResourceGrouped[0];
$this->view->vos_supported = array();
$this->view->vos_errors = array();
foreach ($resourcegrouped as $resource) {
$attr = $resource->attributes();
$resource_id = (int) $attr->id;
$this->view->vos_supported[$resource_id] = $resource->Members[0];
$this->view->vos_errors[$resource_id] = $resource->ErrorMessage[0];
}
}
if (isset($_REQUEST["summary_attrs_showvoownership"])) {
$model = new ResourceOwnership();
$this->view->resource_ownerships = $model->getindex();
}
if (isset($_REQUEST["summary_attrs_showwlcg"])) {
$model = new ResourceWLCG();
$this->view->resource_wlcg = $model->getindex();
//append bdii link
foreach ($this->rgs as $rg_id => $rg) {
foreach ($rg as $resource_id => $resource) {
//get resource group name
$rgroup = $this->view->resourcegroups[$rg_id][0];
$rgname = $rgroup->name;
if (isset($this->view->resource_wlcg[$resource_id][0])) {
$this->view->resource_wlcg[$resource_id][0]->ldap_url = "ldap://is.grid.iu.edu:2180/mds-vo-name={$rgname},o=grid";
}
}
}
}
if (isset($_REQUEST["summary_attrs_showenv"])) {
$model = new ResourceEnv();
$details = $model->getindex(array("metric_id" => 0));
$this->view->envs = array();
//convert to XML String to SimpleXMLElement object
foreach ($this->rgs as $rg) {
foreach ($rg as $resource_id => $resource) {
if (isset($details[$resource_id])) {
$rec = $details[$resource_id][0];
$env = null;
if ($rec !== null) {
try {
$env = new SimpleXMLElement($rec->xml);
} catch (exception $e) {
elog((string) $e);
elog($rec->xml);
}
}
$this->view->envs[$resource_id] = $env;
}
}
}
}
if (isset($_REQUEST["summary_attrs_showcontact"])) {
$model = new ResourceContact();
$contacts = $model->getindex();
//.........这里部分代码省略.........