$event_checked = true; } else { $event_checked = false; } $Colors = getEColors("type", $act_id); $Colors_Palete = $colorHarmony->Monochromatic($Colors["bg"]); $Activity_Types[$act_id] = array("typename" => html_entity_decode($act_name, ENT_QUOTES, $default_charset), "label" => getTranslatedString(html_entity_decode($act_name, ENT_QUOTES, $default_charset), 'Calendar'), "act_type" => "event", "title_color" => $Colors_Palete[0], "color" => $Colors_Palete[1], "textColor" => $Colors["text"], "checked" => $event_checked); // add modules foreach ($tasklabel as $tbid => $mname) { $Modules_Colors = getEColors("type", $mname); $Module_Types[$mname] = array("typename" => $mname, "act_type" => "task", "label" => getTranslatedString($mname, $mname), "title_color" => $Modules_Colors['text'], "color" => $Modules_Colors['bg'], "textColor" => $Modules_Colors["text"], "checked" => $invite_checked); } unset($Colors); unset($Colors_Palete); } $Invite_Colors = getEColors("type", "invite"); $Invite_Colors_Palette = $colorHarmony->Monochromatic($Invite_Colors["bg"]); if (!$load_ch || $Ch_Views["1"]["invite"]) { $invite_checked = true; } else { $invite_checked = false; } $Activity_Types["invite"] = array("typename" => "Invite", "act_type" => "event", "label" => $mod_strings["LBL_INVITE"], "title_color" => $Invite_Colors_Palette[0], "color" => $Invite_Colors_Palette[1], "textColor" => $Invite_Colors["text"], "checked" => $invite_checked); if (isset($_REQUEST["viewOption"]) && $_REQUEST["viewOption"] != "") { $default_view = $_REQUEST["viewOption"]; } else { if ($current_user->activity_view == "This Year") { $default_view = 'month'; } else { if ($current_user->activity_view == "This Month") { $default_view = 'month';
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; }