• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: toString

 public function toString($destroy = true)
 {
     if (count($this->tabs) == 1) {
         $this->setAttribute('class', 'min-width ui-tabs ui-widget ui-widget-content ui-corner-all widget');
         $header = reset($this->headers);
         $header = new CDiv($header);
         $header->addClass('ui-corner-all ui-widget-header header');
         $header->setAttribute('id', 'tab_' . key($this->headers));
         $this->addItem($header);
         $tab = reset($this->tabs);
         $tab->addClass('ui-tabs ui-tabs-panel ui-widget ui-widget-content ui-corner-all widget');
         $this->addItem($tab);
     } else {
         $headersList = new CList();
         foreach ($this->headers as $id => $header) {
             $tabLink = new CLink($header, '#' . $id, null, null, false);
             $tabLink->setAttribute('id', 'tab_' . $id);
             $headersList->addItem($tabLink);
         }
         $this->addItem($headersList);
         $this->addItem($this->tabs);
         $options = array();
         if (!is_null($this->selectedTab)) {
             $options['selected'] = $this->selectedTab;
         }
         if ($this->rememberTab) {
             $options['cookie'] = array();
         }
         zbx_add_post_js('jQuery("#' . $this->id . '").tabs(' . zbx_jsvalue($options, true) . ').show();');
     }
     return parent::toString($destroy);
 }
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:32,代码来源:class.ctabview.php


示例2: createChain

 /**
  * Creates and returns calculation rules chain.
  * 
  * @return CList calculation rules chain
  */
 protected function createChain()
 {
     if (!isset($this->_rules)) {
         $chain = $this->chain();
         $this->_rules = new CList();
         foreach ($chain as $item) {
             $rule = $this->createChainRule($item);
             $this->_rules->add($rule);
         }
     }
     return $this->_rules;
 }
开发者ID:hansenmakangiras,项目名称:disperindag,代码行数:17,代码来源:RatingModelChain.php


示例3: addValidators

 protected function addValidators()
 {
     $validators = new CList();
     foreach ($this->rules() as $rule) {
         if (isset($rule[0], $rule[1])) {
             $validator = CValidator::createValidator($rule[1], $this->_model, $rule[0], array_slice($rule, 2));
             $validators->add($validator);
         } else {
             throw new CException(Yii::t('yii', '{class} has an invalid validation rule. The rule must specify attributes to be validated and the validator name.', array('{class}' => get_class($this))));
         }
     }
     return $validators;
 }
开发者ID:hit-shappens,项目名称:testapp,代码行数:13,代码来源:ExtendedARBehavior.php


示例4: getList

 /**
  * @param bool $id = false
  * @return CList|int
  */
 public function getList($id = false)
 {
     if ($id === true) {
         return $this->list->getStringId();
     }
     return $this->list;
 }
开发者ID:evodelavega,项目名称:activecampaign-api-php,代码行数:11,代码来源:Filter.php


示例5: findRecursive

 public static function findRecursive($dir, $filters = NULL, $depth = -1, $limit = 0)
 {
     if (!$filters instanceof EFileFilters) {
         $filters = new EFileFilters($filters);
     }
     $list = new CList();
     //TODO: $dir = new DirectoryIterator(dirname(__FILE__)); foreach ($dir as $fileinfo) {}
     $handle = opendir($dir);
     while (($fileName = readdir($handle)) !== FALSE) {
         if ($limit > 0 && $list->count >= $limit) {
             break;
         }
         if ($fileName === '.' || $fileName === '..') {
             continue;
         }
         $file = EFile::getInstance($dir . DIRECTORY_SEPARATOR . $fileName);
         //TODO: подумать о сортировке прямо в цикле поиска
         if ($filters->run($file)) {
             if ($file->isDir && $depth) {
                 $list->mergeWith(self::findRecursive($file->path, $filters, $depth - 1, $limit - $list->count));
             } else {
                 $list->add($file);
             }
         }
     }
     closedir($handle);
     return $list;
 }
开发者ID:sinelnikof,项目名称:yiiext,代码行数:28,代码来源:EFile.php


示例6: createValidators

 public function createValidators()
 {
     $validators = new CList();
     $rules = $this->rules();
     if ($this->addDefaultRules) {
         $rules = array_merge($rules, $this->defaultRules());
     }
     foreach ($rules as $rule) {
         if (isset($rule[0], $rule[1])) {
             // attributes, validator name
             $validators->add(CValidator::createValidator($rule[1], $this, $rule[0], array_slice($rule, 2)));
         } else {
             throw new CException(Yii::t('yii', '{class} has an invalid validation rule. The rule must specify attributes to be validated and the validator name.', array('{class}' => get_class($this))));
         }
     }
     return $validators;
 }
开发者ID:teknosuper,项目名称:YiiValidateRelation,代码行数:17,代码来源:YiiFormModel.php


