本文整理汇总了PHP中UploadFile::get_url方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadFile::get_url方法的具体用法?PHP UploadFile::get_url怎么用?PHP UploadFile::get_url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UploadFile
的用法示例。
在下文中一共展示了UploadFile::get_url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fill_in_additional_detail_fields
function fill_in_additional_detail_fields()
{
global $theme;
global $current_language;
global $timedate;
global $app_list_strings;
$this->uploadfile = $this->filename;
$mod_strings = return_module_language($current_language, $this->object_name);
global $img_name;
global $img_name_bare;
if (!$this->file_ext) {
$img_name = SugarThemeRegistry::current()->getImageURL(strtolower($this->file_ext) . "_image_inline.gif");
$img_name_bare = strtolower($this->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.
}
$this->file_url_noimage = basename(UploadFile::get_url($this->filename, $this->id));
if (!empty($this->status_id)) {
$this->status = $app_list_strings['document_status_dom'][$this->status_id];
}
}
示例2: fill_in_additional_detail_fields
/**
* @see SugarBean::fill_in_additional_detail_fields()
*/
public function fill_in_additional_detail_fields()
{
global $app_list_strings;
global $img_name;
global $img_name_bare;
$this->uploadfile = $this->filename;
// Bug 41453 - Make sure we call the parent method as well
parent::fill_in_additional_detail_fields();
if (!$this->file_ext) {
$img_name = SugarThemeRegistry::current()->getImageURL(strtolower($this->file_ext) . "_image_inline.gif");
$img_name_bare = strtolower($this->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.
}
$this->file_url_noimage = basename(UploadFile::get_url($this->filename, $this->id));
if (!empty($this->status_id)) {
$this->status = $app_list_strings['document_status_dom'][$this->status_id];
}
}
示例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: fill_in_additional_detail_fields
function fill_in_additional_detail_fields()
{
global $theme;
global $current_language;
parent::fill_in_additional_detail_fields();
$mod_strings = return_module_language($current_language, 'Documents');
//find the document name and current version.
$query = "SELECT document_name, revision, document_revision_id FROM documents, document_revisions where documents.id = '{$this->document_id}' AND document_revisions.id = documents.document_revision_id";
$result = $this->db->query($query, true, "Error fetching document details...:");
$row = $this->db->fetchByAssoc($result);
if ($row != null) {
$this->document_name = $row['document_name'];
$this->latest_revision = $row['revision'];
$this->latest_revision_id = $row['document_revision_id'];
}
//populate the file url.
//image is selected based on the extension name <ext>_image_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($this->file_ext)) {
$img_name = SugarThemeRegistry::current()->getImageURL("{$this->file_ext}_image_inline.gif");
$img_name_bare = "{$this->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='" . UploadFile::get_url($this->filename, $this->id) . "' target='_blank'>" . SugarThemeRegistry::current()->getImage($img_name, 'alt="' . $mod_strings['LBL_LIST_VIEW_DOCUMENT'] . '" border="0"') . "</a>";
} else {
$this->file_url = "";
}
}
示例5: process_page
//.........这里部分代码省略.........
}
$history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => strtotime($email->fetched_row['date_sent'] . ' GMT'));
}
//end Emails
// Bug 46439 'No email archived when clicking on View Summary' (All condition)
if (method_exists($focus, 'get_unlinked_email_query')) {
$queryArray = $focus->get_unlinked_email_query(array('return_as_array' => 'true'));
$query = $queryArray['select'];
$query .= $queryArray['from'];
if (!empty($queryArray['join_tables'])) {
foreach ($queryArray['join_tables'] as $join_table) {
if ($join_table != '') {
$query .= ', ' . $join_table . ' ';
}
}
}
$query .= $queryArray['join'];
$query .= $queryArray['where'];
$emails = new Email();
$focus_unlinked_emails_list = $emails->process_list_query($query, 0);
$focus_unlinked_emails_list = $focus_unlinked_emails_list['list'];
foreach ($focus_unlinked_emails_list as $email) {
$email->retrieve($email->id);
$history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => strtotime($email->fetched_row['date_sent'] . ' GMT'));
}
}
//end Unlinked Emails
foreach ($focus_notes_list as $note) {
$history_list[] = array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified, 'description' => $this->formatDescription($note->description), 'date_type' => $app_strings['DATA_TYPE_MODIFIED'], 'sort_value' => strtotime($note->fetched_row['date_modified'] . ' GMT'));
if (!empty($note->filename)) {
$count = count($history_list);
$count--;
$history_list[$count]['filename'] = $note->filename;
$history_list[$count]['fileurl'] = UploadFile::get_url($note->filename, $note->id);
}
}
// end Notes
$xtpl = new XTemplate('modules/Activities/Popup_picker.html');
$xtpl->assign('MOD', $mod_strings);
$xtpl->assign('APP', $app_strings);
insert_popup_header();
//output header
echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>";
echo getClassicModuleTitle($focus->module_dir, array(translate('LBL_MODULE_NAME', $focus->module_dir), $focus->name), false);
echo "</td><td align='right' class='moduleTitle'>";
echo "<A href='javascript:print();' class='utilsLink'><img src='" . SugarThemeRegistry::current()->getImageURL("print.gif") . "' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a> <A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n";
echo "</td></tr></table>";
$oddRow = true;
if (count($history_list) > 0) {
$history_list = array_csort($history_list, 'sort_value', SORT_DESC);
}
foreach ($history_list as $activity) {
$activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], 'DESCRIPTION' => $activity['description'], 'DATE_TYPE' => $activity['date_type']);
if (empty($activity['direction'])) {
$activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']];
} else {
$activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']];
}
switch ($activity['type']) {
case 'Call':
$activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']];
break;
case 'Meeting':
$activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']];
break;
case 'Task':
示例6: get_image
$xtpl->assign("PARENT_MODULE", $focus->parent_type);
}
$xtpl->assign("CREATED_BY", $focus->created_by_name);
$xtpl->assign("MODIFIED_BY", $focus->modified_by_name);
$xtpl->assign("PARENT_NAME", $focus->parent_name);
$xtpl->assign("PARENT_ID", $focus->parent_id);
$xtpl->assign("NAME", $focus->name);
$xtpl->assign("DATE_MODIFIED", $focus->date_modified);
$xtpl->assign("DATE_ENTERED", $focus->date_entered);
global $current_user;
if (is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])) {
$xtpl->assign("ADMIN_EDIT", "<a href='index.php?action=index&module=DynamicLayout&from_action=" . $_REQUEST['action'] . "&from_module=" . $_REQUEST['module'] . "&record=" . $_REQUEST['record'] . "'>" . get_image($image_path . "EditLayout", "border='0' alt='Edit Layout' align='bottom'") . "</a>");
}
if (isset($focus->filename) && $focus->filename != '') {
global $sugar_config;
$save_file = urlencode(basename(UploadFile::get_url($focus->filename, $focus->id)));
$file_path = UploadFile::get_file_path($focus->filename, $focus->id);
$display = false;
if (file_exists($file_path)) {
$display = true;
$xtpl->assign("FILELINK", "<a href='download.php?id=" . $save_file . "&type=Notes' class='tabDetailViewDFLink'>" . $focus->filename . "</a> ");
}
if ($display) {
$xtpl->assign("SAVE_FILE", $save_file);
$xtpl->assign("FILE_NAME", $focus->filename);
}
}
$xtpl->assign("DESCRIPTION", nl2br(url2html($focus->description)));
$xtpl->parse("main.open_source");
$detailView->processListNavigation($xtpl, "NOTE", $offset);
// adding custom fields:
示例7: get_list_view_data
function get_list_view_data()
{
$note_fields = $this->get_list_view_array();
global $app_list_strings, $focus, $action, $currentModule, $mod_strings, $sugar_config;
$this->_create_proper_name_field();
if (isset($this->parent_type)) {
$note_fields['PARENT_MODULE'] = $this->parent_type;
}
if (!isset($this->filename) || $this->filename != '') {
$file_path = UploadFile::get_file_path($this->filename, $this->id);
if (file_exists($file_path)) {
$save_file = urlencode(basename(UploadFile::get_url($this->filename, $this->id)));
$note_fields['FILENAME'] = $this->filename;
$note_fields['FILE_URL'] = "index.php?entryPoint=download&id=" . $save_file . "&type=Notes";
}
}
if (isset($this->contact_name)) {
$note_fields['CONTACT_NAME'] = $this->contact_name;
}
global $current_language;
$mod_strings = return_module_language($current_language, 'Notes');
$note_fields['STATUS'] = $mod_strings['LBL_NOTE_STATUS'];
return $note_fields;
}
示例8: get_list_view_data
function get_list_view_data()
{
$note_fields = $this->get_list_view_array();
global $app_list_strings, $focus, $action, $currentModule, $mod_strings, $sugar_config;
$note_fields["DATE_MODIFIED"] = substr($note_fields["DATE_MODIFIED"], 0, 10);
if (isset($this->parent_type)) {
$note_fields['PARENT_MODULE'] = $this->parent_type;
}
if (!isset($this->filename) || $this->filename != '') {
$file_path = UploadFile::get_file_path($this->filename, $this->id);
if (file_exists($file_path)) {
$save_file = urlencode(basename(UploadFile::get_url($this->filename, $this->id)));
$note_fields['FILENAME'] = $this->filename;
$note_fields['FILE_URL'] = "download.php?id=" . $save_file . "&type=Notes";
}
}
global $current_language;
$mod_strings = return_module_language($current_language, 'Notes');
$note_fields['STATUS'] = $mod_strings['LBL_NOTE_STATUS'];
return $note_fields;
}
示例9: User
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
if (isset($_REQUEST['return_module'])) {
$xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
}
if (isset($_REQUEST['return_action'])) {
$xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
}
if (isset($_REQUEST['return_id'])) {
$xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
}
$xtpl->assign("THEME", $theme);
$xtpl->assign("IMAGE_PATH", $image_path);
$xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
$focus->fill_document_name_revision($focus->document_id);
$xtpl->assign("ID", $focus->id);
$xtpl->assign("DOCUMENT_NAME", $focus->name);
$xtpl->assign("CURRENT_REVISION", $focus->latest_revision);
$xtpl->assign("CHANGE_LOG", $focus->change_log);
$created_user = new User();
$created_user->retrieve($focus->created_by);
$xtpl->assign("CREATED_BY", $created_user->first_name . ' ' . $created_user->last_name);
$xtpl->assign("DATE_CREATED", $focus->date_entered);
$xtpl->assign("REVISION", $focus->revision);
$xtpl->assign("FILENAME", $focus->filename);
$xtpl->assign("FILE_NAME", $focus->filename);
$xtpl->assign("SAVE_FILE", $focus->id);
$xtpl->assign("FILE_URL", UploadFile::get_url($focus->filename, $focus->id));
$xtpl->assign("GRIDLINE", $gridline);
$xtpl->parse("main");
$xtpl->out("main");
示例10: getcwd
}
//rof
$merge_array['ids'] = $ids;
$dataDir = getcwd() . '/' . sugar_cached('MergedDocuments/');
if (!file_exists($dataDir)) {
sugar_mkdir($dataDir);
}
srand((double) microtime() * 1000000);
$mTime = microtime();
$dataFileName = 'sugardata' . $mTime . '.php';
write_array_to_file('merge_array', $merge_array, $dataDir . $dataFileName);
//Save the temp file so we can remove when we are done
$_SESSION['MAILMERGE_TEMP_FILE_' . $mTime] = $dataDir . $dataFileName;
$site_url = $sugar_config['site_url'];
//$templateFile = $site_url . '/' . UploadFile::get_upload_url($document);
$templateFile = $site_url . '/' . UploadFile::get_url(from_html($document->filename), $document->id);
$dataFile = $dataFileName;
$redirectUrl = 'index.php?action=index&step=5&module=MailMerge&mtime=' . $mTime;
$startUrl = 'index.php?action=index&module=MailMerge&reset=true';
$relModule = trim($relModule);
$contents = "SUGARCRM_MAIL_MERGE_TOKEN#{$templateFile}#{$dataFile}#{$module}#{$relModule}";
$rtfFileName = 'sugartokendoc' . $mTime . '.doc';
$fp = sugar_fopen($dataDir . $rtfFileName, 'w');
fwrite($fp, $contents);
fclose($fp);
$_SESSION['mail_merge_file_location'] = sugar_cached('MergedDocuments/') . $rtfFileName;
$_SESSION['mail_merge_file_name'] = $rtfFileName;
$xtpl->assign("MAILMERGE_FIREFOX_URL", $site_url . '/' . $GLOBALS['sugar_config']['cache_dir'] . 'MergedDocuments/' . $rtfFileName);
$xtpl->assign("MAILMERGE_START_URL", $startUrl);
$xtpl->assign("MAILMERGE_TEMPLATE_FILE", $templateFile);
$xtpl->assign("MAILMERGE_DATA_FILE", $dataFile);
示例11: empty
$attachments = '';
if (!empty($focus->id) || !empty($_REQUEST['record']) && $_REQUEST['type'] == 'forward') {
$focusId = empty($focus->id) ? $_REQUEST['record'] : $focus->id;
$note = new Note();
$where = "notes.parent_id='{$focusId}' AND notes.filename IS NOT NULL";
$notes_list = $note->get_full_list("", $where, true);
if (!isset($notes_list)) {
$notes_list = array();
}
for ($i = 0; $i < count($notes_list); $i++) {
$the_note = $notes_list[$i];
if (empty($the_note->filename)) {
continue;
}
$attachments .= '<input type="checkbox" name="remove_attachment[]" value="' . $the_note->id . '"> ' . $app_strings['LNK_REMOVE'] . ' ';
$attachments .= '<a href="' . UploadFile::get_url($the_note->filename, $the_note->id) . '" target="_blank">' . $the_note->filename . '</a><br>';
}
}
$attJs = '<script type="text/javascript">';
$attJs .= 'var file_path = "' . $sugar_config['site_url'] . '/' . $sugar_config['upload_dir'] . '";';
$attJs .= 'var lnk_remove = "' . $app_strings['LNK_REMOVE'] . '";';
$attJs .= '</script>';
$xtpl->assign('ATTACHMENTS', $attachments);
$xtpl->assign('ATTACHMENTS_JAVASCRIPT', $attJs);
//// END ATTACHMENTS
///////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// DOCUMENTS
$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();
$xtpl->assign('encoded_document_popup_request_data', $json->encode($popup_request_data));
示例12: getHistory
//.........这里部分代码省略.........
} else {
$open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START']);
}
}
// end Calls
foreach ($focus_emails_list as $email) {
if (empty($email->contact_id) && empty($email->contact_name)) {
$email_contacts = $email->get_linked_beans('contacts', 'Contact', array(), 0, 100);
if (!empty($email_contacts[0]->id) && !empty($email_contacts[0]->name)) {
$email->contact_id = $email_contacts[0]->id;
$email->contact_name = $email_contacts[0]->name;
}
}
$ts = '';
if (!empty($email->fetched_row['date_sent'])) {
//emails can have an empty date sent field
$ts = $timedate->fromDb($email->fetched_row['date_sent'])->ts;
}
$history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => $ts);
}
//end Emails
// Bug 46439 'No email archived when clicking on View Summary' (All condition)
if (method_exists($focus, 'get_unlinked_email_query')) {
$queryArray = $focus->get_unlinked_email_query(array('return_as_array' => 'true'));
$query = $queryArray['select'];
$query .= $queryArray['from'];
if (!empty($queryArray['join_tables'])) {
foreach ($queryArray['join_tables'] as $join_table) {
if ($join_table != '') {
$query .= ', ' . $join_table . ' ';
}
}
}
$query .= $queryArray['join'];
$query .= $queryArray['where'];
$emails = BeanFactory::getBean('Emails');
$focus_unlinked_emails_list = $emails->process_list_query($query, 0);
$focus_unlinked_emails_list = $focus_unlinked_emails_list['list'];
foreach ($focus_unlinked_emails_list as $email) {
$email->retrieve($email->id);
$history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => strtotime($email->fetched_row['date_sent'] . ' GMT'));
}
}
//end Unlinked Emails
foreach ($focus_notes_list as $note) {
if ($note->ACLAccess('view')) {
$history_list[] = array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified, 'description' => $this->formatDescription($note->description), 'date_type' => $app_strings['DATA_TYPE_MODIFIED'], 'sort_value' => strtotime($note->fetched_row['date_modified'] . ' GMT'));
if (!empty($note->filename)) {
$count = count($history_list);
$count--;
$history_list[$count]['filename'] = $note->filename;
$history_list[$count]['fileurl'] = UploadFile::get_url($note->filename, $note->id);
}
}
}
// end Notes
$oddRow = true;
$result = array();
if (count($history_list) > 0) {
$history_list = array_csort($history_list, 'sort_value', SORT_DESC);
}
foreach ($history_list as $activity) {
$activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], 'DESCRIPTION' => $activity['description'], 'DATE_TYPE' => $activity['date_type']);
if (empty($activity['direction'])) {
$activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']];
} else {
$activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']];
}
switch ($activity['type']) {
case 'Call':
$activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']];
break;
case 'Meeting':
$activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']];
break;
case 'Task':
$activity_fields['STATUS'] = $app_list_strings['task_status_dom'][$activity['status']];
break;
}
if (isset($activity['location'])) {
$activity_fields['LOCATION'] = $activity['location'];
}
if (isset($activity['filename'])) {
$activity_fields['ATTACHMENT'] = "<a href='index.php?entryPoint=download&id=" . $activity['id'] . "&type=Notes' target='_blank'>" . SugarThemeRegistry::current()->getImage("attachment", "border='0' align='absmiddle'", null, null, '.gif', $activity['filename']) . "</a>";
}
if (isset($activity['parent_type'])) {
$activity_fields['PARENT_MODULE'] = $activity['parent_type'];
}
$result[] = $activity;
}
if (isset($focus->name)) {
$name = $focus->name;
} else {
if ($focus->full_name) {
$name = $focus->full_name;
}
}
$response = array('module_key' => $focus->module_name, 'name' => $name, 'history' => $result);
return $response;
}
示例13: fill_in_additional_detail_fields
function fill_in_additional_detail_fields()
{
global $theme;
global $current_language;
global $timedate;
$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
$this->filename = $row['filename'];
$this->latest_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 = "themes/" . $theme . "/images/{$row['file_ext']}_image_inline.gif";
$img_name_bare = "{$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.
}
$this->file_url = "<a href='download.php?id=" . basename(UploadFile::get_url($this->filename, $this->document_revision_id)) . "&type=Documents' target='_blank'>" . get_image('themes/' . $theme . '/images/' . $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));
//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 = $row['first_name'] . ' ' . $row['last_name'];
$this->last_rev_create_date = $timedate->to_display_date_time($row['rev_date']);
}
}
示例14: process_page
/**
*
*/
function process_page()
{
global $theme;
global $focus;
global $mod_strings;
global $app_strings;
global $app_list_strings;
global $currentModule;
global $odd_bg;
global $even_bg;
global $image_path;
$theme_path = "themes/" . $theme . "/";
$image_path = 'themes/' . $theme . '/images/';
require_once $theme_path . 'layout_utils.php';
$history_list = array();
if (!empty($_REQUEST['record'])) {
$result = $focus->retrieve($_REQUEST['record']);
if ($result == null) {
sugar_die($app_strings['ERROR_NO_RECORD']);
}
}
if ($focus->object_name == "ProjectTask" || $focus->object_name == "Project") {
$focus_tasks_list = array();
} else {
$focus_tasks_list = $focus->get_linked_beans('tasks', 'Task');
}
$focus_meetings_list = $focus->get_linked_beans('meetings', 'Meeting');
$focus_calls_list = $focus->get_linked_beans('calls', 'Call');
$focus_emails_list = $focus->get_linked_beans('emails', 'Email');
$focus_notes_list = $focus->get_linked_beans('notes', 'Note');
foreach ($focus_tasks_list as $task) {
if ($task->date_due == '0000-00-00') {
$date_due = '';
} else {
$date_due = $task->date_due;
}
if ($task->status != "Not Started" && $task->status != "In Progress" && $task->status != "Pending Input") {
$history_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_modified' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => 'Due:');
} else {
$open_activity_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_due' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => 'Due:');
}
}
// end Tasks
foreach ($focus_meetings_list as $meeting) {
if ($meeting->status != "Planned") {
$history_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_modified' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => 'Start:');
} else {
$open_activity_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_due' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => 'Start:');
}
}
// end Meetings
foreach ($focus_calls_list as $call) {
if ($call->status != "Planned") {
$history_list[] = array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => 'Start:');
} else {
$open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => 'Start:');
}
}
// end Calls
foreach ($focus_emails_list as $email) {
$history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => 'Sent:');
}
//end Emails
foreach ($focus_notes_list as $note) {
$history_list[] = array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified, 'description' => $this->formatDescription($note->description), 'date_type' => 'Modified:');
if (!empty($note->filename)) {
$count = count($history_list);
$count--;
$history_list[$count]['filename'] = $note->filename;
$history_list[$count]['fileurl'] = UploadFile::get_url($note->filename, $note->id);
}
}
// end Notes
$xtpl = new XTemplate('modules/Activities/Popup_picker.html');
$xtpl->assign('THEME', $theme);
$xtpl->assign('MOD', $mod_strings);
$xtpl->assign('APP', $app_strings);
insert_popup_header($theme);
//output header
echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>";
echo get_module_title($focus->module_dir, $focus->module_dir . ": " . $focus->name, false);
echo "</td><td align='right' class='moduleTitle'>";
echo "<A href='javascript:print();' class='utilsLink'><img src='" . $image_path . "print.gif' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a> <A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n";
echo "</td></tr></table>";
$oddRow = true;
if (count($history_list) > 0) {
$history_list = array_csort($history_list, 'date_modified', SORT_DESC);
}
foreach ($history_list as $activity) {
$activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], 'DESCRIPTION' => $activity['description'], 'DATE_TYPE' => $activity['date_type']);
if (empty($activity['direction'])) {
$activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']];
} else {
$activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']];
}
switch ($activity['type']) {
case 'Call':
//.........这里部分代码省略.........
示例15: process_page
//.........这里部分代码省略.........
//$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true);
} elseif (!empty($call->date_start) && empty($call->time_start)) {
//jc - Bug#19862
//for some reason the calls module does not populate the time_start variable in
//this case, so the date_start attribute contains the information we need
//to determine where in the history this call belongs.
//using swap_formats to get from the format '03/31/2008 09:45pm' to the format
//'2008-03-31 09:45:00'
$sort_date_time = $timedate->swap_formats($call->date_start, $timedate->get_date_time_format(), $timedate->get_db_date_time_format());
}
$history_list[] = array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => $sort_date_time);
} else {
$open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START']);
}
}
// end Calls
foreach ($focus_emails_list as $email) {
$sort_date_time = '';
if (!empty($email->date_start) and !empty($email->time_start)) {
$sort_date_time = $timedate->to_db_date_time($email->date_start, $email->time_start);
$sort_date_time = implode(' ', $sort_date_time);
// kbrill - Bug #16714
//$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true);
}
$history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => $sort_date_time);
}
//end Emails
foreach ($focus_notes_list as $note) {
if (!empty($note->date_modified)) {
$sort_date_time = $timedate->swap_formats($note->date_modified, $timedate->get_date_time_format(), $timedate->get_db_date_time_format());
}
$history_list[] = array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified, 'description' => $this->formatDescription($note->description), 'date_type' => $app_strings['DATA_TYPE_MODIFIED'], 'sort_value' => $sort_date_time);
if (!empty($note->filename)) {
$count = count($history_list);
$count--;
$history_list[$count]['filename'] = $note->filename;
$history_list[$count]['fileurl'] = UploadFile::get_url($note->filename, $note->id);
}
}
// end Notes
$xtpl = new XTemplate('modules/Activities/Popup_picker.html');
$xtpl->assign('MOD', $mod_strings);
$xtpl->assign('APP', $app_strings);
insert_popup_header();
//output header
echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>";
echo get_module_title($focus->module_dir, translate('LBL_MODULE_NAME', $focus->module_dir) . ": " . $focus->name, false);
echo "</td><td align='right' class='moduleTitle'>";
echo "<A href='javascript:print();' class='utilsLink'><img src='" . SugarThemeRegistry::current()->getImageURL("print.gif") . "' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a> <A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n";
echo "</td></tr></table>";
$oddRow = true;
if (count($history_list) > 0) {
$history_list = array_csort($history_list, 'sort_value', SORT_DESC);
}
foreach ($history_list as $activity) {
$activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], 'DESCRIPTION' => $activity['description'], 'DATE_TYPE' => $activity['date_type']);
if (empty($activity['direction'])) {
$activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']];
} else {
$activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']];
}
switch ($activity['type']) {
case 'Call':
$activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']];
break;
case 'Meeting':
$activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']];
break;
case 'Task':
$activity_fields['STATUS'] = $app_list_strings['task_status_dom'][$activity['status']];
break;
}
if (isset($activity['location'])) {
$activity_fields['LOCATION'] = $activity['location'];
}
if (isset($activity['filename'])) {
$activity_fields['ATTACHMENT'] = "<a href='index.php?entryPoint=download&id=" . $activity['id'] . "&type=Notes' target='_blank'>" . SugarThemeRegistry::current()->getImage("attachment", "alt='" . $activity['filename'] . "' border='0' align='absmiddle'") . "</a>";
}
if (isset($activity['parent_type'])) {
$activity_fields['PARENT_MODULE'] = $activity['parent_type'];
}
$xtpl->assign("ACTIVITY", $activity_fields);
$xtpl->assign("ACTIVITY_MODULE_PNG", SugarThemeRegistry::current()->getImage($activity_fields['MODULE'] . '', 'border="0" alt="' . $activity_fields['NAME'] . '"'));
if ($oddRow) {
//todo move to themes
$xtpl->assign("ROW_COLOR", 'oddListRow');
$xtpl->assign("BG_COLOR", $odd_bg);
} else {
//todo move to themes
$xtpl->assign("ROW_COLOR", 'evenListRow');
$xtpl->assign("BG_COLOR", $even_bg);
}
$oddRow = !$oddRow;
$xtpl->parse("history.row");
// Put the rows in.
}
$xtpl->parse("history");
$xtpl->out("history");
insert_popup_footer();
}