本文整理汇总了PHP中Lock::getItemTypeForMassiveAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Lock::getItemTypeForMassiveAction方法的具体用法?PHP Lock::getItemTypeForMassiveAction怎么用?PHP Lock::getItemTypeForMassiveAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lock
的用法示例。
在下文中一共展示了Lock::getItemTypeForMassiveAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doMassiveActions
//.........这里部分代码省略.........
foreach ($input["item"] as $key => $val) {
if (isset($input['items_id'])) {
// Add items to contracts
$input = array('itemtype' => $input["item_itemtype"], 'items_id' => $input["items_id"], 'contracts_id' => $key);
}
if (isset($input['contracts_id'])) {
// Add contract to item
$input = array('itemtype' => $input["itemtype"], 'items_id' => $key, 'contracts_id' => $input['contracts_id']);
} else {
return false;
}
if ($contractitem->can(-1, 'w', $input)) {
if ($contractitem->add($input)) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
}
break;
case "remove_contract_item":
foreach ($input["item"] as $key => $val) {
if (isset($input['items_id'])) {
// Remove item to contracts
$input = array('itemtype' => $input["item_itemtype"], 'items_id' => $input["items_id"], 'contracts_id' => $key);
} else {
// Remove contract to items
$input = array('itemtype' => $input["itemtype"], 'items_id' => $key, 'contracts_id' => $input['contracts_id']);
}
$contractitem = new Contract_Item();
if ($contractitem->can(-1, 'w', $input)) {
if ($item = getItemForItemtype($input["itemtype"])) {
if ($item->getFromDB($input['items_id'])) {
$contract = new Contract();
if ($contract->getFromDB($input['contracts_id'])) {
if ($contractitem->getFromDBForItems($contract, $item)) {
if ($contractitem->delete(array('id' => $contractitem->getID()))) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['ko']++;
}
} else {
$res['ko']++;
}
} else {
$res['ko']++;
}
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
}
break;
//Lock management
//Lock management
case 'unlock_Printer':
case 'unlock_Monitor':
case 'unlock_NetworkPort':
case 'unlock_NetworkName':
case 'unlock_IPAddress':
case 'unlock_ComputerDisk':
case 'unlock_ComputerVirtualMachine':
case 'unlock_Peripheral':
case 'unlock_SoftwareVersion':
$itemtype = Lock::getItemTypeForMassiveAction($input["action"]);
if ($itemtype) {
$res = Lock::unlockItems($itemtype, $this->getType(), $input["item"]);
}
break;
case 'unlock_Device':
foreach (Item_Devices::getDeviceTypes() as $itemtype) {
$res = Lock::unlockItems($itemtype, $this->getType(), $input["item"]);
}
break;
default:
// Plugin specific actions
$split = explode('_', $input["action"]);
$res = '';
if ($split[0] == 'plugin' && isset($split[1])) {
// Normalized name plugin_name_action
// Allow hook from any plugin on any (core or plugin) type
$res = Plugin::doOneHook($split[1], 'MassiveActionsProcess', $input);
// } else if ($plug=isPluginItemType($input["itemtype"])) {
// non-normalized name
// hook from the plugin defining the type
// $res = Plugin::doOneHook($plug['plugin'], 'MassiveActionsProcess', $input);
} else {
$res = $this->doSpecificMassiveActions($input);
}
break;
}
return $res;
}