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

📄 templates_calendar.php

📁 开源的CRM,功能全面,国内最优秀的源码
💻 PHP
📖 第 1 页 / 共 3 页
字号:
					if (obj[i].selected == true) {
						sel[sel.length] = i;
					}
				}
				for (i in sel) {
					if (sel[i] != obj.length-1 && !obj[sel[i]+1].selected) {
						var tmp = new Array(obj[sel[i]+1].text, obj[sel[i]+1].value);
						obj[sel[i]+1].text = obj[sel[i]].text;
						obj[sel[i]+1].value = obj[sel[i]].value;
						obj[sel[i]].text = tmp[0];
						obj[sel[i]].value = tmp[1];
						obj[sel[i]+1].selected = true;
						obj[sel[i]].selected = false;
					}
				}
			}
			</script>
			
			<div id='shared_cal_edit' style='display: none;'>
			<form name='shared_cal' action=\"index.php\" method=\"post\" >
			<input type=\"hidden\" name=\"module\" value=\"".$currentModule."\">
			<input type=\"hidden\" name=\"action\" value=\"".$action."\">
			<input type=\"hidden\" name=\"view\" value=\"shared\">
			<input type=\"hidden\" name=\"edit\" value=\"0\">
			<table cellpadding=\"0\" cellspacing=\"3\" border=\"0\" align=\"center\">
			<tr><th valign=\"top\"  align=\"center\" colspan=\"2\">
			";

			echo $current_module_strings['LBL_SELECT_USERS'];
			echo "
			</th>
			</tr><tr>
			</tr><td valign=\"top\">














			</td><td valign=\"top\">

			<table cellpadding=\"1\" cellspacing=\"1\" border=\"0\" class=\"chartForm\" align=\"center\">
			<tr>
				<td valign='top' nowrap><b>".$current_module_strings['LBL_USERS']."</b></td>
				<td valign='top' id=\"shared_ids_td\"><select id=\"shared_ids\" name=\"shared_ids[]\" multiple size='3'>";


			if (!empty ($team_id)) {
				require_once ('modules/Teams/Team.php');
				$team = new Team();
				$team->retrieve($team_id);
				$users = $team->get_team_members();
				$user_ids = array ();
				foreach ($users as $user) {
					$user_ids[$user->id] = $user->user_name;
				}
				echo get_select_options_with_id($user_ids, $ids);
			} else

				echo get_select_options_with_id(get_user_array(false), $ids);

			echo "	</select></td>
				<td><a onclick=\"up('shared_ids');\">".get_image($image_path.'uparrow_big', 'border=\"0\" style=\"margin-bottom: 1px;\" alt=\"Sort\"')."</a><br>
				<a onclick=\"down('shared_ids');\">".get_image($image_path.'downarrow_big', 'border=\"0\" style=\"margin-top: 1px;\"  alt=\"Sort\"')."</a></td>
			</tr>
			<tr>";
			echo "<td align=\"right\" colspan=\"2\"><input class=\"button\" type=\"submit\" title=\"".$app_strings['LBL_SELECT_BUTTON_TITLE']."\" accessKey=\"".$app_strings['LBL_SELECT_BUTTON_KEY']."\" value=\"".$app_strings['LBL_SELECT_BUTTON_LABEL']."\" /><input class=\"button\" onClick=\"javascript: toggleDisplay('shared_cal_edit');\" type=\"button\" title=\"".$app_strings['LBL_CANCEL_BUTTON_TITLE']."\" accessKey=\"".$app_strings['LBL_CANCEL_BUTTON_KEY']."\" value=\"".$app_strings['LBL_CANCEL_BUTTON_LABEL']."\"/></td>
			</tr>
			</table>
			</td></tr>
			</table>
			</form>";

		}

		echo "</div></p>
		<script language=\"javascript\">";

		if (isset ($_REQUEST['edit']) && $_REQUEST['edit'])
			echo "toggleDisplay('shared_cal_edit');";

		if (isset ($_REQUEST['view']) && !empty ($_REQUEST['month'])) {
			if ($_REQUEST['view'] == 'day') {
				if(ACLController::checkAccess('Calls', 'edit', true)){
					echo "
					document.CallSave.date_start.value = \"".$timedate->to_display_date($args['calendar']->date_time->get_mysql_date(), false)."\"
					document.CallSave.time_start.value = \"".$timedate->to_display_time($args['calendar']->date_time->get_mysql_time().':00', false)."\"";
				}
			}
		}
		echo "
		function set_dates(date,time)
		{
		document.CallSave.date_start.value = date;
		document.CallSave.time_start.value = time;
		
		}
		</script>
		<table id=\"daily_cal_table_outside\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"monthBox\">
		<tr>
		<td>
		  <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"monthHeader\">
		  <tr>
		  <td width=\"1%\" class=\"monthHeaderPrevTd\" nowrap>";

		if (!isset ($args['size']) || $args['size'] != 'small') {
			template_get_previous_calendar($args);
		}

		echo "
		  </td>
		  <td width=\" 98 % \" align=center scope='row'>";

		if (isset( $args['size']) && $args['size'] = 'small')
		{
		?>
		<a style="text-decoration: none;" 
			href="index.php?module=Calendar&action=index&view=month&<?php echo $args['calendar']->date_time->get_date_str();?>">
<?php

	}
