} $smarty->assign('TIMEMODULEARRAY', trim($timeModules_array, ",")); $smarty->assign('TIMEMODULEDETAILS', json_encode($timeModluleDetails)); } //Sunday=0, Monday=1, Tuesday=2, etc. $smarty->assign('FISRTDAY', $Calendar_Settings["number_dayoftheweek"]); if ($Calendar_Settings["hour_format"] == "24") { $is_24 = true; } else { $is_24 = false; } $smarty->assign('IS_24', $is_24); include_once 'modules/Calendar4You/class/color_converter.class.php'; include_once 'modules/Calendar4You/class/color_harmony.class.php'; $Event_Colors = $Calendar4You->getEventColors(); $colorHarmony = new colorHarmony(); $Task_Colors = getEColors("type", "task"); $Task_Colors_Palete = $colorHarmony->Monochromatic($Task_Colors["bg"]); if (!$load_ch || $Ch_Views["1"]["task"]) { $task_checked = true; } else { $task_checked = false; } $Activity_Types = $Module_Types = array(); $Activity_Types["task"] = array("typename" => "Tasks", "label" => $c_mod_strings["LBL_TASK"], "act_type" => "task", "title_color" => $Task_Colors_Palete[0], "color" => $Task_Colors_Palete[1], "textColor" => $Task_Colors["text"], "checked" => $task_checked); $ActTypes = getActTypesForCalendar(); foreach ($ActTypes as $act_id => $act_name) { if (!$load_ch || $Ch_Views["1"][$act_id]) { $event_checked = true; } else { $event_checked = false;
public function GetCalendarUsersData($orderby = "templateid", $dir = "asc") { global $current_user, $mod_strings, $app_strings, $Event_Colors; include_once 'modules/Calendar4You/class/color_converter.class.php'; include_once 'modules/Calendar4You/class/color_harmony.class.php'; if (count($this->View) > 0) { $load_ch = true; } else { $load_ch = false; } $colorHarmony = new colorHarmony(); if ($this->view_all) { $query = "SELECT * FROM vtiger_users ORDER BY first_name, last_name"; $params = array(); } else { if (empty($this->tabid)) { $this->tabid = getTabid("Calendar4You"); } require 'user_privileges/sharing_privileges_' . $current_user->id . '.php'; require 'user_privileges/user_privileges_' . $current_user->id . '.php'; $query = "select status as status, id as id,user_name as user_name,first_name,last_name from vtiger_users where id=? \n union \n select status as status, vtiger_user2role.userid as id,vtiger_users.user_name as user_name ,\n\t\t\t\t\t vtiger_users.first_name as first_name ,vtiger_users.last_name as last_name\n\t\t\t\t\t from vtiger_user2role inner join vtiger_users on vtiger_users.id=vtiger_user2role.userid inner join vtiger_role on vtiger_role.roleid=vtiger_user2role.roleid where vtiger_role.parentrole like ? \n union\n\t\t\t\t\t select status as status, shareduserid as id,vtiger_users.user_name as user_name,\n\t\t\t\t\t vtiger_users.first_name as first_name ,vtiger_users.last_name as last_name from vtiger_tmp_write_user_sharing_per inner join vtiger_users on vtiger_users.id=vtiger_tmp_write_user_sharing_per.shareduserid where vtiger_tmp_write_user_sharing_per.userid=? and vtiger_tmp_write_user_sharing_per.tabid=?\n union\n select status as status, id as id,user_name as user_name,first_name,last_name from vtiger_users \n inner join vtiger_sharedcalendar on vtiger_sharedcalendar.userid = vtiger_users.id where sharedid=?"; $params = array($current_user->id, $current_user_parent_role_seq . "::%", $current_user->id, $this->tabid, $current_user->id); } $result = $this->db->pquery($query, $params); $return_data = array(); $num_rows = $this->db->num_rows($result); for ($i = 0; $i < $num_rows; $i++) { $userid = $this->db->query_result($result, $i, 'id'); $user_name = $this->db->query_result($result, $i, 'user_name'); $first_name = $this->db->query_result($result, $i, 'first_name'); $last_name = $this->db->query_result($result, $i, 'last_name'); $status = $this->db->query_result($result, $i, 'status'); if ($this->CheckUserPermissions($userid) === false) { continue; } $User_Colors = getEColors("user", $userid); $User_Colors_Palette = $colorHarmony->Monochromatic($User_Colors["bg"]); if (!$load_ch || !empty($this->View["2"][$userid])) { $user_checked = true; } else { $user_checked = false; } $user_array = array("id" => $userid, "firstname" => $first_name, "lastname" => $last_name, "fullname" => trim($first_name . " " . $last_name), "color" => $User_Colors_Palette[1], "textColor" => $User_Colors["text"], "title_color" => $User_Colors_Palette[0], "status" => $status, "checked" => $user_checked); $return_data[$userid] = $user_array; unset($User_Colors); unset($User_Colors_Palette); } return $return_data; }