本文整理汇总了PHP中MassiveAction::getAllMassiveActions方法的典型用法代码示例。如果您正苦于以下问题:PHP MassiveAction::getAllMassiveActions方法的具体用法?PHP MassiveAction::getAllMassiveActions怎么用?PHP MassiveAction::getAllMassiveActions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MassiveAction
的用法示例。
在下文中一共展示了MassiveAction::getAllMassiveActions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayDatas
/**
* Display datas extracted from DB
*
* @param $data array of search datas prepared to get datas
*
* @return nothing
**/
static function displayDatas(array &$data)
{
global $CFG_GLPI;
$item = null;
if (class_exists($data['itemtype'])) {
$item = new $data['itemtype']();
}
$rand = mt_rand();
if (!isset($data['data']) || !isset($data['data']['totalcount'])) {
return false;
}
// Contruct Pager parameters
$globallinkto = Toolbox::append_params(array('criteria' => Toolbox::stripslashes_deep($data['search']['criteria']), 'metacriteria' => Toolbox::stripslashes_deep($data['search']['metacriteria'])), '&');
$parameters = "sort=" . $data['search']['sort'] . "&order=" . $data['search']['order'] . '&' . $globallinkto;
if (isset($_GET['_in_modal'])) {
$parameters .= "&_in_modal=1";
}
// Global search header
if ($data['display_type'] == self::GLOBAL_SEARCH) {
if ($data['item']) {
echo "<div class='center'><h2>" . $data['item']->getTypeName();
// More items
if ($data['data']['totalcount'] > $data['search']['start'] + self::GLOBAL_DISPLAY_COUNT) {
echo " <a href='" . $data['search']['target'] . "?{$parameters}'>" . __('All') . "</a>";
}
echo "</h2></div>\n";
} else {
return false;
}
}
// If the begin of the view is before the number of items
if ($data['data']['count'] > 0) {
// Display pager only for HTML
if ($data['display_type'] == self::HTML_OUTPUT) {
// For plugin add new parameter if available
if ($plug = isPluginItemType($data['itemtype'])) {
$function = 'plugin_' . $plug['plugin'] . '_addParamFordynamicReport';
if (function_exists($function)) {
$out = $function($data['itemtype']);
if (is_array($out) && count($out)) {
$parameters .= Toolbox::append_params($out, '&');
}
}
}
$search_config_top = "";
$search_config_bottom = "";
if (!isset($_GET['_in_modal']) && Session::haveRightsOr('search_config', array(DisplayPreference::PERSONAL, DisplayPreference::GENERAL))) {
$search_config_top = $search_config_bottom = "<div class='pager_controls'><img alt=\"" . __s('Select default items to show') . "\" title=\"" . __s('Select default items to show') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/options_search.png' ";
$search_config_top .= " class='pointer' onClick=\"";
$search_config_top .= Html::jsGetElementbyID('search_config_top') . ".dialog('open');\">";
$search_config_bottom .= " class='pointer' onClick=\"";
$search_config_bottom .= Html::jsGetElementbyID('search_config_bottom') . ".dialog('open');\">";
$search_config_top .= Ajax::createIframeModalWindow('search_config_top', $CFG_GLPI["root_doc"] . "/front/displaypreference.form.php?itemtype=" . $data['itemtype'], array('title' => __('Select default items to show'), 'reloadonclose' => true, 'display' => false));
$search_config_bottom .= Ajax::createIframeModalWindow('search_config_bottom', $CFG_GLPI["root_doc"] . "/front/displaypreference.form.php?itemtype=" . $data['itemtype'], array('title' => __('Select default items to show'), 'reloadonclose' => true, 'display' => false));
}
if ($item !== null && $item->maybeDeleted()) {
$delete_ctrl = self::isDeletedSwitch($data['search']['is_deleted']);
$search_config_top .= $delete_ctrl;
}
Html::printPager($data['search']['start'], $data['data']['totalcount'], $data['search']['target'], $parameters, $data['itemtype'], 0, $search_config_top);
$search_config_top .= "</div>";
$search_config_bottom .= "</div>";
}
// Define begin and end var for loop
// Search case
$begin_display = $data['data']['begin'];
$end_display = $data['data']['end'];
// Form to massive actions
$isadmin = $data['item'] && $data['item']->canUpdate();
if (!$isadmin && InfoCom::canApplyOn($data['itemtype'])) {
$isadmin = Infocom::canUpdate() || Infocom::canCreate();
}
if ($data['itemtype'] != 'AllAssets') {
$showmassiveactions = count(MassiveAction::getAllMassiveActions($data['item'], $data['search']['is_deleted']));
} else {
$showmassiveactions = true;
}
$massformid = 'massform' . $data['itemtype'];
if ($showmassiveactions && $data['display_type'] == self::HTML_OUTPUT) {
Html::openMassiveActionsForm($massformid);
$massiveactionparams = $data['search']['massiveactionparams'];
$massiveactionparams['num_displayed'] = $end_display - $begin_display;
$massiveactionparams['fixed'] = false;
$massiveactionparams['is_deleted'] = $data['search']['is_deleted'];
$massiveactionparams['container'] = $massformid;
Html::showMassiveActions($massiveactionparams);
}
// Compute number of columns to display
// Add toview elements
$nbcols = count($data['data']['cols']);
if ($data['display_type'] == self::HTML_OUTPUT && $showmassiveactions) {
// HTML display - massive modif
$nbcols++;
//.........这里部分代码省略.........