本文整理汇总了PHP中Document::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Document::delete方法的具体用法?PHP Document::delete怎么用?PHP Document::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Document
的用法示例。
在下文中一共展示了Document::delete方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
function delete($id = FALSE)
{
if ($id) {
$document = new Document($id);
$document->delete();
set_notify('success', lang('delete_data_complete'));
}
redirect('documents');
}
示例2: reinitializeImport
function reinitializeImport($itemtype, $items_id)
{
global $DB;
if ($this->getFromDBbyDevice($items_id, $itemtype)) {
$doc = new Document();
if ($doc->GetfromDB($this->fields["documents_id"])) {
$query = "DELETE\n FROM `glpi_documents_items`\n WHERE `documents_id` = '" . $this->fields["documents_id"] . "';";
$result = $DB->query($query);
if (is_file(GLPI_DOC_DIR . "/" . $doc->fields["filename"]) && !is_dir(GLPI_DOC_DIR . "/" . $doc->fields["filename"])) {
unlink(GLPI_DOC_DIR . "/" . $doc->fields["filename"]);
}
$doc->delete(array('id' => $this->fields["documents_id"]), true);
}
}
if (isset($this->fields["id"])) {
$this->delete(array('id' => $this->fields["id"]));
}
}
示例3: transferDocuments
//.........这里部分代码省略.........
if (isset($this->already_transfer['Document'][$item_ID])) {
$newdocID = $this->already_transfer['Document'][$item_ID];
if ($newdocID != $item_ID) {
$need_clean_process = true;
}
} else {
// No
// Can be transfer without copy ? = all linked items need to be transfer (so not copy)
$canbetransfer = true;
$query = "SELECT DISTINCT `itemtype`\n FROM `glpi_documents_items`\n WHERE `documents_id` = '{$item_ID}'";
if ($result_type = $DB->query($query)) {
if ($DB->numrows($result_type) > 0) {
while (($data_type = $DB->fetch_array($result_type)) && $canbetransfer) {
$dtype = $data_type['itemtype'];
if (isset($this->item_search[$dtype])) {
// No items to transfer -> exists links
$query_search = "SELECT count(*) AS CPT\n FROM `glpi_documents_items`\n WHERE `documents_id` = '{$item_ID}'\n AND `itemtype` = '{$dtype}'\n AND `items_id`\n NOT IN " . $this->item_search[$dtype];
// contacts, contracts, and enterprises are linked as device.
if (isset($this->item_recurs[$dtype])) {
$query_search .= " AND `items_id`\n NOT IN " . $this->item_recurs[$dtype];
}
$result_search = $DB->query($query_search);
if ($DB->result($result_search, 0, 'CPT') > 0) {
$canbetransfer = false;
}
}
}
}
}
// Yes : transfer
if ($canbetransfer) {
$this->transferItem('Document', $item_ID, $item_ID);
$newdocID = $item_ID;
} else {
$need_clean_process = true;
$document->getFromDB($item_ID);
// No : search contract
$query = "SELECT *\n FROM `glpi_documents`\n WHERE `entities_id` = '" . $this->to . "'\n AND `name` = '" . addslashes($document->fields['name']) . "'";
if ($result_search = $DB->query($query)) {
if ($DB->numrows($result_search) > 0) {
$newdocID = $DB->result($result_search, 0, 'id');
$this->addToAlreadyTransfer('Document', $item_ID, $newdocID);
}
}
// found : use it
// not found : copy doc
if ($newdocID < 0) {
// 1 - create new item
unset($document->fields['id']);
$input = $document->fields;
// Not set new entity Do by transferItem
unset($document->fields);
$newdocID = $document->add($input);
// 2 - transfer as copy
$this->transferItem('Document', $item_ID, $newdocID);
}
}
}
// Update links
if ($ID == $newID) {
if ($item_ID != $newdocID) {
$query = "UPDATE `glpi_documents_items`\n SET `documents_id` = '{$newdocID}'\n WHERE `id` = '" . $data['id'] . "'";
$DB->query($query);
}
// Same Item -> update links
} else {
// Copy Item -> copy links
if ($item_ID != $newdocID) {
$query = "INSERT\n INTO `glpi_documents_items`\n (`documents_id`, `items_id`, `itemtype`)\n VALUES ('{$newdocID}','{$newID}','{$itemtype}')";
$DB->query($query);
} else {
// same doc for new item update link
$query = "UPDATE\n `glpi_documents_items`\n SET `items_id` = '{$newID}'\n WHERE `id` = '" . $data['id'] . "'";
$DB->query($query);
}
}
// If clean and unused ->
if ($need_clean_process && $this->options['clean_document']) {
$query = "SELECT COUNT(*) AS CPT\n FROM `glpi_documents_items`\n WHERE `documents_id` = '{$item_ID}'";
if ($result_remaining = $DB->query($query)) {
if ($DB->result($result_remaining, 0, 'CPT') == 0) {
if ($this->options['clean_document'] == 1) {
$document->delete(array('id' => $item_ID));
}
if ($this->options['clean_document'] == 2) {
// purge
$document->delete(array('id' => $item_ID), 1);
}
}
}
}
}
}
}
} else {
// else unlink
$query = "DELETE\n FROM `glpi_documents_items`\n WHERE `items_id` = '{$ID}'\n AND `itemtype` = '{$itemtype}'";
$DB->query($query);
}
}
示例4: Document
Session::checkLoginUser();
if (!isset($_GET["id"])) {
$_GET["id"] = -1;
}
$doc = new Document();
$documentitem = new Document_Item();
if (isset($_POST["add"])) {
$doc->check(-1, 'w', $_POST);
if ($newID = $doc->add($_POST)) {
Event::log($newID, "documents", 4, "login", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $doc->fields["name"]));
}
Html::back();
} else {
if (isset($_POST["delete"])) {
$doc->check($_POST["id"], 'd');
if ($doc->delete($_POST)) {
Event::log($_POST["id"], "documents", 4, "document", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
}
$doc->redirectToList();
} else {
if (isset($_POST["restore"])) {
$doc->check($_POST["id"], 'd');
if ($doc->restore($_POST)) {
Event::log($_POST["id"], "documents", 4, "document", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
}
$doc->redirectToList();
} else {
if (isset($_POST["purge"])) {
$doc->check($_POST["id"], 'd');
if ($doc->delete($_POST, 1)) {
Event::log($_POST["id"], "documents", 4, "document", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
示例5: removeLicense
public function removeLicense()
{
//delete all documents and associated expressions and SFX providers
$document = new Document();
foreach ($this->getDocuments() as $document) {
//delete all expressions and expression notes
$expression = new Expression();
foreach ($document->getExpressions() as $expression) {
$expressionNote = new ExpressionNote();
foreach ($expression->getExpressionNotes() as $expressionNote) {
$expressionNote->delete();
}
$expression->removeQualifiers();
$expression->delete();
}
$sfxProvider = new SFXProvider();
foreach ($document->getSFXProviders() as $sfxProvider) {
$sfxProvider->delete();
}
$signature = new Signature();
foreach ($document->getSignatures() as $signature) {
$signature->delete();
}
$document->delete();
}
//delete all attachments
$attachment = new Attachment();
foreach ($this->getAttachments() as $attachment) {
$attachmentFile = new AttachmentFile();
foreach ($attachment->getAttachmentFiles() as $attachmentFile) {
$attachmentFile->delete();
}
$attachment->delete();
}
$this->delete();
}
示例6: Document
break;
case 'deleteDocument':
//note - does not delete physical document
$document = new Document(new NamedArguments(array('primaryKey' => $_GET['documentID'])));
//delete children sfx providers
$sfxProvider = new SFXProvider();
foreach ($document->getSFXProviders() as $sfxProvider) {
$sfxProvider->delete();
}
//delete children signatures
$signature = new Signature();
foreach ($document->getSignatures() as $signature) {
$signature->delete();
}
try {
$document->delete();
} catch (Exception $e) {
echo $e->getMessage();
}
break;
case 'submitSignature':
//set date for proper saving
if (isset($_POST['signatureDate']) && $_POST['signatureDate'] != '') {
$signatureDate = date("Y-m-d", strtotime($_POST['signatureDate']));
} else {
$signatureDate = "";
}
//if signatureID is sent then this is an update
if (isset($_POST['signatureID']) && $_POST['signatureID'] != '') {
$signature = new Signature(new NamedArguments(array('primaryKey' => $_POST['signatureID'])));
} else {
示例7: getStringFromRequest
$groupname = getStringFromRequest('groupname');
$parent_doc_group = getIntFromRequest('parent_doc_group');
$dg = new DocumentGroup($g);
if ($dg->isError()) {
exit_error('Error', $dg->getErrorMessage());
}
if (!$dg->create($groupname, $parent_doc_group)) {
exit_error('Error', $dg->getErrorMessage());
}
$feedback = _('Created successfully');
} elseif (getStringFromRequest('deletedoc') && $docid && getStringFromRequest('sure') && getStringFromRequest('really_sure')) {
$d = new Document($g, $docid);
if ($d->isError()) {
exit_error('Error', $d->getErrorMessage());
}
if (!$d->delete()) {
exit_error('Error', $d->getErrorMessage());
}
$feedback = _('Deleted');
header('Location: index.php?group_id=' . $d->Group->getID() . '&feedback=' . urlencode($feedback));
die;
// End parsing file and redirect
}
}
//
//
// Edit a specific document
//
//
if ($editdoc && $docid) {
$d = new Document($g, $docid);
示例8: Document
function document_delete($doc_id)
{
global $database;
// FIND THE DOCUMENT SETTINGS PARAMETER
$query = "SELECT * FROM se_document_parameters";
$params = $database->database_fetch_assoc($database->database_query($query));
$scribd_api_key = $params['api_key'];
$scribd_secret = $params['secret_key'];
// CRAETE DOCUMENT OBJECT
$scribd = new Document($scribd_api_key, $scribd_secret, $user->user_info['user_id']);
// IF DOCUMNET ID IS NUMERIC
if (is_numeric($doc_id)) {
$document = $database->database_fetch_assoc($database->database_query("SELECT document_user_id, document_doc_id, document_filepath FROM se_documents WHERE document_id = '{$doc_id}'"));
if (!empty($document)) {
$scribd->my_user_id = $document['document_user_id'];
$data = $scribd->delete($document['document_doc_id']);
if ($data) {
// DELETE THE DOCUMENTS
$database->database_query("DELETE FROM se_documents WHERE document_id = '{$doc_id}'");
// DELETE DOCUMENTS TAGS
$database->database_query("DELETE FROM se_documents_tags WHERE document_id = '{$doc_id}'");
// DELETE DOCUMENTS COMMENTS
$database->database_query("DELETE FROM se_documentcomments WHERE documentcomment_document_id = '{$doc_id}'");
// DELETE DOCUMENTS NOTIFICATIONS
$database->database_query("\r\n\t\t\t\t DELETE FROM\r\n\t\t\t\t se_notifys\r\n\t\t\t\t USING\r\n\t\t\t\t se_notifys\r\n\t\t\t\t LEFT JOIN\r\n\t\t\t\t se_notifytypes\r\n\t\t\t\t ON se_notifys.notify_notifytype_id=se_notifytypes.notifytype_id\r\n\t\t\t\t WHERE\r\n\t\t\t\t se_notifytypes.notifytype_name='documentcomment' AND\r\n\t\t\t\t notify_object_id='{$doc_id}'\r\n\t\t\t\t ");
// UNLINK THE DOCUMENTS
if (!empty($document['document_filepath'])) {
unlink('.' . $document['document_filepath']);
}
}
} else {
return FALSE;
}
} elseif (is_array($doc_id)) {
// IF MORE THAN ONE DOCUMENTS IS GOING TO DELETE AT A ONE TIME
foreach ($doc_id as $document_id) {
$document = $database->database_fetch_assoc($database->database_query("SELECT document_user_id, document_doc_id, document_filepath FROM se_documents WHERE document_id = '{$document_id}'"));
if (!empty($document)) {
$scribd->my_user_id = $document['document_user_id'];
$data = $scribd->delete($document['document_doc_id']);
if ($data) {
// DELETE THE DOCUMENTS
$database->database_query("DELETE FROM se_documents WHERE document_id = '{$document_id}'");
// DELETE DOCUMENTS TAGS
$database->database_query("DELETE FROM se_documents_tags WHERE document_id = '{$document_id}'");
// DELETE DOCUMENTS COMMENTS
$database->database_query("DELETE FROM se_documentcomments WHERE documentcomment_document_id = '{$document_id}'");
// DELETE DOCUMENTS NOTIFICATIONS
$database->database_query("\r\n\t\t\t\t DELETE FROM\r\n\t\t\t\t se_notifys\r\n\t\t\t\t USING\r\n\t\t\t\t se_notifys\r\n\t\t\t\t LEFT JOIN\r\n\t\t\t\t se_notifytypes\r\n\t\t\t\t ON se_notifys.notify_notifytype_id=se_notifytypes.notifytype_id\r\n\t\t\t\t WHERE\r\n\t\t\t\t se_notifytypes.notifytype_name='documentcomment' AND\r\n\t\t\t\t notify_object_id='{$document_id}'\r\n\t\t\t\t ");
// UNLINK THE DOCUMENTS
if (!empty($document['document_filepath'])) {
unlink('.' . $document['document_filepath']);
}
}
}
}
} else {
return FALSE;
}
}
示例9: delete
/**
* @see Document::delete
* @return void
*/
public function delete()
{
$versions = $this->getVersions();
foreach ($versions as $version) {
$version->delete();
}
// remove all tasks
$this->getResource()->deleteAllTasks();
parent::delete();
}
示例10: create_submit
//.........这里部分代码省略.........
}
} elseif ($new_purchase->projectType == "Infrastructure") {
if ($task->taskName == "PRE-PROCUREMENT CONFERENCE" || $task->taskName == "ADVERTISEMENT") {
if ($amount > 5000000) {
$task_details->status = "Pending";
}
} else {
if ($task->taskName == "PRE-BID CONFERENCE") {
if ($amount > 1000000) {
$task_details->status = "Pending";
}
}
}
} elseif ($new_purchase->projectType == "Consulting Services") {
if ($amount > 1000000) {
$task_details->status = "Pending";
}
}
}
//End Project Type
$firstnew = 1;
$task_details->doc_id = $document->id;
$task_details->save();
}
$users = User::all();
foreach ($users as $user) {
$count = new Count();
$count->user_id = $user->id;
$count->doc_id = $doc_id;
$count->save();
}
$pr_id = Session::get('pr_id');
DB::table('attachments')->where('doc_id', $doc_id)->update(array('saved' => 1));
DB::table('attachments')->where('saved', '=', 0)->delete();
Session::forget('doc_id');
if (!Input::hasfile('file')) {
Session::forget('imgerror');
}
$connected = @fsockopen("www.google.com", 80);
//website, port (try 80 or 443)
if ($connected) {
$sendee = DB::table('users')->where('id', $purchase->requisitioner)->first();
$email = $sendee->email;
$fname = $sendee->firstname;
$data = ['id' => $purchase->id];
Mail::send('emails.template', $data, function ($message) use($email, $fname) {
$message->from('procurementTrackingSystem@tarlac.com', 'Procurement Tracking System Tarlac');
$message->to($email, $fname)->subject('Tarlac Procurement Tracking System: New Purchase Request Created');
});
$notice = "Purchase request created successfully. ";
} else {
$notice = "Purchase request created successfully. Email notice was not sent. ";
}
// Insert data to reports table
$date_received = Input::get('dateReceived');
$date_received = substr($date_received, 0, strrpos($date_received, ' '));
$reports = Reports::whereDate($date_received)->first();
if ($reports == null) {
$reports = new Reports();
$reports->date = $date_received;
$reports->pRequestCount = 1;
} else {
$reports->pRequestCount = $reports->pRequestCount + 1;
}
$reports->save();
//End Reports
示例11: janisawesome
//.........这里部分代码省略.........
}
} elseif ($new_purchase->projectType == "Infrastructure") {
if ($task->taskName == "PRE-PROCUREMENT CONFERENCE" || $task->taskName == "ADVERTISEMENT") {
if ($amount > 5000000) {
$task_details->status = "Pending";
}
} else {
if ($task->taskName == "PRE-BID CONFERENCE") {
if ($amount > 1000000) {
$task_details->status = "Pending";
}
}
}
} elseif ($new_purchase->projectType == "Consulting Services") {
if ($amount > 1000000) {
$task_details->status = "Pending";
}
}
}
//End Project Type
$firstnew = 1;
$task_details->doc_id = $document->id;
$task_details->save();
}
$users = User::all();
foreach ($users as $user) {
$count = new Count();
$count->user_id = $user->id;
$count->doc_id = $doc_id;
$count->save();
}
$pr_id = Session::get('pr_id');
DB::table('attachments')->where('doc_id', $doc_id)->update(array('saved' => 1));
DB::table('attachments')->where('saved', '=', 0)->delete();
Session::forget('doc_id');
$connected = true;
// $connected = @fsockopen("www.google.com", 80); //website, port (try 80 or 443)
if (!$connected) {
$sendee = DB::table('users')->where('id', $purchase->requisitioner)->first();
$email = $sendee->email;
$fname = $sendee->firstname;
$data = ['id' => $purchase->id];
Mail::send('emails.template', $data, function ($message) use($email, $fname) {
$message->from('procurementTrackingSystem@tarlac.com', 'Procurement Tracking System Tarlac');
$message->to($email, $fname)->subject('Tarlac Procurement Tracking System: New Purchase Request Created');
});
$notice = "Purchase request created successfully. ";
// Insert data to reports table
$date_received = Input::get('dateReceived');
$date_received = substr($date_received, 0, strrpos($date_received, ' '));
$reports = Reports::whereDate($date_received)->first();
if ($reports == null) {
$reports = new Reports();
$reports->date = $date_received;
$reports->pRequestCount = 1;
} else {
$reports->pRequestCount = $reports->pRequestCount + 1;
}
$reports->save();
//End Reports
} else {
// Insert data to reports table
$date_received = Input::get('dateReceived');
$date_received = substr($date_received, 0, strrpos($date_received, ' '));
$reports = Reports::whereDate($date_received)->first();
if ($reports == null) {
示例12: showDocs
function showDocs()
{
global $connector;
global $result;
$course = new Course();
$doc = new Document();
$course->setConnector($connector);
$doc->setConnector($connector);
if (isset($_POST['operation'])) {
list($operation, $params) = explode("#", $_POST['operation']);
switch ($operation) {
case 'saveChanges':
$doc->storeFormValues($_POST, BASE_PATH . "/upload/");
$error_msg = $doc->insert();
break;
case 'delete':
$error_msg = $doc->delete($params);
break;
default:
$error_msg = "Operazione non valida";
}
if ($error_msg != "") {
$result["errorMessage"] = $error_msg;
} elseif ($operation != 'edit') {
$result["statusMessage"] = "Operazione completata!";
}
}
$result["courses"] = $course->getList("nome");
$result['docs'] = $doc->getList();
$page = "document.php";
include_once BASE_PATH . "template.php";
}
示例13: Delete
/**
* method Delete()
* Delete a record
*/
function Delete($param)
{
try {
// get the parameter $key
$key = $param['key'];
// open a transaction with database 'changeman'
TTransaction::open('changeman');
// instantiates object Document
$object = new Document($key);
// deletes the object from the database
$object->delete();
// close the transaction
TTransaction::close();
// reload the listing
$this->onReload();
// shows the success message
new TMessage('info', TAdiantiCoreTranslator::translate('Record deleted'));
} catch (Exception $e) {
// shows the exception error message
new TMessage('error', '<b>Error</b> ' . $e->getMessage());
// undo all pending operations
TTransaction::rollback();
}
}
示例14: deleteuser_document
function deleteuser_document($user_id)
{
global $database;
//GETTING SCRIBD PARAMETERS
$query = "SELECT * FROM se_document_parameters";
$params = $database->database_fetch_assoc($database->database_query($query));
$scribd_api_key = $params['api_key'];
$scribd_secret = $params['secret_key'];
$scribd = new Document($scribd_api_key, $scribd_secret, $user_id);
//GET ALL DOCUMENTS OWNED BY USER
$result = $database->database_query("SELECT document_id, document_doc_id, document_filepath FROM se_documents WHERE document_user_id = '{$user_id}'");
if ($database->database_num_rows($result) > 0) {
while ($doc_info = $database->database_fetch_assoc($result)) {
$scribd->delete($doc_info['document_doc_id']);
$database->database_query("DELETE FROM se_documents_tags WHERE document_id = '{$doc_info['document_id']}'");
if ($doc_info['document_filepath'] != '') {
unlink('.' . $doc_info['document_filepath']);
}
}
}
// DELETE DOCUMENT ENTRIES AND COMMENTS
$database->database_query("DELETE FROM se_documents, se_documentcomments USING se_documents LEFT JOIN se_documentcomments ON se_documents.document_id=se_documentcomments.documentcomment_document_id WHERE se_documents.document_user_id='{$user_id}'");
// DELETE COMMENTS POSTED BY USER
$database->database_query("DELETE FROM se_documentcomments WHERE documentcomment_authoruser_id='{$user_id}'");
}