templates_calendar.php
来自「SugarCRM5.1 开源PHP客户关系管理系统」· PHP 代码 · 共 962 行 · 第 1/3 页
PHP
962 行
<?php}function template_cal_horizontal_slice(& $args) { echo "<td width=\"14%\" class=\"dailyCalBodyItems\" id=\"bodyItem\" scope='row' valign=\"top\">"; if($args['show_link'] == 'on') { template_echo_slice_date($args); } else { template_echo_slice_date_nolink($args); } template_echo_slice_activities_shared($args); echo "</td>";}function template_calendar_year(& $args) { $count = 0;?><table cellspacing="0" cellpadding="0" border="0" width="100%"><tr> <td class="yearCalBody"> <table id="daily_cal_table" border="0" cellpadding="0" cellspacing="1" width="100%"><?php for($i = 0; $i < 4; $i ++) {?><tr><?php for($j = 0; $j < 3; $j ++) { $args['slice'] = $args['calendar']->slice_hash[$args['calendar']->slices_arr[$count]];?><td valign="top" align="center" scope='row' class="yearCalBodyMonth"><?php template_cal_month_slice($args); ?></td><?php $count ++; }?></tr><?php }?></table></td></tr></table><?php}function template_calendar_month(& $args) { global $mod_strings;?><table width="100%" id="daily_cal_table" border="0" cellspacing="1" cellpadding="0" > <?php // need to change these values after we find out what activities // occur outside of these values /* $start_slice_idx = $args['calendar']->get_start_slice_idx(); $end_slice_idx = $args['calendar']->get_end_slice_idx(); $cur_slice_idx = 1; */ $count = 0; if($args['calendar']->slice_hash[$args['calendar']->slices_arr[35]]->start_time->month != $args['calendar']->date_time->month) { $rows = 5; } else { $rows = 6; }?><tr><?php if($args['calendar']->show_week_on_month_view ) { ?><th width="1%" class="monthCalBodyTHWeek" scope='col'><?php echo $mod_strings['LBL_WEEK']; ?></th><?php } ?><?php for($i = 0; $i < 7; $i ++) { $first_row_slice = $args['calendar']->slice_hash[$args['calendar']->slices_arr[$i]];?><th width="14%" class="monthCalBodyTHDay" scope='col' ><?php echo $first_row_slice->start_time->get_day_of_week_short(); ?></th><?php }?></tr><?php if(isset($_REQUEST['view']) && $_REQUEST['view'] == 'month') { $height_class = "monthViewDayHeight"; } else if(isset($args['size']) && $args['size'] == 'small') { $height_class = ""; } else { $height_class = "yearViewDayHeight"; } for($i = 0; $i < $rows; $i ++) {?><tr class="<?php echo $height_class; ?>"><?php if($args['calendar']->show_week_on_month_view ) { ?><td valign=middle align=center class="monthCalBodyWeek" scope='row'><a href="index.php?module=Calendar&action=index&view=week&<?php echo $args['calendar']->slice_hash[$args['calendar']->slices_arr[$count]]->start_time->get_date_str(); ?>" class="monthCalBodyWeekLink"><?php echo $args['calendar']->slice_hash[$args['calendar']->slices_arr[$count + 1]]->start_time->week; ?></a></td><?php } ?><?php for($j = 0; $j < 7; $j ++) { $args['slice'] = $args['calendar']->slice_hash[$args['calendar']->slices_arr[$count]];?><td valign=top <?php if($j==0)echo "scope='row' ";?> class="<?php if($j==0 || $j==6) { ?>monthCalBody<?php if(get_current_day($args) == true) {echo "Today"; }?>WeekEnd<?php } else { ?>monthCalBody<?php if(get_current_day($args) == true) {echo "Today"; }?>WeekDay<?php } ?>"><?php template_cal_day_slice($args); ?></td><?php $count ++; }?></tr><?php }?></table><?php}function get_current_day(& $args) { global $timedate; static $user_today_timestamp = null; // adjust for user's TZ if(!isset($user_today_timestamp)) { $gmt_today = $timedate->get_gmt_db_datetime(); $user_today = $timedate->handle_offset($gmt_today, 'Y-m-d H:i:s'); preg_match_all('/\d*/', $user_today, $matches); $matches = $matches[0]; $user_today_timestamp = mktime($matches[6], $matches[8], '0', $matches[2], $matches[4], $matches[0]); } $slice = $args['slice']; if($slice->start_time->get_mysql_date() == date('Y-m-d', $user_today_timestamp)) { return true; }}function template_echo_daily_view_hour(& $args) { $slice = $args['slice']; $hour = $slice->start_time->get_hour(); return $hour;}function template_echo_daily_view_24_hour(& $args) { $slice = $args['slice']; $hour = $slice->start_time->get_24_hour(); return $hour;}function template_echo_slice_date(& $args) { global $mod_strings; global $timedate; $slice = $args['slice']; if($slice->view != 'hour') { if($slice->start_time->get_day_of_week_short() == 'Sun' || $slice->start_time->get_day_of_week_short() == 'Sat') { echo "<a href=\"index.php?module=Calendar&action=index&view=".$slice->get_view()."&".$slice->start_time->get_date_str()."\" "; } else { echo "<a href=\"index.php?module=Calendar&action=index&view=".$slice->get_view()."&".$slice->start_time->get_date_str()."\" "; } } if($slice->view == 'day' &&($args['calendar']->view == 'week')) { echo "class='weekCalBodyDayLink'>"; echo $slice->start_time->get_day_of_week_short(); echo " "; echo $slice->start_time->get_day(); } elseif($args['calendar']->view == 'shared') { echo "class='monthCalBodyWeekDayDateLink'>"; echo $slice->start_time->get_day_of_week_short(); echo " "; echo $slice->start_time->get_day(); } else if($slice->view == 'day') { echo "class='monthCalBodyWeekDayDateLink'>"; if($slice->start_time->get_month() == $args['calendar']->date_time->get_month()) { echo $slice->start_time->get_day(); } //echo $slice->start_time->get_day(); } else if($slice->view == 'month') { echo "class='yearCalBodyMonthLink'>"; echo $slice->start_time->get_month_name(); } else if($slice->view == 'hour') { if($args['calendar']->toggle_appt == true) { echo '<a href="javascript:void toggleDisplay(\''.$slice->start_time->get_24_hour().'_appt\');" class="weekCalBodyDayLink">'; } //Bug 13324, We are now using the users time format instead of a custom AM/PM setting echo $timedate->to_display_time($slice->start_time->get_24_hour() . ":00:00", true, false); } else { sugar_die("template_echo_slice_date: view not supported"); } echo "</a>";}function template_echo_slice_date_nolink(& $args) { global $mod_strings; $slice = $args['slice']; echo $slice->start_time->get_day_of_week_short(); echo " "; echo $slice->start_time->get_day();}function template_echo_date_info($view, $date_time) { global $current_user; $dateFormat = $current_user->getUserDateTimePreferences(); if($view == 'month') { for($i=0; $i<strlen($dateFormat['date']); $i++) { switch($dateFormat['date']{$i}) { case "Y": echo " ".$date_time->year; break; case "m": echo " ".$date_time->get_month_name(); break; } } } else if($view == 'week' || $view == 'shared') { $first_day = $date_time->get_day_by_index_this_week(0); $last_day = $date_time->get_day_by_index_this_week(6); for($i=0; $i<strlen($dateFormat['date']); $i++) { switch($dateFormat['date']{$i}) { case "Y": echo " ".$first_day->year; break; case "m": echo " ".$first_day->get_month_name(); break; case "d": echo " ".$first_day->get_day(); break; } } echo " - "; for($i=0; $i<strlen($dateFormat['date']); $i++) { switch($dateFormat['date']{$i}) { case "Y": echo " ".$last_day->year; break; case "m": echo " ".$last_day->get_month_name(); break; case "d": echo " ".$last_day->get_day(); break; } } } else if($view == 'day') { echo $date_time->get_day_of_week()." "; for($i=0; $i<strlen($dateFormat['date']); $i++) { switch($dateFormat['date']{$i}) { case "Y": echo " ".$date_time->year; break; case "m": echo " ".$date_time->get_month_name(); break; case "d": echo " ".$date_time->get_day(); break; } } } else if($view == 'year') { echo $date_time->year; } else { sugar_die("echo_date_info: date not supported"); }}function template_get_next_calendar(& $args) { global $image_path; global $mod_strings;?><a href="index.php?action=index&module=Calendar&view=<?php echo $args['calendar']->view; ?>&<?php echo $args['calendar']->get_next_date_str(); ?>" class="NextPrevLink"><?php echo $mod_strings["LBL_NEXT_".$args['calendar']->get_view_name($args['calendar']->view)]; ?> <?php echo get_image($image_path.'calendar_next','alt="'. $mod_strings["LBL_NEXT_".$args['calendar']->get_view_name($args['calendar']->view)].'" align="absmiddle" border="0"'); ?></a><?php}function template_get_previous_calendar(& $args) { global $mod_strings; global $image_path;?><a href="index.php?action=index&module=Calendar&view=<?php echo $args['calendar']->view; ?>&<?php echo $args['calendar']->get_previous_date_str(); ?>" class="NextPrevLink"><?php echo get_image($image_path.'calendar_previous','alt="'. $mod_strings["LBL_PREVIOUS_".$args['calendar']->get_view_name($args['calendar']->view)].'" align="absmiddle" border="0"'); ?> <?php echo $mod_strings["LBL_PREVIOUS_".$args['calendar']->get_view_name($args['calendar']->view)]; ?></a><?php}?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?