更新到 5.2 正式版后第一次 SVN 提交。

[email protected]


git-svn-id: https://svn.code.sf.net/p/hawebs/svn@582 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
YuCheng Hu
2010-11-15 09:48:27 +00:00
parent 347cd9bbb1
commit 792f4d82f9
45 changed files with 14837 additions and 0 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,239 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
global $theme,$mod_strings,$current_language,$currentModule,$current_user,$app_strings;
$theme_path = "themes/".$theme."/";
$image_path = $theme_path."images/";
require_once("modules/Calendar/calendarLayout.php");
require_once('include/utils/utils.php');
require_once("modules/Calendar/Calendar.php");
require_once('include/logging.php');
$cal_log =& LoggerManager::getLogger('calendar');
$cal_log->debug("In CalendarAjax file");
$mysel = vtlib_purify($_REQUEST['view']);
if($_REQUEST['file'] == 'OpenListView')
{
require_once('Smarty_setup.php');
$smarty = new vtigerCRM_Smarty;
require_once("modules/Calendar/OpenListView.php");
$smarty->assign("APP",$app_strings);
$smarty->assign("IMAGE_PATH",$image_path);
if($_REQUEST['mode'] == '0')
{
$activities[0] = getPendingActivities(0);
$smarty->assign("ACTIVITIES",$activities);
$smarty->display("upcomingActivities.tpl");
}
else if($_REQUEST['mode'] == '1')
{
$activities[1] = getPendingActivities(1);
$smarty->assign("ACTIVITIES",$activities);
$smarty->display("pendingActivities.tpl");
}
die();
}
$calendar_arr = Array();
$calendar_arr['IMAGE_PATH'] = $image_path;
$date_data = array();
if ( isset($_REQUEST['day']))
{
$date_data['day'] = $_REQUEST['day'];
}
if ( isset($_REQUEST['month']))
{
$date_data['month'] = $_REQUEST['month'];
}
if ( isset($_REQUEST['week']))
{
$date_data['week'] = $_REQUEST['week'];
}
if ( isset($_REQUEST['year']))
{
if ($_REQUEST['year'] > 2037 || $_REQUEST['year'] < 1970)
{
print("<font color='red'>".$app_strings['LBL_CAL_LIMIT_MSG']."</font>");
exit;
}
$date_data['year'] = $_REQUEST['year'];
}
if((isset($_REQUEST['type']) && $_REQUEST['type'] !='') || (isset($_REQUEST['n_type']) && $_REQUEST['n_type'] !=''))
{
$type = $_REQUEST['type'];
$n_type = $_REQUEST['n_type'];
$cal_log->debug("type value is:".$type);
if($type == 'minical')
{
$cal_log->debug("going to get mini calendar");
$temp_module = $currentModule;
$mod_strings = return_module_language($current_language,'Calendar');
$currentModule = 'Calendar';
$calendar_arr['IMAGE_PATH'] = $image_path;
$calendar_arr['calendar'] = new Calendar('month',$date_data);
$calendar_arr['view'] = 'month';
$calendar_arr['size'] = 'small';
if($current_user->hour_format != '')
$calendar_arr['calendar']->hour_format=$current_user->hour_format;
$calendar_arr['calendar']->add_Activities($current_user);
calendar_layout($calendar_arr);
$mod_strings = return_module_language($current_language,$temp_module);
$currentModule = vtlib_purify($_REQUEST['module']);
}
elseif($type == 'settings')
{
$cal_log->debug("going to get calendar Settings");
require_once('modules/Calendar/calendar_share.php');
}
else
{
$subtab = vtlib_purify($_REQUEST['subtab']);
if(empty($mysel))
{
$mysel = 'day';
}
$calendar_arr['calendar'] = new Calendar($mysel,$date_data);
$calendar_arr['view'] = $mysel;
if($calendar_arr['calendar']->view == 'day')
$start_date = $end_date = $calendar_arr['calendar']->date_time->get_formatted_date();
elseif($calendar_arr['calendar']->view == 'week')
{
$start_date = $calendar_arr['calendar']->slices[0];
$end_date = $calendar_arr['calendar']->slices[6];
}
elseif($calendar_arr['calendar']->view == 'month')
{
$start_date = $calendar_arr['calendar']->date_time->getThismonthDaysbyIndex(0);
$end_date = $calendar_arr['calendar']->date_time->getThismonthDaysbyIndex($calendar_arr['calendar']->date_time->daysinmonth - 1);
$start_date = $start_date->get_formatted_date();
$end_date = $end_date->get_formatted_date();
}
elseif($calendar_arr['calendar']->view == 'year')
{
$start_date = $calendar_arr['calendar']->date_time->getThisyearMonthsbyIndex(0);
$end_date = $calendar_arr['calendar']->date_time->get_first_day_of_changed_year('increment');
$start_date = $start_date->get_formatted_date();
$end_date = $end_date->get_formatted_date();
}
else
{
die("view:".$calendar_arr['calendar']->view." is not defined");
}
if($type == 'change_owner' || $type == 'activity_delete' || $type == 'change_status' || $type == 'activity_postpone' || $n_type == 'nav')
{
if($current_user->hour_format != '')
$calendar_arr['calendar']->hour_format=$current_user->hour_format;
if($type == 'change_status')
{
$return_id = vtlib_purify($_REQUEST['record']);
if(isset($_REQUEST['status']))
{
$status = $_REQUEST['status'];
$activity_type = "Task";
}
elseif(isset($_REQUEST['eventstatus']))
{
$status = $_REQUEST['eventstatus'];
$activity_type = "Events";
}
ChangeStatus($status,$return_id,$activity_type);
$mail_data = getActivityMailInfo($return_id,$status,$activity_type);
if($mail_data['sendnotification'] == 1)
{
getEventNotification($activity_type,$mail_data['subject'],$mail_data);
}
$invitee_qry = "select * from vtiger_invitees where activityid=?";
$invitee_res = $adb->pquery($invitee_qry, array($return_id));
$count = $adb->num_rows($invitee_res);
if($count != 0)
{
for($j = 0; $j < $count; $j++)
{
$invitees_ids[]= $adb->query_result($invitee_res,$j,"inviteeid");
}
$invitees_ids_string = implode(';',$invitees_ids);
sendInvitation($invitees_ids_string,$activity_type,$mail_data['subject'],$mail_data);
}
}
if($type == 'activity_postpone')
{
}
if ($_REQUEST['viewOption'] == 'hourview' && ($mysel == 'day' || $mysel == 'week' || $mysel == 'month' || $mysel == 'year'))
{
$calendar_arr['calendar']->add_Activities($current_user);
}
if(isset($_REQUEST['viewOption']) && $_REQUEST['viewOption'] != null && $subtab == 'event')
{
if($_REQUEST['viewOption'] == 'hourview')
{
$cal_log->debug("going to get calendar Event HourView");
if($calendar_arr['view'] == 'day')
{
echo getDayViewLayout($calendar_arr)."####".getEventInfo($calendar_arr,'listcnt');
}
elseif($calendar_arr['view'] == 'week')
{
echo getWeekViewLayout($calendar_arr)."####".getEventInfo($calendar_arr,'listcnt');
}
elseif($calendar_arr['view'] == 'month')
{
echo getMonthViewLayout($calendar_arr)."####".getEventInfo($calendar_arr,'listcnt');
}
elseif($calendar_arr['view'] == 'year')
{
echo getYearViewLayout($calendar_arr)."####".getEventInfo($calendar_arr,'listcnt');
}
else
{
die("view:".$view['view']." is not defined");
}
}
elseif($_REQUEST['viewOption'] == 'listview')
{
$cal_log->debug("going to get calendar Event ListView");
//To get Events List
$activity_arr = getEventList($calendar_arr, $start_date, $end_date);
$activity_list = $activity_arr[0];
$navigation_arr = $activity_arr[1];
echo constructEventListView($calendar_arr,$activity_list,$navigation_arr)."####".getEventInfo($calendar_arr,'listcnt');
}
}
elseif($subtab == 'todo')
{
$cal_log->debug("going to get calendar Todo ListView");
//To get Todos List
$todo_arr = getTodoList($calendar_arr, $start_date, $end_date);
$todo_list = $todo_arr[0];
$navigation_arr = $todo_arr[1];
echo constructTodoListView($todo_list,$calendar_arr,$subtab,$navigation_arr)."####".getTodoInfo($calendar_arr,'listcnt');
}
}
elseif($type == 'view')
{
checkFileAccess('modules/Calendar/'.$_REQUEST['file'].'.php');
require_once('modules/Calendar/'.$_REQUEST['file'].'.php');
}
else
{
die("View option is not defined");
}
}
}
else
{
require_once('include/Ajax/CommonAjax.php');
//die("type is not set");
}
?>
@@ -0,0 +1,139 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
global $app_strings;
global $currentModule,$image_path,$theme,$adb, $current_user;
require_once('Smarty_setup.php');
require_once("data/Tracker.php");
require_once('themes/'.$theme.'/layout_utils.php');
require_once('include/utils/utils.php');
require_once('modules/Calendar/Activity.php');
$cur_time = time();
$_SESSION['last_reminder_check_time'] = $cur_time;
$_SESSION['next_reminder_interval'] = 60;
if($_SESSION['next_reminder_time'] == 'None') {
return;
} elseif(isset($_SESSION['next_reminder_interval']) && (($_SESSION['next_reminder_time'] -
$_SESSION['next_reminder_interval']) > $cur_time)) {
echo "<script type='text/javascript' id='_vtiger_activityreminder_callback_interval_'>".
($_SESSION['next_reminder_interval'] * 1000)."</script>";
return;
}
$log = LoggerManager::getLogger('Activity_Reminder');
$smarty = new vtigerCRM_Smarty;
if(isPermitted('Calendar','index') == 'yes'){
$active = $adb->pquery("select * from vtiger_users where id=?",array($current_user->id));
$active_res = $adb->query_result($active,0,'reminder_interval');
if($active_res == 'None') {
$_SESSION['next_reminder_time'] = 'None';
}
if($active_res!='None'){
$interval=$adb->query_result($active,0,"reminder_interval");
$intervalInMinutes = ConvertToMinutes($interval);
// check for reminders every minute
$time = time();
$_SESSION['next_reminder_time'] = $time + ($intervalInMinutes * 60);
$date = date('Y-m-d', strtotime("+$intervalInMinutes minutes", $time));
$time = date('H:i', strtotime("+$intervalInMinutes minutes", $time));
$callback_query =
"SELECT * FROM vtiger_activity_reminder_popup inner join vtiger_crmentity where " .
" vtiger_activity_reminder_popup.status = 0 and " .
" vtiger_activity_reminder_popup.recordid = vtiger_crmentity.crmid " .
" and vtiger_crmentity.smownerid = ".$current_user->id." and vtiger_crmentity.deleted = 0 " .
" and ((DATE_FORMAT(vtiger_activity_reminder_popup.date_start,'%Y-%m-%d') < '" . $date . "')" .
" OR ((DATE_FORMAT(vtiger_activity_reminder_popup.date_start,'%Y-%m-%d') = '" . $date . "')" .
" AND (TIME_FORMAT(vtiger_activity_reminder_popup.time_start,'%H:%i') <= '" . $time . "')))";
$result = $adb->query($callback_query);
$cbrows = $adb->num_rows($result);
if($cbrows > 0) {
for($index = 0; $index < $cbrows; ++$index) {
$reminderid = $adb->query_result($result, $index, "reminderid");
$cbrecord = $adb->query_result($result, $index, "recordid");
$cbmodule = $adb->query_result($result, $index, "semodule");
$focus = CRMEntity::getInstance($cbmodule);
if($cbmodule == 'Calendar') {
$focus->retrieve_entity_info($cbrecord,$cbmodule);
$cbsubject = $focus->column_fields['subject'];
$cbactivitytype = $focus->column_fields['activitytype'];
$cbdate = $focus->column_fields["date_start"];
$cbtime = $focus->column_fields["time_start"];
} else {
// For non-calendar records.
$cbsubject = array_values(getEntityName($cbmodule, $cbrecord));
$cbsubject = $cbsubject[0];
$cbactivitytype = getTranslatedString($cbmodule, $cbmodule);
$cbdate = $adb->query_result($result, $index, 'date_start');
$cbtime = $adb->query_result($result, $index, 'time_start');
}
if($cbactivitytype=='Task')
$cbstatus = $focus->column_fields["taskstatus"];
else
$cbstatus = $focus->column_fields["eventstatus"];
// Appending recordid we can get unique callback dom id for that record.
$popupid = "ActivityReminder_$cbrecord";
if($cbdate <= date('Y-m-d')){
if($cbdate == date('Y-m-d') && $cbtime > date('H:i')) $cbcolor = '';
else $cbcolor= '#FF1515';
}
$smarty->assign("THEME", $theme);
$smarty->assign("popupid", $popupid);
$smarty->assign("APP", $app_strings);
$smarty->assign("cbreminderid", $reminderid);
$smarty->assign("cbdate", $cbdate);
$smarty->assign("cbtime", $cbtime);
$smarty->assign("cbsubject", $cbsubject);
$smarty->assign("cbmodule", $cbmodule);
$smarty->assign("cbrecord", $cbrecord);
$smarty->assign("cbstatus", $cbstatus);
$smarty->assign("cbcolor", $cbcolor);
$smarty->assign("cblinkdtl", $cblinkdtl);
$smarty->assign("activitytype", $cbactivitytype);
$smarty->display("ActivityReminderCallback.tpl");
$mark_reminder_as_read = "UPDATE vtiger_activity_reminder_popup set status = 1 where reminderid = ?";
$adb->pquery($mark_reminder_as_read, array($reminderid));
echo "<script type='text/javascript'>window.top.document.title= '".
$app_strings['LBL_NEW_BUTTON_LABEL'].$app_strings['LBL_Reminder']."';</script>";
}
} else {
$callback_query =
"SELECT * FROM vtiger_activity_reminder_popup inner join vtiger_crmentity where " .
" vtiger_activity_reminder_popup.status = 0 and " .
" vtiger_activity_reminder_popup.recordid = vtiger_crmentity.crmid " .
" and vtiger_crmentity.smownerid = ".$current_user->id." and vtiger_crmentity.deleted = 0 ".
"AND vtiger_activity_reminder_popup.reminderid > 0 ORDER BY date_start DESC , ".
"TIME_FORMAT(vtiger_activity_reminder_popup.time_start,'%H:%i') DESC LIMIT 1";
$result = $adb->query($callback_query);
$it = new SqlResultIterator($adb, $result);
$nextReminderTime = null;
foreach ($it as $row) {
$nextReminderTime = strtotime($row->date_start.' '.$row->time_start);
}
$_SESSION['next_reminder_time'] = $nextReminderTime - ($intervalInMinutes * 60);
}
echo "<script type='text/javascript' id='_vtiger_activityreminder_callback_interval_'>".
($_SESSION['next_reminder_interval'] * 1000)."</script>";
}
}
?>
@@ -0,0 +1,46 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
global $app_strings;
global $currentModule,$image_path,$theme,$adb, $current_user;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
require_once("data/Tracker.php");
require_once('themes/'.$theme.'/layout_utils.php');
require_once('include/utils/utils.php');
$log = LoggerManager::getLogger('Activity_Reminder');
$cbaction = $_REQUEST['cbaction'];
$cbmodule = $_REQUEST['cbmodule'];
$cbrecord = $_REQUEST['cbrecord'];
if($cbaction == 'POSTPONE') {
if(isset($cbmodule) && isset($cbrecord)) {
$reminderid = $_REQUEST['cbreminderid'];
if(!empty($reminderid) ) {
unset($_SESSION['next_reminder_time']);
$reminder_query = "UPDATE vtiger_activity_reminder_popup set status = 0 WHERE reminderid = ? AND semodule = ? AND recordid = ?";
$adb->pquery($reminder_query, array($reminderid, $cbmodule, $cbrecord));
echo ":#:SUCCESS";
} else {
echo ":#:FAILURE";
}
}
}
?>
@@ -0,0 +1,292 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once('modules/Calendar/CalendarCommon.php');
require_once('include/utils/CommonUtils.php');
require_once('include/utils/UserInfoUtil.php');
require_once('include/database/PearDatabase.php');
require_once('modules/Calendar/Activity.php');
class Appointment
{
var $start_time;
var $end_time;
var $subject;
var $participant;
var $participant_state;
var $contact_name;
var $account_id;
var $account_name;
var $creatorid;
var $creator;
var $owner;
var $ownerid;
var $assignedto;
var $eventstatus;
var $priority;
var $activity_type;
var $description;
var $record;
var $temphour;
var $tempmin;
var $image_name;
var $formatted_datetime;
var $duration_min;
var $duration_hour;
var $shared = false;
var $recurring;
var $dur_hour;
function Appointment()
{
$this->participant = Array();
$this->participant_state = Array();
$this->description = "";
}
/** To get the events of the specified user and shared events
* @param $userid -- The user Id:: Type integer
* @param $from_datetime -- The start date Obj :: Type Array
* @param $to_datetime -- The end date Obj :: Type Array
* @param $view -- The calendar view :: Type String
* @returns $list :: Type Array
*/
function readAppointment($userid, &$from_datetime, &$to_datetime, $view)
{
global $current_user,$adb;
require('user_privileges/user_privileges_'.$current_user->id.'.php');
require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
$and = "AND ((vtiger_activity.date_start between ? AND ?)
OR (vtiger_activity.date_start < ? AND vtiger_activity.due_date > ?)
OR (vtiger_activity.due_date between ? AND ?))";
$q= "select vtiger_activity.*, vtiger_crmentity.*, case when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name FROM vtiger_activity inner join vtiger_crmentity on vtiger_activity.activityid = vtiger_crmentity.crmid left join vtiger_recurringevents on vtiger_activity.activityid=vtiger_recurringevents.activityid left join vtiger_groups on vtiger_groups.groupid = vtiger_crmentity.smownerid LEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid WHERE vtiger_crmentity.deleted = 0 and vtiger_activity.activitytype not in ('Emails','Task') $and ";
// User Select Customization: Changes should made also in (calendayLaout getEventList) and one more BELOW
$query_filter_prefix = calendarview_getSelectedUserFilterQuerySuffix();
$q .= $query_filter_prefix;
// END
$params = array($from_datetime->get_formatted_date(), $to_datetime->get_formatted_date(), $from_datetime->get_formatted_date(), $from_datetime->get_formatted_date(), $from_datetime->get_formatted_date(), $to_datetime->get_formatted_date());
if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[16] == 3)
{
//Added for User Based Custom View for Calendar
$sec_parameter=getCalendarViewSecurityParameter();
$q .= $sec_parameter;
}
$q .= " AND vtiger_recurringevents.activityid is NULL ";
$q .= " group by vtiger_activity.activityid ORDER by vtiger_activity.date_start,vtiger_activity.time_start";
$r = $adb->pquery($q, $params);
$n = $adb->getRowCount($r);
$a = 0;
$list = Array();
while ( $a < $n )
{
$result = $adb->fetchByAssoc($r);
$start_timestamp = strtotime($result["date_start"]);
$end_timestamp = strtotime($result["due_date"]);
if($from_datetime->ts <= $start_timestamp) $from = $start_timestamp;
else $from = $from_datetime->ts;
if($to_datetime->ts <= $end_timestamp) $to = $to_datetime->ts;
else $to = $end_timestamp;
for($j = $from; $j <= $to; $j=$j+(60*60*24))
{
$obj = &new Appointment();
$temp_start = date("Y-m-d",$j);
$result["date_start"]= $temp_start ;
list($obj->temphour,$obj->tempmin) = explode(":",$result["time_start"]);
if($start_timestamp != $end_timestamp && $view == 'day'){
if($j == $start_timestamp){
$result["duration_hours"] = 24 - $obj->temphour;
}elseif($j > $start_timestamp && $j < $end_timestamp){
list($obj->temphour,$obj->tempmin)= $current_user->start_hour !=''?explode(":",$current_user->start_hour):explode(":","08:00");
$result["duration_hours"] = 24 - $obj->temphour;
}elseif($j == $end_timestamp){
list($obj->temphour,$obj->tempmin)= $current_user->start_hour !=''?explode(":",$current_user->start_hour):explode(":","08:00");
list($ehr,$emin) = explode(":",$result["time_end"]);
$result["duration_hours"] = $ehr - $obj->temphour;
}
}
$obj->readResult($result, $view);
$list[] = $obj;
unset($obj);
}
$a++;
}
//Get Recurring events
$q = "SELECT vtiger_activity.*, vtiger_crmentity.*, case when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name , vtiger_recurringevents.recurringid, vtiger_recurringevents.recurringdate as date_start ,vtiger_recurringevents.recurringtype,vtiger_groups.groupname from vtiger_activity inner join vtiger_crmentity on vtiger_activity.activityid = vtiger_crmentity.crmid inner join vtiger_recurringevents on vtiger_activity.activityid=vtiger_recurringevents.activityid left join vtiger_groups on vtiger_groups.groupid = vtiger_crmentity.smownerid LEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid";
$q .= getNonAdminAccessControlQuery('Calendar',$current_user);
$q.=" where vtiger_crmentity.deleted = 0 and vtiger_activity.activitytype not in ('Emails','Task') AND (recurringdate between ? and ?) ";
// User Select Customization
$q .= $query_filter_prefix;
// END
$params = array($from_datetime->get_formatted_date(), $to_datetime->get_formatted_date());
$q .= " ORDER by vtiger_recurringevents.recurringid";
$r = $adb->pquery($q, $params);
$n = $adb->getRowCount($r);
$a = 0;
while ( $a < $n )
{
$obj = &new Appointment();
$result = $adb->fetchByAssoc($r);
list($obj->temphour,$obj->tempmin) = explode(":",$result["time_start"]);
$obj->readResult($result,$view);
$a++;
$list[] = $obj;
unset($obj);
}
usort($list,'compare');
return $list;
}
/** To read and set the events value in Appointment Obj
* @param $act_array -- The vtiger_activity array :: Type Array
* @param $view -- The calendar view :: Type String
*/
function readResult($act_array, $view)
{
global $adb,$current_user,$app_strings;
$format_sthour='';
$format_stmin='';
$this->description = $act_array["description"];
$this->eventstatus = getRoleBasesdPickList('eventstatus',$act_array["eventstatus"]);
$this->priority = getRoleBasesdPickList('taskpriority',$act_array["priority"]);
$this->subject = $act_array["subject"];
$this->activity_type = $act_array["activitytype"];
$this->duration_hour = $act_array["duration_hours"];
$this->duration_minute = $act_array["duration_minutes"];
$this->creatorid = $act_array["smcreatorid"];
//$this->creator = getUserName($act_array["smcreatorid"]);
$this->assignedto = $act_array["user_name"];
$this->owner = $act_array["user_name"];
if(!is_admin($current_user))
{
if($act_array["smownerid"]!=0 && $act_array["smownerid"] != $current_user->id && $act_array["visibility"] == "Public"){
$que = "select * from vtiger_sharedcalendar where sharedid=? and userid=?";
$row = $adb->pquery($que, array($current_user->id, $act_array["smownerid"]));
$no = $adb->getRowCount($row);
if($no > 0)
$this->shared = true;
}
}
$this->image_name = $act_array["activitytype"].".gif";
if(!empty($act_array["recurringid"]) && !empty($act_array["recurringtype"]))
$this->recurring="Recurring.gif";
$this->record = $act_array["activityid"];
list($styear,$stmonth,$stday) = explode("-",$act_array["date_start"]);
if($act_array["notime"] != 1){
$st_hour = twoDigit($this->temphour);
list($sthour,$stmin) = split(":",$act_array["time_start"]);
}else{
$st_hour = 'notime';
$stmin = '00';
$sthour= '00';
}
list($eyear,$emonth,$eday) = explode("-",$act_array["due_date"]);
list($end_hour,$end_min) = split(":",$act_array["time_end"]);
$start_date_arr = Array(
'min' => $stmin,
'hour' => $sthour,
'day' => $stday,
'month' => $stmonth,
'year' => $styear
);
$end_date_arr = Array(
'min' => $end_min,
'hour' => $end_hour,
'day' => $eday,
'month' => $emonth,
'year' => $eyear
);
$this->start_time = new vt_DateTime($start_date_arr,true);
$this->end_time = new vt_DateTime($end_date_arr,true);
if($view == 'day' || $view == 'week')
{
$this->formatted_datetime= $act_array["date_start"].":".$st_hour;
}
elseif($view == 'year')
{
list($year,$month,$date) = explode("-",$act_array["date_start"]);
$this->formatted_datetime = $month;
}
else
{
$this->formatted_datetime= $act_array["date_start"];
}
return;
}
}
/** To two array values
* @param $a -- The vtiger_activity array :: Type Array
* @param $b -- The vtiger_activity array :: Type Array
* @returns value 0 or 1 or -1 depends on comparision result
*/
function compare($a,$b)
{
if ($a->start_time->ts == $b->start_time->ts)
{
return 0;
}
return ($a->start_time->ts < $b->start_time->ts) ? -1 : 1;
}
function getRoleBasesdPickList($fldname,$exist_val)
{
global $adb,$app_strings,$current_user;
$is_Admin = $current_user->is_admin;
if($is_Admin == 'off' && $fldname != '')
{
$roleid=$current_user->roleid;
$roleids = Array();
$subrole = getRoleSubordinates($roleid);
if(count($subrole)> 0)
$roleids = $subrole;
array_push($roleids, $roleid);
//here we are checking wheather the table contains the sortorder column .If sortorder is present in the main picklist table, then the role2picklist will be applicable for this table...
$sql="select * from vtiger_$fldname where $fldname=?";
$res = $adb->pquery($sql,array(decode_html($exist_val)));
$picklistvalueid = $adb->query_result($res,0,'picklist_valueid');
if ($picklistvalueid != null) {
$pick_query="select * from vtiger_role2picklist where picklistvalueid=$picklistvalueid and roleid in (". generateQuestionMarks($roleids) .")";
$res_val=$adb->pquery($pick_query,array($roleids));
$num_val = $adb->num_rows($res_val);
}
if($num_val > 0)
$pick_val = $exist_val;
else
$pick_val = $app_strings['LBL_NOT_ACCESSIBLE'];
}else
$pick_val = $exist_val;
return $pick_val;
}
?>
@@ -0,0 +1,123 @@
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
function set_values(form) {
if (form.duedate_flag.checked) {
form.duedate_flag.value='on';
form.duedate.value="";
form.duetime.value="";
form.duedate.readOnly=true;
form.duetime.readOnly=true;
document.images.jscal_trigger.width = 0;
document.images.jscal_trigger.height = 0;
}
else {
form.duedate_flag.value='off';
form.duedate.readOnly=false;
form.duetime.readOnly=false;
if (form.duetime.readonly) alert (alert_arr.READONLY);
document.images.jscal_trigger.width = 16;
document.images.jscal_trigger.height = 16;
}
}
function toggleTime()
{
if(getObj("notime").checked)
{
getObj("notime").value = 'on';
getObj("duration_hours").disabled = true;
getObj("duration_minutes").disabled = true;
}
else
{
getObj("notime").value = 'off';
getObj("duration_minutes").disabled = false;
getObj("duration_hours").disabled = false;
}
}
function toggleAssignType(currType)
{
if (currType=="U")
{
getObj("assign_user").style.display="block"
getObj("assign_team").style.display="none"
}
else
{
getObj("assign_user").style.display="none"
getObj("assign_team").style.display="block"
}
}
function showActivityView(selectactivity_view)
{
//script to reload the page with the view type when the combo values are changed
View_name = selectactivity_view.options[selectactivity_view.options.selectedIndex].value;
document.frmOpenLstView.action = "index.php?module=Home&action=index&activity_view="+View_name;
document.frmOpenLstView.submit();
}
function exportCalendar(){
if(document.getElementsByName('exportCalendar')[0].value == 'iCal'){
var filename = $('ics_filename').value;
VtigerJS_DialogBox.block();
var url = "index.php?module=Calendar&action=iCalExport&filename="+filename;
location.href = url;
VtigerJS_DialogBox.unblock();
ghide('CalExport')
}
}
function importCalendar(){
var file = document.getElementById('ics_file').value;
if (file != '') {
if (file.indexOf('.ics') != (file.length - 4)) {
alert(alert_arr.PLS_SELECT_VALID_FILE+".ics")
}
else {
document.ical_import.action.value='iCalImport';
document.ical_import.module.value='Calendar';
document.ical_import.submit();
}
}
}
@@ -0,0 +1,297 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
require_once('modules/Calendar/Appointment.php');
require_once('modules/Calendar/Date.php');
class Calendar
{
var $view='day';
var $date_time;
var $hour_format = 'am/pm';
var $day_slice;
var $week_slice;
var $week_array;
var $month_array;
var $week_hour_slices = Array();
var $slices = Array();
/* for dayview */
var $day_start_hour=0;
var $day_end_hour=23;
var $sharedusers=Array();
/*
constructor
*/
//var $groupTable = Array('vtiger_activitygrouprelation','activityid');
function Calendar($view='',$data=Array())
{
$this->view = $view;
$this->date_time = new vt_DateTime($data,true);
$this->constructLayout();
}
/**
* Function to get calendarview Label
* @param string $view - calendarview
* return string - calendarview Label
*/
function getCalendarView($view)
{
switch($view)
{
case 'day':
return "DAY";
case 'week':
return "WEEK";
case 'month':
return "MON";
case 'year':
return "YEAR";
}
}
/**
* Function to set values for calendar object depends on calendar view
*/
function constructLayout()
{
global $current_user;
switch($this->view)
{
case 'day':
for($i=-1;$i<=23;$i++)
{
if($i == -1)
{
$layout = new Layout('hour',$this->date_time->getTodayDatetimebyIndex(0));
$this->day_slice[$layout->start_time->get_formatted_date().':notime'] = $layout;
$this->slices['notime'] = $layout->start_time->get_formatted_date().":notime";
}
else
{
$layout = new Layout('hour',$this->date_time->getTodayDatetimebyIndex($i));
$this->day_slice[$layout->start_time->get_formatted_date().':'.$layout->start_time->z_hour] = $layout;
array_push($this->slices, $layout->start_time->get_formatted_date().":".$layout->start_time->z_hour);
}
}
break;
case 'week':
$weekview_days = 7;
for($i=0;$i<$weekview_days;$i++)
{
$layout = new Layout('day',$this->date_time->getThisweekDaysbyIndex($i));
$this->week_array[$layout->start_time->get_formatted_date()] = $layout;
for($h=-1;$h<=23;$h++)
{
if($h == -1)
{
$hour_list = new Layout('hour',$this->date_time->getTodayDatetimebyIndex(0,$layout->start_time->day,$layout->start_time->month,$layout->start_time->year));
$this->week_slice[$layout->start_time->get_formatted_date().':notime'] = $hour_list;
$this->week_hour_slices['notime'] = $layout->start_time->get_formatted_date().":notime";
}
else
{
$hour_list = new Layout('hour',$this->date_time->getTodayDatetimebyIndex($h,$layout->start_time->day,$layout->start_time->month,$layout->start_time->year));
$this->week_slice[$layout->start_time->get_formatted_date().':'.$hour_list->start_time->z_hour] = $hour_list;
array_push($this->week_hour_slices, $layout->start_time->get_formatted_date().":".$hour_list->start_time->z_hour);
}
}
array_push($this->slices, $layout->start_time->get_formatted_date());
}
break;
case 'month':
$arr = getCalendarDaysInMonth($this->date_time);
$this->month_array = $arr["month_array"];
$this->slices = $arr["slices"];
$this->date_time = $arr["date_time"];
break;
case 'year':
$this->month_day_slices = Array();
for($i=0;$i<12;$i++){
$currMonth = $this->date_time->getThisyearMonthsbyIndex($i);
$layout = new Layout('month',$this->date_time->getThisyearMonthsbyIndex($i));
$this->year_array[$layout->start_time->z_month] = $layout;
$arr = getCalendarDaysInMonth($currMonth);
$slices = $arr["slices"];
$this->month_day_slices[$i] = $slices;
array_push($this->slices, $layout->start_time->z_month);
}
break;
}
}
/**
* Function to get date info depends on calendarview
* @param string $type - string 'increment' or 'decrment'
*/
function get_datechange_info($type)
{
if($type == 'next')
$mode = 'increment';
if($type == 'prev')
$mode = 'decrment';
switch($this->view)
{
case 'day':
$day = $this->date_time->get_changed_day($mode);
break;
case 'week':
$day = $this->date_time->get_first_day_of_changed_week($mode);
break;
case 'month':
$day = $this->date_time->get_first_day_of_changed_month($mode);
break;
case 'year':
$day = $this->date_time->get_first_day_of_changed_year($mode);
break;
default:
return "view is not supported";
}
return $day->get_date_str();
}
/**
* Function to get activities
* @param array $current_user - user data
* @param string $free_busy -
*/
function add_Activities($current_user,$free_busy='')
{
if(isset($current_user->start_hour) && $current_user->start_hour !='')
{
list($sthour,$stmin)= explode(":",$current_user->start_hour);
$hr = $sthour+0;
$this->day_start_hour=$hr;
}
else
{
$this->day_start_hour=8;
}
if(isset($current_user->end_hour) && $current_user->end_hour !='')
{
list($endhour,$endmin)=explode(":",$current_user->end_hour);
$endhour = $endhour+0;
$this->day_end_hour=$endhour;
}
else
{
$this->day_end_hour=23;
}
if ( $this->view == 'week')
{
$start_datetime = $this->date_time->getThisweekDaysbyIndex(0);
$end_datetime = $this->date_time->getThisweekDaysbyIndex(6);
} elseif($this->view == 'month') {
$start_datetime = $this->date_time->getThismonthDaysbyIndex(0);
$end_datetime = $this->date_time->getThismonthDaysbyIndex($this->date_time->daysinmonth-1);
} elseif($this->view == 'year'){
$start_datetime = $this->date_time->getThisyearMonthsbyIndex(0);
$end_datetime = $this->date_time->get_first_day_of_changed_year('increment');
}else {
$start_datetime = $this->date_time;
$end_datetime = $this->date_time->getTodayDatetimebyIndex(23);
}
$activities = Array();
$activities = Appointment::readAppointment($current_user->id,$start_datetime,$end_datetime,$this->view);
if(!empty($activities))
{
foreach($activities as $key=>$value)
{
if($this->view == 'day')
{
array_push($this->day_slice[$value->formatted_datetime]->activities, $value);
}
elseif($this->view == 'week')
{
array_push($this->week_slice[$value->formatted_datetime]->activities, $value);
}
elseif($this->view == 'month')
{
array_push($this->month_array[$value->formatted_datetime]->activities,$value);
}
elseif($this->view == 'year')
{
array_push($this->year_array[$value->formatted_datetime]->activities,$value);
}
else
die("view:".$this->view." is not defined");
}
}
}
}
class Layout
{
var $view = 'day';
var $start_time;
var $end_time;
var $activities = Array();
/**
* Constructor for Layout class
* @param string $view - calendarview
* @param string $time - time string
*/
function Layout($view,$time)
{
$this->view = $view;
$this->start_time = $time;
if ( $view == 'month')
$this->end_time = $this->start_time->getMonthendtime();
if ( $view == 'day')
$this->end_time = $this->start_time->getDayendtime();
if ( $view == 'hour')
$this->end_time = $this->start_time->getHourendtime();
}
/**
* Function to get view
* return currentview
*/
function getView()
{
return $this->view;
}
}
/**
* this function returns the days in a month in an array format
* @param object $date_time - the date time object for the current month
* @return array $result - the array containing current months days information
*/
function getCalendarDaysInMonth($date_time){
global $current_user;
$month_array = array();
$slices = array();
$monthview_days = $date_time->daysinmonth;
$firstday_of_month = $date_time->getThisMonthsDayByIndex(0);
$fdom = $firstday_of_month;
$num_of_prev_days = ($fdom->dayofweek+1)%7-1;
for($i=-$num_of_prev_days;$i<42;$i++){
$pd = $date_time->getThisMonthsDayByIndex($i);
$layout = new Layout('day', $pd);
$month_array[$layout->start_time->get_formatted_date()] = $layout;
array_push($slices, $layout->start_time->get_formatted_date());
}
$result = array("month_array"=>$month_array, "slices"=>$slices, "date_time"=>$date_time);
return $result;
}
?>
@@ -0,0 +1,13 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once('include/Ajax/CommonAjax.php');
?>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,14 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
include('modules/CustomView/index.php');
?>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,36 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.mozilla.org/MPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Activities/Delete.php,v 1.11 2005/04/18 10:37:49 samk Exp $
* Description: TODO: To be written.
********************************************************************************/
global $currentModule;
$focus = CRMEntity::getInstance($currentModule);
require_once('include/logging.php');
$log = LoggerManager::getLogger('task_delete');
//Added to fix 4600
$url = getBasic_Advance_SearchURL();
if(!isset($_REQUEST['record']))
die($mod_strings['ERR_DELETE_RECORD']);
DeleteEntity($_REQUEST['module'],$_REQUEST['return_module'],$focus,$_REQUEST['record'],$_REQUEST['return_id']);
$parenttab=getParentTab();
header("Location: index.php?module=".vtlib_purify($_REQUEST['return_module'])."&action=".vtlib_purify($_REQUEST['return_action'])."&record=".vtlib_purify($_REQUEST['return_id'])."&parenttab=".$parenttab."&relmodule=".vtlib_purify($_REQUEST['module']).$url);
?>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,297 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Activities/EditView.php,v 1.11 2005/03/24 16:18:38 samk Exp $
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('Smarty_setup.php');
require_once('data/Tracker.php');
require_once('include/CustomFieldUtil.php');
require_once('include/utils/utils.php');
require_once('include/FormValidationUtil.php');
require_once('modules/Calendar/calendarLayout.php');
require_once("modules/Emails/mail.php");
include_once 'modules/Calendar/header.php';
global $app_strings;
global $mod_strings,$current_user;
// Unimplemented until jscalendar language vtiger_files are fixed
$focus = CRMEntity::getInstance($currentModule);
$smarty = new vtigerCRM_Smarty();
//added to fix the issue4600
$searchurl = getBasic_Advance_SearchURL();
$smarty->assign("SEARCH", $searchurl);
//4600 ends
$activity_mode = vtlib_purify($_REQUEST['activity_mode']);
if($activity_mode == 'Task')
{
$tab_type = 'Calendar';
$taskcheck = true;
$smarty->assign("SINGLE_MOD",$mod_strings['LBL_TODO']);
}
elseif($activity_mode == 'Events')
{
$tab_type = 'Events';
$taskcheck = false;
$smarty->assign("SINGLE_MOD",$mod_strings['LBL_EVENT']);
}
if(isset($_REQUEST['record']) && $_REQUEST['record']!='') {
$focus->id = $_REQUEST['record'];
$focus->mode = 'edit';
$focus->retrieve_entity_info($_REQUEST['record'],$tab_type);
$focus->name=$focus->column_fields['subject'];
$sql = 'select vtiger_users.user_name,vtiger_invitees.* from vtiger_invitees left join vtiger_users on vtiger_invitees.inviteeid=vtiger_users.id where activityid=?';
$result = $adb->pquery($sql, array($focus->id));
$num_rows=$adb->num_rows($result);
$invited_users=Array();
for($i=0;$i<$num_rows;$i++)
{
$userid=$adb->query_result($result,$i,'inviteeid');
$username=$adb->query_result($result,$i,'user_name');
$invited_users[$userid]=$username;
}
$smarty->assign("INVITEDUSERS",$invited_users);
$smarty->assign("UPDATEINFO",updateInfo($focus->id));
$related_array = getRelatedListsInformation("Calendar", $focus);
$cntlist = $related_array['Contacts']['entries'];
$is_fname_permitted = getFieldVisibilityPermission("Contacts", $current_user->id, 'firstname');
$cnt_idlist = '';
$cnt_namelist = '';
if($cntlist != '')
{
$i = 0;
foreach($cntlist as $key=>$cntvalue)
{
if($i != 0)
{
$cnt_idlist .= ';';
$cnt_namelist .= "\n";
}
$cnt_idlist .= $key;
$contName = preg_replace("/(<a[^>]*>)(.*)(<\/a>)/i", "\\2", $cntvalue[0]);
if ($is_fname_permitted == '0') $contName .= ' '.preg_replace("/(<a[^>]*>)(.*)(<\/a>)/i", "\\2", $cntvalue[1]);
$cnt_namelist .= '<option value="'.$key.'">'.$contName.'</option>';
$i++;
}
}
$smarty->assign("CONTACTSID",$cnt_idlist);
$smarty->assign("CONTACTSNAME",$cnt_namelist);
$query = 'select vtiger_recurringevents.recurringfreq,vtiger_recurringevents.recurringinfo from vtiger_recurringevents where vtiger_recurringevents.activityid = ?';
$res = $adb->pquery($query, array($focus->id));
$rows = $adb->num_rows($res);
if($rows != 0)
{
$value['recurringcheck'] = 'Yes';
$value['repeat_frequency'] = $adb->query_result($res,0,'recurringfreq');
$recurringinfo = explode("::",$adb->query_result($res,0,'recurringinfo'));
$value['eventrecurringtype'] = $recurringinfo[0];
if($recurringinfo[0] == 'Weekly')
{
for($i=0;$i<6;$i++)
{
$label = 'week'.$recurringinfo[$i+1];
$value[$label] = 'checked';
}
}
elseif($recurringinfo[0] == 'Monthly')
{
$value['repeatMonth'] = $recurringinfo[1];
if($recurringinfo[1] == 'date')
{
$value['repeatMonth_date'] = $recurringinfo[2];
}
else
{
$value['repeatMonth_daytype'] = $recurringinfo[2];
$value['repeatMonth_day'] = $recurringinfo[3];
}
}
}
else
{
$value['recurringcheck'] = 'No';
}
}else
{
if(isset($_REQUEST['contact_id']) && $_REQUEST['contact_id']!=''){
$smarty->assign("CONTACTSID",$_REQUEST['contact_id']);
$contact_name = "<option value=".$_REQUEST['contact_id'].">".getContactName($_REQUEST['contact_id'])."</option>";
$smarty->assign("CONTACTSNAME",$contact_name);
$account_id = $_REQUEST['account_id'];
$account_name = getAccountName($account_id);
}
}
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$focus->id = "";
$focus->mode = '';
}
if(empty($_REQUEST['record']) && $focus->mode != 'edit'){
setObjectValuesFromRequest($focus);
}
$userDetails=getOtherUserName($current_user->id);
$to_email = getUserEmailId('id',$current_user->id);
$smarty->assign("CURRENTUSERID",$current_user->id);
$disp_view = getView($focus->mode);
if($disp_view == 'edit_view')
{
$act_data = getBlocks($tab_type,$disp_view,$mode,$focus->column_fields);
}
else
{
$act_data = getBlocks($tab_type,$disp_view,$mode,$focus->column_fields,'BAS');
}
$smarty->assign("BLOCKS",$act_data);
foreach($act_data as $header=>$blockitem)
{
foreach($blockitem as $row=>$data)
{
foreach($data as $key=>$maindata)
{
$uitype[$maindata[2][0]] = $maindata[0][0];
$fldlabel[$maindata[2][0]] = $maindata[1][0];
$fldlabel_sel[$maindata[2][0]] = $maindata[1][1];
$fldlabel_combo[$maindata[2][0]] = $maindata[1][2];
$value[$maindata[2][0]] = $maindata[3][0];
$secondvalue[$maindata[2][0]] = $maindata[3][1];
$thirdvalue[$maindata[2][0]] = $maindata[3][2];
}
}
}
// jread.topik. patch account_id for create contact
if (strlen($account_name) > 0)
{
$fldlabel_sel['parent_id'][1]='selected';
$secondvalue['parent_id'] = $account_id;
$value['parent_id'] = $account_name;
}
$format = ($current_user->hour_format == '')?'am/pm':$current_user->hour_format;
$stdate = key($value['date_start']);
$enddate = key($value['due_date']);
$sttime = $value['date_start'][$stdate];
$endtime = $value['due_date'][$enddate];
$time_arr = getaddEventPopupTime($sttime,$endtime,$format);
$value['starthr'] = $time_arr['starthour'];
$value['startmin'] = $time_arr['startmin'];
$value['startfmt'] = $time_arr['startfmt'];
$value['endhr'] = $time_arr['endhour'];
$value['endmin'] = $time_arr['endmin'];
$value['endfmt'] = $time_arr['endfmt'];
$smarty->assign("STARTHOUR",getTimeCombo($format,'start',$time_arr['starthour'],$time_arr['startmin'],$time_arr['startfmt'],$taskcheck));
$smarty->assign("ENDHOUR",getTimeCombo($format,'end',$time_arr['endhour'],$time_arr['endmin'],$time_arr['endfmt']));
$smarty->assign("FOLLOWUP",getTimeCombo($format,'followup_start',$time_arr['endhour'],$time_arr['endmin'],$time_arr['endfmt']));
$smarty->assign("ACTIVITYDATA",$value);
$smarty->assign("LABEL",$fldlabel);
$smarty->assign("secondvalue",$secondvalue);
$smarty->assign("thirdvalue",$thirdvalue);
$smarty->assign("fldlabel_combo",$fldlabel_combo);
$smarty->assign("fldlabel_sel",$fldlabel_sel);
$smarty->assign("OP_MODE",$disp_view);
$smarty->assign("ACTIVITY_MODE",$activity_mode);
$smarty->assign("HOURFORMAT",$format);
$smarty->assign("USERSLIST",$userDetails);
$smarty->assign("USEREMAILID",$to_email);
$smarty->assign("MODULE",$currentModule);
$smarty->assign("DATEFORMAT",parse_calendardate($app_strings['NTC_DATE_FORMAT']));
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$log->info("Activity edit view");
$smarty->assign("MOD", $mod_strings);
$smarty->assign("APP", $app_strings);
if (isset($focus->name))
$smarty->assign("NAME", $focus->name);
else
$smarty->assign("NAME", "");
if($focus->mode == 'edit')
{
$smarty->assign("MODE", $focus->mode);
}
$category = getParentTab();
$smarty->assign("CATEGORY",$category);
// Unimplemented until jscalendar language vtiger_files are fixed
$smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']);
$smarty->assign("CALENDAR_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
if (isset($_REQUEST['return_module']))
$smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module']));
if (isset($_REQUEST['return_action']))
$smarty->assign("RETURN_ACTION",vtlib_purify( $_REQUEST['return_action']));
if (isset($_REQUEST['return_id']))
$smarty->assign("RETURN_ID", vtlib_purify($_REQUEST['return_id']));
if (isset($_REQUEST['ticket_id']))
$smarty->assign("TICKETID", $_REQUEST['ticket_id']);
if (isset($_REQUEST['product_id']))
$smarty->assign("PRODUCTID", $_REQUEST['product_id']);
if (isset($_REQUEST['return_viewname']))
$smarty->assign("RETURN_VIEWNAME", vtlib_purify($_REQUEST['return_viewname']));
if(isset($_REQUEST['view']) && $_REQUEST['view']!='')
$smarty->assign("view",vtlib_purify($_REQUEST['view']));
if(isset($_REQUEST['hour']) && $_REQUEST['hour']!='')
$smarty->assign("hour",vtlib_purify($_REQUEST['hour']));
if(isset($_REQUEST['day']) && $_REQUEST['day']!='')
$smarty->assign("day",vtlib_purify($_REQUEST['day']));
if(isset($_REQUEST['month']) && $_REQUEST['month']!='')
$smarty->assign("month",vtlib_purify($_REQUEST['month']));
if(isset($_REQUEST['year']) && $_REQUEST['year']!='')
$smarty->assign("year",vtlib_purify($_REQUEST['year']));
if(isset($_REQUEST['viewOption']) && $_REQUEST['viewOption']!='')
$smarty->assign("viewOption",vtlib_purify($_REQUEST['viewOption']));
if(isset($_REQUEST['subtab']) && $_REQUEST['subtab']!='')
$smarty->assign("subtab",vtlib_purify($_REQUEST['subtab']));
if(isset($_REQUEST['maintab']) && $_REQUEST['maintab']!='')
$smarty->assign("maintab",vtlib_purify($_REQUEST['maintab']));
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
$smarty->assign("ID", $focus->id);
$tabid = getTabid($tab_type);
$validationData = getDBValidationData($focus->tab_name,$tabid);
$data = split_validationdataArray($validationData);
$check_button = Button_Check($module);
$smarty->assign("CHECK", $check_button);
$smarty->assign("DUPLICATE",vtlib_purify($_REQUEST['isDuplicate']));
if ($activity_mode == 'Task') {
$custom_fields_data = getCalendarCustomFields(getTabid('Calendar'),'edit',$focus->column_fields);
} else {
$custom_fields_data = getCalendarCustomFields(getTabid('Events'),'edit',$focus->column_fields);
}
$smarty->assign("CUSTOM_FIELDS_DATA", $custom_fields_data);
$smarty->assign("REPEAT_LIMIT_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
$smarty->display("ActivityEditView.tpl");
?>
@@ -0,0 +1,282 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Activities/ListView.php,v 1.14 2005/03/26 09:45:00 samk Exp $
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('Smarty_setup.php');
require_once("data/Tracker.php");
require_once('modules/Calendar/Activity.php');
require_once('include/logging.php');
require_once('include/ListView/ListView.php');
require_once('include/utils/utils.php');
require_once('modules/CustomView/CustomView.php');
require_once('modules/Calendar/CalendarCommon.php');
global $app_strings;
global $list_max_entries_per_page;
$log = LoggerManager::getLogger('task_list');
global $currentModule,$image_path,$theme,$adb;
if (isset($_REQUEST['current_user_only'])) $current_user_only = vtlib_purify($_REQUEST['current_user_only']);
$focus = new Activity();
// Initialize sort by fields
$focus->initSortbyField('Calendar');
// END
$smarty = new vtigerCRM_Smarty;
$other_text = Array();
if(!$_SESSION['lvs'][$currentModule])
{
unset($_SESSION['lvs']);
$modObj = new ListViewSession();
$modObj->sorder = $sorder;
$modObj->sortby = $order_by;
$_SESSION['lvs'][$currentModule] = get_object_vars($modObj);
}
if($_REQUEST['errormsg'] != '')
{
$errormsg = vtlib_purify($_REQUEST['errormsg']);
$smarty->assign("ERROR",$mod_strings["SHARED_EVENT_DEL_MSG"]);
}else
{
$smarty->assign("ERROR","");
}
//<<<<<<< sort ordering >>>>>>>>>>>>>
$sorder = $focus->getSortOrder();
$order_by = $focus->getOrderBy();
$_SESSION['ACTIVITIES_ORDER_BY'] = $order_by;
$_SESSION['ACTIVITIES_SORT_ORDER'] = $sorder;
//<<<<<<< sort ordering >>>>>>>>>>>>>
//<<<<cutomview>>>>>>>
$oCustomView = new CustomView($currentModule);
$viewid = $oCustomView->getViewId($currentModule);
$customviewcombo_html = $oCustomView->getCustomViewCombo($viewid);
$viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
//Added to handle approving or denying status-public by the admin in CustomView
$statusdetails = $oCustomView->isPermittedChangeStatus($viewnamedesc['status']);
$smarty->assign("CUSTOMVIEW_PERMISSION",$statusdetails);
//To check if a user is able to edit/delete a customview
$edit_permit = $oCustomView->isPermittedCustomView($viewid,'EditView',$currentModule);
$delete_permit = $oCustomView->isPermittedCustomView($viewid,'Delete',$currentModule);
$smarty->assign("CV_EDIT_PERMIT",$edit_permit);
$smarty->assign("CV_DELETE_PERMIT",$delete_permit);
//<<<<<customview>>>>>
if($viewid == 0 )
{
echo "<table border='0' cellpadding='5' cellspacing='0' width='100%' height='450px'><tr><td align='center'>";
echo "<div style='border: 3px solid rgb(153, 153, 153); background-color: rgb(255, 255, 255); width: 55%; position: relative; z-index: 10000000;'>
<table border='0' cellpadding='5' cellspacing='0' width='98%'>
<tbody><tr>
<td rowspan='2' width='11%'><img src='<?php echo vtiger_imageurl('close.gif', $theme) ?>'></td>
<td style='border-bottom: 1px solid rgb(204, 204, 204);' nowrap='nowrap' width='70%'>
<span class='genHeaderSmall'>$app_strings[LBL_PERMISSION]</span></td>
</tr>
<tr>
<td class='small' align='right' nowrap='nowrap'>
<a href='javascript:window.history.back();'>$app_strings[LBL_GO_BACK]</a><br>
</td>
</tr>
</tbody></table>
</div>";
echo "</td></tr></table>";
exit;
}
$changeOwner = getAssignedTo(16);
$userList = $changeOwner[0];
$groupList = $changeOwner[1];
$smarty->assign("CHANGE_USER",$userList);
$smarty->assign("CHANGE_GROUP",$groupList);
$smarty->assign("CHANGE_OWNER",getUserslist());
$smarty->assign("CHANGE_GROUP_OWNER",getGroupslist());
$where = "";
$url_string = ''; // assigning http url string
if(isset($_REQUEST['query']) && $_REQUEST['query'] == 'true')
{
list($where, $ustring) = split("#@@#",getWhereCondition($currentModule));
// we have a query
$url_string .="&query=true".$ustring;
$log->info("Here is the where clause for the list view: $where");
$smarty->assign("SEARCH_URL",$url_string);
}
if($viewnamedesc['viewname'] == 'All')
{
$smarty->assign("ALL", 'All');
}
if(isPermitted("Calendar","Delete",$_REQUEST['record']) == 'yes')
{
$other_text['del'] = $app_strings[LBL_MASS_DELETE];
}
if(isPermitted('Calendar','EditView','') == 'yes')
{
$other_text['c_owner'] = $app_strings[LBL_CHANGE_OWNER];
}
global $task_title;
$title_display = $current_module_strings['LBL_LIST_FORM_TITLE'];
if ($task_title) $title_display= $task_title;
//Retreive the list from Database
//<<<<<<<<<customview>>>>>>>>>
if($viewid != "0")
{
$listquery = getListQuery("Calendar");
$list_query = $oCustomView->getModifiedCvListQuery($viewid,$listquery,"Calendar");
}else
{
$list_query = getListQuery("Calendar");
}
//<<<<<<<<customview>>>>>>>>>
if(isset($where) && $where != '')
{
if(isset($_REQUEST['from_homepagedb']) && $_REQUEST['from_homepagedb'] == 'true')
$list_query .= " and ((vtiger_activity.status!='Completed' and vtiger_activity.status!='Deferred') or vtiger_activity.status is null) and ((vtiger_activity.eventstatus!='Held' and vtiger_activity.eventstatus!='Not Held') or vtiger_activity.eventstatus is null) AND ".$where;
else
$list_query .= " AND " .$where;
}
if (isset($_REQUEST['from_homepage'])) {
$today = date("Y-m-d", time());
if ($_REQUEST['from_homepage'] == 'upcoming_activities')
$list_query .= " AND (vtiger_activity.status is NULL OR vtiger_activity.status not in ('Completed','Deferred')) and (vtiger_activity.eventstatus is NULL OR vtiger_activity.eventstatus not in ('Held','Not Held')) AND (date_start >= '$today' OR vtiger_recurringevents.recurringdate >= '$today')";
elseif ($_REQUEST['from_homepage'] == 'pending_activities')
$list_query .= " AND (vtiger_activity.status is NULL OR vtiger_activity.status not in ('Completed','Deferred')) and (vtiger_activity.eventstatus is NULL OR vtiger_activity.eventstatus not in ('Held','Not Held')) AND (due_date <= '$today' OR vtiger_recurringevents.recurringdate <= '$today')";
}
if(isset($order_by) && $order_by != '') {
if($order_by == 'smownerid') {
$list_query .= ' ORDER BY user_name '.$sorder;
} else {
$tablename = getTableNameForField('Calendar',$order_by);
$tablename = (($tablename != '')?($tablename."."):'');
if($order_by == 'lastname')
$list_query .= ' ORDER BY vtiger_contactdetails.lastname '.$sorder;
else
$list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
}
}
//Constructing the list view
$smarty->assign("CUSTOMVIEW_OPTION",$customviewcombo_html);
$smarty->assign("VIEWID", $viewid);
$smarty->assign("MOD", $mod_strings);
$smarty->assign("APP", $app_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH",$image_path);
$smarty->assign("MODULE",$currentModule);
$smarty->assign("SINGLE_MOD",'Activity');
$smarty->assign("BUTTONS",$other_text);
$smarty->assign("NEW_EVENT",$app_strings['LNK_NEW_EVENT']);
$smarty->assign("NEW_TASK",$app_strings['LNK_NEW_TASK']);
//Postgres 8 fixes
if( $adb->dbType == "pgsql")
$list_query = fixPostgresQuery( $list_query, $log, 0);
if(PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true){
$count_result = $adb->query( mkCountQuery( $list_query));
$noofrows = $adb->query_result($count_result,0,"count");
}else{
$noofrows = null;
}
$queryMode = (isset($_REQUEST['query']) && $_REQUEST['query'] == 'true');
$start = ListViewSession::getRequestCurrentPage($currentModule, $list_query, $viewid, $queryMode);
$navigation_array = VT_getSimpleNavigationValues($start,$list_max_entries_per_page,$noofrows);
$limit_start_rec = ($start-1) * $list_max_entries_per_page;
if( $adb->dbType == "pgsql")
$list_result = $adb->pquery($list_query. " OFFSET $limit_start_rec LIMIT $list_max_entries_per_page", array());
else
$list_result = $adb->pquery($list_query. " LIMIT $limit_start_rec, $list_max_entries_per_page", array());
$recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec,$noofrows);
$smarty->assign('recordListRange',$recordListRangeMsg);
//Retreive the List View Table Header
if($viewid !='')
$url_string .="&viewname=".$viewid;
//Cambiado code to add close button in custom vtiger_field
if (($viewid!=0)&&($viewid!="")){
if (!isset($oCustomView->list_fields['Close'])) $oCustomView->list_fields['Close']=array ( 'vtiger_activity' => 'eventstatus' );
if (!isset($oCustomView->list_fields_name['Close'])) $oCustomView->list_fields_name['Close']='eventstatus';
}
$listview_header = getListViewHeader($focus,"Calendar",$url_string,$sorder,$order_by,"",$oCustomView);
$smarty->assign("LISTHEADER", $listview_header);
$listview_header_search=getSearchListHeaderValues($focus,"Calendar",$url_string,$sorder,$order_by,"",$oCustomView);
$smarty->assign("SEARCHLISTHEADER", $listview_header_search);
$listview_entries = getListViewEntries($focus,"Calendar",$list_result,$navigation_array,"","","EditView","Delete",$oCustomView);
$smarty->assign("LISTENTITY", $listview_entries);
$smarty->assign("SELECT_SCRIPT", $view_script);
//Added to select Multiple records in multiple pages
$smarty->assign("SELECTEDIDS", vtlib_purify($_REQUEST['selobjs']));
$smarty->assign("ALLSELECTEDIDS", vtlib_purify($_REQUEST['allselobjs']));
$smarty->assign("CURRENT_PAGE_BOXES", implode(array_keys($listview_entries),";"));
$navigationOutput = getTableHeaderSimpleNavigation($navigation_array,$url_string,"Calendar","ListView",$viewid);
$alphabetical = AlphabeticalSearch($currentModule,'ListView','subject','true','basic',"","","","",$viewid);
$fieldnames = getAdvSearchfields($module);
$criteria = getcriteria_options();
$smarty->assign("CRITERIA", $criteria);
$smarty->assign("FIELDNAMES", $fieldnames);
$smarty->assign("ALPHABETICAL", $alphabetical);
$smarty->assign("NAVIGATION", $navigationOutput);
$category = getParentTab();
$smarty->assign("CATEGORY",$category);
$check_button = Button_Check($module);
$smarty->assign("CHECK", $check_button);
$_SESSION[$currentModule.'_listquery'] = $list_query;
// Gather the custom link information to display
include_once('vtlib/Vtiger/Link.php');
$customlink_params = Array('MODULE'=>$currentModule, 'ACTION'=>vtlib_purify($_REQUEST['action']), 'CATEGORY'=> $category);
$smarty->assign('CUSTOM_LINKS', Vtiger_Link::getAllByType(getTabid($currentModule), Array('LISTVIEWBASIC','LISTVIEW'), $customlink_params));
// END
if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '')
$smarty->display("ListViewEntries.tpl");
else
$smarty->display("ActivityListView.tpl");
?>
@@ -0,0 +1,11 @@
<?php
/*+*******************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*********************************************************************************/
require_once 'include/ListView/ListViewPagging.php';
?>
@@ -0,0 +1,210 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Activities/OpenListView.php,v 1.22 2005/04/19 17:00:30 ray Exp $
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
/**
* Function to get Pending/Upcoming activities
* @param integer $mode - number to differentiate upcoming and pending activities
* return array $values - activities record in array format
*/
function getPendingActivities($mode,$view=''){
global $log;
$log->debug("Entering getPendingActivities() method ...");
require_once('data/Tracker.php');
require_once('include/utils/utils.php');
require_once('user_privileges/default_module_view.php');
global $currentModule;
global $singlepane_view;
global $theme;
global $focus;
global $action;
global $adb;
global $app_strings;
global $current_language;
global $current_user;
$current_module_strings = return_module_language($current_language, 'Calendar');
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
if($_REQUEST['activity_view']==''){
$activity_view='today';
}else{
$activity_view=vtlib_purify($_REQUEST['activity_view']);
}
$today = date("Y-m-d", time());
if($view == 'today'){
$upcoming_condition = " AND (date_start = '$today' OR vtiger_recurringevents.recurringdate = '$today')";
$pending_condition = " AND (due_date = '$today' OR vtiger_recurringevents.recurringdate = '$today')";
}else if($view == 'all'){
$upcoming_condition = " AND (date_start >= '$today' OR vtiger_recurringevents.recurringdate >= '$today')";
$pending_condition = " AND (due_date <= '$today' OR vtiger_recurringevents.recurringdate <= '$today')";
}
if($mode != 1){
$list_query = " select vtiger_crmentity.crmid,vtiger_crmentity.smownerid,vtiger_crmentity.".
"setype, vtiger_recurringevents.recurringdate, vtiger_activity.activityid, ".
"vtiger_activity.activitytype, vtiger_activity.date_start, vtiger_activity.due_date,".
"from vtiger_activity inner join vtiger_crmentity on vtiger_crmentity.crmid=".
"vtiger_activity.activityid LEFT JOIN vtiger_groups ON vtiger_groups.groupid = ".
"vtiger_crmentity.smownerid left outer join vtiger_recurringevents on ".
"vtiger_recurringevents.activityid=vtiger_activity.activityid";
$list_query .= getNonAdminAccessControlQuery('Calendar',$current_user);
$list_query .= " WHERE vtiger_crmentity.deleted=0 and vtiger_activity.activitytype not in ".
"('Emails') AND ( vtiger_activity.status is NULL OR vtiger_activity.status not in".
"('Completed','Deferred')) and ( vtiger_activity.eventstatus is NULL OR vtiger_activity.".
"eventstatus not in ('Held','Not Held') )".$upcoming_condition;
}else{
$list_query = "select vtiger_crmentity.crmid,vtiger_crmentity.smownerid,vtiger_crmentity".
"setype, vtiger_recurringevents.recurringdate, vtiger_activity.activityid, vtiger_activity".
".activitytype, vtiger_activity.date_start, vtiger_activity.due_date, from vtiger_activity".
"inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid ".
"LEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid ".
"left outer join vtiger_recurringevents on vtiger_recurringevents.activityid=".
"vtiger_activity.activityid";
$list_query .= getNonAdminAccessControlQuery('Calendar',$current_user);
$list_query .= "WHERE vtiger_crmentity.deleted=0 and (vtiger_activity.".
"activitytype not in ('Emails')) AND (vtiger_activity.status is NULL OR vtiger_activity.".
"status not in ('Completed','Deferred')) and (vtiger_activity.eventstatus is NULL OR ".
"vtiger_activity.eventstatus not in ('Held','Not Held')) ".$pending_condition;
$list_query.= " GROUP BY vtiger_activity.activityid";
$list_query.= " ORDER BY date_start,time_start ASC";
$res = $adb->query($list_query);
$noofrecords = $adb->num_rows($res);
$open_activity_list = array();
$noofrows = $adb->num_rows($res);
if (count($res)>0){
for($i=0;$i<$noofrows;$i++){
$open_activity_list[] = Array('name' => $adb->query_result($res,$i,'subject'),
'id' => $adb->query_result($res,$i,'activityid'),
'type' => $adb->query_result($res,$i,'activitytype'),
'module' => $adb->query_result($res,$i,'setype'),
'date_start' => getDisplayDate($adb->query_result($res,$i,'date_start')),
'due_date' => getDisplayDate($adb->query_result($res,$i,'due_date')),
'recurringdate' => getDisplayDate($adb->query_result($res,$i,'recurringdate')),
'priority' => $adb->query_result($res,$i,'priority'), // Armando L�scher 04.07.2005 -> �priority -> Desc: Get vtiger_priority from db
);
}
}
$title=array();
$title[]=$view;
$title[]='myUpcoPendAct.gif';
$title[]='home_myact';
$title[]='showActivityView';
$title[]='MyUpcumingFrm';
$title[]='activity_view';
$header=array();
$header[] =$current_module_strings['LBL_LIST_SUBJECT'];
$header[] ='Type';
$return_url="&return_module=$currentModule&return_action=DetailView&return_id=" . ((is_object($focus)) ? $focus->id : "");
$oddRow = true;
$entries=array();
foreach($open_activity_list as $event){
$recur_date=preg_replace('/--/','',$event['recurringdate']);
if($recur_date!=""){
$event['date_start']=$event['recurringdate'];
}
$font_color_high = "color:#00DD00;";
$font_color_medium = "color:#DD00DD;";
switch ($event['priority']){
case 'High':
$font_color=$font_color_high;
break;
case 'Medium':
$font_color=$font_color_medium;
break;
default:
$font_color='';
}
if($event['type'] != 'Task' && $event['type'] != 'Emails' && $event['type'] != ''){
$activity_type = 'Events';
}else{
$activity_type = 'Task';
}
}
$entries[$event['id']] = array(
'0' => '<a href="index.php?action=DetailView&module='.$event["module"].'&activity_mode='.$activity_type.'&record='.$event["id"].''.$return_url.'" style="'.$font_color.';">'.$event["name"].'</a>',
'IMAGE' => '<IMG src="'.$image_path.$event["type"].'s.gif">',
);
}
$values=Array('noofactivities'=>$noofrecords,'Title'=>$title,'Header'=>$header,'Entries'=>$entries);
$log->debug("Exiting getPendingActivities method ...");
return $values;
}
/**
* Function creates HTML to display ActivityView selection box
* @param string $activity_view - activity view
* return string $ACTIVITY_VIEW_SELECT_OPTION - HTML selection box
*/
function getActivityview($activity_view)
{
global $log;
$log->debug("Entering getActivityview(".$activity_view.") method ...");
$today = date("Y-m-d", time());
if($activity_view == 'Today')
{
$selected1 = 'selected';
}
else if($activity_view == 'This Week')
{
$selected2 = 'selected';
}
else if($activity_view == 'This Month')
{
$selected3 = 'selected';
}
else if($activity_view == 'This Year')
{
$selected4 = 'selected';
}
//constructing the combo values for activities
$ACTIVITY_VIEW_SELECT_OPTION = '<select class=small name="activity_view" onchange="showActivityView(this)">';
$ACTIVITY_VIEW_SELECT_OPTION .= '<option value="Today" '.$selected1.'>';
$ACTIVITY_VIEW_SELECT_OPTION .= 'Today';
$ACTIVITY_VIEW_SELECT_OPTION .= '</option>';
$ACTIVITY_VIEW_SELECT_OPTION .= '<option value="This Week" '.$selected2.'>';
$ACTIVITY_VIEW_SELECT_OPTION .= 'This Week';
$ACTIVITY_VIEW_SELECT_OPTION .= '</option>';
$ACTIVITY_VIEW_SELECT_OPTION .= '<option value="This Month" '.$selected3.'>';
$ACTIVITY_VIEW_SELECT_OPTION .= 'This Month';
$ACTIVITY_VIEW_SELECT_OPTION .= '</option>';
$ACTIVITY_VIEW_SELECT_OPTION .= '<option value="This Year" '.$selected4.'>';
$ACTIVITY_VIEW_SELECT_OPTION .= 'This Year';
$ACTIVITY_VIEW_SELECT_OPTION .= '</option>';
$ACTIVITY_VIEW_SELECT_OPTION .= '</select>';
$log->debug("Exiting getActivityview method ...");
return $ACTIVITY_VIEW_SELECT_OPTION;
}
?>
@@ -0,0 +1,19 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
$activity_mode = vtlib_purify($_REQUEST['activity_mode']);
if(isset($_REQUEST['activity_mode']) && $_REQUEST['activity_mode'] == 'Events')
{
$tab_type = 'Events';
$module = 'Events';
}
$tab_id=getTabid($tab_type);
require_once('include/quickcreate.php');
?>
@@ -0,0 +1,164 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once('include/RelatedListView.php');
require_once('modules/Contacts/Contacts.php');
require_once('modules/Products/Products.php');
require_once('include/utils/UserInfoUtil.php');
// functions added for group calendar -Jaguar
/**
* Function to get duration
* @param string $time_start - activity start time
* @param string $duration_hours - duration in hours
* @param string $duration_minutes - duration in minutes
* return string $end_time - time string
*/
function get_duration($time_start,$duration_hours,$duration_minutes)
{
global $log;
$log->debug("Entering get_duration(".$time_start.",".$duration_hours.",".$duration_minutes.") method ...");
$time=explode(":",$time_start);
$time_mins = $time[1];
$time_hrs = $time[0];
$mins = ($time_mins + $duration_minutes) % 60;
$hrs_min = floor(($time_mins + $duration_minutes) / 60);
if(!isset($hrs))
$hrs=0;
$hrs = $duration_hours + $hrs_min + $time_hrs;
if($hrs<10)
$hrs=$hrs;
if($mins<10)
$mins="0".$mins;
$end_time = $hrs .$mins;
$log->debug("Exiting get_duration method ...");
return $end_time;
}
/**
* Function to convert time to number
* @param string $time_start - activity start time
* return integer $start_time - time
*/
function time_to_number($time_start)
{
global $log;
$log->debug("Entering time_to_number(".$time_start.") method ...");
$start_time_array = explode(":",$time_start);
if(preg_match("/^[0]/",$start_time_array[0]))
{
$time_start_hrs=str_replace('0',"",$start_time_array[0]);
}
else
{
$time_start_hrs=$start_time_array[0];
}
$start_time= $time_start_hrs .$start_time_array[1];
$log->debug("Exiting time_to_number method ...");
return $start_time;
}
/**
* Function to status availability of user
* @param string $owner - ownername
* @param integer $userid - userid
* @param integer $activity_id - activityid
* @param string $avail_date - date in string format
* @param string $activity_start_time - time string
* @param string $activity_end_time - time string
* return string $availability - html img tag in string
*/
function status_availability($owner,$userid,$activity_id,$avail_date,$activity_start_time,$activity_end_time)
{
global $adb,$image_path,$log,$theme;
$log->debug("Entering status_availability(".$owner,$userid.",".$activity_id.",".$avail_date.",".$activity_start_time.",".$activity_end_time.") method ...");
$avail_flag="false";
$avail_date=getDBInsertDateValue($avail_date);
if( $owner != $userid)
{
$usr_query="select activityid,vtiger_activity.date_start,vtiger_activity.due_date, vtiger_activity.time_start,vtiger_activity.duration_hours,vtiger_activity.duration_minutes,vtiger_crmentity.smownerid from vtiger_activity,vtiger_crmentity where vtiger_crmentity.crmid=vtiger_activity.activityid and ('".$avail_date."' like date_start) and vtiger_crmentity.smownerid=? and vtiger_activity.activityid !=? and vtiger_crmentity.deleted=0";
}
else
{
$usr_query="select activityid,vtiger_activity.date_start,vtiger_activity.due_date, vtiger_activity.time_start,vtiger_activity.duration_hours,vtiger_activity.duration_minutes,vtiger_crmentity.smownerid from vtiger_activity,vtiger_crmentity where vtiger_crmentity.crmid=vtiger_activity.activityid and ('".$avail_date."' like date_start) and vtiger_crmentity.smownerid=? and vtiger_activity.activityid !=? and vtiger_crmentity.deleted=0";
}
$result_cal=$adb->pquery($usr_query, array($userid, $activity_id));
$noofrows_cal = $adb->num_rows($result_cal);
$avail_flag="false";
if($noofrows_cal!=0)
{
while($row_cal = $adb->fetch_array($result_cal))
{
$usr_date_start=$row_cal['date_start'];
$usr_due_date=$row_cal['due_date'];
$usr_time_start=$row_cal['time_start'];
$usr_hour_dur=$row_cal['duration_hours'];
$usr_mins_dur=$row_cal['duration_minutes'];
$user_start_time=time_to_number($usr_time_start);
$user_end_time=get_duration($usr_time_start,$usr_hour_dur,$usr_mins_dur);
if( ( ($user_start_time > $activity_start_time) && ( $user_start_time < $activity_end_time) ) || ( ( $user_end_time > $activity_start_time) && ( $user_end_time < $activity_end_time) ) || ( ( $activity_start_time == $user_start_time ) || ($activity_end_time == $user_end_time) ) )
{
$availability= 'busy';
$avail_flag="true";
$log->info("user start time-- ".$user_start_time."user end time".$user_end_time);
$log->info("Availability ".$availability);
}
}
}
if($avail_flag!="true")
{
$recur_query="SELECT vtiger_activity.activityid, vtiger_activity.time_start, vtiger_activity.duration_hours, vtiger_activity.duration_minutes , vtiger_crmentity.smownerid, vtiger_recurringevents.recurringid, vtiger_recurringevents.recurringdate as date_start from vtiger_activity inner join vtiger_crmentity on vtiger_activity.activityid = vtiger_crmentity.crmid inner join vtiger_recurringevents on vtiger_activity.activityid=vtiger_recurringevents.activityid where ('".$avail_date."' like vtiger_recurringevents.recurringdate) and vtiger_crmentity.smownerid=? and vtiger_activity.activityid !=? and vtiger_crmentity.deleted=0";
$result_cal=$adb->pquery($recur_query, array($userid, $activity_id));
$noofrows_cal = $adb->num_rows($result_cal);
$avail_flag="false";
if($noofrows_cal!=0)
{
while($row_cal = $adb->fetch_array($result_cal))
{
$usr_date_start=$row_cal['date_start'];
$usr_time_start=$row_cal['time_start'];
$usr_hour_dur=$row_cal['duration_hours'];
$usr_mins_dur=$row_cal['duration_minutes'];
$user_start_time=time_to_number($usr_time_start);
$user_end_time=get_duration($usr_time_start,$usr_hour_dur,$usr_mins_dur);
if( ( ($user_start_time > $activity_start_time) && ( $user_start_time < $activity_end_time) ) || ( ( $user_end_time > $activity_start_time) && ( $user_end_time < $activity_end_time) ) || ( ( $activity_start_time == $user_start_time ) || ($activity_end_time == $user_end_time) ) )
{
$availability= 'busy';
$avail_flag="true";
$log->info("Recurring Events:: user start time-- ".$user_start_time."user end time".$user_end_time);
$log->info("Recurring Events:: Availability ".$availability);
}
}
}
}
if($avail_flag == "true")
{
$availability=' <IMG SRC="' . vtiger_imageurl('busy.gif', $theme). '">';
}
else
{
$availability=' <IMG SRC="' . vtiger_imageurl('free.gif', $theme). '">';
}
$log->debug("Exiting status_availability method ...");
return $availability;
}
?>
@@ -0,0 +1,186 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
/**
* Class to handle repeating events
*/
class Calendar_RepeatEvents {
/**
* Get timing using YYYY-MM-DD HH:MM:SS input string.
*/
static function mktime($fulldateString) {
$splitpart = self::splittime($fulldateString);
$datepart = split('-', $splitpart[0]);
$timepart = split(':', $splitpart[1]);
return mktime($timepart[0], $timepart[1], 0, $datepart[1], $datepart[2], $datepart[0]);
}
/**
* Increment the time by interval and return value in YYYY-MM-DD HH:MM format.
*/
static function nexttime($basetiming, $interval) {
return date('Y-m-d H:i', strtotime($interval, $basetiming));
}
/**
* Based on user time format convert the YYYY-MM-DD HH:MM value.
*/
static function formattime($timeInYMDHIS) {
global $current_user;
$format_string = 'Y-m-d H:i';
switch($current_user->date_format) {
case 'dd-mm-yyyy': $format_string = 'd-m-Y H:i'; break;
case 'mm-dd-yyyy': $format_string = 'm-d-Y H:i'; break;
case 'yyyy-mm-dd': $format_string = 'Y-m-d H:i'; break;
}
return date($format_string, self::mktime($timeInYMDHIS));
}
/**
* Split full timing into date and time part.
*/
static function splittime($fulltiming) {
return split(' ', $fulltiming);
}
/**
* Calculate the time interval to create repeated event entries.
*/
static function getRepeatInterval($type, $frequency, $recurringInfo, $start_date, $limit_date) {
$repeatInterval = Array();
$starting = self::mktime($start_date);
$limiting = self::mktime($limit_date);
if($type == 'Daily') {
$count = 0;
while(true) {
++$count;
$interval = ($count * $frequency);
if(self::mktime(self::nexttime($starting, "+$interval days")) > $limiting) {
break;
}
$repeatInterval[] = $interval;
}
} else if($type == 'Weekly') {
if($recurringInfo->dayofweek_to_rpt == null) {
$count = 0;
$weekcount = 7;
while(true) {
++$count;
$interval = $count * $weekcount;
if(self::mktime(self::nexttime($starting, "+$interval days")) > $limiting) {
break;
}
$repeatInterval[] = $interval;
}
} else {
$count = 0;
while(true) {
++$count;
$interval = $count;
$new_timing = self::mktime(self::nexttime($starting, "+$interval days"));
$new_timing_dayofweek = date('N', $new_timing);
if($new_timing > $limiting) {
break;
}
if(in_array($new_timing_dayofweek-1, $recurringInfo->dayofweek_to_rpt)) {
$repeatInterval[] = $interval;
}
}
}
} else if($type == 'Monthly') {
$count = 0;
$avg_monthcount = 30; // TODO: We need to handle month increments precisely!
while(true) {
++$count;
$interval = $count * $avg_monthcount;
if(self::mktime(self::nexttime($starting, "+$interval days")) > $limiting) {
break;
}
$repeatInterval[] = $interval;
}
} else if($type == 'Yearly') {
$count = 0;
$avg_monthcount = 30;
while(true) {
++$count;
$interval = $count * $avg_monthcount;
if(self::mktime(self::nexttime($starting, "+$interval days")) > $limiting) {
break;
}
$repeatInterval[] = $interval;
}
}
return $repeatInterval;
}
/**
* Repeat Activity instance till given limit.
*/
static function repeat($focus) {
global $log;
$repeat = getrecurringObjValue();
$frequency = $repeat->recur_freq;
$repeattype= $repeat->recur_type;
$base_focus = new Activity();
$base_focus->retrieve_entity_info($focus->id,'Events');
$base_focus->id = $_REQUEST['record'];
$base_focus_start = $base_focus->column_fields['date_start'].' '.$base_focus->column_fields['time_start'];
$base_focus_end = $base_focus->column_fields['due_date'].' '.$base_focus->column_fields['time_end'];
$repeat_limit = getDBInsertDateValue($_REQUEST['calendar_repeat_limit_date']).' '.$base_focus->column_fields['time_start'];
$repeatIntervals = self::getRepeatInterval($repeattype, $frequency, $repeat, $base_focus_start, $repeat_limit);
$base_focus_start = self::mktime($base_focus_start);
$base_focus_end = self::mktime($base_focus_end);
$skip_focus_fields = Array ('record_id', 'createdtime', 'modifiedtime', 'recurringtype');
/** Create instance before and reuse */
$new_focus = new Activity();
$numberOfRepeats = count($repeatIntervals);
foreach($repeatIntervals as $index => $interval) {
$new_focus_start_timing = self::nexttime($base_focus_start, "+$interval days");
$new_focus_start_timing = self::splittime(self::formattime($new_focus_start_timing));
$new_focus_end_timing = self::nexttime($base_focus_end, "+$interval days");
$new_focus_end_timing = self::splittime(self::formattime($new_focus_end_timing));
// Reset the new_focus and prepare for reuse
if(isset($new_focus->id)) unset($new_focus->id);
$new_focus->column_fields = array();
foreach($base_focus->column_fields as $key=>$value) {
if(in_array($key, $skip_focus_fields)) {
// skip copying few fields
} else if($key == 'date_start') {
$new_focus->column_fields['date_start'] = $new_focus_start_timing[0];
} else if($key == 'time_start') {
$new_focus->column_fields['time_start'] = $new_focus_start_timing[1];
} else if($key == 'time_end') {
$new_focus->column_fields['time_end'] = $new_focus_end_timing[1];
} else if($key == 'due_date') {
$new_focus->column_fields['due_date'] = $new_focus_end_timing[0];
} else {
$new_focus->column_fields[$key] = $value;
}
}
if($numberOfRepeats > 10 && $index > 10) {
unset($new_focus->column_fields['sendnotification']);
}
$new_focus->save('Calendar');
}
}
}
?>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,3 @@
@echo off
cd ..\..\
..\..\..\php\php.exe SendReminder.php
@@ -0,0 +1,42 @@
<?php
/*+**********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
************************************************************************************/
require_once('Smarty_setup.php');
global $mod_strings,$app_strings,$theme;
$smarty = new vtigerCRM_Smarty;
$module = vtlib_purify($_REQUEST['formodule']);
$menu_array = Array();
$menu_array['CustomFields']['location'] = 'index.php?module=Settings&action=CustomFieldList&parenttab=Settings&formodule='.$module;
$menu_array['CustomFields']['image_src'] = vtiger_imageurl('orgshar.gif', $theme);
$menu_array['CustomFields']['desc'] = getTranslatedString('LBL_CALENDER_CUSTOMFIELDS_DESCRIPTION');
$menu_array['CustomFields']['label'] = getTranslatedString('LBL_CALENDER_CUSTOMFIELDS');
//add blanks for 3-column layout
$count = count($menu_array)%3;
if($count>0) {
for($i=0;$i<3-$count;$i++) {
$menu_array[] = array();
}
}
$smarty->assign("MOD",$mod_strings);
$smarty->assign("APP",$app_strings);
$smarty->assign("IMAGE_PATH", "themes/$theme/images/");
$smarty->assign('MODULE',$module);
$smarty->assign('MODULE_LBL',getTranslatedString($module));
$smarty->assign('MENU_ARRAY', $menu_array);
$smarty->display(vtlib_getModuleTemplate('Vtiger','Settings.tpl'));
?>
@@ -0,0 +1,12 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once('include/Ajax/TagCloud.php')
?>
@@ -0,0 +1,85 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
require_once('modules/Calendar/Activity.php');
require_once('modules/Calendar/CalendarCommon.php');
require_once('include/logging.php');
require_once("config.php");
require_once('include/database/PearDatabase.php');
$local_log =& LoggerManager::getLogger('index');
$focus = new Activity();
$activity_mode = vtlib_purify($_REQUEST['activity_mode']);
if($activity_mode == 'Task')
{
$tab_type = 'Calendar';
$focus->column_fields["activitytype"] = 'Task';
}
if(isset($_REQUEST['record']))
{
$focus->id = $_REQUEST['record'];
}
if(isset($_REQUEST['mode']))
{
$focus->mode = $_REQUEST['mode'];
}
foreach($focus->column_fields as $fieldname => $val)
{
if(isset($_REQUEST[$fieldname]))
{
if(is_array($_REQUEST[$fieldname]))
$value = $_REQUEST[$fieldname];
else
$value = trim($_REQUEST[$fieldname]);
$focus->column_fields[$fieldname] = $value;
}
}
$focus->column_fields["subject"] = $_REQUEST["task_subject"];
$focus->column_fields["time_start"] = $_REQUEST["task_time_start"];
if($_REQUEST['task_assigntype'] == 'U') {
$focus->column_fields['assigned_user_id'] = $_REQUEST['task_assigned_user_id'];
} elseif($_REQUEST['task_assigntype'] == 'T') {
$focus->column_fields['assigned_user_id'] = $_REQUEST['task_assigned_group_id'];
}
$focus->column_fields["taskstatus"] = $_REQUEST["taskstatus"];
$focus->column_fields["date_start"] = $_REQUEST["task_date_start"];
$focus->column_fields["due_date"] = $_REQUEST["task_due_date"];
$focus->column_fields["taskpriority"] = $_REQUEST["taskpriority"];
$focus->column_fields["parent_id"] = $_REQUEST["task_parent_id"];
$focus->column_fields["contact_id"] = $_REQUEST["task_contact_id"];
$focus->column_fields["description"] = $_REQUEST["task_description"];
if(isset($_REQUEST['task_sendnotification']) && $_REQUEST['task_sendnotification'] != null)
$focus->column_fields["sendnotification"] = $_REQUEST["task_sendnotification"];
$focus->save($tab_type);
function getRequestedToData()
{
$mail_data = Array();
$mail_data['user_id'] = $_REQUEST["task_assigned_user_id"];
$mail_data['subject'] = $_REQUEST['task_subject'];
$mail_data['status'] = (($_REQUEST['activity_mode']=='Task')?($_REQUEST['taskstatus']):($_REQUEST['eventstatus']));
$mail_data['activity_mode'] = $_REQUEST['activity_mode'];
$mail_data['taskpriority'] = $_REQUEST['taskpriority'];
$mail_data['relatedto'] = $_REQUEST['task_parent_name'];
$mail_data['contact_name'] = $_REQUEST['task_contact_name'];
$mail_data['description'] = $_REQUEST['task_description'];
$mail_data['assign_type'] = $_REQUEST['task_assigntype'];
$mail_data['group_name'] = getGroupName($_REQUEST['task_assigned_group_id']);
$mail_data['mode'] = $_REQUEST['task_mode'];
$value = getaddEventPopupTime($_REQUEST['task_time_start'],$_REQUEST['task_time_end'],'24');
$start_hour = $value['starthour'].':'.$value['startmin'].''.$value['startfmt'];
$mail_data['st_date_time'] = getDisplayDate($_REQUEST['task_date_start'])." ".$start_hour;
$mail_data['end_date_time']=getDisplayDate($_REQUEST['task_due_date']);
return $mail_data;
}
header("Location: index.php?action=index&module=Calendar&view=".vtlib_purify($_REQUEST['view'])."&hour=".vtlib_purify($_REQUEST['hour'])."&day=".vtlib_purify($_REQUEST['day'])."&month=".vtlib_purify($_REQUEST['month'])."&year=".vtlib_purify($_REQUEST['year'])."&viewOption=".vtlib_purify($_REQUEST['viewOption'])."&subtab=todo&parenttab=".getParentTab());
?>
@@ -0,0 +1,11 @@
<?php
/*+*******************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*********************************************************************************/
require_once 'modules/Home/UnifiedSearch.php';
?>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,169 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
global $current_user,$mod_strings,$app_strings;
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
require_once('include/database/PearDatabase.php');
require_once('modules/Calendar/CalendarCommon.php');
$t=Date("Ymd");
$userDetails=getSharingUserName($current_user->id);
$shareduser_ids = getSharedUserId($current_user->id);
?>
<table border=0 cellspacing=0 cellpadding=5 width=100% class="layerHeadingULine">
<tr>
<td class="layerPopupHeading" align="left"><?php echo $mod_strings['LBL_CALSETTINGS']?></td>
<td align=right>
<a href="javascript:fninvsh('calSettings');"><img src="<?php echo vtiger_imageurl('close.gif', $theme) ?>" border="0" align="absmiddle" /></a>
</td>
</tr>
</table>
<form name="SharingForm" method="post" action="index.php" onsubmit="VtigerJS_DialogBox.block();">
<input type="hidden" name="module" value="Calendar">
<input type="hidden" name="action" value="updateCalendarSharing">
<input type="hidden" name="view" value="<?php echo vtlib_purify($_REQUEST['view']) ?>">
<input type="hidden" name="hour" value="<?php echo vtlib_purify($_REQUEST['hour']) ?>">
<input type="hidden" name="day" value="<?php echo vtlib_purify($_REQUEST['day']) ?>">
<input type="hidden" name="month" value="<?php echo vtlib_purify($_REQUEST['month']) ?>">
<input type="hidden" name="year" value="<?php echo vtlib_purify($_REQUEST['year']) ?>">
<input type="hidden" name="viewOption" value="<?php echo vtlib_purify($_REQUEST['viewOption']) ?>">
<input type="hidden" name="subtab" value="<?php echo vtlib_purify($_REQUEST['subtab']) ?>">
<input type="hidden" name="parenttab" value="<?php echo vtlib_purify($_REQUEST['parenttab']) ?>">
<input type="hidden" name="current_userid" value="<?php echo $current_user->id ?>" >
<input type="hidden" name="shar_userid" id="shar_userid" >
<table border=0 cellspacing=0 cellpadding=5 width=95% align=center>
<tr>
<td class=small >
<table border=0 celspacing=0 cellpadding=5 width=100% align=center bgcolor=white>
<tr>
<td align="right" width="10%" valign="top"><img src="<?php echo vtiger_imageurl('cal_clock.jpg', $theme) ?>" align="absmiddle"></td>
<td align="left" width="90%">
<b><?php echo $mod_strings['LBL_TIMESETTINGS']?></b><br>
<input type="checkbox" name="sttime_check" <?php if($current_user->start_hour != ''){?> checked <?php } ?> onClick="enableCalstarttime();">&nbsp;<?php echo $mod_strings['LBL_CALSTART']?>
<select name="start_hour" <?php if($current_user->start_hour == ''){?>disabled <?php } ?> >
<?php
for($i=0;$i<=23;$i++)
{
if($i == 0)
$hour = "12:00 am";
elseif($i >= 12)
{
if($i == 12)
$hour = $i;
else
$hour = $i - 12;
$hour = $hour.":00 pm";
}
else
{
$hour = $i.":00 am";
}
if($i <= 9 && strlen(trim($i)) < 2)
{
$value = '0'.$i.':00';
}
else
$value = $i.':00';
if($value === $current_user->start_hour)
$selected = 'selected';
else
$selected = '';
?>
<option <?php echo $selected?> value="<?php echo $value?>"><?php echo $hour?></option>
<?php
}
?>
</select><br>
<input type="checkbox" name="hour_format" <?php if($current_user->hour_format == '24'){?> checked <?php } ?> value="24">&nbsp;<?php echo $mod_strings['LBL_USE24']?>
</td>
</tr>
<tr><td colspan="2" style="border-bottom:1px dotted #CCCCCC;"></td></tr>
<tr>
<td align="right" valign="top"><img src="<?php echo vtiger_imageurl('cal_sharing.jpg', $theme) ?>" width="45" height="38" align="absmiddle"></td>
<td align="left">
<b><?php echo $mod_strings['LBL_CALSHARE']?></b><br>
<?php echo $mod_strings['LBL_CALSHAREMESSAGE']?><br><br>
<!-- Calendar sharing UI-->
<DIV id="cal_shar" style="display:block;width:100%;height:200px">
<table border=0 cellspacing=0 cellpadding=2 width=100% bgcolor="#FFFFFF">
<tr>
<td valign=top>
<table border=0 cellspacing=0 cellpadding=2 width=100%>
<tr>
<td colspan=3>
<ul style="padding-left:20px">
<li><?php echo $mod_strings['LBL_INVITE_SHARE']?>
<li><?php echo $mod_strings['LBL_INVITE_INST2']?>
</ul>
</td>
</tr>
<tr>
<td><b><?php echo $mod_strings['LBL_AVL_USERS']?></b></td>
<td>&nbsp;</td>
<td><b><?php echo $mod_strings['LBL_SEL_USERS']?></b></td>
</tr>
<tr>
<td width=40% align=center valign=top>
<select name="available_users" id="available_users" class=small size=5
multiple style="height:70px;width:100%">
<?php
foreach($userDetails as $id=>$name)
{
if($id != '')
echo "<option value=".$id.">".$name."</option>";
}
?>
</select>
</td>
<td width=20% align=center valign=top>
<input type=button value="<?php echo $mod_strings['LBL_ADD_BUTTON'] ?> >>" class="crm button small save" style="width:100%" onClick="incUser('available_users','selected_users')"><br>
<input type=button value="<< <?php echo $mod_strings['LBL_RMV_BUTTON'] ?> " class="crm button small cancel" style="width:100%" onClick="rmvUser('selected_users')">
</td>
<td>
<select name="selected_users" id="selected_users" class=small size=5 multiple style="height:70px;width:100%">
<?php
foreach($shareduser_ids as $shar_id=>$share_user)
{
if($shar_id != '')
echo "<option value=".$shar_id.">".$share_user."</option>";
}
?>
</select>
</select>
<td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=5 width=100% class="layerPopupTransport">
<tr>
<td align="center">
<input type="submit" name="save" value=" &nbsp;<?php echo $app_strings['LBL_SAVE_BUTTON_LABEL'] ?>&nbsp;" class="crmbutton small save" onClick = "userEventSharing('shar_userid','selected_users');"/>&nbsp;&nbsp;
<input type="button" name="cancel" value=" <?php echo $app_strings['LBL_CANCEL_BUTTON_LABEL'] ?> " class="crmbutton small cancel" onclick="fninvsh('calSettings');" />
</td>
</tr>
</table>
</form>
@@ -0,0 +1,22 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
require_once('include/database/PearDatabase.php');
$idlist = vtlib_purify($_POST['idlist']);
$returnmodule=vtlib_purify($_REQUEST['return_module']);
$returnaction=vtlib_purify($_REQUEST['return_action']);
//split the string and store in an array
$storearray = explode(";",$idlist);
foreach($storearray as $id)
{
$sql="delete from vtiger_sharedcalendar where sharedid=?";
$result = $adb->pquery($sql, array($id));
}
header("Location:index.php?module=".$returnmodule."&action=".$returnaction);
?>

Some files were not shown because too many files have changed in this diff Show More