本文整理汇总了PHP中DocumentRevision::getDocumentRevisionNameForDisplay方法的典型用法代码示例。如果您正苦于以下问题:PHP DocumentRevision::getDocumentRevisionNameForDisplay方法的具体用法?PHP DocumentRevision::getDocumentRevisionNameForDisplay怎么用?PHP DocumentRevision::getDocumentRevisionNameForDisplay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentRevision
的用法示例。
在下文中一共展示了DocumentRevision::getDocumentRevisionNameForDisplay方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testgetDocumentRevisionNameForDisplay
public function testgetDocumentRevisionNameForDisplay()
{
$documentRevision = new DocumentRevision();
//test wihout setting attributes
$result = $documentRevision->getDocumentRevisionNameForDisplay();
$this->assertEquals('.', $result);
//test with attributes preset
$documentRevision->filename = 'test.ext';
$documentRevision->revision = 1;
$result = $documentRevision->getDocumentRevisionNameForDisplay();
$this->assertEquals('-Revision_1.ext', $result);
}
示例2: handleAttachments
//.........这里部分代码省略.........
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
//// ADDING NEW ATTACHMENTS
$max_files_upload = 10;
// Jenny - Bug 8211 Since attachments for drafts have already been processed,
// we don't need to re-process them.
if ($this->status != "draft") {
$notes_list = array();
if (!empty($this->id) && !$this->new_with_id) {
$note = new Note();
$where = "notes.parent_id='{$this->id}'";
$notes_list = $note->get_full_list("", $where, true);
}
$this->attachments = array_merge($this->attachments, $notes_list);
}
// cn: Bug 5995 - rudimentary error checking
$filesError = array(0 => 'UPLOAD_ERR_OK - There is no error, the file uploaded with success.', 1 => 'UPLOAD_ERR_INI_SIZE - The uploaded file exceeds the upload_max_filesize directive in php.ini.', 2 => 'UPLOAD_ERR_FORM_SIZE - The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.', 3 => 'UPLOAD_ERR_PARTIAL - The uploaded file was only partially uploaded.', 4 => 'UPLOAD_ERR_NO_FILE - No file was uploaded.', 5 => 'UNKNOWN ERROR', 6 => 'UPLOAD_ERR_NO_TMP_DIR - Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.', 7 => 'UPLOAD_ERR_CANT_WRITE - Failed to write file to disk. Introduced in PHP 5.1.0.');
for ($i = 0; $i < $max_files_upload; $i++) {
// cn: Bug 5995 - rudimentary error checking
if (!isset($_FILES["email_attachment{$i}"])) {
$GLOBALS['log']->debug("Email Attachment {$i} does not exist.");
continue;
}
if ($_FILES['email_attachment' . $i]['error'] != 0 && $_FILES['email_attachment' . $i]['error'] != 4) {
$GLOBALS['log']->debug('Email Attachment could not be attach due to error: ' . $filesError[$_FILES['email_attachment' . $i]['error']]);
continue;
}
$note = new Note();
$note->parent_id = $this->id;
$note->parent_type = $this->module_dir;
$upload_file = new UploadFile('email_attachment' . $i);
if (empty($upload_file)) {
continue;
}
if (isset($_FILES['email_attachment' . $i]) && $upload_file->confirm_upload()) {
$note->filename = $upload_file->get_stored_file_name();
$note->file = $upload_file;
$note->name = $mod_strings['LBL_EMAIL_ATTACHMENT'] . ': ' . $note->file->original_file_name;
$this->attachments[] = $note;
}
}
$this->saved_attachments = array();
foreach ($this->attachments as $note) {
if (!empty($note->id)) {
array_push($this->saved_attachments, $note);
continue;
}
$note->parent_id = $this->id;
$note->parent_type = 'Emails';
$note->file_mime_type = $note->file->mime_type;
$note_id = $note->save();
$this->saved_attachments[] = $note;
$note->id = $note_id;
$note->file->final_move($note->id);
}
//// END NEW ATTACHMENTS
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
//// ATTACHMENTS FROM DOCUMENTS
for ($i = 0; $i < 10; $i++) {
if (isset($_REQUEST['documentId' . $i]) && !empty($_REQUEST['documentId' . $i])) {
$doc = new Document();
$docRev = new DocumentRevision();
$docNote = new Note();
$noteFile = new UploadFile('none');
$doc->retrieve($_REQUEST['documentId' . $i]);
$docRev->retrieve($doc->document_revision_id);
$this->saved_attachments[] = $docRev;
// cn: bug 9723 - Emails with documents send GUID instead of Doc name
$docNote->name = $docRev->getDocumentRevisionNameForDisplay();
$docNote->filename = $docRev->filename;
$docNote->description = $doc->description;
$docNote->parent_id = $this->id;
$docNote->parent_type = 'Emails';
$docNote->file_mime_type = $docRev->file_mime_type;
$docId = $docNote = $docNote->save();
$noteFile->duplicate_file($docRev->id, $docId, $docRev->filename);
}
}
//// END ATTACHMENTS FROM DOCUMENTS
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
//// REMOVE ATTACHMENTS
if (isset($_REQUEST['remove_attachment']) && !empty($_REQUEST['remove_attachment'])) {
foreach ($_REQUEST['remove_attachment'] as $noteId) {
$q = 'UPDATE notes SET deleted = 1 WHERE id = \'' . $noteId . '\'';
$this->db->query($q);
}
}
//this will remove attachments that have been selected to be removed from drafts.
if (isset($_REQUEST['removeAttachment']) && !empty($_REQUEST['removeAttachment'])) {
$exRemoved = explode('::', $_REQUEST['removeAttachment']);
foreach ($exRemoved as $noteId) {
$q = 'UPDATE notes SET deleted = 1 WHERE id = \'' . $noteId . '\'';
$this->db->query($q);
}
}
//// END REMOVE ATTACHMENTS
///////////////////////////////////////////////////////////////////////////
}