当前位置: 首页>>代码示例>>PHP>>正文


PHP API::ScreenItem方法代码示例

本文整理汇总了PHP中API::ScreenItem方法的典型用法代码示例。如果您正苦于以下问题:PHP API::ScreenItem方法的具体用法?PHP API::ScreenItem怎么用?PHP API::ScreenItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在API的用法示例。


在下文中一共展示了API::ScreenItem方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getScreen

 /**
  * Get particular screen object.
  *
  * @static
  *
  * @param array		$options
  * @param int		$options['resourcetype']
  * @param int		$options['screenitemid']
  * @param int		$options['hostid']
  *
  * @return CScreenBase
  */
 public static function getScreen(array $options = array())
 {
     // get resourcetype from screenitem
     if (empty($options['screenitem']) && !empty($options['screenitemid'])) {
         if (!empty($options['hostid'])) {
             $options['screenitem'] = API::TemplateScreenItem()->get(array('screenitemids' => $options['screenitemid'], 'hostids' => $options['hostid'], 'output' => API_OUTPUT_EXTEND));
         } else {
             $options['screenitem'] = API::ScreenItem()->get(array('screenitemids' => $options['screenitemid'], 'output' => API_OUTPUT_EXTEND));
         }
         $options['screenitem'] = reset($options['screenitem']);
     }
     if (zbx_empty($options['resourcetype']) && !zbx_empty($options['screenitem']['resourcetype'])) {
         $options['resourcetype'] = $options['screenitem']['resourcetype'];
     }
     if (zbx_empty($options['resourcetype'])) {
         return null;
     }
     // get screen
     switch ($options['resourcetype']) {
         case SCREEN_RESOURCE_GRAPH:
             return new CScreenGraph($options);
         case SCREEN_RESOURCE_SIMPLE_GRAPH:
             return new CScreenSimpleGraph($options);
         case SCREEN_RESOURCE_MAP:
             return new CScreenMap($options);
         case SCREEN_RESOURCE_PLAIN_TEXT:
             return new CScreenPlainText($options);
         case SCREEN_RESOURCE_HOSTS_INFO:
             return new CScreenHostsInfo($options);
         case SCREEN_RESOURCE_TRIGGERS_INFO:
             return new CScreenTriggersInfo($options);
         case SCREEN_RESOURCE_SERVER_INFO:
             return new CScreenServerInfo($options);
         case SCREEN_RESOURCE_CLOCK:
             return new CScreenClock($options);
         case SCREEN_RESOURCE_SCREEN:
             return new CScreenScreen($options);
         case SCREEN_RESOURCE_TRIGGERS_OVERVIEW:
             return new CScreenTriggersOverview($options);
         case SCREEN_RESOURCE_DATA_OVERVIEW:
             return new CScreenDataOverview($options);
         case SCREEN_RESOURCE_URL:
             return new CScreenUrl($options);
         case SCREEN_RESOURCE_ACTIONS:
             return new CScreenActions($options);
         case SCREEN_RESOURCE_EVENTS:
             return new CScreenEvents($options);
         case SCREEN_RESOURCE_HOSTGROUP_TRIGGERS:
             return new CScreenHostgroupTriggers($options);
         case SCREEN_RESOURCE_SYSTEM_STATUS:
             return new CScreenSystemStatus($options);
         case SCREEN_RESOURCE_HOST_TRIGGERS:
             return new CScreenHostTriggers($options);
         case SCREEN_RESOURCE_HISTORY:
             return new CScreenHistory($options);
         case SCREEN_RESOURCE_CHART:
             return new CScreenChart($options);
         default:
             return null;
     }
 }
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:73,代码来源:CScreenBuilder.php

