本文整理汇总了PHP中Document::get_document_name方法的典型用法代码示例。如果您正苦于以下问题:PHP Document::get_document_name方法的具体用法?PHP Document::get_document_name怎么用?PHP Document::get_document_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Document
的用法示例。
在下文中一共展示了Document::get_document_name方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSaveAndGet_document_name
public function testSaveAndGet_document_name()
{
error_reporting(E_ERROR | E_PARSE);
$document = new Document();
$document->filename = 'test';
$document->file_url = 'test_url';
$document->file_url_noimage = 'test_image_url';
$document->last_rev_created_name = 'test';
$document->category_id = '1';
$document->subcategory_id = '1';
$document->document_name = 'test';
$document->save();
//test for record ID to verify that record is saved
$this->assertTrue(isset($document->id));
$this->assertEquals(36, strlen($document->id));
//execute Get_document_name() method and verify it gets the name correctly
$this->assertEquals(null, $document->get_document_name(1));
$this->assertEquals('test', $document->get_document_name($document->id));
//mark the record as deleted and verify that this record cannot be retrieved anymore.
$document->mark_deleted($document->id);
$result = $document->retrieve($document->id);
$this->assertEquals(null, $result);
}
示例2:
$xtpl->assign("ACTIVE_DATE", $focus->active_date);
$xtpl->assign("EXP_DATE", $focus->exp_date);
$xtpl->assign("FILE_NAME", $focus->filename);
$xtpl->assign("SAVE_FILE", $save_file);
$xtpl->assign("FILE_URL_NOIMAGE", $focus->file_url_noimage);
$xtpl->assign("LAST_REV_CREATOR", $focus->last_rev_created_name);
if (isset($focus->last_rev_create_date)) {
$xtpl->assign("LAST_REV_DATE", $focus->last_rev_create_date);
} else {
$xtpl->assign("LAST_REV_DATE", "");
}
$xtpl->assign("DOCUMENT_REVISION_ID", $focus->document_revision_id);
$detailView->processListNavigation($xtpl, "DOCUMENT", $offset);
$xtpl->parse("main.open_source");
if (!empty($focus->related_doc_id)) {
$xtpl->assign("RELATED_DOCUMENT_NAME", Document::get_document_name($focus->related_doc_id));
}
if (!empty($focus->related_doc_rev_id)) {
$xtpl->assign("RELATED_DOC_REV_ID", $focus->related_doc_rev_id);
$xtpl->assign("RELATED_DOCUMENT_VERSION", DocumentRevision::get_document_revision_name($focus->related_doc_rev_id));
}
if (!empty($focus->is_template) && $focus->is_template == 1) {
$xtpl->assign("IS_TEMPLATE_CHECKED", "checked");
}
if (!empty($focus->template_type)) {
$xtpl->assign("TEMPLATE_TYPE", $app_list_strings['document_template_type_dom'][$focus->template_type]);
}
// adding custom fields:
require_once 'modules/DynamicFields/templates/Files/DetailView.php';
$xtpl->parse("main");
$xtpl->out("main");
示例3: fill_in_additional_detail_fields
function fill_in_additional_detail_fields()
{
global $theme;
global $current_language;
global $timedate;
global $locale;
parent::fill_in_additional_detail_fields();
$mod_strings = return_module_language($current_language, 'Documents');
$query = "SELECT filename,revision,file_ext FROM document_revisions WHERE id='{$this->document_revision_id}'";
$result = $this->db->query($query);
$row = $this->db->fetchByAssoc($result);
//popuplate filename
if (isset($row['filename'])) {
$this->filename = $row['filename'];
}
//$this->latest_revision = $row['revision'];
if (isset($row['revision'])) {
$this->revision = $row['revision'];
}
//populate the file url.
//image is selected based on the extension name <ext>_icon_inline, extension is stored in document_revisions.
//if file is not found then default image file will be used.
global $img_name;
global $img_name_bare;
if (!empty($row['file_ext'])) {
$img_name = SugarThemeRegistry::current()->getImageURL(strtolower($row['file_ext']) . "_image_inline.gif");
$img_name_bare = strtolower($row['file_ext']) . "_image_inline";
}
//set default file name.
if (!empty($img_name) && file_exists($img_name)) {
$img_name = $img_name_bare;
} else {
$img_name = "def_image_inline";
//todo change the default image.
}
if ($this->ACLAccess('DetailView')) {
$this->file_url = "<a href='index.php?entryPoint=download&id=" . basename(UploadFile::get_url($this->filename, $this->document_revision_id)) . "&type=Documents' target='_blank'>" . SugarThemeRegistry::current()->getImage($img_name, 'alt="' . $mod_strings['LBL_LIST_VIEW_DOCUMENT'] . '" border="0"') . "</a>";
$this->file_url_noimage = basename(UploadFile::get_url($this->filename, $this->document_revision_id));
} else {
$this->file_url = "";
$this->file_url_noimage = "";
}
//get last_rev_by user name.
$query = "SELECT first_name,last_name, document_revisions.date_entered as rev_date FROM users, document_revisions WHERE users.id = document_revisions.created_by and document_revisions.id = '{$this->document_revision_id}'";
$result = $this->db->query($query, true, "Eror fetching user name: ");
$row = $this->db->fetchByAssoc($result);
if (!empty($row)) {
$this->last_rev_created_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name']);
$this->last_rev_create_date = $timedate->to_display_date_time($row['rev_date']);
}
global $app_list_strings;
if (!empty($this->status_id)) {
//_pp($this->status_id);
$this->status = $app_list_strings['document_status_dom'][$this->status_id];
}
$this->related_doc_name = Document::get_document_name($this->related_doc_id);
$this->related_doc_rev_number = DocumentRevision::get_document_revision_name($this->related_doc_rev_id);
$this->save_file = basename($this->file_url_noimage);
}
示例4: display
/**
* @see SugarView::display()
*/
public function display()
{
global $app_list_strings, $mod_strings;
$load_signed = false;
if (isset($_REQUEST['load_signed_id']) && !empty($_REQUEST['load_signed_id'])) {
$load_signed = true;
if (isset($_REQUEST['record'])) {
$this->bean->related_doc_id = $_REQUEST['record'];
}
if (isset($_REQUEST['selected_revision_id'])) {
$this->bean->related_doc_rev_id = $_REQUEST['selected_revision_id'];
}
$this->bean->id = null;
$this->bean->document_name = null;
$this->bean->filename = null;
$this->bean->is_template = 0;
}
//if
if (!empty($this->bean->id) || empty($this->bean->id) && !empty($_REQUEST['record']) && !empty($_REQUEST['action']) && strtolower($_REQUEST['action']) == 'quickedit') {
$this->ss->assign("FILE_OR_HIDDEN", "hidden");
if (!$this->ev->isDuplicate) {
$this->ss->assign("DISABLED", "disabled");
}
} else {
$this->bean->revision = 1;
$this->ss->assign("FILE_OR_HIDDEN", "file");
}
$popup_request_data = array('call_back_function' => 'document_set_return', 'form_name' => 'EditView', 'field_to_name_array' => array('id' => 'related_doc_id', 'document_name' => 'related_document_name'));
$json = getJSONobj();
$this->ss->assign('encoded_document_popup_request_data', $json->encode($popup_request_data));
//get related document name.
if (!empty($this->bean->related_doc_id)) {
$this->ss->assign("RELATED_DOCUMENT_NAME", Document::get_document_name($this->bean->related_doc_id));
$this->ss->assign("RELATED_DOCUMENT_ID", $this->bean->related_doc_id);
if (!empty($this->bean->related_doc_rev_id)) {
$this->ss->assign("RELATED_DOCUMENT_REVISION_OPTIONS", get_select_options_with_id(DocumentRevision::get_document_revisions($this->bean->related_doc_id), $this->bean->related_doc_rev_id));
} else {
$this->ss->assign("RELATED_DOCUMENT_REVISION_OPTIONS", get_select_options_with_id(DocumentRevision::get_document_revisions($this->bean->related_doc_id), ''));
}
} else {
$this->ss->assign("RELATED_DOCUMENT_REVISION_DISABLED", "disabled");
}
//set parent information in the form.
if (isset($_REQUEST['parent_id'])) {
$this->ss->assign("PARENT_ID", $_REQUEST['parent_id']);
}
//if
if (isset($_REQUEST['parent_name'])) {
$this->ss->assign("PARENT_NAME", $_REQUEST['parent_name']);
if (!empty($_REQUEST['parent_type'])) {
switch (strtolower($_REQUEST['parent_type'])) {
case "contracts":
$this->ss->assign("LBL_PARENT_NAME", $mod_strings['LBL_CONTRACT_NAME']);
break;
//todo remove leads case.
//todo remove leads case.
case "leads":
$this->ss->assign("LBL_PARENT_NAME", $mod_strings['LBL_CONTRACT_NAME']);
break;
}
//switch
}
//if
}
//if
if (isset($_REQUEST['parent_type'])) {
$this->ss->assign("PARENT_TYPE", $_REQUEST['parent_type']);
}
if ($load_signed) {
$this->ss->assign("RELATED_DOCUMENT_REVISION_DISABLED", "disabled");
$this->ss->assign("RELATED_DOCUMENT_BUTTON_AVAILABILITY", "hidden");
$this->ss->assign("LOAD_SIGNED_ID", $_REQUEST['load_signed_id']);
} else {
$this->ss->assign("RELATED_DOCUMENT_BUTTON_AVAILABILITY", "button");
}
//if-else
parent::display();
}
示例5: fill_in_additional_detail_fields
function fill_in_additional_detail_fields()
{
global $theme;
global $current_language;
global $timedate;
global $locale;
parent::fill_in_additional_detail_fields();
$mod_strings = return_module_language($current_language, 'Documents');
if (!empty($this->document_revision_id)) {
$query = "SELECT users.first_name AS first_name, users.last_name AS last_name, document_revisions.date_entered AS rev_date,\n \t document_revisions.filename AS filename, document_revisions.revision AS revision,\n \t document_revisions.file_ext AS file_ext, document_revisions.file_mime_type AS file_mime_type\n \t FROM users, document_revisions\n \t WHERE users.id = document_revisions.created_by AND document_revisions.id = '{$this->document_revision_id}'";
$result = $this->db->query($query);
$row = $this->db->fetchByAssoc($result);
//populate name
if (isset($this->document_name)) {
$this->name = $this->document_name;
}
if (isset($row['filename'])) {
$this->filename = $row['filename'];
}
//$this->latest_revision = $row['revision'];
if (isset($row['revision'])) {
$this->revision = $row['revision'];
}
//image is selected based on the extension name <ext>_icon_inline, extension is stored in document_revisions.
//if file is not found then default image file will be used.
global $img_name;
global $img_name_bare;
if (!empty($row['file_ext'])) {
$img_name = SugarThemeRegistry::current()->getImageURL(strtolower($row['file_ext']) . "_image_inline.gif");
$img_name_bare = strtolower($row['file_ext']) . "_image_inline";
}
}
//set default file name.
if (!empty($img_name) && file_exists($img_name)) {
$img_name = $img_name_bare;
} else {
$img_name = "def_image_inline";
//todo change the default image.
}
if ($this->ACLAccess('DetailView')) {
if (!empty($this->doc_type) && $this->doc_type != 'Sugar' && !empty($this->doc_url)) {
$file_url = "<a href='" . $this->doc_url . "' target='_blank'>" . SugarThemeRegistry::current()->getImage($this->doc_type . '_image_inline', 'border="0"', null, null, '.png', $mod_strings['LBL_LIST_VIEW_DOCUMENT']) . "</a>";
} else {
$file_url = "<a href='index.php?entryPoint=download&id={$this->document_revision_id}&type=Documents' target='_blank'>" . SugarThemeRegistry::current()->getImage($img_name, 'border="0"', null, null, '.gif', $mod_strings['LBL_LIST_VIEW_DOCUMENT']) . "</a>";
}
$this->file_url = $file_url;
$this->file_url_noimage = "index.php?entryPoint=download&type=Documents&id={$this->document_revision_id}";
} else {
$this->file_url = "";
$this->file_url_noimage = "";
}
//get last_rev_by user name.
if (!empty($row)) {
$this->last_rev_created_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name']);
$this->last_rev_create_date = $timedate->to_display_date_time($this->db->fromConvert($row['rev_date'], 'datetime'));
$this->last_rev_mime_type = $row['file_mime_type'];
}
global $app_list_strings;
if (!empty($this->status_id)) {
//_pp($this->status_id);
$this->status = $app_list_strings['document_status_dom'][$this->status_id];
}
if (!empty($this->related_doc_id)) {
$this->related_doc_name = Document::get_document_name($this->related_doc_id);
$this->related_doc_rev_number = DocumentRevision::get_document_revision_name($this->related_doc_rev_id);
}
}
示例6: die
<?php
if (!defined('sugarEntry') || !sugarEntry) {
die("Not A Valid Entry Point");
}
$id = $_REQUEST['record'];
$document = new Document();
$document->retrieve($id);
$filename = $document->document_revision_id;
$filepath = "upload/{$filename}";
$document_name = $document->get_document_name($id);
// File típusának ellenőrzése
$image_formats = array('JPEG', 'GIF', 'PNG');
$finfo = new finfo();
$fileinfo = $finfo->file($filepath);
$fileinfo_array = explode(" ", $fileinfo);
if ($fileinfo_array[0] == 'PDF') {
$im = new imagick($filepath . "[0]");
$im->setImageFormat('png');
$im->thumbnailImage(300, 0);
header('Content-Type:image/png');
ob_clean();
flush();
echo $im;
} elseif (!in_array($fileinfo_array[0], $image_formats)) {
header('Content-Type:image/png');
ob_clean();
flush();
readfile('custom/themes/default/images/unknown.png');
} else {
//Kép Átméretezése