本文整理汇总了PHP中Document_Item::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Document_Item::delete方法的具体用法?PHP Document_Item::delete怎么用?PHP Document_Item::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Document_Item
的用法示例。
在下文中一共展示了Document_Item::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doSpecificMassiveActions
/**
* @see CommonDBTM::doSpecificMassiveActions()
**/
function doSpecificMassiveActions($input = array())
{
$res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
switch ($input['action']) {
case "add_document":
case "add_document_item":
$documentitem = new Document_Item();
foreach ($input["item"] as $key => $val) {
if (isset($input['items_id'])) {
// Add items to documents
$input2 = array('itemtype' => $input["item_itemtype"], 'items_id' => $input["items_id"], 'documents_id' => $key);
} else {
if (isset($input['documents_id'])) {
// Add document to item
$input2 = array('itemtype' => $input["itemtype"], 'items_id' => $key, 'documents_id' => $input['documents_id']);
} else {
return false;
}
}
if ($documentitem->can(-1, 'w', $input2)) {
if ($documentitem->add($input2)) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
}
break;
case "remove_document":
case "remove_document_item":
foreach ($input["item"] as $key => $val) {
if (isset($input['items_id'])) {
// Remove item to documents
$input2 = array('itemtype' => $input["item_itemtype"], 'items_id' => $input["items_id"], 'documents_id' => $key);
} else {
if (isset($input['documents_id'])) {
// Remove contract to items
$input2 = array('itemtype' => $input["itemtype"], 'items_id' => $key, 'documents_id' => $input['documents_id']);
} else {
return false;
}
}
$docitem = new Document_Item();
if ($docitem->can(-1, 'w', $input2)) {
if ($item = getItemForItemtype($input2["itemtype"])) {
if ($item->getFromDB($input2['items_id'])) {
$doc = new self();
if ($doc->getFromDB($input2['documents_id'])) {
if ($docitem->getFromDBForItems($doc, $item)) {
if ($docitem->delete(array('id' => $docitem->getID()))) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['ko']++;
}
} else {
$res['ko']++;
}
} else {
$res['ko']++;
}
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
}
break;
default:
return parent::doSpecificMassiveActions($input);
}
return $res;
}
示例2: sprintf
Event::log($_POST['tickets_id'], "ticket", 4, "tracking", sprintf(__('%s adds an actor'), $_SESSION["glpiname"]));
Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_POST['tickets_id']);
} else {
if (isset($_POST['addme_assign'])) {
$ticket_user = new Ticket_User();
$track->check($_POST['tickets_id'], READ);
$input = array('tickets_id' => $_POST['tickets_id'], 'users_id' => Session::getLoginUserID(), 'use_notification' => 1, 'type' => CommonITILActor::ASSIGN);
$ticket_user->add($input);
Event::log($_POST['tickets_id'], "ticket", 4, "tracking", sprintf(__('%s adds an actor'), $_SESSION["glpiname"]));
Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_POST['tickets_id']);
} else {
if (isset($_REQUEST['delete_document'])) {
$document_item = new Document_Item();
$found_document_items = $document_item->find("itemtype = 'Ticket' " . " AND items_id = " . intval($_REQUEST['tickets_id']) . " AND documents_id = " . intval($_REQUEST['documents_id']));
foreach ($found_document_items as $item) {
$document_item->delete($item, true);
}
Html::back();
}
}
}
}
}
}
}
}
}
if (isset($_GET["id"]) && $_GET["id"] > 0) {
if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
Html::helpHeader(Ticket::getTypeName(Session::getPluralNumber()), '', $_SESSION["glpiname"]);
} else {
示例3: foreach
Event::log($_POST["id"], "documents", 4, "document", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
}
glpi_header($_SERVER['HTTP_REFERER']);
} else {
if (isset($_POST["adddocumentitem"])) {
$documentitem->check(-1, 'w', $_POST);
if ($documentitem->add($_POST)) {
Event::log($_POST["documents_id"], "documents", 4, "document", $_SESSION["glpiname"] . " " . $LANG['log'][32]);
}
glpi_header($_SERVER['HTTP_REFERER']);
} else {
if (isset($_POST["deletedocumentitem"])) {
if (isset($_POST["item"]) && count($_POST["item"])) {
foreach ($_POST["item"] as $key => $val) {
if ($documentitem->can($key, 'w')) {
$documentitem->delete(array('id' => $key));
}
}
}
Event::log($_POST["documents_id"], "documents", 4, "document", $_SESSION["glpiname"] . " " . $LANG['log'][33]);
glpi_header($_SERVER['HTTP_REFERER']);
} else {
if (isset($_GET["deletedocumentitem"]) && isset($_GET["documents_id"]) && isset($_GET["id"])) {
$documentitem->check($_GET["id"], 'w');
if ($documentitem->delete(array('id' => $_GET["id"]))) {
Event::log($_GET["documents_id"], "documents", 4, "document", $_SESSION["glpiname"] . " " . $LANG['log'][33]);
}
glpi_header($_SERVER['HTTP_REFERER']);
} else {
commonHeader($LANG['Menu'][27], $_SERVER['PHP_SELF'], "financial", "document");
$doc->showForm($_GET["id"]);