本文整理汇总了PHP中MassiveAction::getItemType方法的典型用法代码示例。如果您正苦于以下问题:PHP MassiveAction::getItemType方法的具体用法?PHP MassiveAction::getItemType怎么用?PHP MassiveAction::getItemType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MassiveAction
的用法示例。
在下文中一共展示了MassiveAction::getItemType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doMassiveAction
/**
* Custom fonction to process shellcommand massive action
**/
function doMassiveAction(MassiveAction $ma, array $ids)
{
if (!empty($ids)) {
$input = $ma->getInput();
$itemtype = $ma->getItemType(false);
$commands_id = $input['commandgroup'];
switch ($ma->getAction()) {
case 'generate':
echo "<div class='center'>";
echo "<table class='tab_cadre_fixe center'>";
echo "<tr class='tab_bg_1'>";
echo "<th colspan='4'>" . PluginShellcommandsCommandGroup::getTypeName(2) . "</th>";
echo "</tr>";
foreach ($ids as $key => $items_id) {
PluginShellcommandsCommandGroup_Item::lauchCommand(array('itemID' => $items_id, 'itemtype' => $itemtype, 'id' => $commands_id, 'value' => null));
}
echo "</table>";
echo "</div>";
break;
}
}
}
示例2: showMassiveActionsSubForm
/**
* @since version 0.85
*
* @see CommonDBTM::showMassiveActionsSubForm()
**/
static function showMassiveActionsSubForm(MassiveAction $ma)
{
global $CFG_GLPI;
switch ($ma->getAction()) {
case 'move_under':
$itemtype = $ma->getItemType(true);
_e('As child of');
Dropdown::show($itemtype, array('name' => 'parent', 'comments' => 0, 'entity' => $_SESSION['glpiactive_entity']));
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Move') . "'>\n";
return true;
}
return parent::showMassiveActionsSubForm($ma);
}
示例3: doMassiveAction
/**
* Custom fonction to process shellcommand massive action
**/
function doMassiveAction(MassiveAction $ma, array $ids)
{
if (!empty($ids)) {
$input = $ma->getInput();
$itemtype = $ma->getItemType(false);
$commands_id = $input['command'];
switch ($ma->getAction()) {
case 'generate':
$shellcommands_item = new PluginShellcommandsShellcommand_Item();
$shellcommands = new PluginShellcommandsShellcommand();
$item = getItemForItemtype($itemtype);
echo "<div class='center'>";
echo "<table class='tab_cadre_fixe center'>";
echo "<tr class='tab_bg_1'>";
echo "<th colspan='4'>" . PluginShellcommandsShellcommand::getTypeName(2) . "</th>";
echo "</tr>";
foreach ($ids as $key => $items_id) {
if (!$shellcommands_item->getFromDBbyShellCommandsAndItem($commands_id, $itemtype)) {
continue;
}
$shellcommands->getFromDB($commands_id);
$item->getFromDB($items_id);
$targetParam = PluginShellcommandsShellcommand_Item::resolveLinkOfCommand($shellcommands->getID(), $item);
// Exec command on each targets : stop on first success
$selectedTarget = null;
if ($targetParam !== false) {
foreach ($targetParam as $target) {
list($error, $message) = PluginShellcommandsShellcommand_Item::execCommand($shellcommands->getID(), $target);
if (!$error) {
$selectedTarget = $target;
break;
}
}
}
echo "<tr class='tab_bg_1 shellcommands_result_line'>";
echo "<td class='center' colspan='4'>" . __($item->getType()) . ' : ' . $item->getLink() . " - " . $selectedTarget . "</td>";
echo "</tr>";
PluginShellcommandsShellcommand::displayCommandResult($shellcommands, $selectedTarget, $message, $error);
}
echo "</table>";
echo "</div>";
break;
}
}
}