示例2: show_messages

        $result = API::ScreenItem()->update($screenItem);
        show_messages($result, _('Item updated'), _('Cannot update item'));
    } else {
        $screenItem['x'] = get_request('x');
        $screenItem['y'] = get_request('y');
        $result = API::ScreenItem()->create($screenItem);
        show_messages($result, _('Item added'), _('Cannot add item'));
    }
    DBend($result);
    if ($result) {
        add_audit_details(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_SCREEN, $screen['screenid'], $screen['name'], 'Cell changed ' . (isset($_REQUEST['screenitemid']) ? 'screen itemid "' . $_REQUEST['screenitemid'] . '"' : '') . (isset($_REQUEST['x']) && isset($_REQUEST['y']) ? ' coordinates "' . $_REQUEST['x'] . ',' . $_REQUEST['y'] . '"' : '') . (isset($_REQUEST['resourcetype']) ? ' resource type "' . $_REQUEST['resourcetype'] . '"' : ''));
        unset($_REQUEST['form']);
    }
} elseif (isset($_REQUEST['delete'])) {
    DBstart();
    $screenitemid = API::ScreenItem()->delete($_REQUEST['screenitemid']);
    $result = DBend($screenitemid);
    show_messages($result, _('Item deleted'), _('Cannot delete item'));
    if ($result && !empty($screenitemid)) {
        $screenitemid = reset($screenitemid);
        $screenitemid = reset($screenitemid);
        add_audit_details(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_SCREEN, $screen['screenid'], $screen['name'], 'Screen itemid "' . $screenitemid . '"');
    }
    unset($_REQUEST['x']);
} elseif (isset($_REQUEST['add_row'])) {
    DBexecute('UPDATE screens SET vsize=(vsize+1) WHERE screenid=' . zbx_dbstr($screen['screenid']));
    $add_row = get_request('add_row', 0);
    if ($screen['vsize'] > $add_row) {
        DBexecute('UPDATE screens_items SET y=(y+1) WHERE screenid=' . zbx_dbstr($screen['screenid']) . ' AND y>=' . zbx_dbstr($add_row));
    }
    add_audit_details(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_SCREEN, $screen['screenid'], $screen['name'], 'Row added');
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:screenedit.php

示例3: updateByPosition

 /**
  * Update screen items using the given 'x' and 'y' parameters.
  * If the given cell is free, a new screen item will be created.
  *
  * @param array $screenItems	An array of screen items with the given X and Y coordinates
  *
  * @return array
  */
 public function updateByPosition(array $screenItems)
 {
     $screenItemDBfields = array('screenid' => null, 'x' => null, 'y' => null);
     foreach ($screenItems as $screenItem) {
         if (!check_db_fields($screenItemDBfields, $screenItem)) {
             self::exception(ZBX_API_ERROR_PARAMETERS, _('Invalid method parameters.'));
         }
     }
     $dbScreenItems = $this->get(array('screenids' => zbx_objectValues($screenItems, 'screenid'), 'output' => array('screenitemid', 'screenid', 'x', 'y'), 'editable' => true, 'preservekeys' => true));
     $create = $update = $affectedIds = array();
     foreach ($screenItems as $screenItem) {
         foreach ($dbScreenItems as $dbScreenItem) {
             if ($screenItem['screenid'] == $dbScreenItem['screenid'] && $screenItem['x'] == $dbScreenItem['x'] && $screenItem['y'] == $dbScreenItem['y']) {
                 $screenItem['screenitemid'] = $dbScreenItem['screenitemid'];
                 $update[$dbScreenItem['screenitemid']] = $screenItem;
                 continue 2;
             }
         }
         $create[] = $screenItem;
     }
     if ($update) {
         $screenItems = API::ScreenItem()->update($update);
         $affectedIds = $screenItems['screenitemids'];
     }
     if ($create) {
         $screenItems = API::ScreenItem()->create($create);
         $affectedIds = array_merge($affectedIds, $screenItems['screenitemids']);
     }
     return array('screenitemids' => $affectedIds);
 }
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:38,代码来源:CScreenItem.php

示例4: getRequest

        $screenItem['screenitemid'] = getRequest('screenitemid');
        $result = API::ScreenItem()->update($screenItem);
    } else {
        $screenItem['x'] = getRequest('x');
        $screenItem['y'] = getRequest('y');
        $result = API::ScreenItem()->create($screenItem);
    }
    if ($result) {
        add_audit_details(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_SCREEN, $screen['screenid'], $screen['name'], 'Cell changed ' . (hasRequest('screenitemid') ? 'screen itemid "' . getRequest('screenitemid') . '"' : '') . (hasRequest('x') && hasRequest('y') ? ' coordinates "' . getRequest('x') . ',' . getRequest('y') . '"' : '') . (hasRequest('resourcetype') ? ' resource type "' . getRequest('resourcetype') . '"' : ''));
        unset($_REQUEST['form']);
    }
    $result = DBend($result);
    show_messages($result, _('Screen updated'), _('Cannot update screen'));
} elseif (hasRequest('delete')) {
    DBstart();
    $screenitemid = API::ScreenItem()->delete(array(getRequest('screenitemid')));
    if ($screenitemid) {
        $screenitemid = reset($screenitemid);
        $screenitemid = reset($screenitemid);
        add_audit_details(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_SCREEN, $screen['screenid'], $screen['name'], 'Screen itemid "' . $screenitemid . '"');
    }
    unset($_REQUEST['x']);
    $result = DBend($screenitemid);
    show_messages($result, _('Screen updated'), _('Cannot update screen'));
} elseif (isset($_REQUEST['add_row'])) {
    DBstart();
    $result = DBexecute('UPDATE screens SET vsize=(vsize+1) WHERE screenid=' . zbx_dbstr($screen['screenid']));
    $add_row = getRequest('add_row', 0);
    if ($screen['vsize'] > $add_row) {
        $result &= DBexecute('UPDATE screens_items' . ' SET y=(y+1)' . ' WHERE screenid=' . zbx_dbstr($screen['screenid']) . ' AND y>=' . zbx_dbstr($add_row));
    }
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:screenedit.php

示例5: create

 /**
  * Create Screen
  *
  * @param array $screens
  * @param string $screens['name']
  * @param array $screens['hsize']
  * @param int $screens['vsize']
  * @return array
  */
 public function create(array $screens)
 {
     $screens = zbx_toArray($screens);
     $this->validateCreate($screens);
     $insertScreenItems = array();
     $screenids = DB::insert('screens', $screens);
     foreach ($screens as $snum => $screen) {
         if (isset($screen['screenitems'])) {
             foreach ($screen['screenitems'] as $screenitem) {
                 $screenitem['screenid'] = $screenids[$snum];
                 $insertScreenItems[] = $screenitem;
             }
         }
     }
     API::ScreenItem()->create($insertScreenItems);
     return array('screenids' => $screenids);
 }
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:26,代码来源:CTemplateScreen.php

示例6: getScreen

 /**
  * Get particular screen object.
  *
  * @static
  *
  * @param array		$options
  * @param int		$options['resourcetype']
  * @param int		$options['screenitemid']
  * @param int		$options['hostid']
  * @param array		$options['screen']
  * @param int		$options['screenid']
  *
  * @return CScreenBase
  */
 public static function getScreen(array $options = [])
 {
     if (!array_key_exists('resourcetype', $options)) {
         $options['resourcetype'] = null;
         // get resourcetype from screenitem
         if (!array_key_exists('screenitem', $options) && array_key_exists('screenitemid', $options)) {
             if (array_key_exists('hostid', $options) && $options['hostid'] > 0) {
                 $options['screenitem'] = API::TemplateScreenItem()->get(['screenitemids' => $options['screenitemid'], 'hostids' => $options['hostid'], 'output' => API_OUTPUT_EXTEND]);
             } else {
                 $options['screenitem'] = API::ScreenItem()->get(['screenitemids' => $options['screenitemid'], 'output' => API_OUTPUT_EXTEND]);
             }
             $options['screenitem'] = reset($options['screenitem']);
         }
         if (array_key_exists('screenitem', $options) && array_key_exists('resourcetype', $options['screenitem'])) {
             $options['resourcetype'] = $options['screenitem']['resourcetype'];
         }
     }
     if ($options['resourcetype'] === null) {
         return null;
     }
     // get screen
     switch ($options['resourcetype']) {
         case SCREEN_RESOURCE_GRAPH:
             return new CScreenGraph($options);
         case SCREEN_RESOURCE_SIMPLE_GRAPH:
             return new CScreenSimpleGraph($options);
         case SCREEN_RESOURCE_MAP:
             return new CScreenMap($options);
         case SCREEN_RESOURCE_PLAIN_TEXT:
             return new CScreenPlainText($options);
         case SCREEN_RESOURCE_HOSTS_INFO:
             return new CScreenHostsInfo($options);
         case SCREEN_RESOURCE_TRIGGERS_INFO:
             return new CScreenTriggersInfo($options);
         case SCREEN_RESOURCE_SERVER_INFO:
             return new CScreenServerInfo($options);
         case SCREEN_RESOURCE_CLOCK:
             return new CScreenClock($options);
         case SCREEN_RESOURCE_SCREEN:
             return new CScreenScreen($options);
         case SCREEN_RESOURCE_TRIGGERS_OVERVIEW:
             return new CScreenTriggersOverview($options);
         case SCREEN_RESOURCE_DATA_OVERVIEW:
             return new CScreenDataOverview($options);
         case SCREEN_RESOURCE_URL:
             $options = self::appendTemplatedScreenOption($options);
             return new CScreenUrl($options);
         case SCREEN_RESOURCE_ACTIONS:
             return new CScreenActions($options);
         case SCREEN_RESOURCE_EVENTS:
             return new CScreenEvents($options);
         case SCREEN_RESOURCE_HOSTGROUP_TRIGGERS:
             return new CScreenHostgroupTriggers($options);
         case SCREEN_RESOURCE_SYSTEM_STATUS:
             return new CScreenSystemStatus($options);
         case SCREEN_RESOURCE_HOST_TRIGGERS:
             return new CScreenHostTriggers($options);
         case SCREEN_RESOURCE_HISTORY:
             return new CScreenHistory($options);
         case SCREEN_RESOURCE_CHART:
             return new CScreenChart($options);
         case SCREEN_RESOURCE_LLD_GRAPH:
             $options = self::appendTemplatedScreenOption($options);
             return new CScreenLldGraph($options);
         case SCREEN_RESOURCE_LLD_SIMPLE_GRAPH:
             $options = self::appendTemplatedScreenOption($options);
             return new CScreenLldSimpleGraph($options);
         case SCREEN_RESOURCE_HTTPTEST_DETAILS:
             return new CScreenHttpTestDetails($options);
         case SCREEN_RESOURCE_DISCOVERY:
             return new CScreenDiscovery($options);
         case SCREEN_RESOURCE_HTTPTEST:
             return new CScreenHttpTest($options);
         default:
             return null;
     }
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:91,代码来源:CScreenBuilder.php

示例7: __construct

 /**
  * Init screen data.
  *
  * @param array		$options
  * @param boolean	$options['isFlickerfree']
  * @param string	$options['pageFile']
  * @param int		$options['mode']
  * @param int		$options['timestamp']
  * @param int		$options['resourcetype']
  * @param int		$options['screenid']
  * @param array		$options['screenitem']
  * @param string	$options['action']
  * @param int		$options['groupid']
  * @param int		$options['hostid']
  * @param int		$options['period']
  * @param int		$options['stime']
  * @param string	$options['profileIdx']
  * @param int		$options['profileIdx2']
  * @param boolean	$options['updateProfile']
  * @param array		$options['timeline']
  * @param string	$options['dataId']
  */
 public function __construct(array $options = array())
 {
     $this->isFlickerfree = isset($options['isFlickerfree']) ? $options['isFlickerfree'] : true;
     $this->mode = isset($options['mode']) ? $options['mode'] : SCREEN_MODE_SLIDESHOW;
     $this->timestamp = !empty($options['timestamp']) ? $options['timestamp'] : time();
     $this->resourcetype = isset($options['resourcetype']) ? $options['resourcetype'] : null;
     $this->screenid = !empty($options['screenid']) ? $options['screenid'] : null;
     $this->action = !empty($options['action']) ? $options['action'] : null;
     $this->groupid = !empty($options['groupid']) ? $options['groupid'] : null;
     $this->hostid = !empty($options['hostid']) ? $options['hostid'] : null;
     $this->dataId = !empty($options['dataId']) ? $options['dataId'] : null;
     // get page file
     if (!empty($options['pageFile'])) {
         $this->pageFile = $options['pageFile'];
     } else {
         global $page;
         $this->pageFile = $page['file'];
     }
     // calculate timeline
     $this->profileIdx = !empty($options['profileIdx']) ? $options['profileIdx'] : '';
     $this->profileIdx2 = !empty($options['profileIdx2']) ? $options['profileIdx2'] : null;
     $this->updateProfile = isset($options['updateProfile']) ? $options['updateProfile'] : true;
     $this->timeline = !empty($options['timeline']) ? $options['timeline'] : null;
     if (empty($this->timeline)) {
         $this->timeline = $this->calculateTime(array('profileIdx' => $this->profileIdx, 'profileIdx2' => $this->profileIdx2, 'updateProfile' => $this->updateProfile, 'period' => !empty($options['period']) ? $options['period'] : null, 'stime' => !empty($options['stime']) ? $options['stime'] : null));
     }
     // get screenitem
     if (!empty($options['screenitem'])) {
         $this->screenitem = $options['screenitem'];
     } elseif (!empty($options['screenitemid'])) {
         if (!empty($this->hostid)) {
             $this->screenitem = API::TemplateScreenItem()->get(array('screenitemids' => $options['screenitemid'], 'hostids' => $this->hostid, 'output' => API_OUTPUT_EXTEND));
         } else {
             $this->screenitem = API::ScreenItem()->get(array('screenitemids' => $options['screenitemid'], 'output' => API_OUTPUT_EXTEND));
         }
         $this->screenitem = reset($this->screenitem);
     }
     // get screenid
     if (empty($this->screenid) && !empty($this->screenitem)) {
         $this->screenid = $this->screenitem['screenid'];
     }
     // get resourcetype
     if (is_null($this->resourcetype) && !empty($this->screenitem['resourcetype'])) {
         $this->resourcetype = $this->screenitem['resourcetype'];
     }
     // create action url
     if (empty($this->action)) {
         $this->action = 'screenedit.php?form=update&screenid=' . $this->screenid . '&screenitemid=' . $this->screenitem['screenitemid'];
     }
 }
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:72,代码来源:CScreenBase.php

示例8: getRequest

        $screenItem['screenitemid'] = getRequest('screenitemid');
        $result = API::ScreenItem()->update($screenItem);
    } else {
        $screenItem['x'] = getRequest('x');
        $screenItem['y'] = getRequest('y');
        $result = API::ScreenItem()->create($screenItem);
    }
    if ($result) {
        add_audit_details(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_SCREEN, $screen['screenid'], $screen['name'], 'Cell changed ' . (hasRequest('screenitemid') ? 'screen itemid "' . getRequest('screenitemid') . '"' : '') . (hasRequest('x') && hasRequest('y') ? ' coordinates "' . getRequest('x') . ',' . getRequest('y') . '"' : '') . (hasRequest('resourcetype') ? ' resource type "' . getRequest('resourcetype') . '"' : ''));
        unset($_REQUEST['form']);
    }
    $result = DBend($result);
    show_messages($result, _('Screen updated'), _('Cannot update screen'));
} elseif (hasRequest('delete')) {
    DBstart();
    $screenitemid = API::ScreenItem()->delete([getRequest('screenitemid')]);
    if ($screenitemid) {
        $screenitemid = reset($screenitemid);
        $screenitemid = reset($screenitemid);
        add_audit_details(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_SCREEN, $screen['screenid'], $screen['name'], 'Screen itemid "' . $screenitemid . '"');
    }
    unset($_REQUEST['x']);
    $result = DBend($screenitemid);
    show_messages($result, _('Screen updated'), _('Cannot update screen'));
} elseif (hasRequest('add_row')) {
    addScreenRow($screen, getRequest('add_row'));
} elseif (hasRequest('add_col')) {
    addScreenColumn($screen, getRequest('add_col'));
} elseif (hasRequest('rmv_row')) {
    delScreenRow($screen, getRequest('rmv_row'));
} elseif (hasRequest('rmv_col')) {
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:screenedit.php

示例9: replaceItems

 /**
  * Replaces all of the screen items of the given screen.
  *
  * @param int   $screenId		The ID of the target screen
  * @param array $screenItems	An array of screen items
  */
 protected function replaceItems($screenId, $screenItems)
 {
     foreach ($screenItems as &$screenItem) {
         $screenItem['screenid'] = $screenId;
     }
     unset($screenItem);
     $createScreenItems = $deleteScreenItems = $updateScreenItems = array();
     $deleteScreenItemsIds = array();
     $dbScreenItems = API::ScreenItem()->get(array('screenids' => $screenId, 'preservekeys' => true));
     foreach ($screenItems as $screenItem) {
         if (isset($screenItem['screenitemid']) && isset($dbScreenItems[$screenItem['screenitemid']])) {
             $updateScreenItems[$screenItem['screenitemid']] = $screenItem;
         } else {
             $createScreenItems[] = $screenItem;
         }
     }
     foreach ($dbScreenItems as $dbScreenItem) {
         if (!isset($updateScreenItems[$dbScreenItem['screenitemid']])) {
             $deleteScreenItemsIds[$dbScreenItem['screenitemid']] = $dbScreenItem['screenitemid'];
         }
     }
     if ($deleteScreenItemsIds) {
         API::ScreenItem()->delete($deleteScreenItemsIds);
     }
     if ($updateScreenItems) {
         API::ScreenItem()->update($updateScreenItems);
     }
     if ($createScreenItems) {
         API::ScreenItem()->create($createScreenItems);
     }
 }
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:37,代码来源:CScreen.php

示例10: replaceItems

 /**
  * Replaces all of the screen items of the given screen with the new ones.
  *
  * @param int $screenid			The ID of the target screen
  * @param array $screenItems	An array of screen items
  */
 protected function replaceItems($screenid, $screenItems)
 {
     $dbScreenItems = API::ScreenItem()->get(array('screenids' => $screenid, 'preservekeys' => true));
     foreach ($screenItems as &$screenItem) {
         $screenItem['screenid'] = $screenid;
     }
     $result = API::ScreenItem()->updateByPosition($screenItems);
     // deleted the old items
     $deleteItemids = array_diff(array_keys($dbScreenItems), $result['screenitemids']);
     API::ScreenItem()->delete($deleteItemids);
 }
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:17,代码来源:CScreen.php

示例11: getScreen

 /**
  * Get particular screen object.
  *
  * @static
  *
  * @param array		$options
  * @param int		$options['resourcetype']
  * @param int		$options['screenitemid']
  * @param int		$options['hostid']
  * @param array		$options['screen']
  * @param int		$options['screenid']
  *
  * @return CScreenBase
  */
 public static function getScreen(array $options = array())
 {
     // get resourcetype from screenitem
     if (empty($options['screenitem']) && !empty($options['screenitemid'])) {
         if (!empty($options['hostid'])) {
             $options['screenitem'] = API::TemplateScreenItem()->get(array('screenitemids' => $options['screenitemid'], 'hostids' => $options['hostid'], 'output' => API_OUTPUT_EXTEND));
         } else {
             $options['screenitem'] = API::ScreenItem()->get(array('screenitemids' => $options['screenitemid'], 'output' => API_OUTPUT_EXTEND));
         }
         $options['screenitem'] = reset($options['screenitem']);
     }
     if (zbx_empty($options['resourcetype']) && !zbx_empty($options['screenitem']['resourcetype'])) {
         $options['resourcetype'] = $options['screenitem']['resourcetype'];
     }
     if (zbx_empty($options['resourcetype'])) {
         return null;
     }
     // get screen
     switch ($options['resourcetype']) {
         case SCREEN_RESOURCE_GRAPH:
             return new CScreenGraph($options);
         case SCREEN_RESOURCE_SIMPLE_GRAPH:
             return new CScreenSimpleGraph($options);
         case SCREEN_RESOURCE_MAP:
             return new CScreenMap($options);
         case SCREEN_RESOURCE_PLAIN_TEXT:
             return new CScreenPlainText($options);
         case SCREEN_RESOURCE_HOSTS_INFO:
             return new CScreenHostsInfo($options);
         case SCREEN_RESOURCE_TRIGGERS_INFO:
             return new CScreenTriggersInfo($options);
         case SCREEN_RESOURCE_SERVER_INFO:
             return new CScreenServerInfo($options);
         case SCREEN_RESOURCE_CLOCK:
             return new CScreenClock($options);
         case SCREEN_RESOURCE_SCREEN:
             return new CScreenScreen($options);
         case SCREEN_RESOURCE_TRIGGERS_OVERVIEW:
             return new CScreenTriggersOverview($options);
         case SCREEN_RESOURCE_DATA_OVERVIEW:
             return new CScreenDataOverview($options);
         case SCREEN_RESOURCE_URL:
             $options = self::appendTemplatedScreenOption($options);
             return new CScreenUrl($options);
         case SCREEN_RESOURCE_ACTIONS:
             return new CScreenActions($options);
         case SCREEN_RESOURCE_EVENTS:
             return new CScreenEvents($options);
         case SCREEN_RESOURCE_HOSTGROUP_TRIGGERS:
             return new CScreenHostgroupTriggers($options);
         case SCREEN_RESOURCE_SYSTEM_STATUS:
             return new CScreenSystemStatus($options);
         case SCREEN_RESOURCE_HOST_TRIGGERS:
             return new CScreenHostTriggers($options);
         case SCREEN_RESOURCE_HISTORY:
             // TODO: pass the items from the outside instead of retrieving them by ids
             if (isset($options['itemids'])) {
                 $items = API::Item()->get(array('itemids' => $options['itemids'], 'webitems' => true, 'selectHosts' => array('name'), 'output' => array('itemid', 'hostid', 'name', 'key_', 'value_type', 'valuemapid'), 'preservekeys' => true));
                 $items = CMacrosResolverHelper::resolveItemNames($items);
                 $options['items'] = $items;
                 unset($options['itemids']);
             }
             return new CScreenHistory($options);
         case SCREEN_RESOURCE_CHART:
             return new CScreenChart($options);
         case SCREEN_RESOURCE_LLD_GRAPH:
             $options = self::appendTemplatedScreenOption($options);
             return new CScreenLldGraph($options);
         case SCREEN_RESOURCE_LLD_SIMPLE_GRAPH:
             $options = self::appendTemplatedScreenOption($options);
             return new CScreenLldSimpleGraph($options);
         default:
             return null;
     }
 }
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:89,代码来源:CScreenBuilder.php

示例12: __construct

 /**
  * Init screen data.
  *
  * @param array		$options
  * @param boolean	$options['isFlickerfree']
  * @param string	$options['pageFile']
  * @param int		$options['mode']
  * @param int		$options['timestamp']
  * @param int		$options['resourcetype']
  * @param bool		$options['isTemplatedScreen']
  * @param int		$options['screenid']
  * @param array		$options['screenitem']
  * @param string	$options['action']
  * @param int		$options['groupid']
  * @param int		$options['hostid']
  * @param int		$options['period']
  * @param int		$options['stime']
  * @param string	$options['profileIdx']
  * @param int		$options['profileIdx2']
  * @param boolean	$options['updateProfile']
  * @param array		$options['timeline']
  * @param string	$options['dataId']
  */
 public function __construct(array $options = [])
 {
     $this->parameters = ['isFlickerfree' => true, 'mode' => SCREEN_MODE_SLIDESHOW, 'timestamp' => time(), 'resourcetype' => null, 'isTemplatedScreen' => false, 'screenid' => null, 'action' => null, 'groupid' => null, 'hostid' => 0, 'pageFile' => null, 'profileIdx' => '', 'profileIdx2' => null, 'updateProfile' => true, 'timeline' => null, 'dataId' => null, 'page' => 1];
     $this->resourcetype = array_key_exists('resourcetype', $options) ? $options['resourcetype'] : null;
     $this->required_parameters = ['isFlickerfree' => true, 'mode' => true, 'timestamp' => true, 'resourcetype' => true, 'dataId' => true];
     switch ($this->resourcetype) {
         case SCREEN_RESOURCE_HTTPTEST_DETAILS:
             $this->required_parameters += ['isTemplatedScreen' => false, 'screenid' => false, 'action' => false, 'groupid' => false, 'hostid' => false, 'pageFile' => false, 'profileIdx' => false, 'profileIdx2' => true, 'updateProfile' => false, 'timeline' => false, 'page' => false];
             break;
         case SCREEN_RESOURCE_DISCOVERY:
             $this->required_parameters += ['isTemplatedScreen' => false, 'screenid' => false, 'action' => false, 'groupid' => false, 'hostid' => false, 'pageFile' => false, 'profileIdx' => false, 'profileIdx2' => false, 'updateProfile' => false, 'timeline' => false, 'page' => false];
             break;
         case SCREEN_RESOURCE_HTTPTEST:
             $this->required_parameters += ['isTemplatedScreen' => false, 'screenid' => false, 'action' => false, 'groupid' => true, 'hostid' => true, 'pageFile' => false, 'profileIdx' => false, 'profileIdx2' => false, 'updateProfile' => false, 'timeline' => false, 'page' => true];
             break;
         default:
             $this->required_parameters += ['isTemplatedScreen' => true, 'screenid' => true, 'action' => true, 'groupid' => true, 'hostid' => true, 'pageFile' => true, 'profileIdx' => true, 'profileIdx2' => true, 'updateProfile' => true, 'timeline' => true, 'page' => false];
     }
     // Get screenitem if its required or resource type is null.
     $this->screenitem = [];
     if (array_key_exists('screenitem', $options) && is_array($options['screenitem'])) {
         $this->screenitem = $options['screenitem'];
     } elseif (array_key_exists('screenitemid', $options) && $options['screenitemid'] > 0) {
         $screenitem_output = ['screenitemid', 'screenid', 'resourcetype', 'resourceid', 'width', 'height', 'elements', 'halign', 'valign', 'style', 'url', 'dynamic', 'sort_triggers', 'application', 'max_columns'];
         if ($this->hostid != 0) {
             $this->screenitem = API::TemplateScreenItem()->get(['output' => $screenitem_output, 'screenitemids' => $options['screenitemid'], 'hostids' => $this->hostid]);
         } else {
             $this->screenitem = API::ScreenItem()->get(['output' => $screenitem_output, 'screenitemids' => $options['screenitemid']]);
         }
         if ($this->screenitem) {
             $this->screenitem = reset($this->screenitem);
         }
     }
     // Get resourcetype.
     if ($this->resourcetype === null && array_key_exists('resourcetype', $this->screenitem)) {
         $this->resourcetype = $this->screenitem['resourcetype'];
     }
     foreach ($this->parameters as $pname => $default_value) {
         if ($this->required_parameters[$pname]) {
             $this->{$pname} = array_key_exists($pname, $options) ? $options[$pname] : $default_value;
         }
     }
     // Get page file.
     if ($this->required_parameters['pageFile'] && $this->pageFile === null) {
         global $page;
         $this->pageFile = $page['file'];
     }
     // Calculate timeline.
     if ($this->required_parameters['timeline'] && $this->timeline === null) {
         $this->timeline = $this->calculateTime(['profileIdx' => $this->profileIdx, 'profileIdx2' => $this->profileIdx2, 'updateProfile' => $this->updateProfile, 'period' => array_key_exists('period', $options) ? $options['period'] : null, 'stime' => array_key_exists('stime', $options) ? $options['stime'] : null]);
     }
     // Get screenid.
     if ($this->required_parameters['screenid'] && $this->screenid === null && $this->screenitem) {
         $this->screenid = $this->screenitem['screenid'];
     }
     // Create action URL.
     if ($this->required_parameters['action'] && $this->action === null && $this->screenitem) {
         $this->action = 'screenedit.php?form=update&screenid=' . $this->screenid . '&screenitemid=' . $this->screenitem['screenitemid'];
     }
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:83,代码来源:CScreenBase.php


注:本文中的API::ScreenItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。