?>
<span class="monthHeaderH3">
<?php template_echo_date_info($args['view'],$args['calendar']->date_time); ?>
</span>
<?php

	if (isset ($args['size']) && $args['size'] = 'small') {
		echo "</a>";
	}
?>

</span>
  </td>
  <td align="right" class="monthHeaderNextTd" width="1%" nowrap><?php


	if (!isset ($args['size']) || $args['size'] != 'small') {
		template_get_next_calendar($args);
	}
?> </td>
  </tr>
  </table>
</td>
</tr>
<tr>
<td class="monthCalBody">
<?php

	if ($args['calendar']->view == 'month') {
		template_calendar_month($args);
	} else
		if ($args['calendar']->view == 'year') {
			template_calendar_year($args);
		} else
			if ($args['calendar']->view == 'shared') {
				require_once ('modules/Users/User.php');
				global $current_user, $shared_user;
				$shared_args = array ();
				foreach ($args as $key => $val) {
					$shared_args[$key] = $val;
				}
				$shared_args['calendar'] = $args['calendar'];
				$shared_user = new User();
				foreach ($ids as $member) {
					$shared_user->retrieve($member);
					$shared_args['calendar']->show_tasks = false;
					$shared_args['calendar']->add_activities($shared_user);
					$shared_args['show_link'] = 'off';
					if (($shared_user->id == $current_user->id))
						$shared_args['show_link'] = 'on';
					echo '<h5 class="calSharedUser">'.$shared_user->first_name.' '.$shared_user->last_name.'</h5>';
					template_calendar_horizontal($shared_args);
				}
				
				
			// calmod - start added
			}
			else if($args['calendar']->view != 'week') {
				template_calendar_vertical_spanning($args);
			// calmod - end added
			
			
			} else {
				template_calendar_vertical($args);
			}
?>
</td>
</tr>
<tr>
<td>
  <table width="100%" cellspacing="0" cellpadding="0" class="monthFooter">
  <tr>
  <td width="50%" class="monthFooterPrev"><?php template_get_previous_calendar($args); ?></td>
  <td align="right" width="50%" class="monthFooterNext"><?php template_get_next_calendar($args); ?></td>
  </tr>
  </table>

</td>
</tr>
</table>
<?php


}


// calmod - start added
function template_echo_popup_booking_form(& $args) {
	global $timedate;
	echo '<div id="popupBookingForm" style="display: none; position: absolute" class="monthCalBodyDayItem">';
	require_once ('modules/Calls/CallFormBase.php');
	$callForm = new CallFormBase();
	//, $timedate->to_display_time(template_echo_daily_view_24_hour($args).':00:00', true, false))."<br>";
	echo $callForm->getFormBody('', 'Calls', 'PopupBookingSave', $timedate->to_display_date($args['calendar']->date_time->get_mysql_date(), false));
	echo '</div>';
	echo <<<EOS
		<script language="JavaScript">
		<!--
			var curPopupTime = '';
			function showPopupBooking(evt, time) {
				var div = document.getElementById('popupBookingForm');
				if(time == curPopupTime || !time) {
					div.style.display = 'none';
					curPopupTime = '';
					document.onclick = '';
					return false;
				}
				document.forms['PopupBookingSave'].time_start.value = time;
				curPopupTime = time;
				if (evt.target) var tg = evt.target;
				else if (evt.srcElement) var tg = evt.srcElement;
				while(tg.nodeName != 'TD')
					tg = tg.parentNode;
				div.style.top = getTop(tg) + 20;
				evt.cancelBubble = true;
				div.onclick = function(event) {
					if(!event) event = window.event;
					event.cancelBubble = true;
				}
				document.onclick = function(event) {
					if(!event) event = window.event;
					showPopupBooking(event, false);
				}
				div.style.display = 'block';
				return false;
			}
			function getTop(elt) {
				var top = 0;
				while(elt.tagName != "BODY") {
					top += elt.offsetTop;
					elt = elt.offsetParent;
				}
				return top;
			}
		-->
		</script>
EOS;
}


