⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 templates_calendar.php

📁 开源的CRM,功能全面,国内最优秀的源码
💻 PHP
📖 第 1 页 / 共 3 页
字号:
			$link .= '</a>';
			$contacts = array();
			if (!empty($cell['data']->sugar_bean->contact_id))
				$contacts[$cell['data']->sugar_bean->contact_id] = $cell['data']->sugar_bean->contact_name;
		}
		
		echo '<td height="100%" class="dailyCalBodyItems" width="' . $percentage . '%" rowspan=' . $cell['rowspan'] . '>';
		echo '<table border="0" cellpadding="1" cellspacing="0" class="monthCalBodyDayItem" height="100%" width="100%">';
		echo '<tr valign="top"><td width="1%" class="monthCalBodyDayIconTd">';
		echo $image . '</td><td class="monthCalBodyDayItemTd" width="100%">' . $link;
		
		// Now for the contacts
		if (count($contacts) > 0) {
			echo '&nbsp;&nbsp; ' . $app_strings['LBL_CONTACTS'] .':';
			$x = 0;
			foreach ($contacts as $contact_id => $contact_name) {
				echo ($x == 0 ? '' : ',');
				echo '&nbsp;<a  class="monthCalBodyDayItemLink" href="index.php?module=Contacts&action=DetailView&record=' . $contact_id . '">' . $contact_name . '</a>';
				$x++;
			}
		}
		
		echo '</td></tr></table>';
		echo '</td>';
	}
}
// calmod - end added


function template_calendar_vertical(& $args) {
?>
  <table id="daily_cal_table" border="0" cellpadding="0" cellspacing="1" width="100%">
  <?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;
	for ($cur_slice_idx = $start_slice_idx; $cur_slice_idx <= $end_slice_idx; $cur_slice_idx ++) {
		$calendar = $args['calendar'];
		$args['slice'] = $calendar->slice_hash[$calendar->slices_arr[$cur_slice_idx]];
?>
  <tr>
  <?php template_cal_vertical_slice($args); ?>
  </tr>
  <?php

	}
?>
  </table>
<?php

}

function template_calendar_horizontal(& $args) {
	echo "<table id=\"daily_cal_table\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"100%\"><tr>";

	// 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;
	for ($cur_slice_idx = $start_slice_idx; $cur_slice_idx <= $end_slice_idx; $cur_slice_idx ++) {
		$calendar = $args['calendar'];
		$args['slice'] = $calendar->slice_hash[$calendar->slices_arr[$cur_slice_idx]];

		template_cal_horizontal_slice($args);
	}

	echo "</tr></table>";
}

function template_cal_vertical_slice(& $args) {
	global $timedate;
?>
<td width="1%" class="dailyCalBodyTime" id="bodytime" scope='row'>
<?php template_echo_slice_date($args) ; ?>

</td>
<td width="99%" class="dailyCalBodyItems" id="bodyitem">

<div style="display:none;" id='<?php echo template_echo_daily_view_24_hour($args); ?>_appt'> <?php

	require_once ('modules/Calls/CallFormBase.php');
	$callForm = new CallFormBase();
	echo $callForm->getFormBody('', 'Calls', 'inlineCal'.template_echo_daily_view_24_hour($args).'CallSave', $timedate->to_display_date($args['calendar']->date_time->get_mysql_date(), false), $timedate->to_display_time(template_echo_daily_view_24_hour($args).':00:00', true, false))."<br>";
?></div>

<?php template_echo_slice_activities($args); ?>
</td>
<?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) {
	$slice = $args['slice'];
	if ($slice->start_time->get_mysql_date() == date('Y-m-d')) {
		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;
	$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 "&nbsp;";
		echo $slice->start_time->get_day();
	}
	elseif ($args['calendar']->view == 'shared') {
		echo "class='monthCalBodyWeekDayDateLink'>";
		echo $slice->start_time->get_day_of_week_short();
		echo "&nbsp;";
		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">';
					}
					
					
				/* calmod - removed
					if ($args['calendar']->use_24) {
						echo $slice->start_time->get_24_hour();
						echo ":00";
					} else {
						echo $slice->start_time->get_hour();
						echo ":00";
						echo "&nbsp;".$mod_strings['LBL_'.$slice->start_time->get_am_pm()];
					}
				*/
				// calmod - start added
					echo date($args['calendar']->timeFormat, $slice->start_time->ts);
				}
				else if($slice->view == 'subhour') {
					$user_time = date($args['calendar']->timeFormat, $slice->start_time->ts);
					echo "<a href=\"#\" onclick=\"return showPopupBooking(event, '$user_time');\" class='weekCalBodyDayLink'>";
					echo $user_time;
				// calmod - end added
				
				
				} 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 "&nbsp;";
	echo $slice->start_time->get_day();
}

function template_echo_date_info($view, $date_time) {
	global $mod_strings;
	if ($view == 'month') {
		echo $date_time->year.$mod_strings['LBL_YEAR'];
		echo $date_time->get_month_name();
		
	} 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);
			echo $first_day->year.$mod_strings['LBL_YEAR'];
			echo $first_day->get_month_name();
			echo $first_day->get_day().$mod_strings['LBL_HAO'];
			echo " - ";
			echo $last_day->year.$mod_strings['LBL_YEAR'];
			echo $last_day->get_month_name();
			echo $last_day->get_day().$mod_strings['LBL_HAO'];
			
			
		} else
			if ($view == 'day') {
			    echo $date_time->year.$mod_strings['LBL_YEAR'];
				echo $date_time->get_month_name();
				echo $date_time->get_day().$mod_strings['LBL_HAO']." ";
				echo $date_time->get_day_of_week();
			} else
				if ($view == 'year') {
					echo $date_time->year.$mod_strings['LBL_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)]; ?>&nbsp;<?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"'); ?>&nbsp;&nbsp;<?php echo $mod_strings["LBL_PREVIOUS_".$args['calendar']->get_view_name($args['calendar']->view)]; ?></a>
<?php

}
?>

⌨️ 快捷键说明

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