$Calendar4You = new Calendar4You(); $Calendar4You->GetDefPermission($current_user->id); if ($record == "" && $save != "") { $Calendar4You->SaveView($Type_Ids, $Users_Ids, $all_users, $Load_Event_Status, $Load_Task_Status); } $detailview_permissions = $Calendar4You->CheckPermissions("DETAIL"); require 'user_privileges/user_privileges_' . $current_user->id . '.php'; require 'user_privileges/sharing_privileges_' . $current_user->id . '.php'; $ParentUsers = array(); $u_query = "select vtiger_user2role.userid as id 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 ?"; $u_params = array($current_user_parent_role_seq . "::%"); $u_result = $adb->pquery($u_query, $u_params); while ($u_row = $adb->fetchByAssoc($u_result)) { $ParentUsers[] = $u_row["id"]; } $view = convertFullCalendarView($full_calendar_view); $calendar_tabid = getTabId("Calendar"); $events_tabid = getTabId("Events"); $Showed_Field = array(); $Event_Info = array(); if ($detailview_permissions) { $sql0 = "SELECT * FROM its4you_calendar4you_event_fields WHERE userid = ? AND view = ?"; $result0 = $adb->pquery($sql0, array($current_user->id, $view)); $num_rows0 = $adb->num_rows($result0); if ($num_rows0 > 0) { while ($row0 = $adb->fetchByAssoc($result0)) { $sql01 = "SELECT uitype, columnname, fieldlabel FROM vtiger_field WHERE fieldname = ? AND tabid IN (?,?)"; $result01 = $adb->pquery($sql01, array($row0['fieldname'], $calendar_tabid, $events_tabid)); $columnname = $adb->query_result($result01, 0, "columnname"); $fieldlabel = $adb->query_result($result01, 0, "fieldlabel"); $uitype = $adb->query_result($result01, 0, "uitype");
} else { if ($current_user->activity_view == "This Year") { $default_view = 'month'; } else { if ($current_user->activity_view == "This Month") { $default_view = 'month'; } else { if ($current_user->activity_view == "This Week") { $default_view = 'agendaWeek'; } else { $default_view = 'agendaDay'; } } } } $mysel = convertFullCalendarView($default_view); $smarty->assign('DEFAULTVIEW', $default_view); $smarty->assign('ACTIVITYTYPES', $Activity_Types); $smarty->assign('MODULETYPES', $Module_Types); if (isset($_REQUEST["user_view_type"]) && $_REQUEST["user_view_type"] != "") { $user_view_type = $_REQUEST["user_view_type"]; } else { if ($Calendar_Settings["user_view"] == "all") { $user_view_type = "all"; } else { $user_view_type = $current_user->id; } } if (strtolower(trim($user_view_type)) == "me") { $user_view_type = $current_user->id; }