function template_calendar_vertical_spanning(& $args) {

	template_echo_popup_booking_form($args);
	
	echo '<table id="daily_cal_table" border="0" cellpadding="0" cellspacing="1" width="100%">';

	$start_slice_idx = $args['calendar']->get_start_slice_idx();
	$end_slice_idx = $args['calendar']->get_end_slice_idx();
	$calendar =& $args['calendar'];
	$seen = array();
	$slices = array();
	$cells = array();
	$args['columns'] = 1;
	$row = 0;
	for($idx = $start_slice_idx; $idx <= $end_slice_idx; $idx++) {
		$slices[$row] =& $calendar->slice_hash[$calendar->slices_arr[$idx]];
		if(!isset($cells[$row]))
			$cells[$row] = array();
		$col = 0;
		foreach($slices[$row]->acts_arr as $uid => $acts_arr) {
			for($jdx = 0; $jdx < count($acts_arr); $jdx++) {
				$bean_id = $acts_arr[$jdx]->sugar_bean->id;
				if(isset($seen[$bean_id])) {
					list($r,$c) = $seen[$bean_id];
					$cells[$r][$c]['rowspan'] ++;
					$cells[$row][$c] = false;
				}
				else {
					while(isset($cells[$row][$col]))
						$col ++;
					$cells[$row][$col] = array(
						'data' => $acts_arr[$jdx],
						'rowspan' => 1,
					);
					$seen[$bean_id] = array($row, $col);
				}
			}
		}
		$args['columns'] = max($args['columns'], $col + 1);
		$row++;
	}
	
	for ($idx = 0; $idx < count($slices); $idx++) {
		echo '<tr height="100%">';
		$args['slice'] =& $slices[$idx];
		$args['cells'] =& $cells[$idx];
		template_calendar_spanning_slice($args);
		echo '</tr>';
	}
	
	echo '</table>';
}


function template_calendar_spanning_slice(& $args) {
	global $mod_strings, $app_list_strings, $app_strings;
	global $timedate;
	global $image_path;
	
	echo '<td width="1%" class="dailyCalBodyTime" id="bodytime" scope="row">';
	template_echo_slice_date($args);
	echo '</td>';
	
	$percentage = floor(100 / $args['columns']);
	$colspan = 0;
	for($col = 0; $col < $args['columns']; $col++) {
		if(!isset($args['cells'][$col])) {
			$colspan++;
			if($col < $args['columns'] - 1)
				continue;
		}
		if($colspan) {
			echo '<td colspan="'. $colspan. ' width="'. ($colspan * $percentage). '%" height="100%" class="dailyCalBodyItems">&nbsp;</td>';
			$colspan = 0;
			if(!isset($args['cells'][$col]))
				continue;
		}
		$cell =& $args['cells'][$col];
		if($cell === false) // handled by rowspan
			continue;

		$startPrintTime = date($args['calendar']->timeFormat, $cell['data']->start_time->ts);
		$endPrintTime = date($args['calendar']->timeFormat, $cell['data']->end_time->ts+ 1);
		
		
		if ($cell['data']->sugar_bean->object_name == 'Call') {
			$status = $app_list_strings['call_status_dom'][$cell['data']->sugar_bean->status];
			$image = get_image($image_path.'Calls','alt="'.$status.': '.$cell['data']->sugar_bean->name.'"');
			$link = $startPrintTime . '&#8209;' . $endPrintTime . '&nbsp;&nbsp;' . str_replace(' ', '&nbsp;', $status);
			$link .= ': <a href="index.php?module=Calls&action=DetailView&record=' . $cell['data']->sugar_bean->id . '" class="monthCalBodyDayItemLink">';
			$link .= $cell['data']->sugar_bean->name;
			$link .= '</a>';
			$contacts = array();
			foreach ($cell['data']->sugar_bean->contacts_arr as $aContact)
				$contacts[$aContact->id] = $aContact->first_name . ' ' . $aContact->last_name;
		}
		else if ($cell['data']->sugar_bean->object_name == 'Meeting') {
			$status = $app_list_strings['meeting_status_dom'][$cell['data']->sugar_bean->status];
			$image = get_image($image_path.'Meetings','alt="'.$status.': '.$cell['data']->sugar_bean->name.'"');
			$link = $startPrintTime . '&#8209;' . $endPrintTime . '&nbsp;&nbsp;' . str_replace(' ', '&nbsp;', $status);
			$link .= ': <a href="index.php?module=Meetings&action=DetailView&record=' . $cell['data']->sugar_bean->id . '" class="monthCalBodyDayItemLink">';
			$link .= $cell['data']->sugar_bean->name;
			$link .= '</a>';
			$contacts = array();
			foreach ($cell['data']->sugar_bean->contacts_arr as $aContact)
				$contacts[$aContact->id] = $aContact->first_name . ' ' . $aContact->last_name;
		}
		else if ($cell['data']->sugar_bean->object_name == 'Task') {
			$image = get_image($image_path.'Tasks','alt="Due: '.$cell['data']->sugar_bean->name.'"');
			$link = $startPrintTime . '&nbsp;&nbsp;Due: <a href="index.php?module=Tasks&action=DetailView&record=' . $cell['data']->sugar_bean->id . '" class="monthCalBodyDayItemLink">';
			$link .= $cell['data']->sugar_bean->name;

⌨️ 快捷键说明

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