示例7: toString

    public function toString($destroy = true)
    {
        if (count($this->tabs) == 1) {
            $this->setAttribute('class', 'min-width ui-tabs ui-widget ui-widget-content ui-corner-all widget');
            $header = reset($this->headers);
            $header = new CDiv($header);
            $header->addClass('ui-corner-all ui-widget-header header');
            $header->setAttribute('id', 'tab_' . key($this->headers));
            $this->addItem($header);
            $tab = reset($this->tabs);
            $tab->addClass('ui-tabs ui-tabs-panel ui-widget ui-widget-content ui-corner-all widget');
            $this->addItem($tab);
        } else {
            $headersList = new CList();
            foreach ($this->headers as $id => $header) {
                $tabLink = new CLink($header, '#' . $id, null, null, false);
                $tabLink->setAttribute('id', 'tab_' . $id);
                $headersList->addItem($tabLink);
            }
            $this->addItem($headersList);
            $this->addItem($this->tabs);
            if ($this->selectedTab === null) {
                $activeTab = get_cookie('tab', 0);
                $createEvent = '';
            } else {
                $activeTab = $this->selectedTab;
                $createEvent = 'create: function() { jQuery.cookie("tab", ' . $this->selectedTab . '); },';
            }
            $disabledTabs = $this->disabledTabs === null ? '' : 'disabled: ' . CJs::encodeJson($this->disabledTabs) . ',';
            zbx_add_post_js('
				jQuery("#' . $this->id . '").tabs({
					' . $createEvent . '
					' . $disabledTabs . '
					active: ' . $activeTab . ',
					activate: function(event, ui) {
						jQuery.cookie("tab", ui.newTab.index().toString());
					}
				})
				.css("visibility", "visible");');
        }
        return parent::toString($destroy);
    }
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:42,代码来源:CTabView.php


示例8: __construct

 /**
  * @param string $options['name']
  * @param int    $options['value']		(optional) Default: TRIGGER_SEVERITY_NOT_CLASSIFIED
  * @param bool   $options['all']		(optional)
  */
 public function __construct(array $options = [])
 {
     parent::__construct();
     $id = zbx_formatDomId($options['name']);
     $this->addClass(ZBX_STYLE_RADIO_SEGMENTED);
     $this->setId($id);
     if (!array_key_exists('value', $options)) {
         $options['value'] = TRIGGER_SEVERITY_NOT_CLASSIFIED;
     }
     $severity_from = array_key_exists('all', $options) && $options['all'] ? -1 : TRIGGER_SEVERITY_NOT_CLASSIFIED;
     $config = select_config();
     for ($severity = $severity_from; $severity < TRIGGER_SEVERITY_COUNT; $severity++) {
         $name = $severity == -1 ? _('all') : getSeverityName($severity, $config);
         $class = $severity == -1 ? null : getSeverityStyle($severity);
         $radio = (new CInput('radio', $options['name'], $severity))->setId(zbx_formatDomId($options['name'] . '_' . $severity));
         if ($severity === $options['value']) {
             $radio->setAttribute('checked', 'checked');
         }
         parent::addItem((new CListItem([$radio, new CLabel($name, $options['name'] . '_' . $severity)]))->addClass($class));
     }
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:26,代码来源:CSeverity.php


示例9: createValueValidatorsByRules

 /**
  * @param array $rules
  * @return CList
  * @throws CException
  */
 private function createValueValidatorsByRules(array $rules)
 {
     $validators = new CList();
     foreach ($rules as $rule) {
         if (isset($rule[0], $rule[1])) {
             if ($rule[1] != 'unique') {
                 $validators->add(CValidator::createValidator($rule[1], $this, $rule[0], array_slice($rule, 2)));
             }
         } else {
             throw new CException(Zurmo::t('ReportsModule', '{class} has an invalid validation rule. The rule must specify ' . 'attributes to be validated and the validator name.', array('{class}' => get_class($this))));
         }
     }
     return $validators;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:19,代码来源:FilterForReportForm.php


示例10: show_messages

function show_messages($bool = true, $okmsg = null, $errmsg = null)
{
    global $page, $ZBX_MESSAGES;
    if (!defined('PAGE_HEADER_LOADED')) {
        return null;
    }
    if (defined('ZBX_API_REQUEST')) {
        return null;
    }
    if (!isset($page['type'])) {
        $page['type'] = PAGE_TYPE_HTML;
    }
    $imageMessages = array();
    if (!$bool && !is_null($errmsg)) {
        $msg = _('ERROR') . ': ' . $errmsg;
    } elseif ($bool && !is_null($okmsg)) {
        $msg = $okmsg;
    }
    if (isset($msg)) {
        switch ($page['type']) {
            case PAGE_TYPE_IMAGE:
                // save all of the messages in an array to display them later in an image
                $imageMessages[] = array('text' => $msg, 'color' => !$bool ? array('R' => 255, 'G' => 0, 'B' => 0) : array('R' => 34, 'G' => 51, 'B' => 68));
                break;
            case PAGE_TYPE_XML:
                echo htmlspecialchars($msg) . "\n";
                break;
            case PAGE_TYPE_HTML:
            default:
                $msg_tab = new CTable($msg, $bool ? 'msgok' : 'msgerr');
                $msg_tab->setCellPadding(0);
                $msg_tab->setCellSpacing(0);
                $row = array();
                $msg_col = new CCol(bold($msg), 'msg_main msg');
                $msg_col->setAttribute('id', 'page_msg');
                $row[] = $msg_col;
                if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) {
                    $msg_details = new CDiv(_('Details'), 'blacklink');
                    $msg_details->setAttribute('onclick', 'javascript: showHide("msg_messages", IE ? "block" : "table");');
                    $msg_details->setAttribute('title', _('Maximize') . '/' . _('Minimize'));
                    array_unshift($row, new CCol($msg_details, 'clr'));
                }
                $msg_tab->addRow($row);
                $msg_tab->show();
                break;
        }
    }
    if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) {
        if ($page['type'] == PAGE_TYPE_IMAGE) {
            foreach ($ZBX_MESSAGES as $msg) {
                // save all of the messages in an array to display them later in an image
                if ($msg['type'] == 'error') {
                    $imageMessages[] = array('text' => $msg['message'], 'color' => array('R' => 255, 'G' => 55, 'B' => 55));
                } else {
                    $imageMessages[] = array('text' => $msg['message'], 'color' => array('R' => 155, 'G' => 155, 'B' => 55));
                }
            }
        } elseif ($page['type'] == PAGE_TYPE_XML) {
            foreach ($ZBX_MESSAGES as $msg) {
                echo '[' . $msg['type'] . '] ' . $msg['message'] . "\n";
            }
        } else {
            $lst_error = new CList(null, 'messages');
            foreach ($ZBX_MESSAGES as $msg) {
                $lst_error->addItem($msg['message'], $msg['type']);
                $bool = $bool && 'error' !== strtolower($msg['type']);
            }
            $msg_show = 6;
            $msg_count = count($ZBX_MESSAGES);
            if ($msg_count > $msg_show) {
                $msg_count = $msg_show * 16;
                $lst_error->setAttribute('style', 'height: ' . $msg_count . 'px;');
            }
            $tab = new CTable(null, $bool ? 'msgok' : 'msgerr');
            $tab->setCellPadding(0);
            $tab->setCellSpacing(0);
            $tab->setAttribute('id', 'msg_messages');
            $tab->setAttribute('style', 'width: 100%;');
            if (isset($msg_tab) && $bool) {
                $tab->setAttribute('style', 'display: none;');
            }
            $tab->addRow(new CCol($lst_error, 'msg'));
            $tab->show();
        }
        $ZBX_MESSAGES = null;
    }
    // draw an image with the messages
    if ($page['type'] == PAGE_TYPE_IMAGE && count($imageMessages) > 0) {
        $imageFontSize = 8;
        // calculate the size of the text
        $imageWidth = 0;
        $imageHeight = 0;
        foreach ($imageMessages as &$msg) {
            $size = imageTextSize($imageFontSize, 0, $msg['text']);
            $msg['height'] = $size['height'] - $size['baseline'];
            // calculate the total size of the image
            $imageWidth = max($imageWidth, $size['width']);
            $imageHeight += $size['height'] + 1;
        }
        unset($msg);
//.........这里部分代码省略.........
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:101,代码来源:func.inc.php


示例11: AddDocumentField

 public function AddDocumentField($documentType, $fields)
 {
     $iblockId = intval(substr($documentType, strlen("iblock_")));
     if ($iblockId <= 0) {
         throw new CBPArgumentOutOfRangeException("documentType", $documentType);
     }
     if (substr($fields["code"], 0, strlen("PROPERTY_")) == "PROPERTY_") {
         $fields["code"] = substr($fields["code"], strlen("PROPERTY_"));
     }
     $fieldsTemporary = array("NAME" => $fields["name"], "ACTIVE" => "Y", "SORT" => $fields["sort"] ? $fields["sort"] : 900, "CODE" => $fields["code"], 'MULTIPLE' => $fields['multiple'] == 'Y' || (string) $fields['multiple'] === '1' ? 'Y' : 'N', 'IS_REQUIRED' => $fields['required'] == 'Y' || (string) $fields['required'] === '1' ? 'Y' : 'N', "IBLOCK_ID" => $iblockId, "FILTRABLE" => "Y", "SETTINGS" => $fields["settings"] ? $fields["settings"] : array("SHOW_ADD_FORM" => 'Y', "SHOW_EDIT_FORM" => 'Y'), "DEFAULT_VALUE" => $fields['DefaultValue']);
     if (strpos("0123456789", substr($fieldsTemporary["CODE"], 0, 1)) !== false) {
         $fieldsTemporary["CODE"] = self::generateMnemonicCode($fieldsTemporary["CODE"]);
     }
     if (array_key_exists("additional_type_info", $fields)) {
         $fieldsTemporary["LINK_IBLOCK_ID"] = intval($fields["additional_type_info"]);
     }
     if (strstr($fields["type"], ":") !== false) {
         list($fieldsTemporary["TYPE"], $fieldsTemporary["USER_TYPE"]) = explode(":", $fields["type"], 2);
         if ($fields["type"] == "E:EList") {
             $fieldsTemporary["LINK_IBLOCK_ID"] = $fields["options"];
         }
     } elseif ($fields["type"] == "user") {
         $fieldsTemporary["TYPE"] = "S:employee";
         $fieldsTemporary["USER_TYPE"] = "UserID";
     } elseif ($fields["type"] == "date") {
         $fieldsTemporary["TYPE"] = "S:Date";
         $fieldsTemporary["USER_TYPE"] = "Date";
     } elseif ($fields["type"] == "datetime") {
         $fieldsTemporary["TYPE"] = "S:DateTime";
         $fieldsTemporary["USER_TYPE"] = "DateTime";
     } elseif ($fields["type"] == "file") {
         $fieldsTemporary["TYPE"] = "F";
         $fieldsTemporary["USER_TYPE"] = "";
     } elseif ($fields["type"] == "select") {
         $fieldsTemporary["TYPE"] = "L";
         $fieldsTemporary["USER_TYPE"] = false;
         if (is_array($fields["options"])) {
             $i = 10;
             foreach ($fields["options"] as $k => $v) {
                 $def = "N";
                 if ($fields['DefaultValue'] == $v) {
                     $def = "Y";
                 }
                 $fieldsTemporary["VALUES"][] = array("XML_ID" => $k, "VALUE" => $v, "DEF" => $def, "SORT" => $i);
                 $i = $i + 10;
             }
         } elseif (is_string($fields["options"]) && strlen($fields["options"]) > 0) {
             $a = explode("\n", $fields["options"]);
             $i = 10;
             foreach ($a as $v) {
                 $v = trim(trim($v), "\r\n");
                 if (!$v) {
                     continue;
                 }
                 $v1 = $v2 = $v;
                 if (substr($v, 0, 1) == "[" && strpos($v, "]") !== false) {
                     $v1 = substr($v, 1, strpos($v, "]") - 1);
                     $v2 = trim(substr($v, strpos($v, "]") + 1));
                 }
                 $def = "N";
                 if ($fields['DefaultValue'] == $v2) {
                     $def = "Y";
                 }
                 $fieldsTemporary["VALUES"][] = array("XML_ID" => $v1, "VALUE" => $v2, "DEF" => $def, "SORT" => $i);
                 $i = $i + 10;
             }
         }
     } elseif ($fields["type"] == "string") {
         $fieldsTemporary["TYPE"] = "S";
         if ($fields["row_count"] && $fields["col_count"]) {
             $fieldsTemporary["ROW_COUNT"] = $fields["row_count"];
             $fieldsTemporary["COL_COUNT"] = $fields["col_count"];
         } else {
             $fieldsTemporary["ROW_COUNT"] = 1;
             $fieldsTemporary["COL_COUNT"] = 30;
         }
     } elseif ($fields["type"] == "text") {
         $fieldsTemporary["TYPE"] = "S";
         if ($fields["row_count"] && $fields["col_count"]) {
             $fieldsTemporary["ROW_COUNT"] = $fields["row_count"];
             $fieldsTemporary["COL_COUNT"] = $fields["col_count"];
         } else {
             $fieldsTemporary["ROW_COUNT"] = 4;
             $fieldsTemporary["COL_COUNT"] = 30;
         }
     } elseif ($fields["type"] == "int" || $fields["type"] == "double") {
         $fieldsTemporary["TYPE"] = "N";
     } elseif ($fields["type"] == "bool") {
         $fieldsTemporary["TYPE"] = "L";
         $fieldsTemporary["VALUES"][] = array("XML_ID" => 'yes', "VALUE" => GetMessage("BPVDX_YES"), "DEF" => "N", "SORT" => 10);
         $fieldsTemporary["VALUES"][] = array("XML_ID" => 'no', "VALUE" => GetMessage("BPVDX_NO"), "DEF" => "N", "SORT" => 20);
     } else {
         $fieldsTemporary["TYPE"] = $fields["type"];
         $fieldsTemporary["USER_TYPE"] = false;
     }
     $idField = false;
     $properties = CIBlockProperty::getList(array(), array("IBLOCK_ID" => $fieldsTemporary["IBLOCK_ID"], "CODE" => $fieldsTemporary["CODE"]));
     if (!$properties->fetch()) {
         $listObject = new CList($iblockId);
         $idField = $listObject->addField($fieldsTemporary);
//.........这里部分代码省略.........
开发者ID:Satariall,项目名称:izurit,代码行数:101,代码来源:bizprocdocument.php


示例12: CWidget

**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
$this->addJSfile('js/class.pmaster.js');
$dashboard = (new CWidget())->setTitle(_('Dashboard'))->setControls((new CForm())->cleanItems()->addItem((new CList())->addItem(get_icon('dashconf', ['enabled' => $data['filter_enabled']]))->addItem(get_icon('fullscreen', ['fullscreen' => $data['fullscreen']]))));
/*
 * Dashboard grid
 */
$dashboardGrid = [[], [], []];
$widgetRefreshParams = [];
$widgets = [WIDGET_FAVOURITE_GRAPHS => ['id' => 'favouriteGraphs', 'menu_popup' => ['CMenuPopupHelper', 'getFavouriteGraphs'], 'data' => $data['favourite_graphs'], 'header' => _('Favourite graphs'), 'links' => [['name' => _('Graphs'), 'url' => 'charts.php']], 'defaults' => ['col' => 0, 'row' => 0]], WIDGET_FAVOURITE_SCREENS => ['id' => 'favouriteScreens', 'menu_popup' => ['CMenuPopupHelper', 'getFavouriteScreens'], 'data' => $data['favourite_screens'], 'header' => _('Favourite screens'), 'links' => [['name' => _('Screens'), 'url' => 'screens.php'], ['name' => _('Slide shows'), 'url' => 'slides.php']], 'defaults' => ['col' => 0, 'row' => 1]], WIDGET_FAVOURITE_MAPS => ['id' => 'favouriteMaps', 'menu_popup' => ['CMenuPopupHelper', 'getFavouriteMaps'], 'data' => $data['favourite_maps'], 'header' => _('Favourite maps'), 'links' => [['name' => _('Maps'), 'url' => 'zabbix.php?action=map.view']], 'defaults' => ['col' => 0, 'row' => 2]]];
foreach ($widgets as $widgetid => $widget) {
    $icon = (new CButton(null))->addClass(ZBX_STYLE_BTN_WIDGET_ACTION)->setTitle(_('Action'))->setId($widget['id'])->setMenuPopup(call_user_func($widget['menu_popup']));
    $footer = new CList();
    foreach ($widget['links'] as $link) {
        $footer->addItem(new CLink($link['name'], $link['url']));
    }
    $col = CProfile::get('web.dashboard.widget.' . $widgetid . '.col', $widget['defaults']['col']);
    $row = CProfile::get('web.dashboard.widget.' . $widgetid . '.row', $widget['defaults']['row']);
    $dashboardGrid[$col][$row] = (new CCollapsibleUiWidget($widgetid, $widget['data']))->setExpanded((bool) CProfile::get('web.dashboard.widget.' . $widgetid . '.state', true))->setHeader($widget['header'], [$icon], true, 'zabbix.php?action=dashboard.widget')->setFooter($footer);
}
$widgets = [WIDGET_SYSTEM_STATUS => ['action' => 'widget.system.view', 'header' => _('System status'), 'defaults' => ['col' => 1, 'row' => 1]], WIDGET_HOST_STATUS => ['action' => 'widget.hosts.view', 'header' => _('Host status'), 'defaults' => ['col' => 1, 'row' => 2]], WIDGET_LAST_ISSUES => ['action' => 'widget.issues.view', 'header' => _n('Last %1$d issue', 'Last %1$d issues', DEFAULT_LATEST_ISSUES_CNT), 'defaults' => ['col' => 1, 'row' => 3]], WIDGET_WEB_OVERVIEW => ['action' => 'widget.web.view', 'header' => _('Web monitoring'), 'defaults' => ['col' => 1, 'row' => 4]]];
if ($data['show_status_widget']) {
    $widgets[WIDGET_ZABBIX_STATUS] = ['action' => 'widget.status.view', 'header' => _('Status of Zabbix'), 'defaults' => ['col' => 1, 'row' => 0]];
}
if ($data['show_discovery_widget']) {
    $widgets[WIDGET_DISCOVERY_STATUS] = ['action' => 'widget.discovery.view', 'header' => _('Discovery status'), 'defaults' => ['col' => 1, 'row' => 5]];
}
foreach ($widgets as $widgetid => $widget) {
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:monitoring.dashboard.view.php


示例13: stage3

 function stage3()
 {
     $table = new CTable(null, 'requirements');
     $table->setAlign('center');
     $DB['TYPE'] = $this->getConfig('DB_TYPE');
     $cmbType = new CComboBox('type', $DB['TYPE'], 'this.form.submit();');
     $frontendSetup = new FrontendSetup();
     $databases = $frontendSetup->getSupportedDatabases();
     foreach ($databases as $id => $name) {
         $cmbType->addItem($id, $name);
     }
     $table->addRow(array(new CCol(_('Database type'), 'header'), $cmbType));
     switch ($DB['TYPE']) {
         case ZBX_DB_SQLITE3:
             $database = new CTextBox('database', $this->getConfig('DB_DATABASE', 'zabbix'));
             $database->attr('onchange', "disableSetupStepButton('#next_2')");
             $table->addRow(array(new CCol(_('Database file'), 'header'), $database));
             break;
         default:
             $server = new CTextBox('server', $this->getConfig('DB_SERVER', 'localhost'));
             $server->attr('onchange', "disableSetupStepButton('#next_2')");
             $table->addRow(array(new CCol(_('Database host'), 'header'), $server));
             $port = new CNumericBox('port', $this->getConfig('DB_PORT', '0'), 5, 'no', false, false);
             $port->attr('style', '');
             $port->attr('onchange', "disableSetupStepButton('#next_2'); validateNumericBox(this, 'false', 'false');");
             $table->addRow(array(new CCol(_('Database port'), 'header'), array($port, ' 0 - use default port')));
             $database = new CTextBox('database', $this->getConfig('DB_DATABASE', 'zabbix'));
             $database->attr('onchange', "disableSetupStepButton('#next_2')");
             $table->addRow(array(new CCol(_('Database name'), 'header'), $database));
             if ($DB['TYPE'] == ZBX_DB_DB2) {
                 $schema = new CTextBox('schema', $this->getConfig('DB_SCHEMA', ''));
                 $schema->attr('onchange', "disableSetupStepButton('#next_2')");
                 $table->addRow(array(new CCol(_('Database schema'), 'header'), $schema));
             }
             $user = new CTextBox('user', $this->getConfig('DB_USER', 'root'));
             $user->attr('onchange', "disableSetupStepButton('#next_2')");
             $table->addRow(array(new CCol(_('User'), 'header'), $user));
             $password = new CPassBox('password', $this->getConfig('DB_PASSWORD', ''));
             $password->attr('onchange', "disableSetupStepButton('#next_2')");
             $table->addRow(array(new CCol(_('Password'), 'header'), $password));
             break;
     }
     global $ZBX_MESSAGES;
     if (!empty($ZBX_MESSAGES)) {
         $lst_error = new CList(null, 'messages');
         foreach ($ZBX_MESSAGES as $msg) {
             $lst_error->addItem($msg['message'], $msg['type']);
         }
         $table = array($table, $lst_error);
     }
     return array(new CDiv(new CDiv(array('Please create database manually, and set the configuration parameters for connection to this database.', BR(), BR(), 'Press "Test connection" button when done.', BR(), $table), 'vertical_center'), 'table_wraper'), new CDiv(array(isset($_REQUEST['retry']) ? !$this->DISABLE_NEXT_BUTTON ? new CSpan(array(_('OK'), BR()), 'ok') : new CSpan(array(_('Fail'), BR()), 'fail') : null, new CSubmit('retry', 'Test connection')), 'info_bar'));
 }
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:52,代码来源:setup.inc.php


示例14: getList

 function getList()
 {
     $list = new CList();
     foreach ($this->stage as $id => $data) {
         if ($id < $this->getStep()) {
             $style = 'completed';
         } else {
             if ($id == $this->getStep()) {
                 $style = 'current';
             } else {
                 $style = null;
             }
         }
         $list->addItem($data['title'], $style);
     }
     return $list;
 }
开发者ID:rennhak,项目名称:zabbix,代码行数:17,代码来源:setup.inc.php


示例15: testOffsetUnset

 public function testOffsetUnset()
 {
     $list = new CList(array(1, 2, 3));
     $list->offsetUnset(1);
     $this->assertEquals(array(1, 3), $list->toArray());
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:6,代码来源:CListTest.php


示例16: createServiceMonitoringTree

/**
 * Creates nodes that can be used to display the SLA report tree using the CTree class.
 *
 * @see CTree
 *
 * @param array $services       an array of services to display in the tree
 * @param array $slaData        sla report data, see CService::getSla()
 * @param $period
 * @param array $parentService
 * @param array $service
 * @param array $dependency
 * @param array $tree
 */
function createServiceMonitoringTree(array $services, array $slaData, $period, &$tree, array $parentService = array(), array $service = array(), array $dependency = array())
{
    // if no parent service is given, start from the root
    if (!$service) {
        $serviceNode = array('id' => 0, 'parentid' => 0, 'caption' => _('root'), 'status' => SPACE, 'sla' => SPACE, 'sla2' => SPACE, 'trigger' => array(), 'reason' => SPACE, 'graph' => SPACE);
        $service = $serviceNode;
        $service['serviceid'] = 0;
        $service['dependencies'] = array();
        $service['trigger'] = array();
        // add all top level services as children of "root"
        foreach ($services as $topService) {
            if (!$topService['parent']) {
                $service['dependencies'][] = array('servicedownid' => $topService['serviceid'], 'soft' => 0, 'linkid' => 0);
            }
        }
        $tree = array($serviceNode);
    } else {
        $serviceSla = $slaData[$service['serviceid']];
        $slaValues = reset($serviceSla['sla']);
        // caption
        // remember the selected time period when following the bar link
        $periods = array('today' => 'daily', 'week' => 'weekly', 'month' => 'monthly', 'year' => 'yearly', 24 => 'daily', 24 * 7 => 'weekly', 24 * 30 => 'monthly', 24 * DAY_IN_YEAR => 'yearly');
        $caption = array(new CLink(array(get_node_name_by_elid($service['serviceid'], null, ': '), $service['name']), 'report3.php?serviceid=' . $service['serviceid'] . '&year=' . date('Y') . '&period=' . $periods[$period]));
        $trigger = $service['trigger'];
        if ($trigger) {
            $url = new CLink($trigger['description'], 'events.php?source=' . EVENT_SOURCE_TRIGGERS . '&triggerid=' . $trigger['triggerid']);
            $caption[] = ' - ';
            $caption[] = $url;
        }
        // reason
        $problemList = '-';
        if ($serviceSla['problems']) {
            $problemList = new CList(null, 'service-problems');
            foreach ($serviceSla['problems'] as $problemTrigger) {
                $problemList->addItem(new CLink($problemTrigger['description'], 'events.php?source=' . EVENT_SOURCE_TRIGGERS . '&triggerid=' . $problemTrigger['triggerid']));
            }
        }
        // sla
        $sla = '-';
        $sla2 = '-';
        if ($service['showsla'] && $slaValues['sla'] !== null) {
            $slaGood = $slaValues['sla'];
            $slaBad = 100 - $slaValues['sla'];
            $p = min($slaBad, 20);
            $width = 160;
            $widthRed = $width * $p / 20;
            $widthGreen = $width - $widthRed;
            $chart1 = null;
            if ($widthGreen > 0) {
                $chart1 = new CDiv(null, 'sla-bar-part sla-green');
                $chart1->setAttribute('style', 'width: ' . $widthGreen . 'px;');
            }
            $chart2 = null;
            if ($widthRed > 0) {
                $chart2 = new CDiv(null, 'sla-bar-part sla-red');
                $chart2->setAttribute('style', 'width: ' . $widthRed . 'px;');
            }
            $bar = new CLink(array($chart1, $chart2, new CDiv('80%', 'sla-bar-legend sla-bar-legend-start'), new CDiv('100%', 'sla-bar-legend sla-bar-legend-end')), 'srv_status.php?serviceid=' . $service['serviceid'] . '&showgraph=1' . url_param('path'));
            $bar = new CDiv($bar, 'sla-bar');
            $bar->setAttribute('title', _s('Only the last 20%% of the indicator is displayed.'));
            $slaBar = array($bar, new CSpan(sprintf('%.4f', $slaBad), 'sla-value ' . ($service['goodsla'] > $slaGood ? 'red' : 'green')));
            $sla = new CDiv($slaBar, 'invisible');
            $sla2 = array(new CSpan(sprintf('%.4f', $slaGood), 'sla-value ' . ($service['goodsla'] > $slaGood ? 'red' : 'green')), '/', new CSpan(sprintf('%.4f', $service['goodsla']), 'sla-value'));
        }
        $serviceNode = array('id' => $service['serviceid'], 'caption' => $caption, 'description' => $service['trigger'] ? $service['trigger']['description'] : _('None'), 'reason' => $problemList, 'sla' => $sla, 'sla2' => $sla2, 'parentid' => $parentService ? $parentService['serviceid'] : 0, 'status' => $serviceSla['status'] !== null ? $serviceSla['status'] : '-');
    }
    // hard dependencies and dependencies for the "root" node
    if (!$dependency || $dependency['soft'] == 0) {
        $tree[$serviceNode['id']] = $serviceNode;
        foreach ($service['dependencies'] as $dependency) {
            $childService = $services[$dependency['servicedownid']];
            createServiceMonitoringTree($services, $slaData, $period, $tree, $service, $childService, $dependency);
        }
    } else {
        $serviceNode['caption'] = new CSpan($serviceNode['caption'], 'service-caption-soft');
        $tree[$serviceNode['id'] . '.' . $dependency['linkid']] = $serviceNode;
    }
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:91,代码来源:services.inc.php


示例17: str_replace

}
$arResult["~LISTS_URL"] = str_replace(array("#group_id#"), array($arParams["SOCNET_GROUP_ID"]), $arParams["~LISTS_URL"]);
$arResult["LISTS_URL"] = htmlspecialcharsbx($arResult["~LISTS_URL"]);
$arResult["~LIST_EDIT_URL"] = str_replace(array("#list_id#", "#group_id#"), array($arResult["IBLOCK_ID"], $arParams["SOCNET_GROUP_ID"]), $arParams["~LIST_EDIT_URL"]);
$arResult["LIST_EDIT_URL"] = htmlspecialcharsbx($arResult["~LIST_EDIT_URL"]);
$arResult["~LIST_URL"] = str_replace(array("#list_id#", "#section_id#", "#group_id#"), array($arResult["IBLOCK_ID"], intval($arResult["SECTION_ID"]), $arParams["SOCNET_GROUP_ID"]), $arParams["~LIST_URL"]);
$arResult["LIST_URL"] = htmlspecialcharsbx($arResult["~LIST_URL"]);
$arResult["~LIST_SECTION_URL"] = str_replace(array("#list_id#", "#section_id#", "#group_id#"), array($arResult["IBLOCK_ID"], intval($arResult["SECTION_ID"]), $arParams["SOCNET_GROUP_ID"]), $arParams["~LIST_SECTIONS_URL"]);
$arResult["LIST_SECTION_URL"] = htmlspecialcharsbx($arResult["~LIST_SECTION_URL"]);
$arResult["~LIST_PARENT_URL"] = str_replace(array("#list_id#", "#section_id#", "#group_id#"), array($arResult["IBLOCK_ID"], intval($arResult["PARENT_SECTION_ID"]), $arParams["SOCNET_GROUP_ID"]), $arParams["~LIST_URL"]);
$arResult["LIST_PARENT_URL"] = htmlspecialcharsbx($arResult["~LIST_PARENT_URL"]);
$arResult["~BIZPROC_WORKFLOW_ADMIN_URL"] = str_replace(array("#list_id#", "#group_id#"), array($arResult["IBLOCK_ID"], $arParams["SOCNET_GROUP_ID"]), $arParams["~BIZPROC_WORKFLOW_ADMIN_URL"]);
$arResult["BIZPROC_WORKFLOW_ADMIN_URL"] = htmlspecialcharsbx($arResult["~BIZPROC_WORKFLOW_ADMIN_URL"]);
$arResult["~EXPORT_EXCEL_URL"] = str_replace(array("#list_id#", "#group_id#"), array($arResult["IBLOCK_ID"], $arParams["SOCNET_GROUP_ID"]), $arParams["~EXPORT_EXCEL_URL"]);
$arResult["EXPORT_EXCEL_URL"] = htmlspecialcharsbx($arResult["~EXPORT_EXCEL_URL"]);
$obList = new CList($arIBlock["ID"]);
$strError = "";
$errorID = $arResult["GRID_ID"] . "_error";
//Form submitted
if ($_SERVER["REQUEST_METHOD"] == "POST" && check_bitrix_sessid() && isset($_POST["action_button_" . $arResult["GRID_ID"]])) {
    $obSection = new CIBlockSection();
    $obElement = new CIBlockElement();
    /*Build filter*/
    $arFilter = array("IBLOCK_ID" => $arIBlock["ID"], "CHECK_PERMISSIONS" => $arParams["CAN_EDIT"] || $arParams["SOCNET_GROUP_ID"] ? "N" : "Y");
    if ($_POST["action_all_rows_" . $arResult["GRID_ID"]] == "Y") {
        if (!$arResult["ANY_SECTION"]) {
            $arFilter["SECTION_ID"] = $arResult["SECTION_ID"];
        }
    } else {
        $arFilter["=ID"] = $_POST["ID"];
    }
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php


示例18: getEavAttributes

 /**
  * @param array attributes key for get.
  * @return array
  */
 public function getEavAttributes($attributes = array())
 {
     // Get all attributes if not specified.
     if (empty($attributes)) {
         $attributes = $this->getSafeAttributesArray();
     }
     // Values array.
     $values = array();
     // Queue for load.
     $loadQueue = new CList();
     foreach ($attributes as $attribute) {
         // Check is safe.
         if ($this->hasSafeAttribute($attribute)) {
             $values[$attribute] = $this->attributes->itemAt($attribute);
             // If attribute not set and not load, prepare array for loaded.
             if (!$this->preload && $values[$attribute] === NULL) {
                 $loadQueue->add($attribute);
             }
         }
     }
     // If array for loaded not empty, load attributes.
     if (!$this->preload && $loadQueue->count() > 0) {
         $this->loadEavAttributes($loadQueue->toArray());
         foreach ($loadQueue as $attribute) {
             $values[$attribute] = $this->attributes->itemAt($attribute);
         }
     }
     // Delete load queue.
     unset($loadQueue);
     // Return values.
     return $values;
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:36,代码来源:EEavBehavior.php


示例19: foreach

        foreach ($_POST["FIELDS"] as $ID => $tmp) {
            $arField = array("SORT" => $_POST["FIELDS"][$ID]["SORT"], "NAME" => $_POST[& 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CLocale类代码示例发布时间:2022-05-23
下一篇:
PHP CLink类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap