本文整理汇总了PHP中CView::set方法的典型用法代码示例。如果您正苦于以下问题:PHP CView::set方法的具体用法?PHP CView::set怎么用?PHP CView::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CView
的用法示例。
在下文中一共展示了CView::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: empty
$data['usrgrpid'] = $script['usrgrpid'];
$data['groupid'] = $script['groupid'];
$data['host_access'] = $script['host_access'];
$data['confirmation'] = $script['confirmation'];
$data['enableConfirmation'] = !zbx_empty($script['confirmation']);
$data['hgstype'] = empty($data['groupid']) ? 0 : 1;
}
$scriptView = new CView('administration.script.edit', $data);
// get host gruop
$hostGroup = null;
if (!empty($data['groupid'])) {
$groups = API::HostGroup()->get(array('groupids' => array($data['groupid']), 'output' => array('groupid', 'name')));
$groups = reset($groups);
$hostGroup[] = array('id' => $groups['groupid'], 'name' => $groups['name']);
}
$scriptView->set('hostGroup', $hostGroup);
// get list of user groups
$usergroups = API::UserGroup()->get(array('output' => array('usrgrpid', 'name')));
order_result($usergroups, 'name');
$scriptView->set('usergroups', $usergroups);
// render view
$scriptView->render();
$scriptView->show();
} else {
$sortField = getRequest('sort', CProfile::get('web.' . $page['file'] . '.sort', 'name'));
$sortOrder = getRequest('sortorder', CProfile::get('web.' . $page['file'] . '.sortorder', ZBX_SORT_UP));
CProfile::update('web.' . $page['file'] . '.sort', $sortField, PROFILE_TYPE_STR);
CProfile::update('web.' . $page['file'] . '.sortorder', $sortOrder, PROFILE_TYPE_STR);
$data = array('sort' => $sortField, 'sortorder' => $sortOrder);
// list of scripts
$data['scripts'] = API::Script()->get(array('output' => array('scriptid', 'name', 'command', 'host_access', 'usrgrpid', 'groupid', 'type', 'execute_on'), 'editable' => true, 'selectGroups' => API_OUTPUT_EXTEND));
示例2: reset
$script = API::Script()->get(array('scriptids' => $data['scriptid'], 'output' => API_OUTPUT_EXTEND));
$script = reset($script);
$data['name'] = $script['name'];
$data['type'] = $script['type'];
$data['execute_on'] = $script['execute_on'];
$data['command'] = $data['commandipmi'] = $script['command'];
$data['description'] = $script['description'];
$data['usrgrpid'] = $script['usrgrpid'];
$data['groupid'] = $script['groupid'];
$data['access'] = $script['host_access'];
$data['confirmation'] = $script['confirmation'];
$data['enableConfirmation'] = !zbx_empty($script['confirmation']);
$data['hgstype'] = empty($data['groupid']) ? 0 : 1;
}
$scriptView = new CView('administration.script.edit');
$scriptView->set('form', $data['form']);
$scriptView->set('form_refresh', $data['form_refresh']);
$scriptView->set('scriptid', $data['scriptid']);
$scriptView->set('name', $data['name']);
$scriptView->set('type', $data['type']);
$scriptView->set('execute_on', $data['execute_on']);
$scriptView->set('command', $data['command']);
$scriptView->set('commandipmi', $data['commandipmi']);
$scriptView->set('description', $data['description']);
$scriptView->set('usrgrpid', $data['usrgrpid']);
$scriptView->set('groupid', $data['groupid']);
$scriptView->set('access', $data['access']);
$scriptView->set('confirmation', $data['confirmation']);
$scriptView->set('enableConfirmation', $data['enableConfirmation']);
$scriptView->set('hgstype', $data['hgstype']);
// get host gruop