* SPDX-License-Identifier: AGPL-3.0-only
************************************/
require_once('modules/Calendar/CalendarCommon.php');
include_once("modules/Calendar/wdCalendar/php/functions.php"); //crmv@20211
/**
* Function creates HTML to display Events and Todos div tags
* @param array $param_arr - collection of objects and strings
* @param string $viewBox - string 'listview' or 'hourview' or may be empty. if 'listview' means get Events ListView.if 'hourview' means gets Events HourView. if empty means get Todos ListView
* @param string $subtab - string 'todo' or 'event'. if 'todo' means Todos View else Events View
*/
function calendar_layout(& $param_arr,$viewBox='',$subtab='',$view_filter='',$activity_view='') // crmv@140887
{
global $mod_strings, $cal_log, $current_user;
$category = getParentTab();
$cal_log->debug("Entering calendar_layout() method");
$cal_header = array();
if (isset($param_arr['size']) && $param_arr['size'] == 'small') $param_arr['calendar']->show_events = false;
$cal_header['view'] = $param_arr['view'];
$cal_header['IMAGE_PATH'] = $param_arr['IMAGE_PATH'];
$cal_header['calendar'] = $param_arr['calendar'];
$eventlabel = $mod_strings['LBL_EVENTS'];
$todolabel = $mod_strings['LBL_TODOS'];
$inIcal = (bool) $param_arr['in_ical']; // crmv@189225
// Calendar header
// crmv@189225
if (!$inIcal) {
include_once("modules/Calendar/addEventUI.php");
}
// crmv@189225e
include_once("modules/Calendar/header.php");
$smarty = new VteSmarty();
$smarty->assign('EVENT_VIEW_OPTIONS', getEventViewOption($param_arr, $view_filter));
get_cal_header_data($param_arr, $viewBox, $subtab, $view_filter);
unset($activity_view_param);
if ($activity_view != '') {
$activity_view_param = '&activity_view=' . urlencode($activity_view);
} else {
$activity_view_param = '&activity_view=' . urlencode($current_user->column_fields['activity_view']);
}
// crmv@68357
// if year is passed (assuming also month and day), pass it to the wdcalendar
if (!empty($_REQUEST['year']) && $cal_header['calendar']->date_time) {
$activity_view_param .= '&showday=' . urlencode($cal_header['calendar']->date_time->get_formatted_date());
}
// pass the ical info
if ($inIcal && is_array($param_arr['icals']) && count($param_arr['icals']) > 0) { // crmv@189225
// use only the first one
$ical = $param_arr['icals'][0];
$activity_view_param .= '&from_module=Messages&from_crmid=' . intval($ical['messagesid']) . '&icalid=' . intval($ical['sequence']);
}
// crmv@68357
$calendarUrl = "index.php?module=Calendar&action=CalendarAjax&file=wdCalendar$activity_view_param";
$smarty->assign('CALENDAR_URL', $calendarUrl);
$smarty->assign('RELATED_ADD', $_REQUEST['related_add']);
$smarty->assign('IN_ICAL', $inIcal); // crmv@189225
$smarty->display('modules/Calendar/Calendar.tpl');
$cal_log->debug("Exiting calendar_layout() method");
}
/**
* Function creates HTML to display number of Events, Todos and pending list in calendar under header(Eg:Total Events : 5, 2 Pending / Total To Dos: 4, 1 Pending)
* @param array $cal_arr - collection of objects and strings
* @param string $viewBox - string 'listview' or 'hourview'. if 'listview' means Events ListView.if 'hourview' means Events HourView.
*/
function get_cal_header_data(& $cal_arr,$viewBox,$subtab,$view_filter='') //crmv@7633s
{
global $mod_strings,$cal_log,$current_user,$adb,$theme;
$cal_log->debug("Entering get_cal_header_data() method...");
global $current_user,$app_strings;
$date_format = $current_user->date_format;
$format = $cal_arr['calendar']->hour_format;
$hour_startat = timeString(array('hour'=>date('H:i',(time() + (60 * 60))),'minute'=>0),'24');
$hour_endat = timeString(array('hour'=>date('H:i',(time() + (60 * 60*2))),'minute'=>0),'24');
$time_arr = getaddEventPopupTime($hour_startat,$hour_endat,$format);
$temp_ts = $cal_arr['calendar']->date_time->ts;
//To get date in user selected format
$temp_date = (($date_format == 'dd-mm-yyyy')?(date('d-m-Y',$temp_ts)):(($date_format== 'mm-dd-yyyy')?(date('m-d-Y',$temp_ts)):(($date_format == 'yyyy-mm-dd')?(date('Y-m-d', $temp_ts)):(''))));
$eventlist=getActivityTypeValues('all','string_separated_by',';');
$headerdata = "";
// $headerdata .="
";
// $headerdata .="";
//crmv@7633e
// crmv@131364
// Terrible fix for the users list. The list is copied into the iframe, but data attribute is not preserved,
// so I have to avoid the double checkbox by setting this attribute
$headerdata .= '';
// crmv@131364e
echo $headerdata;
$cal_log->debug("Exiting get_cal_header_data() method...");
}
//crmv@7633
function crmvGetAssignedToHTML(& $cal,$assignedto,$toggletype,$view_filter)
{
global $app_strings,$current_user,$mod_strings;//crmv@20629
//crmv@vte10usersFix
$htmlFilterButtons = '
';
$htmlFilterButtons .= '';
$htmlFilterButtons .= '';
//crmv@vte10usersFix e
// crmv@43117 crmv@OPER6317
if ($toggletype == 'task') {
$htmlStr .= $mod_strings['LBL_CAL_FILTER'].":
';
return $htmlStr.$htmlFilterButtons;
//crmv@vte10usersFix e
}
//crmv@7633e
//crmv@20211 //crmv@20629 //crmv@33996 // crmv@98866
function crmvGetUserAssignedToHTML($assignedto,$toggletype,$only_contents=false,$view_filter='selected')
{
global $mod_strings, $app_strings, $current_user;
$ECU = EntityColorUtils::getInstance();
$checkFunction = 'onClick="filterAssignedSingleUser(this.value);updateShownList();"';
if (!$only_contents)
$htmlStr .= '