templates_calendar.php

来自「SugarCRM5.1 开源PHP客户关系管理系统」· PHP 代码 · 共 962 行 · 第 1/3 页

PHP
962
字号
<?phpif(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');/********************************************************************************* * SugarCRM is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc. *  * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation with the addition of the following permission added * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. *  * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more * details. *  * You should have received a copy of the GNU General Public License along with * this program; if not, see http://www.gnu.org/licenses or write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA. *  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. *  * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. *  * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * SugarCRM" logo. If the display of the logo is not reasonably feasible for * technical reasons, the Appropriate Legal Notices must display the words * "Powered by SugarCRM". ********************************************************************************//////////////////////////////////// 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="' . getJSPath('include/javascript/sugar_grp_overlib.js') . '"></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>&nbsp;<?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("&#039", "'"), '\&#039', $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  style=\'margin-left:2px; margin-right: 2px;\' src={$image_path}close.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') { 				$out = '<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>';								///////////////////////////////////////////////////////////////				////	MEETING INTEGRATION				if(method_exists($act->sugar_bean, 'hasIntegratedMeeting')) {					if($act->sugar_bean->hasIntegratedMeeting()) {						$out .= $act->sugar_bean->miIcon;					}				}				////	END MEETING INTEGRATION				///////////////////////////////////////////////////////////////				$out .= "</td>";				echo $out;							} 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;		}				$out = '';				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, true, 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, true, 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."<br>(".						$timedate->to_display_time($act->sugar_bean->time_start, true, false).")						</a>";											// MEETING INTEGRATION					if($act->sugar_bean->hasIntegratedMeeting()) {						$out .= $act->sugar_bean->miIcon;					}					// END MEETING INTEGRATION					$out .= "</td></tr>";					echo $out;				}			} 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=Tasks&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);				$ids = array($current_user->id);							}			//get team id for which to display user list

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?