📄 templates_calendar.php
字号:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version
* 1.1.3 ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/////////////////////////////////
// template
/////////////////////////////////
global $timedate;
function template_cal_tabs(& $args) {
global $mod_strings, $sugar_version, $sugar_config;
$tabs = array ('day', 'week', 'month', 'year', 'shared');
$other_class = 'button';
$sel_class = 'buttonOn';
if($args['view'] != 'day') {
echo '<script type="text/javascript" src="include/javascript/overlibmws.js?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '"></script>
<script type="text/javascript" src="include/javascript/overlibmws_iframe.js?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '"></script>
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>';
}
?>
<table id="cal_tabs" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="padding-bottom: 2px;">
<?php
$bg = $other_class;
$time_arr = array ();
foreach ($tabs as $tab) {
if ($args['view'] == $tab) {
$bg = $sel_class;
} else {
$bg = $other_class;
}
?>
<input onclick="window.location.href='index.php?module=Calendar&action=index&view=<?php echo $tab; ?><?php echo $args['calendar']->date_time->get_date_str(); ?>'" type="button" class="<?php echo $bg; ?>" value=" <?php echo $mod_strings["LBL_".$args['calendar']->get_view_name($tab)]; ?> " title="<?php echo $mod_strings["LBL_".$args['calendar']->get_view_name($tab)]; ?>"></a>
<?php } ?>
</td>
</tr>
</table>
<?php
}
/////////////////////////////////
// template
/////////////////////////////////
function template_cal_month_slice(& $args) {
?>
<?php
template_echo_slice_date($args);
$newargs = array ();
$cal_arr = array ();
$cal_arr['month'] = $args['slice']->start_time->month;
$cal_arr['year'] = $args['slice']->start_time->year;
$newargs['calendar'] = new Calendar('month', $cal_arr);
$newargs['calendar']->show_only_current_slice = true;
$newargs['calendar']->show_activities = false;
$newargs['calendar']->show_week_on_month_view = false;
template_calendar_month($newargs);
?>
<?php
}
/////////////////////////////////
// template
/////////////////////////////////
function template_echo_slice_activities(& $args) {
global $app_list_strings, $image_path, $current_user, $app_strings, $theme;
$count = 0;
if (empty ($args['slice']->acts_arr[$current_user->id])) {
return;
}
foreach ($args['slice']->acts_arr[$current_user->id] as $act) {
$fields = array();
foreach($act->sugar_bean->field_name_map as $field) {
if(!empty($act->sugar_bean->$field['name']))
$fields[strtoupper($field['name'])] = $act->sugar_bean->$field['name'];
}
if($act->sugar_bean->ACLAccess('DetailView') && file_exists('modules/' . $act->sugar_bean->module_dir . '/metadata/additionalDetails.php')) {
require_once('modules/' . $act->sugar_bean->module_dir . '/metadata/additionalDetails.php');
$ad_function = 'additionalDetails' . $act->sugar_bean->object_name;
$results = $ad_function($fields);
$results['string'] = str_replace(array("'", "'"), '\'', $results['string']); // no xss!
if(trim($results['string']) == '') $results['string'] = $app_strings['LBL_NONE'];
}
$extra = "onmouseover=\"return overlib('" .
str_replace(array("\rn", "\r", "\n"), array('','','<br />'), $results['string'])
. "', CAPTION, '{$app_strings['LBL_ADDITIONAL_DETAILS']}"
. "', DELAY, 200, STICKY, MOUSEOFF, 1000, WIDTH, "
. (empty($results['width']) ? '300' : $results['width'])
. ", CLOSETEXT, '<img border=0 src={$image_path}close_inline.gif>', "
. "CLOSETITLE, '{$app_strings['LBL_ADDITIONAL_DETAILS_CLOSE_TITLE']}', CLOSECLICK, FGCLASS, 'olFgClass', "
. "CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass');\" "
. "onmouseout=\"return nd(1000);\" ";
$count ++;
echo '<div style="margin-top: 1px;"><table cellpadding="0" cellspacing="0"
border="0" width="100%" class="monthCalBodyDayItem"><tr>';
if ($act->sugar_bean->object_name == 'Call') {
echo '<td class="monthCalBodyDayIconTd">' . get_image($image_path.'Calls','alt="'.$app_list_strings['call_status_dom'][$act->sugar_bean->status].': '.$act->sugar_bean->name.'"') . '</td>
<td class="monthCalBodyDayItemTd" width="100%"><a ' . $extra . ' href="index.php?module=Calls&action=DetailView&record=' .
$act->sugar_bean->id . '" class="monthCalBodyDayItemLink">' . $app_list_strings['call_status_dom'][$act->sugar_bean->status] . ': ' . $act->sugar_bean->name . '</a></td>';
} else if ($act->sugar_bean->object_name == 'Meeting') {
echo '<td class="monthCalBodyDayIconTd">' . get_image($image_path.'Meetings','alt="'.$app_list_strings['meeting_status_dom'][$act->sugar_bean->status].': '.$act->sugar_bean->name.'"') . '</td>
<td class="monthCalBodyDayItemTd" width="100%"><a ' . $extra . ' href="index.php?module=Meetings&action=DetailView&record=' .
$act->sugar_bean->id . '" class="monthCalBodyDayItemLink">' . $app_list_strings['meeting_status_dom'][$act->sugar_bean->status] . ': ' . $act->sugar_bean->name .'</a></td>';
} else if ($act->sugar_bean->object_name == 'Task') {
echo '<td class="monthCalBodyDayIconTd">' . get_image($image_path.'Tasks','alt="'.$act->sugar_bean->status.': '.$act->sugar_bean->name.'"') . '</td>
<td class="monthCalBodyDayItemTd" width="100%"><a ' . $extra . ' href="index.php?module=Tasks&action=DetailView&record=' . $act->sugar_bean->id . '" class="monthCalBodyDayItemLink">'.$act->sugar_bean->status.': ' . $act->sugar_bean->name . '</a></td>';
}
echo '</tr></table><div>';
}
}
function template_echo_slice_activities_shared(& $args) {
global $app_list_strings;
global $image_path;
global $shared_user, $timedate;
$count = 0;
if (empty ($args['slice']->acts_arr[$shared_user->id])) {
return;
}
foreach ($args['slice']->acts_arr[$shared_user->id] as $act) {
$count ++;
echo "<div style=\"margin-top: 1px;\">
<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" class=\"monthCalBodyDayItem\">";
if($act->sugar_bean->object_name == 'Call') {
echo "<tr><td class=\"monthCalBodyDayIconTd\">";
get_image($image_path.'Calls','alt=\"'.$app_list_strings['call_status_dom'][$act->sugar_bean->status].': '.$act->sugar_bean->name.'\"');
echo "</td>";
if(empty($act->sugar_bean->name)) {
echo "<td class=\"monthCalBodyDayItemTd\" width=\"100%\">";
echo $timedate->to_display_time($act->sugar_bean->time_start, false, false);
echo "</td></tr>";
} else {
echo "<td class=\"monthCalBodyDayItemTd\" width=\"100%\">
<a href=\"index.php?module=Calls&action=DetailView&record=".
$act->sugar_bean->id."\" class=\"monthCalBodyDayItemLink\">".
$app_list_strings['call_status_dom'][$act->sugar_bean->status].":".
$act->sugar_bean->name."(".
$timedate->to_display_time($act->sugar_bean->time_start, false, false)."
)</a></td></tr>";
}
} else if ($act->sugar_bean->object_name == 'Meeting') {
echo "<td class=\"monthCalBodyDayIconTd\">".
get_image($image_path.'Meetings','alt=\"'.$app_list_strings['meeting_status_dom'][$act->sugar_bean->status].': '.$act->sugar_bean->name.'\"');
echo "</td>";
if (empty($act->sugar_bean->name)) {
echo "<td class=\"monthCalBodyDayItemTd\" width=\"100%\">".
$timedate->to_display_time($act->sugar_bean->time_start, true, false);
echo "</td></tr>";
} else {
echo "<td class=\"monthCalBodyDayItemTd\" width=\"100%\">
<a href=\"index.php?module=Meetings&action=DetailView&record=".
$act->sugar_bean->id."\" class=\"monthCalBodyDayItemLink\">".
$app_list_strings['meeting_status_dom'][$act->sugar_bean->status].":".
$act->sugar_bean->name."(".
$timedate->to_display_time($act->sugar_bean->time_start, true, false).")
</a></td></tr>";
}
} else if ($act->sugar_bean->object_name == 'Task') {
echo "<td class=\"monthCalBodyDayIconTd\">".
get_image($image_path.'Tasks','alt="'.$act->sugar_bean->status.': '.$act->sugar_bean->name.'"');
echo "</td>";
if (empty($act->sugar_bean->name)) {
echo "<td class=\"monthCalBodyDayItemTd\" width=\"100%\">".
$timedate->to_display_time($act->sugar_bean->time_due, true, false);
echo "</td></tr>";
} else {
echo "<td class=\"monthCalBodyDayItemTd\" width=\"100%\">
<a href=\"index.php?module=Meetings&action=DetailView&record=".
$act->sugar_bean->id."\" class=\"monthCalBodyDayItemLink\">".
$act->sugar_bean->status.': '.$act->sugar_bean->name."(".
$timedate->to_display_time($act->sugar_bean->time_due, true, false).")
</a></td></tr>";
}
}
echo "</table><div>";
}
}
/////////////////////////////////
// template
/////////////////////////////////
function template_cal_day_slice(& $args) {
/*
echo "cale:".$args['calendar']->view;
echo "cal1:".$args['calendar']->date_time->month;
echo "cal3:".$args['slice']->date_time->month;
*/
if ($args['calendar']->show_only_current_slice == false || $args['calendar']->date_time->month == $args['slice']->start_time->month) {
template_echo_slice_date($args);
if ($args['calendar']->show_activities == true) {
template_echo_slice_activities($args);
}
}
}
/////////////////////////////////
// template
/////////////////////////////////
function template_calendar(& $args) {
global $timedate;
if (isset ($args['size']) && $args['size'] = 'small') {
$args['calendar']->show_activities = false;
$args['calendar']->show_week_on_month_view = false;
}
$newargs = array ();
$newargs['view'] = $args['view'];
$newargs['calendar'] = $args['calendar'];
if (!isset ($args['size']) || $args['size'] != 'small') {
template_cal_tabs($newargs);
}
if (isset ($_REQUEST['view']) && $_REQUEST['view'] == 'shared') {
global $ids;
global $current_user;
global $mod_strings;
global $app_list_strings, $current_language, $currentModule, $action, $theme, $image_path, $app_strings;
$current_module_strings = return_module_language($current_language, 'Calendar');
$ids = array ();
$user_ids = $current_user->getPreference('shared_ids');
//get list of user ids for which to display data
if (!empty ($user_ids) && count($user_ids) != 0 && !isset ($_REQUEST['shared_ids'])) {
$ids = $user_ids;
}
elseif (isset ($_REQUEST['shared_ids']) && count($_REQUEST['shared_ids']) > 0) {
$ids = $_REQUEST['shared_ids'];
$current_user->setPreference('shared_ids', $_REQUEST['shared_ids']);
} else {
$ids = get_user_array(false);
$ids = array_keys($ids);
}
//get team id for which to display user list
$team = $current_user->getPreference('team_id');
if (!empty ($team) && !isset ($_REQUEST['team_id'])) {
$team_id = $team;
}
elseif (isset ($_REQUEST['team_id'])) {
$team_id = $_REQUEST['team_id'];
$current_user->setPreference('team_id', $_REQUEST['team_id']);
} else {
$team_id = '';
}
if (empty ($_SESSION['team_id'])) {
$_SESSION['team_id'] = "";
}
$tools = '<div align="right"><a href="index.php?module='.$currentModule.'&action='.$action.'&view=shared" class="chartToolsLink"> <a href="javascript: toggleDisplay(\'shared_cal_edit\');" class="chartToolsLink">'.get_image($image_path.'edit', 'alt="Edit" border="0" align="absmiddle"').' '.$current_module_strings['LBL_EDIT'].'</a></div>';
echo get_form_header($mod_strings['LBL_SHARED_CAL_TITLE'], $tools, false);
if (empty ($_SESSION['shared_ids']))
$_SESSION['shared_ids'] = "";
echo "
<script language=\"javascript\">
function up(name) {
var td = document.getElementById(name+'_td');
var obj = td.getElementsByTagName('select')[0];
obj = (typeof obj == \"string\") ? document.getElementById(obj) : obj;
if (obj.tagName.toLowerCase() != \"select\" && obj.length < 2)
return false;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -