year;
break;
case "m":
$str .= " ".$last_day->get_month_name();
break;
case "d":
$str .= " ".$last_day->get_day();
break;
}
}
}
}
}
}
}
return $str;
}
/**
* Get link to next date range
* @return string
*/
protected function get_next_calendar()
{
global $cal_strings,$image_path;
$str = "";
if ($_REQUEST['module'] == "Calendar") {
$str .= "";
} else {
$str .= "";
}
$str .= " ".SugarThemeRegistry::current()->getImage("calendar_next", 'align="absmiddle" border="0"', null, null, '.gif', '') . ""; //setting alt tag blank on purpose for 508 compliance
return $str;
}
/**
* Get link to previous date range
* @return string
*/
protected function get_previous_calendar()
{
global $cal_strings,$image_path;
$str = "";
if ($_REQUEST['module'] == "Calendar") {
$str .= "";
} else {
$str .= "";
}
$str .= SugarThemeRegistry::current()->getImage('calendar_previous', 'align="absmiddle" border="0"', null, null, '.gif', ''); //setting alt tag blank on purpose for 508 compliance
$str .= " ";
return $str;
}
/**
* display header
* @param boolean $controls display ui contol itmes
*/
public function display_calendar_header($controls = true)
{
global $cal_strings;
$ss = new Sugar_Smarty();
$ss->assign("MOD", $cal_strings);
$ss->assign("view", $this->cal->view);
$ss->assign('print', $this->cal->isPrint());
if ($controls) {
$current_date = str_pad($this->cal->date_time->month, 2, '0', STR_PAD_LEFT)."/".str_pad($this->cal->date_time->day, 2, '0', STR_PAD_LEFT)."/".$this->cal->date_time->year;
$tabs = $this->views;
$tabs_params = array();
foreach ($tabs as $key => $tab) {
if (($key != "basicDay") and ($key != "basicWeek")) {
$tabs_params[$key]['title'] = $cal_strings["LBL_" . strtoupper($key)];
$tabs_params[$key]['id'] = $key . "-tab";
$tabs_params[$key]['link'] = "window.location.href='" . ajaxLink("index.php?module=Calendar&action=index&view=" . $key . $this->cal->date_time->get_date_str()) . "'";
} else {
unset($tabs[$key]);
}
}
$ss->assign('controls', $controls);
$ss->assign('tabs', $tabs);
$ss->assign('tabs_params', $tabs_params);
$ss->assign('current_date', $current_date);
$ss->assign('start_weekday', $GLOBALS['current_user']->get_first_day_of_week());
$ss->assign('cal_img', '');
}
$ss->assign('previous', $this->get_previous_calendar());
$ss->assign('next', $this->get_next_calendar());
$ss->assign('date_info', $this->get_date_info($this->cal->view, $this->cal->date_time));
$header = get_custom_file_if_exists("modules/Calendar/tpls/header.tpl");
echo $ss->fetch($header);
}
/**
* display footer
*/
public function display_calendar_footer()
{
global $cal_strings;
$ss = new Sugar_Smarty();
$ss->assign("MOD", $cal_strings);
$ss->assign("view", $this->cal->view);
$ss->assign('previous', $this->get_previous_calendar());
$ss->assign('next', $this->get_next_calendar());
$footer = get_custom_file_if_exists("modules/Calendar/tpls/footer.tpl");
echo $ss->fetch($footer);
}
public function convertPHPToMomentFormat($format)
{
$replacements = array(
'd' => 'DD',
'D' => 'ddd',
'j' => 'D',
'l' => 'dddd',
'N' => 'E',
'S' => 'o',
'w' => 'e',
'z' => 'DDD',
'W' => 'W',
'F' => 'MMMM',
'm' => 'MM',
'M' => 'MMM',
'n' => 'M',
't' => '', // no equivalent
'L' => '', // no equivalent
'o' => 'YYYY',
'Y' => 'YYYY',
'y' => 'YY',
'a' => 'a',
'A' => 'A',
'B' => '', // no equivalent
'g' => 'h',
'G' => 'H',
'h' => 'hh',
'H' => 'HH',
'i' => 'mm',
's' => 'ss',
'u' => 'SSS',
'e' => 'zz', // deprecated since version 1.6.0 of moment.js
'I' => '', // no equivalent
'O' => '', // no equivalent
'P' => '', // no equivalent
'T' => '', // no equivalent
'Z' => '', // no equivalent
'c' => '', // no equivalent
'r' => '', // no equivalent
'U' => 'X',
);
$momentFormat = strtr($format, $replacements);
return $momentFormat;
}
/**
* display title
*/
public function display_title()
{
global $mod_strings;
//Hack to make this 6.5 compatible until this module is converted to MVC
if ($this->cal->view == "mobile") {
$buttons = array("Meeting","Call","Task");
echo "". $mod_strings['LBL_MODULE_TITLE'] ."
";
echo "';
} else {
echo "". $mod_strings['LBL_MODULE_TITLE'] ."
";
}
}
/**
* display html used in shared view
*/
public function display_shared_html($view)
{
global $app_strings,$cal_strings,$action;
$ss = new Sugar_Smarty();
$ss->assign("APP", $app_strings);
$ss->assign("MOD", $cal_strings);
$ss->assign("view", $view);
$ss->assign("UP", SugarThemeRegistry::current()->getImage('uparrow_big', 'border="0" style="margin-bottom: 1px;"', null, null, '.gif', $app_strings['LBL_SORT']));
$ss->assign("DOWN", SugarThemeRegistry::current()->getImage('downarrow_big', 'border="0" style="margin-top: 1px;"', null, null, '.gif', $app_strings['LBL_SORT']));
//hide by default.
if (!empty($_REQUEST['edit_shared'])) {
$ss->assign("edit_shared", true);
}
$ss->assign("users_options", get_select_options_with_id(get_user_array(false), $this->cal->shared_ids));
$tpl = get_custom_file_if_exists("modules/Calendar/tpls/shared_users.tpl");
echo $ss->fetch($tpl);
}
}