本文整理汇总了PHP中slideshow_accessible函数的典型用法代码示例。如果您正苦于以下问题:PHP slideshow_accessible函数的具体用法?PHP slideshow_accessible怎么用?PHP slideshow_accessible使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了slideshow_accessible函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: make_favorite_screens
function make_favorite_screens()
{
$table = new CTableInfo();
$fav_screens = get_favorites('web.favorite.screenids');
foreach ($fav_screens as $key => $favorite) {
$source = $favorite['source'];
$sourceid = $favorite['value'];
if ('slideshowid' == $source) {
if (!($slide = get_slideshow_by_slideshowid($sourceid))) {
continue;
}
if (!slideshow_accessible($sourceid, PERM_READ_ONLY)) {
continue;
}
$link = new CLink(get_node_name_by_elid($sourceid) . $slide['name'], 'screens.php?config=1&elementid=' . $sourceid);
$link->setTarget('blank');
$capt = new CSpan($link);
$capt->setAttribute('style', 'line-height: 14px; vertical-align: middle;');
$icon = new CLink(new CImg('images/general/chart.png', 'screen', 18, 18, 'borderless'), 'screens.php?config=1&elementid=' . $sourceid . '&fullscreen=1');
$icon->setTarget('blank');
} else {
if (!($screen = get_screen_by_screenid($sourceid))) {
continue;
}
if (!screen_accessible($sourceid, PERM_READ_ONLY)) {
continue;
}
$link = new CLink(get_node_name_by_elid($sourceid) . $screen['name'], 'screens.php?config=0&elementid=' . $sourceid);
$link->setTarget('blank');
$capt = new CSpan($link);
$capt->setAttribute('style', 'line-height: 14px; vertical-align: middle;');
$icon = new CLink(new CImg('images/general/chart.png', 'screen', 18, 18, 'borderless'), 'screens.php?config=0&elementid=' . $sourceid . '&fullscreen=1');
$icon->setTarget('blank');
}
$table->addRow(new CCol(array($icon, SPACE, $capt)));
}
$td = new CCol(array(new CLink(S_SCREENS . ' »', 'screens.php', 'highlight')));
$td->setAttribute('style', 'text-align: right;');
$table->setFooter($td);
return $table;
}
示例2: make_screen_submenu
function make_screen_submenu()
{
$favScreens = array();
$fav_screens = CFavorite::get('web.favorite.screenids');
if (!$fav_screens) {
return $favScreens;
}
$screenids = array();
foreach ($fav_screens as $favorite) {
if ('screenid' == $favorite['source']) {
$screenids[$favorite['value']] = $favorite['value'];
}
}
$options = array('screenids' => $screenids, 'output' => array('screenid', 'name'));
$screens = API::Screen()->get($options);
$screens = zbx_toHash($screens, 'screenid');
foreach ($fav_screens as $favorite) {
$source = $favorite['source'];
$sourceid = $favorite['value'];
if ('slideshowid' == $source) {
if (!slideshow_accessible($sourceid, PERM_READ)) {
continue;
}
if (!($slide = get_slideshow_by_slideshowid($sourceid))) {
continue;
}
$slide_added = true;
$favScreens[] = array('name' => $slide['name'], 'favobj' => 'slideshowid', 'favid' => $slide['slideshowid'], 'favaction' => 'remove');
} else {
if (!isset($screens[$sourceid])) {
continue;
}
$screen = $screens[$sourceid];
$screen_added = true;
$favScreens[] = array('name' => $screen['name'], 'favobj' => 'screenid', 'favid' => $screen['screenid'], 'favaction' => 'remove');
}
}
if (isset($screen_added)) {
$favScreens[] = array('name' => _('Remove') . ' ' . _('All') . ' ' . _('Screens'), 'favobj' => 'screenid', 'favid' => 0, 'favaction' => 'remove');
}
if (isset($slide_added)) {
$favScreens[] = array('name' => _('Remove') . ' ' . _('All') . ' ' . _('Slides'), 'favobj' => 'slideshowid', 'favid' => 0, 'favaction' => 'remove');
}
return $favScreens;
}
示例3: while
while ($row = DBfetch($result)) {
if (!slideshow_accessible($row['elementid'], PERM_READ_ONLY)) {
continue;
}
$cmbElements->addItem($row['elementid'], get_node_name_by_elid($row['elementid']) . $row['name']);
if (bccomp($elementid, $row['elementid']) == 0) {
$element_correct = 1;
}
if (!isset($first_element)) {
$first_element = $row['elementid'];
}
}
if (!isset($element_correct) && isset($first_element)) {
$elementid = $first_element;
}
if (isset($elementid) && !slideshow_accessible($elementid, PERM_READ_ONLY)) {
access_deny();
}
if ($cmbElements->ItemsCount() > 0) {
$form->addItem(array(SPACE . S_SLIDESHOW . SPACE, $cmbElements));
}
if (2 != $_REQUEST['fullscreen'] && !empty($elementid) && check_dynamic_items($elementid, 1)) {
if (!isset($_REQUEST['hostid'])) {
$_REQUEST['groupid'] = $_REQUEST['hostid'] = 0;
}
$options = array('allow_all_hosts', 'monitored_hosts', 'with_items');
if (!$ZBX_WITH_ALL_NODES) {
array_push($options, 'only_current_node');
}
$params = array();
foreach ($options as $option) {
示例4: getFavouriteScreens
/**
* Prepare data for favourite screens menu popup.
*
* @return array
*/
public static function getFavouriteScreens()
{
$screens = $slideshows = array();
$favourites = CFavorite::get('web.favorite.screenids');
if ($favourites) {
$screenIds = $slideshowIds = array();
foreach ($favourites as $favourite) {
if ($favourite['source'] === 'screenid') {
$screenIds[$favourite['value']] = $favourite['value'];
}
}
$dbScreens = API::Screen()->get(array('output' => array('screenid', 'name'), 'screenids' => $screenIds, 'preservekeys' => true));
foreach ($favourites as $favourite) {
$sourceId = $favourite['value'];
if ($favourite['source'] === 'slideshowid') {
if (slideshow_accessible($sourceId, PERM_READ)) {
$dbSlideshow = get_slideshow_by_slideshowid($sourceId);
if ($dbSlideshow) {
$slideshows[] = array('id' => $dbSlideshow['slideshowid'], 'label' => $dbSlideshow['name']);
}
}
} else {
if (isset($dbScreens[$sourceId])) {
$dbScreen = $dbScreens[$sourceId];
$screens[] = array('id' => $dbScreen['screenid'], 'label' => $dbScreen['name']);
}
}
}
}
return array('type' => 'favouriteScreens', 'screens' => $screens, 'slideshows' => $slideshows);
}
示例5: getFavouriteScreensData
/**
* Get favourite screens and slide shows data.
*
* @return array['screens']
* @return array['slideshows']
*/
function getFavouriteScreensData()
{
$screens = $slideshows = [];
$favourites = CFavorite::get('web.favorite.screenids');
if ($favourites) {
$screenIds = $slideshowIds = [];
foreach ($favourites as $favourite) {
if ($favourite['source'] === 'screenid') {
$screenIds[$favourite['value']] = $favourite['value'];
}
}
$dbScreens = API::Screen()->get(['output' => ['screenid', 'name'], 'screenids' => $screenIds, 'preservekeys' => true]);
foreach ($favourites as $favourite) {
$sourceId = $favourite['value'];
if ($favourite['source'] === 'slideshowid') {
if (slideshow_accessible($sourceId, PERM_READ)) {
$dbSlideshow = get_slideshow_by_slideshowid($sourceId, PERM_READ);
if ($dbSlideshow) {
$slideshows[] = ['id' => $dbSlideshow['slideshowid'], 'label' => $dbSlideshow['name']];
}
}
} else {
if (isset($dbScreens[$sourceId])) {
$dbScreen = $dbScreens[$sourceId];
$screens[] = ['id' => $dbScreen['screenid'], 'label' => $dbScreen['name']];
}
}
}
}
return ['screens' => $screens, 'slideshows' => $slideshows];
}
示例6: CWidget
$slideWidget = new CWidget();
// create new hostgroup button
$createForm = new CForm('get');
$createForm->cleanItems();
$createForm->addItem(new CSubmit('form', _('Create slide show')));
$slideWidget->addPageHeader(_('CONFIGURATION OF SLIDE SHOWS'), $createForm);
$slideWidget->addHeader(_('Slide shows'));
$slideWidget->addHeaderRowNumber();
// create form
$slideForm = new CForm();
$slideForm->setName('slideForm');
// create table
$slidesTable = new CTableInfo(_('No slide shows defined.'));
$slidesTable->setHeader(array(new CCheckBox('all_shows', null, "checkAll('" . $slideForm->getName() . "', 'all_shows', 'shows');"), make_sorting_header(_('Name'), 'name'), make_sorting_header(_('Delay'), 'delay'), make_sorting_header(_('Count of slides'), 'cnt')));
foreach ($this->data['slides'] as $slide) {
if (!slideshow_accessible($slide['slideshowid'], PERM_READ_WRITE)) {
continue;
}
$slidesTable->addRow(array(new CCheckBox('shows[' . $slide['slideshowid'] . ']', null, null, $slide['slideshowid']), new CLink($slide['name'], '?config=1&form=update&slideshowid=' . $slide['slideshowid'], 'action'), $slide['delay'], $slide['cnt']));
}
// create go button
$goComboBox = new CComboBox('go');
$goOption = new CComboItem('delete', _('Delete selected'));
$goOption->setAttribute('confirm', _('Delete selected slide shows?'));
$goComboBox->addItem($goOption);
$goButton = new CSubmit('goButton', _('Go') . ' (0)');
$goButton->setAttribute('id', 'goButton');
zbx_add_post_js('chkbxRange.pageGoName = "shows";');
// append table to form
$slideForm->addItem(array($this->data['paging'], $slidesTable, $this->data['paging'], get_table_header(array($goComboBox, $goButton))));
// append form to widget
示例7: dirname
CProfile::update('web.slides.timelinefixed', $_REQUEST['favid'], PROFILE_TYPE_INT);
}
}
}
if ($page['type'] == PAGE_TYPE_JS || $page['type'] == PAGE_TYPE_HTML_BLOCK) {
require_once dirname(__FILE__) . '/include/page_footer.php';
exit;
}
/*
* Display
*/
$data = array('fullscreen' => $_REQUEST['fullscreen'], 'slideshows' => array());
// get slideshows
$db_slideshows = DBselect('SELECT s.slideshowid,s.name' . ' FROM slideshows s' . whereDbNode('s.slideshowid'));
while ($slideshow = DBfetch($db_slideshows)) {
if (slideshow_accessible($slideshow['slideshowid'], PERM_READ)) {
$data['slideshows'][$slideshow['slideshowid']] = $slideshow;
}
}
order_result($data['slideshows'], 'name');
// get element id
$data['elementid'] = get_request('elementid', CProfile::get('web.slides.elementid', null));
CProfile::update('web.slides.elementid', $data['elementid'], PROFILE_TYPE_ID);
if (!isset($data['slideshows'][$data['elementid']])) {
$slideshow = reset($data['slideshows']);
$data['elementid'] = $slideshow['slideshowid'];
}
// get screen
$data['screen'] = empty($data['elementid']) ? array() : get_slideshow($data['elementid'], 0);
if (!empty($data['screen'])) {
// get groups and hosts
示例8: detect_page_type
$page['file'] = 'slideconf.php';
$page['type'] = detect_page_type(PAGE_TYPE_HTML);
$page['hist_arg'] = array();
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array('shows' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'slideshowid' => array(T_ZBX_INT, O_NO, P_SYS, DB_ID, '(isset({form})&&({form}=="update"))'), 'name' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})', _('Name')), 'delay' => array(T_ZBX_INT, O_OPT, null, BETWEEN(1, SEC_PER_DAY), 'isset({save})', _('Default delay (in seconds)')), 'slides' => array(null, O_OPT, null, null, null), 'go' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'clone' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'save' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'delete' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null));
check_fields($fields);
validate_sort_and_sortorder('name', ZBX_SORT_UP);
if (!empty($_REQUEST['slides'])) {
natksort($_REQUEST['slides']);
}
/*
* Permissions
*/
if (isset($_REQUEST['slideshowid'])) {
if (!slideshow_accessible($_REQUEST['slideshowid'], PERM_READ_WRITE)) {
access_deny();
}
$dbSlideshow = get_slideshow_by_slideshowid(get_request('slideshowid'));
if (empty($dbSlideshow)) {
access_deny();
}
}
if (isset($_REQUEST['go'])) {
if (!isset($_REQUEST['shows']) || !is_array($_REQUEST['shows'])) {
access_deny();
} else {
$dbSlideshowChk = DBfetch(DBselect('SELECT COUNT(*) AS cnt FROM slideshows s WHERE ' . dbConditionInt('s.slideshowid', $_REQUEST['shows'])));
if ($dbSlideshowChk['cnt'] != count($_REQUEST['shows'])) {
access_deny();
}
示例9: dirname
require_once dirname(__FILE__) . '/include/screens.inc.php';
$form = new CForm();
$form->setName('slideform');
$form->setAttribute('id', 'slides');
$table = new CTableInfo(_('No slides found.'));
if ($multiselect) {
$header = array(array(new CCheckBox('all_slides', null, "javascript: checkAll('" . $form->getName() . "', 'all_slides', 'slides');"), _('Name')));
} else {
$header = array(_('Name'));
}
$table->setHeader($header);
$slideshows = array();
$dbSlideshows = DBfetchArray(DBselect('SELECT s.slideshowid,s.name' . ' FROM slideshows s' . whereDbNode('s.slideshowid', $nodeId)));
order_result($dbSlideshows, 'name');
foreach ($dbSlideshows as $dbSlideshow) {
if (!slideshow_accessible($dbSlideshow['slideshowid'], PERM_READ)) {
continue;
}
$slideshows[$dbSlideshow['slideshowid']] = $dbSlideshow;
$name = new CLink($dbSlideshow['name'], '#');
if ($multiselect) {
$js_action = 'javascript: addValue(' . zbx_jsvalue($reference) . ', ' . zbx_jsvalue($dbSlideshow['slideshowid']) . ');';
} else {
$values = array($dstfld1 => $dbSlideshow[$srcfld1], $dstfld2 => $dbSlideshow[$srcfld2]);
$js_action = 'javascript: addValues(' . zbx_jsvalue($dstfrm) . ', ' . zbx_jsvalue($values) . '); close_window(); return false;';
}
$name->setAttribute('onclick', $js_action . ' jQuery(this).removeAttr("onclick");');
if ($multiselect) {
$name = new CCol(array(new CCheckBox('slides[' . zbx_jsValue($dbSlideshow[$srcfld1]) . ']', null, null, $dbSlideshow['slideshowid']), $name));
}
$table->addRow($name);
示例10: get_window_opener
$action = get_window_opener($dstfrm, $dstfld1, $srctbl) . get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) . "window.opener.setTimeout('add2favorites();', 1000);";
} else {
$action = get_window_opener($dstfrm, $dstfld1, $row[$srcfld1]) . get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]);
}
$description->SetAction($action . ' close_window(); return false;');
$table->addRow(array($hostid > 0 ? null : $row['host'], $description, item_type2str($row['type']), item_value_type2str($row['value_type']), new CSpan(item_status2str($row['status']), item_status2style($row['status']))));
}
$table->Show();
} else {
if ('slides' == $srctbl) {
require_once 'include/screens.inc.php';
$table = new CTableInfo(S_NO_NODES_DEFINED);
$table->SetHeader(S_NAME);
$result = DBselect('select slideshowid,name from slideshows where ' . DBin_node('slideshowid', $nodeid) . ' ORDER BY name');
while ($row = DBfetch($result)) {
if (!slideshow_accessible($row['slideshowid'], PERM_READ_ONLY)) {
continue;
}
$name = new CLink($row['name'], '#', 'action');
if (isset($_REQUEST['reference']) && $_REQUEST['reference'] == 'dashboard') {
$action = get_window_opener($dstfrm, $dstfld1, $srcfld2) . get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) . "window.opener.setTimeout('add2favorites();', 1000);";
} else {
$action = get_window_opener($dstfrm, $dstfld1, $row[$srcfld1]) . (isset($srcfld2) ? get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) : '');
}
$name->SetAction($action . " close_window(); return false;");
$table->addRow($name);
}
$table->Show();
} else {
if ($srctbl == 'screens') {
require_once 'include/screens.inc.php';
示例11: make_screen_submenu
function make_screen_submenu()
{
$fav_screens = get_favorites('web.favorite.screenids');
$screenids = array();
foreach ($fav_screens as $key => $favorite) {
if ('screenid' == $favorite['source']) {
$screenids[$favorite['value']] = $favorite['value'];
}
}
$options = array('screenids' => $screenids, 'output' => API_OUTPUT_EXTEND);
$screens = CScreen::get($options);
$screens = zbx_toHash($screens, 'screenid');
$favScreens = array();
foreach ($fav_screens as $key => $favorite) {
$source = $favorite['source'];
$sourceid = $favorite['value'];
if ('slideshowid' == $source) {
if (!slideshow_accessible($sourceid, PERM_READ_ONLY)) {
continue;
}
if (!($slide = get_slideshow_by_slideshowid($sourceid))) {
continue;
}
$slide_added = true;
$favScreens[] = array('name' => $slide['name'], 'favobj' => 'slideshowid', 'favid' => $slide['slideshowid'], 'action' => 'remove');
} else {
if (!isset($screens[$sourceid])) {
continue;
}
$screen = $screens[$sourceid];
$screen_added = true;
$favScreens[] = array('name' => $screen['name'], 'favobj' => 'screenid', 'favid' => $screen['screenid'], 'action' => 'remove');
}
}
if (isset($screen_added)) {
$favScreens[] = array('name' => S_REMOVE . SPACE . S_ALL_S . SPACE . S_SCREENS, 'favobj' => 'screenid', 'favid' => 0, 'action' => 'remove');
}
if (isset($slide_added)) {
$favScreens[] = array('name' => S_REMOVE . SPACE . S_ALL_S . SPACE . S_SLIDES, 'favobj' => 'slideshowid', 'favid' => 0, 'action' => 'remove');
}
return $favScreens;
}