This commit is contained in:
2024-04-27 09:23:34 +02:00
commit 11e713ca6f
11884 changed files with 3263371 additions and 0 deletions

636
modules/Calendar/Calendar.php Executable file
View File

@@ -0,0 +1,636 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
require_once('modules/Calendar/DateTimeUtil.php');
require_once('include/utils/activity_utils.php');
function sort_func_by_act_date($act0,$act1)
{
if ($act0->start_time->ts == $act1->start_time->ts)
{
return 0;
}
return ($act0->start_time->ts < $act1->start_time->ts) ? -1 : 1;
}
class Calendar
{
var $view = 'month';
var $date_time;
var $slices_arr = array();
// for monthly calendar view, if you want to see all the
// days in the grid, otherwise you only see that months
var $show_only_current_slice = false;
var $show_activities = true;
var $show_tasks = true;
var $activity_focus;
var $show_week_on_month_view = true;
var $use_24 = 1;
var $toggle_appt = true;
var $slice_hash = array();
var $shared_users_arr = array();
function Calendar($view,$time_arr=array())
{
global $current_user;
global $sugar_config;
if ( $current_user->getPreference('time'))
{
$time = $current_user->getPreference('time');
}
else
{
$time = $sugar_config['default_time_format'];
}
if( substr_count($time, 'h') > 0)
{
$this->use_24 = 0;
}
$this->view = $view;
if ( isset($time_arr['activity_focus']))
{
$this->activity_focus = new CalendarActivity($time_arr['activity_focus']);
$this->date_time = $this->activity_focus->start_time;
}
else
{
$this->date_time = new DateTimeUtil($time_arr,true);
}
if (!( $view == 'day' || $view == 'month' || $view == 'year' || $view == 'week' || $view == 'shared') )
{
sugar_die ("view needs to be one of: day, week, month, shared, or year");
}
if ( empty($this->date_time->year))
{
sugar_die ("all views: year was not set");
}
else if ( $this->view == 'month' && empty($this->date_time->month))
{
sugar_die ("month view: month was not set");
}
else if ( $this->view == 'week' && empty($this->date_time->week))
{
sugar_die ("week view: week was not set");
}
else if ( $this->view == 'shared' && empty($this->date_time->week))
{
sugar_die ("shared view: shared was not set");
}
else if ( $this->view == 'day' && empty($this->date_time->day) && empty($this->date_time->month))
{
sugar_die ("day view: day and month was not set");
}
$this->create_slices();
}
function add_shared_users(&$shared_users_arr)
{
$this->shared_users_arr = $shared_users_arr;
}
function get_view_name($view)
{
if ($view == 'month')
{
return "MONTH";
}
else if ($view == 'week')
{
return "WEEK";
}
else if ($view == 'day')
{
return "DAY";
}
else if ($view == 'year')
{
return "YEAR";
}
else if ($view == 'shared')
{
return "SHARED";
}
else
{
sugar_die ("get_view_name: view ".$this->view." not supported");
}
}
function isDayView() {
return $this->view == 'day';
}
function get_slices_arr()
{
return $this->slices_arr;
}
function create_slices()
{
global $current_user;
if ( $this->view == 'month')
{
$days_in_month = $this->date_time->days_in_month;
$first_day_of_month = $this->date_time->get_day_by_index_this_month(0);
$num_of_prev_days = $first_day_of_month->day_of_week;
// do 42 slices (6x7 grid)
for($i=0;$i < 42;$i++)
{
$slice = new Slice('day',$this->date_time->get_day_by_index_this_month($i-$num_of_prev_days));
$this->slice_hash[$slice->start_time->get_mysql_date()] = $slice;
array_push($this->slices_arr, $slice->start_time->get_mysql_date());
}
}
else if ( $this->view == 'week' || $this->view == 'shared')
{
$days_in_week = 7;
for($i=0;$i<$days_in_week;$i++)
{
$slice = new Slice('day',$this->date_time->get_day_by_index_this_week($i));
$this->slice_hash[$slice->start_time->get_mysql_date()] = $slice;
array_push($this->slices_arr, $slice->start_time->get_mysql_date());
}
}
else if ( $this->view == 'day')
{
$hours_in_day = 24;
for($i=0;$i<$hours_in_day;$i++)
{
$slice = new Slice('hour',$this->date_time->get_datetime_by_index_today($i));
$this->slice_hash[$slice->start_time->get_mysql_date().":".$slice->start_time->hour ] = $slice;
$this->slices_arr[] = $slice->start_time->get_mysql_date().":".$slice->start_time->hour;
}
}
else if ( $this->view == 'year')
{
for($i=0;$i<12;$i++)
{
$slice = new Slice('month',$this->date_time->get_day_by_index_this_year($i));
$this->slice_hash[$slice->start_time->get_mysql_date()] = $slice;
array_push($this->slices_arr, $slice->start_time->get_mysql_date());
}
}
else
{
sugar_die("not a valid view:".$this->view);
}
}
function add_activities($user,$type='sugar') {
if ( $this->view == 'week' || $this->view == 'shared') {
$end_date_time = $this->date_time->get_first_day_of_next_week();
} else {
$end_date_time = $this->date_time;
}
$acts_arr = array();
if($type == 'vfb') {
$acts_arr = CalendarActivity::get_freebusy_activities($user, $this->date_time, $end_date_time);
} else {
$acts_arr = CalendarActivity::get_activities($user->id, $this->show_tasks, $this->date_time, $end_date_time, $this->view);
}
// loop thru each activity for this user
for ($i = 0;$i < count($acts_arr);$i++) {
$act = $acts_arr[$i];
// get "hashed" time slots for the current activity we are looping through
$hash_list =DateTimeUtil::getHashList($this->view,$act->start_time,$act->end_time);
for($j=0;$j < count($hash_list); $j++) {
if(!isset($this->slice_hash[$hash_list[$j]]) || !isset($this->slice_hash[$hash_list[$j]]->acts_arr[$user->id])) {
$this->slice_hash[$hash_list[$j]]->acts_arr[$user->id] = array();
}
$this->slice_hash[$hash_list[$j]]->acts_arr[$user->id][] = $act;
}
}
}
function occurs_within_slice(&$slice,&$act)
{
// if activity starts within this slice
// OR activity ends within this slice
// OR activity starts before and ends after this slice
if ( ( $act->start_time->ts >= $slice->start_time->ts &&
$act->start_time->ts <= $slice->end_time->ts )
||
( $act->end_time->ts >= $slice->start_time->ts &&
$act->end_time->ts <= $slice->end_time->ts )
||
( $act->start_time->ts <= $slice->start_time->ts &&
$act->end_time->ts >= $slice->end_time->ts )
)
{
//print "act_start:{$act->start_time->ts}<BR>";
//print "act_end:{$act->end_time->ts}<BR>";
//print "slice_start:{$slice->start_time->ts}<BR>";
//print "slice_end:{$slice->end_time->ts}<BR>";
return true;
}
return false;
}
function get_previous_date_str()
{
if ($this->view == 'month')
{
$day = $this->date_time->get_first_day_of_last_month();
}
else if ($this->view == 'week' || $this->view == 'shared')
{
$day = $this->date_time->get_first_day_of_last_week();
}
else if ($this->view == 'day')
{
$day = $this->date_time->get_yesterday();
}
else if ($this->view == 'year')
{
$day = $this->date_time->get_first_day_of_last_year();
}
else
{
return "get_previous_date_str: notdefined for this view";
}
return $day->get_date_str();
}
function get_next_date_str()
{
if ($this->view == 'month')
{
$day = $this->date_time->get_first_day_of_next_month();
}
else
if ($this->view == 'week' || $this->view == 'shared' )
{
$day = $this->date_time->get_first_day_of_next_week();
}
else
if ($this->view == 'day')
{
$day = $this->date_time->get_tomorrow();
}
else
if ($this->view == 'year')
{
$day = $this->date_time->get_first_day_of_next_year();
}
else
{
sugar_die("get_next_date_str: not defined for view");
}
return $day->get_date_str();
}
function get_start_slice_idx()
{
if ($this->isDayView())
{
$start_at = 8;
for($i=0;$i < 8; $i++)
{
if (count($this->slice_hash[$this->slices_arr[$i]]->acts_arr) > 0)
{
$start_at = $i;
break;
}
}
return $start_at;
}
else
{
return 0;
}
}
function get_end_slice_idx()
{
if ( $this->view == 'month')
{
return $this->date_time->days_in_month - 1;
}
else if ( $this->view == 'week' || $this->view == 'shared')
{
return 6;
}
else if ($this->isDayView())
{
$end_at = 18;
for($i=$end_at;$i < 23; $i++)
{
if (count($this->slice_hash[$this->slices_arr[$i+1]]->acts_arr) > 0)
{
$end_at = $i + 1;
}
}
return $end_at;
}
else
{
return 1;
}
}
}
class Slice
{
var $view = 'day';
var $start_time;
var $end_time;
var $acts_arr = array();
function Slice($view,$time)
{
$this->view = $view;
$this->start_time = $time;
if ( $view == 'day')
{
$this->end_time = $this->start_time->get_day_end_time();
}
if ( $view == 'hour')
{
$this->end_time = $this->start_time->get_hour_end_time();
}
}
function get_view()
{
return $this->view;
}
}
// global to switch on the offet
$DO_USER_TIME_OFFSET = false;
class CalendarActivity
{
var $sugar_bean;
var $start_time;
var $end_time;
function CalendarActivity($args)
{
// if we've passed in an array, then this is a free/busy slot
// and does not have a sugarbean associated to it
global $DO_USER_TIME_OFFSET;
if ( is_array ( $args ))
{
$this->start_time = $args[0];
$this->end_time = $args[1];
$this->sugar_bean = null;
return;
}
// else do regular constructor..
$sugar_bean = $args;
global $timedate;
$this->sugar_bean = $sugar_bean;
if ($sugar_bean->object_name == 'Task')
{
$newdate = $timedate->merge_date_time($this->sugar_bean->date_due, $this->sugar_bean->time_due);
$tempdate = $timedate->to_db_date($newdate,$DO_USER_TIME_OFFSET);
if($newdate != $tempdate){
$this->sugar_bean->date_due = $tempdate;
}
$temptime = $timedate->to_db_time($newdate, $DO_USER_TIME_OFFSET);
if($newdate != $temptime){
$this->sugar_bean->time_due = $temptime;
}
$this->start_time =DateTimeUtil::get_time_start(
$this->sugar_bean->date_due,
$this->sugar_bean->time_due
);
if ( empty($this->start_time))
{
return null;
}
$this->end_time = $this->start_time;
}
else
{
// Convert it back to database time so we can properly manage it for getting the proper start and end dates
$dbDate = $timedate->to_db($this->sugar_bean->date_start);
$this->start_time =DateTimeUtil::get_time_start($dbDate);
$this->end_time =DateTimeUtil::get_time_end(
$this->start_time,
$this->sugar_bean->duration_hours,
$this->sugar_bean->duration_minutes
);
}
}
function get_occurs_within_where_clause($table_name, $rel_table, $start_ts_obj, $end_ts_obj, $field_name='date_start', $view) {
global $timedate;
$dtUtilArr = array();
switch ($view) {
case 'month':
$start_ts = $start_ts_obj->get_first_day_of_this_month();
$end_ts = $end_ts_obj->get_first_day_of_next_month();
break;
default:
// Date for the past 5 days as that is the maximum duration of a single activity
$dtUtilArr['ts'] = $start_ts_obj->ts - (86400*5);
$start_ts = new DateTimeUtil($dtUtilArr, false);
// Date for the next 5 days as that is the maximum duration of a single activity
$dtUtilArr['ts'] = $end_ts_obj->ts + (86400*5);
$end_ts = new DateTimeUtil($dtUtilArr, false);
break;
}
$start_mysql_date = explode('-', $start_ts->get_mysql_date());
$start_mysql_date_time = explode(' ',$timedate->handle_offset(date($GLOBALS['timedate']->get_db_date_time_format(), $start_ts->ts), $timedate->dbDayFormat, true));
$end_mysql_date = explode('-', $end_ts->get_mysql_date());
$end_mysql_date_time = explode(' ',$timedate->handle_offset(date($GLOBALS['timedate']->get_db_date_time_format(), $end_ts->ts), $timedate->dbDayFormat, true));
$where = "(". $GLOBALS['db']->convert($table_name.'.'.$field_name,'date_format',array("'%Y-%m-%d'"),array("'YYYY-MM-DD'")) ." >= '{$start_mysql_date_time[0]}' AND ";
$where .= $GLOBALS['db']->convert($table_name.'.'.$field_name,'date_format',array("'%Y-%m-%d'"),array("'YYYY-MM-DD'")) ." <= '{$end_mysql_date_time[0]}')";
if($rel_table != '') {
$where .= ' AND '.$rel_table.'.accept_status != \'decline\'';
}
return $where;
}
function get_freebusy_activities(&$user_focus,&$start_date_time,&$end_date_time)
{
$act_list = array();
$vcal_focus = new vCal();
$vcal_str = $vcal_focus->get_vcal_freebusy($user_focus);
$lines = explode("\n",$vcal_str);
foreach ($lines as $line)
{
$dates_arr = array();
if ( preg_match('/^FREEBUSY.*?:([^\/]+)\/([^\/]+)/i',$line,$matches))
{
$dates_arr[] =DateTimeUtil::parse_utc_date_time($matches[1]);
$dates_arr[] =DateTimeUtil::parse_utc_date_time($matches[2]);
$act_list[] = new CalendarActivity($dates_arr);
}
}
usort($act_list,'sort_func_by_act_date');
return $act_list;
}
function get_activities($user_id, $show_tasks, &$view_start_time, &$view_end_time, $view) {
global $current_user;
$act_list = array();
$seen_ids = array();
// get all upcoming meetings, tasks due, and calls for a user
if(ACLController::checkAccess('Meetings', 'list', $current_user->id == $user_id)) {
$meeting = new Meeting();
if($current_user->id == $user_id) {
$meeting->disable_row_level_security = true;
}
$where = CalendarActivity::get_occurs_within_where_clause($meeting->table_name, $meeting->rel_users_table, $view_start_time, $view_end_time, 'date_start', $view);
$focus_meetings_list = build_related_list_by_user_id($meeting,$user_id,$where);
foreach($focus_meetings_list as $meeting) {
if(isset($seen_ids[$meeting->id])) {
continue;
}
$seen_ids[$meeting->id] = 1;
$act = new CalendarActivity($meeting);
if(!empty($act)) {
$act_list[] = $act;
}
}
}
if(ACLController::checkAccess('Calls', 'list',$current_user->id == $user_id)) {
$call = new Call();
if($current_user->id == $user_id) {
$call->disable_row_level_security = true;
}
$where = CalendarActivity::get_occurs_within_where_clause($call->table_name, $call->rel_users_table, $view_start_time, $view_end_time, 'date_start', $view);
$focus_calls_list = build_related_list_by_user_id($call,$user_id,$where);
foreach($focus_calls_list as $call) {
if(isset($seen_ids[$call->id])) {
continue;
}
$seen_ids[$call->id] = 1;
$act = new CalendarActivity($call);
if(!empty($act)) {
$act_list[] = $act;
}
}
}
if($show_tasks) {
if(ACLController::checkAccess('Tasks', 'list',$current_user->id == $user_id)) {
$task = new Task();
$where = CalendarActivity::get_occurs_within_where_clause('tasks', '', $view_start_time, $view_end_time, 'date_due', $view);
$where .= " AND tasks.assigned_user_id='$user_id' ";
$focus_tasks_list = $task->get_full_list("", $where,true);
if(!isset($focus_tasks_list)) {
$focus_tasks_list = array();
}
foreach($focus_tasks_list as $task) {
$act = new CalendarActivity($task);
if(!empty($act)) {
$act_list[] = $act;
}
}
}
}
usort($act_list,'sort_func_by_act_date');
return $act_list;
}
}

48
modules/Calendar/DateTime.php Executable file
View File

@@ -0,0 +1,48 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
/*
* This class has been deprecated, the class name classhes with a finction in PHP 5.20. Please use DateTimeUtil instead.
*/
require_once('modules/Calendar/DateTimeUtil.php');
class DateTime extends DateTimeUtil
{
}
?>

632
modules/Calendar/DateTimeUtil.php Executable file
View File

@@ -0,0 +1,632 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
class DateTimeUtil
{
var $timezone;
var $sec;
var $min;
var $hour;
var $zhour;
var $day;
var $zday;
var $day_of_week;
var $day_of_week_short;
var $day_of_week_long;
var $day_of_year;
var $week;
var $month;
var $zmonth;
var $month_short;
var $month_long;
var $year;
var $am_pm;
var $tz_offset;
// unix epoch time
var $ts;
/**
* Convert from DB-formatted timedate to DateTimeUtil object
* @param string $date_start
* @param string $time_start
*/
function get_time_start($date_start, $time_start = '')
{
global $timedate;
if(empty($time_start)) {
list($date_start, $time_start) = explode(' ', $date_start);
}
$match=array();
preg_match("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/",$date_start,$match);
$time_arr = array();
$time_arr['year'] = $match[1];
$time_arr['month'] = $match[2];
$time_arr['day'] = $match[3];
if ( empty( $time_start) )
{
$time_arr['hour'] = 0;
$time_arr['min'] = 0;
}
else
{
if (preg_match('/^(\d\d*):(\d\d*):(\d\d*)$/',$time_start,$match))
{
$time_arr['hour'] = $match[1];
$time_arr['min'] = $match[2];
}
else if ( preg_match('/^(\d\d*):(\d\d*)$/',$time_start,$match))
{
$time_arr['hour'] = $match[1];
$time_arr['min'] = $match[2];
}
}
$gmtdiff = date('Z')-$timedate->adjustmentForUserTimeZone()*60;
$time_arr['sec'] = $gmtdiff;
return new DateTimeUtil($time_arr,true);
}
function get_time_end( $start_time, $duration_hours,$duration_minutes)
{
if ( empty($duration_hours))
{
$duration_hours = "00";
}
if ( empty($duration_minutes))
{
$duration_minutes = "00";
}
$added_seconds = ($duration_hours * 60 * 60 + $duration_minutes * 60 ) - 1;
$time_arr = array();
$time_arr['year'] = $start_time->year;
$time_arr['month'] = $start_time->month;
$time_arr['day'] = $start_time->day;
$time_arr['hour'] = $start_time->hour;
$time_arr['min'] = $start_time->min;
$time_arr['sec'] = $added_seconds;
return new DateTimeUtil($time_arr,true);
}
function get_date_str()
{
$arr = array();
if ( isset( $this->hour))
{
array_push( $arr, "hour=".$this->hour);
}
if ( isset( $this->day))
{
array_push( $arr, "day=".$this->day);
}
if ( isset( $this->month))
{
array_push( $arr, "month=".$this->month);
}
if ( isset( $this->year))
{
array_push( $arr, "year=".$this->year);
}
return ("&".implode('&',$arr));
}
function get_tomorrow()
{
$date_arr = array('day'=>($this->day + 1),
'month'=>$this->month,
'year'=>$this->year);
return new DateTimeUtil($date_arr,true);
}
function get_yesterday()
{
$date_arr = array('day'=>($this->day - 1),
'month'=>$this->month,
'year'=>$this->year);
return new DateTimeUtil($date_arr,true);
}
function get_mysql_date()
{
return $this->year."-".$this->zmonth."-".$this->zday;
}
function get_mysql_time()
{
return $this->hour.":".$this->min;
}
function parse_utc_date_time($str)
{
preg_match('/(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z/',$str,$matches);
$date_arr = array(
'year'=>$matches[1],
'month'=>$matches[2],
'day'=>$matches[3],
'hour'=>$matches[4],
'min'=>$matches[5]);
$date_time = new DateTimeUtil($date_arr,true);
$date_arr = array('ts'=>$date_time->ts + $date_time->tz_offset);
return new DateTimeUtil($date_arr,true);
}
function get_utc_date_time()
{
return gmdate('Ymd\THi', $this->ts)."00Z";
}
function get_first_day_of_last_year()
{
$date_arr = array('day'=>1,
'month'=>1,
'year'=>($this->year - 1));
return new DateTimeUtil($date_arr,true);
}
function get_first_day_of_next_year()
{
$date_arr = array('day'=>1,
'month'=>1,
'year'=>($this->year + 1));
return new DateTimeUtil($date_arr,true);
}
function get_first_day_of_next_week()
{
$first_day = $this->get_day_by_index_this_week(0);
$date_arr = array('day'=>($first_day->day + 7),
'month'=>$first_day->month,
'year'=>$first_day->year);
return new DateTimeUtil($date_arr,true);
}
function get_first_day_of_last_week()
{
$first_day = $this->get_day_by_index_this_week(0);
$date_arr = array('day'=>($first_day->day - 7),
'month'=>$first_day->month,
'year'=>$first_day->year);
return new DateTimeUtil($date_arr,true);
}
function get_first_day_of_last_month()
{
if ($this->month == 1)
{
$month = 12;
$year = $this->year - 1;
}
else
{
$month = $this->month - 1;
$year = $this->year ;
}
$date_arr = array('day'=>1,
'month'=>$month,
'year'=>$year);
return new DateTimeUtil($date_arr,true);
}
function get_first_day_of_this_month()
{
$month = $this->month;
$year = $this->year ;
$date_arr = array('day'=>1,
'month'=>$month,
'year'=>$year);
return new DateTimeUtil($date_arr,true);
}
function get_first_day_of_next_month()
{
$date_arr = array('day'=>1,
'month'=>($this->month + 1),
'year'=>$this->year);
return new DateTimeUtil($date_arr,true);
}
function fill_in_details()
{
global $mod_strings, $timedate;
$hour = 0;
$min = 0;
$sec = 0;
$day = 1;
$month = 1;
$year = 1970;
if ( isset($this->sec))
{
$sec = $this->sec;
}
if ( isset($this->min))
{
$min = $this->min;
}
if ( isset($this->hour))
{
$hour = $this->hour;
}
if ( isset($this->day))
{
$day= $this->day;
}
if ( isset($this->month))
{
$month = $this->month;
}
if ( isset($this->year))
{
$year = $this->year;
}
else
{
sugar_die ("fill_in_details: year was not set");
}
$this->ts = mktime($hour,$min,$sec,$month,$day,$year)+$timedate->adjustmentForUserTimeZone()*60;
$this->load_ts($this->ts);
}
function load_ts($timestamp)
{
// global $mod_list_strings;
global $current_language;
$mod_list_strings = return_mod_list_strings_language($current_language,"Calendar");
if ( empty($timestamp))
{
$timestamp = time();
}
$this->ts = $timestamp;
global $timedate;
$tdiff = $timedate->adjustmentForUserTimeZone();
$date_str = date('i:G:H:j:d:t:w:z:L:W:n:m:Y:Z',$timestamp-$tdiff*60);
list(
$this->min,
$this->hour,
$this->zhour,
$this->day,
$this->zday,
$this->days_in_month,
$this->day_of_week,
$this->day_of_year,
$is_leap,
$this->week,
$this->month,
$this->zmonth,
$this->year,
$this->tz_offset)
= explode(':',$date_str);
$this->tz_offset = date('Z') - $tdiff * 60;
$this->day_of_week_short =$mod_list_strings['dom_cal_weekdays'][$this->day_of_week];
$this->day_of_week_long=$mod_list_strings['dom_cal_weekdays_long'][$this->day_of_week];
$this->month_short=$mod_list_strings['dom_cal_month'][$this->month];
$this->month_long=$mod_list_strings['dom_cal_month_long'][$this->month];
$this->days_in_year = 365;
if ($is_leap == 1)
{
$this->days_in_year += 1;
}
}
function DateTimeUtil($time,$fill_in_details)
{
if (! isset( $time) || count($time) == 0 )
{
$this->load_ts(null);
}
else if ( isset( $time['ts']))
{
$this->load_ts($time['ts']);
}
else if ( isset( $time['date_str']))
{
list($this->year,$this->month,$this->day)=
explode("-",$time['date_str']);
if ($fill_in_details == true)
{
$this->fill_in_details();
}
}
else
{
if ( isset($time['sec']))
{
$this->sec = $time['sec'];
}
if ( isset($time['min']))
{
$this->min = $time['min'];
}
if ( isset($time['hour']))
{
$this->hour = $time['hour'];
}
if ( isset($time['day']))
{
$this->day = $time['day'];
}
if ( isset($time['week']))
{
$this->week = $time['week'];
}
if ( isset($time['month']))
{
$this->month = $time['month'];
}
if ( isset($time['year']) && $time['year'] >= 1970)
{
$this->year = $time['year'];
}
else
{
return null;
}
if ($fill_in_details == true)
{
$this->fill_in_details();
}
}
}
function dump_date_info()
{
echo "min:".$this->min."<br>\n";
echo "hour:".$this->hour."<br>\n";
echo "day:".$this->day."<br>\n";
echo "month:".$this->month."<br>\n";
echo "year:".$this->year."<br>\n";
}
function get_hour()
{
$hour = $this->hour;
if ($this->hour > 12)
{
$hour -= 12;
}
else if ($this->hour == 0)
{
$hour = 12;
}
return $hour;
}
function get_24_hour()
{
return $this->hour;
}
function get_am_pm()
{
if ($this->hour >=12)
{
return "PM";
}
return "AM";
}
function get_day()
{
return $this->day;
}
function get_month()
{
return $this->month;
}
function get_day_of_week_short()
{
return $this->day_of_week_short;
}
function get_day_of_week()
{
return $this->day_of_week_long;
}
function get_month_name()
{
return $this->month_long;
}
function get_datetime_by_index_today($hour_index)
{
$arr = array();
if ( $hour_index < 0 || $hour_index > 23 )
{
sugar_die("hour is outside of range");
}
$arr['hour'] = $hour_index;
$arr['min'] = 0;
$arr['day'] = $this->day;
$arr['month'] = $this->month;
$arr['year'] = $this->year;
return new DateTimeUtil($arr,true);
}
function get_hour_end_time()
{
$arr = array();
$arr['hour'] = $this->hour;
$arr['min'] = 59;
$arr['sec'] = 59;
$arr['day'] = $this->day;
$arr['month'] = $this->month;
$arr['year'] = $this->year;
return new DateTimeUtil($arr,true);
}
function get_day_end_time()
{
$arr = array();
$arr['hour'] = 23;
$arr['min'] = 59;
$arr['sec'] = 59;
$arr['day'] = $this->day;
$arr['month'] = $this->month;
$arr['year'] = $this->year;
return new DateTimeUtil($arr,true);
}
function get_day_by_index_this_week($day_index)
{
$arr = array();
if ( $day_index < 0 || $day_index > 6 )
{
sugar_die("day is outside of week range");
}
$arr['day'] = $this->day +
($day_index - $this->day_of_week);
$arr['month'] = $this->month;
$arr['year'] = $this->year;
return new DateTimeUtil($arr,true);
}
function get_day_by_index_this_year($month_index)
{
$arr = array();
$arr['month'] = $month_index+1;
$arr['year'] = $this->year;
// wp: Find the last day of the month requested, ensure that is the ceiling of the day param
$arr['day'] = min(strftime("%d", mktime(0, 0, 0, $arr['month']+1, 0, $arr['year'])), $this->day);
return new DateTimeUtil($arr,true);
}
function get_day_by_index_this_month($day_index)
{
$arr = array();
$arr['day'] = $day_index + 1;
$arr['month'] = $this->month;
$arr['year'] = $this->year;
return new DateTimeUtil($arr,true);
}
function getHashList($view, &$start_time, &$end_time)
{
$hash_list = array();
if (version_compare(phpversion(), '5.0') < 0)
$new_time = $start_time;
else
$new_time = clone($start_time);
$arr = array();
if ( $view != 'day')
{
$end_time = $end_time->get_day_end_time();
}
if (empty($new_time->ts))
{
return;
}
if ( $new_time->ts == $end_time->ts)
{
$end_time->ts+=1;
}
while( $new_time->ts < $end_time->ts)
{
$arr['month'] = $new_time->month;
$arr['year'] = $new_time->year;
$arr['day'] = $new_time->day;
$arr['hour'] = $new_time->hour;
if ( $view == 'day')
{
$hash_list[] = $new_time->get_mysql_date().":".$new_time->hour;
$arr['hour'] += 1;
}
else
{
$hash_list[] = $new_time->get_mysql_date();
$arr['day'] += 1;
}
$new_time = new DateTimeUtil($arr,true);
}
return $hash_list;
}
}
?>

44
modules/Calendar/Forms.php Executable file
View File

@@ -0,0 +1,44 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$GLOBALS['QCModule'] = 'Calls';
//If Meetings module was requested, we override the return_module action to default to Calls
if((isset($_REQUEST['module']) && $_REQUEST['module'] == 'Meetings') && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'index')) {
$_REQUEST['return_module'] = 'Calls';
}
require_once('modules/Calls/Forms.php');
?>

61
modules/Calendar/Menu.php Executable file
View File

@@ -0,0 +1,61 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
global $mod_strings, $app_strings;
global $mod_strings;
//if(ACLController::checkAccess('Calls', 'edit', true))$module_menu[]=Array("index.php?module=Calls&action=EditView&return_module=Calls&return_action=DetailView", $mod_strings['LNK_NEW_CALL'],"CreateCalls");
//if(ACLController::checkAccess('Meetings', 'edit', true))$module_menu[]=Array("index.php?module=Meetings&action=EditView&return_module=Meetings&return_action=DetailView", $mod_strings['LNK_NEW_MEETING'],"CreateMeetings");
if(ACLController::checkAccess('Tasks', 'edit', true))$module_menu[]=Array("index.php?module=Tasks&action=EditView&return_module=Tasks&return_action=DetailView", $mod_strings['LNK_NEW_TASK'],"CreateTasks");
//if(ACLController::checkAccess('Notes', 'edit', true))$module_menu[]=Array("index.php?module=Notes&action=EditView&return_module=Notes&return_action=DetailView", $mod_strings['LNK_NEW_NOTE'],"CreateNotes");
//if(ACLController::checkAccess('Calls', 'list', true))$module_menu[]=Array("index.php?module=Calls&action=index&return_module=Calls&return_action=DetailView", $mod_strings['LNK_CALL_LIST'],"Calls");
//if(ACLController::checkAccess('Meetings', 'list', true))$module_menu[]=Array("index.php?module=Meetings&action=index&return_module=Meetings&return_action=DetailView", $mod_strings['LNK_MEETING_LIST'],"Meetings");
if(ACLController::checkAccess('Tasks', 'list', true))$module_menu[]=Array("index.php?module=Tasks&action=index&return_module=Tasks&return_action=DetailView", $mod_strings['LNK_TASK_LIST'],"Tasks");
//if(ACLController::checkAccess('Notes', 'list', true))$module_menu[]=Array("index.php?module=Notes&action=index&return_module=Notes&return_action=DetailView", $mod_strings['LNK_NOTE_LIST'],"Notes");
if(ACLController::checkAccess('Calendar', 'list', true))$module_menu[]=Array("index.php?module=Calendar&action=index&view=day", $mod_strings['LNK_VIEW_CALENDAR'],"Calendar");
//if(ACLController::checkAccess('Calls', 'import', true))$module_menu[]=Array("index.php?module=Import&action=Step1&import_module=Calls&return_module=Calls&return_action=index", $mod_strings['LNK_IMPORT_CALLS'],"Import", 'Calls');
//if(ACLController::checkAccess('Meetings', 'import', true))$module_menu[]=Array("index.php?module=Import&action=Step1&import_module=Meetings&return_module=Meetings&return_action=index", $mod_strings['LNK_IMPORT_MEETINGS'],"Import", 'Meetings');
//if(ACLController::checkAccess('Tasks', 'import', true))$module_menu[]=Array("index.php?module=Import&action=Step1&import_module=Tasks&return_module=Tasks&return_action=index", $mod_strings['LNK_IMPORT_TASKS'],"Import", 'Tasks');
//if(ACLController::checkAccess('Notes', 'import', true))$module_menu[]=Array("index.php?module=Import&action=Step1&import_module=Notes&return_module=Notes&return_action=index", $mod_strings['LNK_IMPORT_NOTES'],"Import", 'Notes');
?>

View File

@@ -0,0 +1,68 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
/// START SHARED CALENDAR
include('modules/Calendar/templates/template_shared_calendar.php');
function SubPanelSharedCalendar(&$focus)
{
global $mod_strings;
global $current_language;
global $currentModule;
$currentModule = $_REQUEST['module'];
$temp_module = $currentModule;
$mod_strings = return_module_language($current_language,'Calendar');
$currentModule = 'Calendar';
$args = array(
"activity_focus"=>$focus,
"users"=>$focus->get_users());
template_shared_calendar($args);
$mod_strings = return_module_language($current_language,$temp_module);
$currentModule = $_REQUEST['module'];
/// END SHARED CALENDAR
}
?>

View File

@@ -0,0 +1,60 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* {APP.LBL_CURRENCY_SYM}Header: /cvsroot/sugarcrm/sugarcrm/modules/Tasks/ListView.html,v 1.8 2004/06/18 07:35:41 sugarclint Exp {APP.LBL_CURRENCY_SYM}
********************************************************************************/
-->
<!-- BEGIN: main -->
<table cellpadding="0" cellspacing="0" width="100%" border="0" class="list view">
<!-- BEGIN: list_nav_row -->
{PAGINATION}
<!-- END: list_nav_row -->
<tr height="20">
<th scope="col" width="5%" align="center" NOWRAP><slot><a href="{ORDER_BY}status" class="listViewThLinkS1">{MOD.LBL_LIST_STATUS}{arrow_start}{status_arrow}{arrow_end}</a></slot></th>
<th scope="col" width="60%" align="left" NOWRAP><slot><a href="{ORDER_BY}name" class="listViewThLinkS1">{MOD.LBL_LIST_SUBJECT}{arrow_start}{name_arrow}{arrow_end}</a></slot></th>
<th scope="col" width="35%" NOWRAP><slot><a href="{ORDER_BY}date_due" class="listViewThLinkS1">{MOD.LBL_LIST_DUE_DATE}{arrow_start}{date_due_arrow}{arrow_end}</a></slot></th>
</tr>
<!-- BEGIN: row -->
<tr height="20" class="{ROW_COLOR}S1">
<td nowrap align=LEFT valign=TOP><slot>{TASK.STATUS}</slot></td>
<td scope='row' valign=TOP><slot><a href="{URL_PREFIX}index.php?action=DetailView&module=Tasks&record={TASK.ID}" >{TASK.NAME}</a></slot></td>
<td nowrap valign=TOP><slot>{TASK.DATE_DUE}</slot></td>
</tr>
<!-- END: row -->
</table>
<!-- END: main -->

View File

@@ -0,0 +1,146 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/ListView/ListViewSmarty.php');
if(file_exists('custom/modules/Calendar/metadata/listviewdefs.php')){
require_once('custom/modules/Calendar/metadata/listviewdefs.php');
}else{
require_once('modules/Calendar/metadata/listviewdefs.php');
}
global $mod_strings;
global $app_strings;
global $app_list_strings;
global $urlPrefix;
global $currentModule;
global $current_language;
$current_module_strings = return_module_language($current_language, 'Tasks');
global $theme;
// clear the display columns back to default when clear query is called
if(!empty($_REQUEST['clear_query']) && $_REQUEST['clear_query'] == 'true')
$current_user->setPreference('ListViewDisplayColumns', array(), 0, 'Calendar');
$savedDisplayColumns = $current_user->getPreference('ListViewDisplayColumns', 'Calendar'); // get user defined display columns
$json = getJSONobj();
$seedTask = new Task();
// setup listview smarty
$lv = new ListViewSmarty();
$displayColumns = array();
// check $_REQUEST if new display columns from post
if(!empty($_REQUEST['displayColumns'])) {
foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) {
if(!empty($listViewDefs['Tasks'][$col]))
$displayColumns[$col] = $listViewDefs['Tasks'][$col];
}
}
elseif(!empty($savedDisplayColumns)) { // use user defined display columns from preferences
$displayColumns = $savedDisplayColumns;
}
else { // use columns defined in listviewdefs for default display columns
foreach($listViewDefs['Calendar'] as $col => $params) {
if(!empty($params['default']) && $params['default'])
$displayColumns[$col] = $params;
}
}
$params = array('massupdate' => false); // setup ListViewSmarty params
if(!empty($_REQUEST['orderBy'])) { // order by coming from $_REQUEST
$params['orderBy'] = $_REQUEST['orderBy'];
$params['overrideOrder'] = true;
if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder'];
}
$params['orderBy'] = '';
$lv->displayColumns = $displayColumns;
// use the stored query if there is one
if (!isset($where)) $where = "";
require_once('modules/MySettings/StoreQuery.php');
$storeQuery = new StoreQuery();
if(!isset($_REQUEST['query'])){
$storeQuery->loadQuery('Calendar');
$storeQuery->populateRequest();
}else{
$storeQuery->saveFromGet('Calendar');
}
global $timedate;
//jc: bug 14616 - dates need to specificy the end of the current date in order to get tasks
// that are scheduled to start today
$today = $timedate->to_db_date(date($timedate->get_date_format() . " H:m:s"), false) . " 23:59:59";
$today = $timedate->handle_offset($today, $timedate->dbDayFormat, true) . " 23:59:59";
//end bug 14616
$where = "(tasks.assigned_user_id='$current_user->id' and tasks.status<>'Completed' and tasks.status<>'Deferred'";
$where .= "and (tasks.date_start is NULL or tasks.date_start <= '$today'))";
$where .= "and tasks.all_day='1'";
$lv->export = false;
$lv->delete = false;
$lv->select = false;
$lv->mailMerge = false;
$lv->multiSelect = false;
$lv->setup($seedTask, 'include/ListView/ListViewGeneric.tpl', $where, $params);
//echo get_module_title($current_module_strings['LBL_MODULE_NAME'], $current_module_strings['LBL_LIST_FORM_TITLE'], false);
echo '<h2>'.$mod_strings['LBL_LIST_ALL_DAY'].'</h2><br>';
echo $lv->display();
//Fake Mass Update
$form = "<form action='index.php' id='MassUpdate' method='post' name='MassUpdate'><input type='hidden' id='uid' name='uid'><input name='action' type='hidden' value='index' /><input name='module' type='hidden' value='Project'></form>";
echo $form;
?>

141
modules/Calendar/index.php Executable file
View File

@@ -0,0 +1,141 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $theme, $current_language, $mod_strings;
require_once('modules/Calendar/templates/templates_calendar.php');
require_once('modules/Calendar/Calendar.php');
setlocale( LC_TIME ,$current_language);
if(!ACLController::checkAccess('Calendar', 'list', true)){
ACLController::displayNoAccess(true);
}
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_TITLE'], true);
if ( empty($_REQUEST['view']))
{
$_REQUEST['view'] = 'day';
}
$date_arr = array();
if ( isset($_REQUEST['ts']))
{
$date_arr['ts'] = $_REQUEST['ts'];
}
if ( isset($_REQUEST['day']))
{
$date_arr['day'] = $_REQUEST['day'];
}
if ( isset($_REQUEST['month']))
{
$date_arr['month'] = $_REQUEST['month'];
}
if ( isset($_REQUEST['week']))
{
$date_arr['week'] = $_REQUEST['week'];
}
if ( isset($_REQUEST['year']))
{
if ($_REQUEST['year'] > 2037 || $_REQUEST['year'] < 1970)
{
print("Sorry, calendar cannot handle the year you requested");
print("<br>Year must be between 1970 and 2037");
exit;
}
$date_arr['year'] = $_REQUEST['year'];
}
// today adjusted for user's timezone
if(empty($date_arr)) {
global $timedate;
$gmt_today = $timedate->get_gmt_db_datetime();
$user_today = $timedate->handle_offset($gmt_today, $GLOBALS['timedate']->get_db_date_time_format());
preg_match('/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/',$user_today,$matches);
$date_arr = array(
'year'=>$matches[1],
'month'=>$matches[2],
'day'=>$matches[3],
'hour'=>$matches[4],
'min'=>$matches[5]);
}
$args['calendar'] = new Calendar($_REQUEST['view'], $date_arr);
if ($_REQUEST['view'] == 'day' || $_REQUEST['view'] == 'week' || $_REQUEST['view'] == 'month')
{
global $current_user;
$args['calendar']->add_activities($current_user);
}
$args['view'] = $_REQUEST['view'];
?>
<script type="text/javascript" language="JavaScript">
<!-- Begin
function toggleDisplay(id){
if(this.document.getElementById( id).style.display=='none'){
this.document.getElementById( id).style.display='inline'
if(this.document.getElementById(id+"link") != undefined){
this.document.getElementById(id+"link").style.display='none';
}
}else{
this.document.getElementById( id).style.display='none'
if(this.document.getElementById(id+"link") != undefined){
this.document.getElementById(id+"link").style.display='inline';
}
}
}
// End -->
</script>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign=top width="70%" style="padding-right: 10px; padding-top: 2px;">
<?php template_calendar($args); ?>
</td>
<?php if ($_REQUEST['view'] == 'day') { ?>
<td valign=top width="30%">
<?php include("modules/Calendar/TasksListView.php") ;?>
</td>
<?php } ?>
</tr>
</table>

View File

@@ -0,0 +1,141 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Defines the English language pack for the base application.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$mod_strings = array (
'LBL_LIST_ALL_DAY' => 'All day job\'s',
'LBL_MODULE_NAME'=>'Calendar',
'LBL_MODULE_TITLE'=>'Calendar',
'LNK_NEW_CALL' => 'Log Call',
'LNK_NEW_MEETING' => 'Schedule Meeting',
'LNK_NEW_APPOINTMENT' => 'Create Appointment',
'LNK_NEW_TASK' => 'Create Task',
'LNK_CALL_LIST' => 'Calls',
'LNK_MEETING_LIST' => 'Meetings',
'LNK_TASK_LIST' => 'Tasks',
'LNK_VIEW_CALENDAR' => 'Today',
'LNK_IMPORT_CALLS'=>'Import Calls',
'LNK_IMPORT_MEETINGS'=>'Import Meetings',
'LNK_IMPORT_TASKS'=>'Import Tasks',
'LBL_MONTH' => 'Month',
'LBL_DAY' => 'Day',
'LBL_YEAR' => 'Year',
'LBL_WEEK' => 'Week',
'LBL_PREVIOUS_MONTH' => 'Previous Month',
'LBL_PREVIOUS_DAY' => 'Previous Day',
'LBL_PREVIOUS_YEAR' => 'Previous Year',
'LBL_PREVIOUS_WEEK' => 'Previous Week',
'LBL_NEXT_MONTH' => 'Next Month',
'LBL_NEXT_DAY' => 'Next Day',
'LBL_NEXT_YEAR' => 'Next Year',
'LBL_NEXT_WEEK' => 'Next Week',
'LBL_AM' => 'AM',
'LBL_PM' => 'PM',
'LBL_SCHEDULED' => 'Scheduled',
'LBL_BUSY' => 'Busy',
'LBL_CONFLICT' => 'Conflict',
'LBL_USER_CALENDARS' => 'User Calendars',
'LBL_SHARED' => 'Shared',
'LBL_PREVIOUS_SHARED' => 'Previous',
'LBL_NEXT_SHARED' => 'Next',
'LBL_SHARED_CAL_TITLE' => 'Shared Calendar',
'LBL_USERS' => 'User',
'LBL_REFRESH' => 'Refresh',
'LBL_EDIT' => 'Edit',
'LBL_SELECT_USERS' => 'Select users for calendar display',
'LBL_FILTER_BY_TEAM' => 'Filter user list by team:',
'LBL_ASSIGNED_TO_NAME' => 'Assigned to',
'LBL_DATE' => 'Start Date & Time'
);
$mod_list_strings = array(
'dom_cal_weekdays'=>array(
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat",
),
'dom_cal_weekdays_long'=>array(
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
),
'dom_cal_month'=>array(
"",
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
),
'dom_cal_month_long'=>array(
"",
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
)
);
?>

View File

@@ -0,0 +1,130 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version
* 1.1.3 ("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.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2005 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* pl_pl.lang.ext.php,v for SugarCRM 4.5-->>
* Translator: Krzysztof Morawski
* All Rights Reserved.
* Any bugs report welcome: krzysiek<at>mojsklepik<dot>net
* Contributor(s): ______________________________________..
********************************************************************************/
$mod_strings = array (
'LBL_LIST_ALL_DAY' => 'Lista zadań całodniowych',
'LBL_MODULE_NAME'=>'Kalendarz',
'LBL_MODULE_TITLE'=>'Kalendarz',
'LNK_NEW_CALL' => 'Dodaj rozmowę tel.',
'LNK_NEW_MEETING' => 'Dodaj spotkanie',
'LNK_NEW_APPOINTMENT' => 'Dodaj termin spotkania',
'LNK_NEW_TASK' => 'Dodaj Zadanie',
'LNK_CALL_LIST' => 'Rozmowy Tel.',
'LNK_MEETING_LIST' => 'Spotkania',
'LNK_TASK_LIST' => 'Zadania',
'LNK_VIEW_CALENDAR' => 'Dziś',
'LNK_IMPORT_CALLS'=>'Importuj rozmowy tel.',
'LNK_IMPORT_MEETINGS'=>'Importuj spotkania',
'LNK_IMPORT_TASKS'=>'Importuj zadania',
'LBL_MONTH' => 'Miesiąc',
'LBL_DAY' => 'Dzień',
'LBL_YEAR' => 'Rok',
'LBL_WEEK' => 'Tydzień',
'LBL_PREVIOUS_MONTH' => 'Poprzedni miesiąc',
'LBL_PREVIOUS_DAY' => 'Poprzedni dzień',
'LBL_PREVIOUS_YEAR' => 'Poprzedni rok',
'LBL_PREVIOUS_WEEK' => 'Poprzedni tydzień',
'LBL_NEXT_MONTH' => 'Następny miesiąc',
'LBL_NEXT_DAY' => 'Następny dzień',
'LBL_NEXT_YEAR' => 'Następny rok',
'LBL_NEXT_WEEK' => 'Następny tydzień',
'LBL_AM' => 'AM',
'LBL_PM' => 'PM',
'LBL_SCHEDULED' => 'Zaplanowany',
'LBL_BUSY' => 'Zajęty',
'LBL_CONFLICT' => 'Konflikt',
'LBL_USER_CALENDARS' => 'Kalendarz użytkownika',
'LBL_SHARED' => 'Współdzielone',
'LBL_PREVIOUS_SHARED' => 'Poprzedni',
'LBL_NEXT_SHARED' => 'Następny',
'LBL_SHARED_CAL_TITLE' => 'Współdzielony kalendarz',
'LBL_USERS' => 'Użytkownik',
'LBL_REFRESH' => 'Odśwież',
'LBL_EDIT' => 'Edytuj',
'LBL_SELECT_USERS' => 'Wybierz użytkowników, którym system wyświetli kalendarz',
'LBL_FILTER_BY_TEAM' => 'Filtruj listę użytkowników przez Zespoły:',
'LBL_ASSIGNED_TO_NAME' => 'Przydzielone do',
'LBL_START_DATE' => 'Data i czas rozpoczęcia',
);
$mod_list_strings = array (
'dom_cal_weekdays' => array (
'Nie' ,
'Pn' ,
'Wt' ,
'Śr' ,
'Czw' ,
'Pt' ,
'So',
),
'dom_cal_weekdays_long' => array (
'Niedziela' ,
'Poniedziałek' ,
'Wtorek' ,
'Środa' ,
'Czwartek' ,
'Piątek' ,
'Sobota',
),
'dom_cal_month' => array (
'' ,
'Styczeń' ,
'Luty' ,
'Marzec' ,
'Kwiecień' ,
'Maj' ,
'Czerwiec' ,
'Lipiec' ,
'Sierpień' ,
'Wrzesień' ,
'Październik' ,
'Listopad' ,
'Grudzień',
),
'dom_cal_month_long' => array (
'' ,
'Styczeń' ,
'Luty' ,
'Marzec' ,
'Kwiecień' ,
'Maj' ,
'Czerwiec' ,
'Lipiec' ,
'Sierpień' ,
'Wrzesień' ,
'Pażdziernik' ,
'Listopad' ,
'Grudzień',
)
);
?>

View File

@@ -0,0 +1,67 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$listViewDefs['Calendar'] = array(
/*
'STATUS' => array(
'width' => '10',
'label' => 'LBL_LIST_STATUS',
'link' => false,
'default' => true),
*/
'SET_COMPLETE' => array(
'width' => '1',
'label' => 'LBL_LIST_CLOSE',
'link' => true,
'sortable' => false,
'default' => true,
'related_fields' => array('status')),
'NAME' => array(
'width' => '40',
'label' => 'LBL_LIST_SUBJECT',
'link' => true,
'default' => true),
'DATE_DUE' => array(
'width' => '15',
'label' => 'LBL_LIST_DUE_DATE',
'link' => false,
'default' => true),
);
?>

View File

@@ -0,0 +1,55 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $mod_strings;
global $current_language;
global $currentModule;
$temp_module = $currentModule;
$mod_strings = return_module_language($current_language,'Calendar');
$currentModule = 'Calendar';
$args = array();
include_once("modules/Calendar/Calendar.php") ;
include_once("modules/Calendar/templates/templates_calendar.php") ;
$args['calendar'] = new Calendar('month');
$args['view'] = 'month';
$args['size'] = 'small';
template_calendar($args);
$mod_strings = return_module_language($current_language,$temp_module);
$currentModule = $_REQUEST['module'];
?>

View File

@@ -0,0 +1,182 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
include_once("modules/Calendar/Calendar.php");
include_once("modules/Calendar/templates/templates_calendar.php");
function template_shared_calendar(&$args) {
global $current_user;
global $app_strings;
global $mod_strings;
$date_arr= array("activity_focus"=>$args['activity_focus']);
$calendar = new Calendar("day",$date_arr);
$calendar->show_tasks = false;
$calendar->toggle_appt = false;
foreach($args['users'] as $user)
{
/*
if ($user->id != $current_user->id)
{
*/
$calendar->add_activities($user,'vfb');
/*
}
*/
}
?>
<p>
<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td><h3><?php echo $mod_strings['LBL_USER_CALENDARS']; ?></h3>
</td>
<td align=right>
<h3><?php template_echo_date_info("day",$calendar->date_time);?></h3>
</td></tr></table>
<table cellpadding="0" cellspacing="0" width="100%" border="0" class="list view">
<tr height="20">
<td scope="col" width="25%" ><?php echo $app_strings['LBL_LIST_NAME']; ?></td>
<?php
$start_slice_idx = $calendar->get_start_slice_idx();
$end_slice_idx = $calendar->get_end_slice_idx();
$cur_slice_idx = 1;
$slice_args = array();
for($cur_slice_idx=$start_slice_idx;$cur_slice_idx<=$end_slice_idx;$cur_slice_idx++)
{
$slice_args['slice'] = $calendar->slice_hash[$calendar->slices_arr[$cur_slice_idx]];
$slice_args['calendar'] = $calendar;
//print_r($cur_time);
?>
<td ><?php template_echo_slice_date($slice_args) ; ?></td>
<?php
}
?>
</tr>
<?php
$oddRow = true;
foreach($args['users'] as $curr_user)
{
if($oddRow)
{
$row_class = 'oddListRowS1';
} else
{
$row_class = 'evenListRowS1';
}
$oddRow = !$oddRow;
?>
<tr height="20" class="<?php echo $row_class; ?>">
<td scope="row" valign="top"><a href="index.php?action=DetailView&module=Users&record=<?php echo $curr_user->id; ?>" >
<?php echo $curr_user->full_name; ?></a></td>
<?php
// loop through each slice for this user and show free/busy
for($cur_slice_idx=$start_slice_idx;$cur_slice_idx<=$end_slice_idx;$cur_slice_idx++)
{
$cur_slice = $calendar->slice_hash[$calendar->slices_arr[$cur_slice_idx]];
// if this current activitiy occurs within this time slice
if ( Calendar::occurs_within_slice($cur_slice,$calendar->activity_focus))
{
/*
$got_conflict = 0;
if ( isset($cur_slice->acts_arr[$curr_user->id]) )
{
foreach( $cur_slice->acts_arr[$curr_user->id] as $act)
{
if ($act->sugar_bean->id != $calendar->activity_focus->sugar_bean->id)
{
$got_conflict = 1;
}
}
}
*/
if (isset($cur_slice->acts_arr[$curr_user->id]) && count($cur_slice->acts_arr[$curr_user->id]) > 1)
{
?>
<td class="listViewCalConflictAppt">&nbsp;</td>
<?php
} else
{
?>
<td class="listViewCalCurrentAppt">&nbsp;</td>
<?php
}
}
else if ( isset($cur_slice->acts_arr[$curr_user->id]))
{
?>
<td class="listViewCalOtherAppt">&nbsp;</td>
<?php
}
else
{
?>
<td>&nbsp;</td>
<?php
}
}
?>
</tr>
<?php
}
?>
</table>
<table width="100%" cellspacing="2" cellpadding="0" border="0">
<tr height="15">
<td width="100%"></td>
<td class="listViewCalCurrentApptLgnd"><img src="<?php echo SugarThemeRegistry::current()->getImageURL('blank.gif'); ?>" alt="<?php echo $mod_strings['LBL_SCHEDULED']; ?>" width="15" height="15">&nbsp;</td>
<td>&nbsp;<?php echo $mod_strings['LBL_SCHEDULED']; ?>&nbsp;</td>
<td class="listViewCalOtherApptLgnd"><img src="<?php echo SugarThemeRegistry::current()->getImageURL('blank.gif'); ?>" alt="<?php echo $mod_strings['LBL_BUSY']; ?>" width="15" height="15">&nbsp;</td>
<td>&nbsp;<?php echo $mod_strings['LBL_BUSY']; ?>&nbsp;</td>
<td class="listViewCalConflictApptLgnd"><img src="<?php echo SugarThemeRegistry::current()->getImageURL('blank.gif'); ?>" alt="<?php echo $mod_strings['LBL_CONFLICT']; ?>" width="15" height="15">&nbsp;</td>
<td>&nbsp;<?php echo $mod_strings['LBL_CONFLICT']; ?></td>
</tr>
</table>
</p>
<?php
}
?>

View File

@@ -0,0 +1,899 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/////////////////////////////////
// template
/////////////////////////////////
global $timedate;
function template_cal_tabs(& $args) {
global $mod_strings, $sugar_version, $sugar_config;
$tabs = array('day', 'week', 'month', 'year', 'shared');
if($args['view'] != 'day') {
echo '<script type="text/javascript" src="' . getJSPath('include/javascript/sugar_grp_overlib.js') . '"></script>
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>';
}
?>
<table id="cal_tabs" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<?php
$time_arr = array();
foreach($tabs as $tab) {
?>
<input type="button" <?php if($args['view'] == $tab) {?>selected="selected" <?php } ?> value=" <?php echo $mod_strings["LBL_".$args['calendar']->get_view_name($tab)]; ?> " title="<?php echo $mod_strings["LBL_".$args['calendar']->get_view_name($tab)]; ?>" onclick="window.location.href='index.php?module=Calendar&action=index&view=<?php echo $tab; ?><?php echo $args['calendar']->date_time->get_date_str(); ?>'">&nbsp;
<?php } ?>
</td>
</tr>
</table>
<?php
}
/////////////////////////////////
// template
/////////////////////////////////
function template_cal_month_slice(& $args) {
?>
<?php
template_echo_slice_date($args);
$newargs = array();
$cal_arr = array();
$cal_arr['month'] = $args['slice']->start_time->month;
$cal_arr['year'] = $args['slice']->start_time->year;
$newargs['calendar'] = new Calendar('month', $cal_arr);
$newargs['calendar']->show_only_current_slice = true;
$newargs['calendar']->show_activities = false;
$newargs['calendar']->show_week_on_month_view = false;
template_calendar_month($newargs);
?>
<?php
}
/////////////////////////////////
// template
/////////////////////////////////
function template_echo_slice_activities(& $args) {
global $app_list_strings, $current_user, $app_strings;
$count = 0;
if(empty($args['slice']->acts_arr[$current_user->id])) {
return;
}
foreach($args['slice']->acts_arr[$current_user->id] as $act) {
$fields = array();
foreach($act->sugar_bean->field_name_map as $field) {
if(!empty($act->sugar_bean->$field['name']))
$fields[strtoupper($field['name'])] = $act->sugar_bean->$field['name'];
}
if($act->sugar_bean->ACLAccess('DetailView') && file_exists('modules/' . $act->sugar_bean->module_dir . '/metadata/additionalDetails.php')) {
require_once('modules/' . $act->sugar_bean->module_dir . '/metadata/additionalDetails.php');
$ad_function = 'additionalDetails' . $act->sugar_bean->object_name;
$results = $ad_function($fields);
$results['string'] = str_replace(array("&#039", "'"), '\&#039', $results['string']); // no xss!
if(trim($results['string']) == '') $results['string'] = $app_strings['LBL_NONE'];
}
$extra = "onmouseover=\"return overlib('" .
str_replace(array("\rn", "\r", "\n"), array('','','<br />'), $results['string'])
. "', CAPTION, '{$app_strings['LBL_ADDITIONAL_DETAILS']}"
. "', DELAY, 200, STICKY, MOUSEOFF, 1000, WIDTH, "
.(empty($results['width']) ? '300' : $results['width'])
. ", CLOSETEXT, '<img border=0 style=\'margin-left:2px; margin-right: 2px;\' src=".SugarThemeRegistry::current()->getImageURL('close.gif').">', "
. "CLOSETITLE, '{$app_strings['LBL_ADDITIONAL_DETAILS_CLOSE_TITLE']}', CLOSECLICK, FGCLASS, 'olFgClass', "
. "CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass');\" "
. "onmouseout=\"return nd(1000);\" ";
$count ++;
echo '<div style="margin-top: 1px;"><table cellpadding="0" cellspacing="0"
border="0" width="100%"><tr>';
if($act->sugar_bean->object_name == 'Call') {
if ( isset($app_list_strings['call_status_dom'][$act->sugar_bean->status]) ) {
$callStatus = $app_list_strings['call_status_dom'][$act->sugar_bean->status];
}
else {
$callStatus = '';
}
echo '<td>' . SugarThemeRegistry::current()->getImage('Calls','alt="'.$app_list_strings['call_status_dom'][$act->sugar_bean->status].': '.$act->sugar_bean->name.'"') . '</td>
<td width="100%"><a ' . $extra . ' href="index.php?module=Calls&action=DetailView&record=' .
$act->sugar_bean->id . '">' . $callStatus . ': ' . $act->sugar_bean->name . '</a></td>';
} else if($act->sugar_bean->object_name == 'Meeting') {
if ( isset($app_list_strings['meeting_status_dom'][$act->sugar_bean->status]) ) {
$meetingStatus = $app_list_strings['meeting_status_dom'][$act->sugar_bean->status];
}
else {
$meetingStatus = '';
}
$out = '<td>' . SugarThemeRegistry::current()->getImage('Meetings','alt="'.$app_list_strings['meeting_status_dom'][$act->sugar_bean->status].': '.$act->sugar_bean->name.'"') . '</td>
<td width="100%"><a ' . $extra . ' href="index.php?module=Meetings&action=DetailView&record=' .
$act->sugar_bean->id . '">' . $meetingStatus . ': ' . $act->sugar_bean->name .'</a>';
///////////////////////////////////////////////////////////////
//// MEETING INTEGRATION
if(method_exists($act->sugar_bean, 'hasIntegratedMeeting')) {
if($act->sugar_bean->hasIntegratedMeeting()) {
$out .= $act->sugar_bean->miIcon;
}
}
//// END MEETING INTEGRATION
///////////////////////////////////////////////////////////////
$out .= "</td>";
echo $out;
} else if($act->sugar_bean->object_name == 'Task') {
echo '<td>' . SugarThemeRegistry::current()->getImage('Tasks','alt="'.$act->sugar_bean->status.': '.$act->sugar_bean->name.'"') . '</td>
<td width="100%"><a ' . $extra . ' href="index.php?module=Tasks&action=DetailView&record=' . $act->sugar_bean->id . '">'.$app_list_strings['task_status_dom'][$fields['STATUS']].': ' . $act->sugar_bean->name . '</a></td>';
}
echo '</tr></table><div>';
}
}
function template_echo_slice_activities_shared(& $args) {
global $app_list_strings;
global $shared_user, $timedate;
$count = 0;
if(empty($args['slice']->acts_arr[$shared_user->id])) {
return;
}
$out = '';
foreach($args['slice']->acts_arr[$shared_user->id] as $act) {
$count ++;
echo "<div style=\"margin-top: 1px;\">
<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">";
if($act->sugar_bean->object_name == 'Call') {
echo "<tr><td>".
SugarThemeRegistry::current()->getImage('Calls','alt=\"'.$app_list_strings['call_status_dom'][$act->sugar_bean->status].': '.$act->sugar_bean->name.'\"');
echo "</td>";
if(empty($act->sugar_bean->name)) {
echo "<td width=\"100%\">";
echo $timedate->getTimePart($act->sugar_bean->date_start);
echo "</td></tr>";
} else {
echo "<td width=\"100%\">
<a href=\"index.php?module=Calls&action=DetailView&record=".
$act->sugar_bean->id."\">".
$app_list_strings['call_status_dom'][$act->sugar_bean->status].": ".
$act->sugar_bean->name."<br>(".
$timedate->getTimePart($act->sugar_bean->date_start).")</a></td></tr>";
}
} else if($act->sugar_bean->object_name == 'Meeting') {
echo "<td>".
SugarThemeRegistry::current()->getImage('Meetings','alt=\"'.$app_list_strings['meeting_status_dom'][$act->sugar_bean->status].': '.$act->sugar_bean->name.'\"');
echo "</td>";
if(empty($act->sugar_bean->name)) {
echo "<td width=\"100%\">".
$timedate->getTimePart($act->sugar_bean->date_start);
echo "</td></tr>";
} else {
echo "<td width=\"100%\">
<a href=\"index.php?module=Meetings&action=DetailView&record=".
$act->sugar_bean->id."\">".
$app_list_strings['meeting_status_dom'][$act->sugar_bean->status].": ".
$act->sugar_bean->name."<br>(".
$timedate->getTimePart($act->sugar_bean->date_start).")</a>";
// MEETING INTEGRATION
if($act->sugar_bean->hasIntegratedMeeting()) {
$out .= $act->sugar_bean->miIcon;
}
// END MEETING INTEGRATION
$out .= "</td></tr>";
echo $out;
}
} else if($act->sugar_bean->object_name == 'Task') {
echo "<td>".
SugarThemeRegistry::current()->getImage('Tasks','alt="'.$act->sugar_bean->status.': '.$act->sugar_bean->name.'"');
echo "</td>";
if(empty($act->sugar_bean->name)) {
echo "<td width=\"100%\">".
$timedate->getTimePart($act->sugar_bean->date_due);
echo "</td></tr>";
} else {
echo "<td width=\"100%\">
<a href=\"index.php?module=Tasks&action=DetailView&record=".
$act->sugar_bean->id."\">".
$act->sugar_bean->status.': '.$act->sugar_bean->name."<br>(".
$timedate->getTimePart($act->sugar_bean->date_due).")</a></td></tr>";
}
}
echo "</table></div>";
}
}
/////////////////////////////////
// template
/////////////////////////////////
function template_cal_day_slice(& $args) {
/*
echo "cale:".$args['calendar']->view;
echo "cal1:".$args['calendar']->date_time->month;
echo "cal3:".$args['slice']->date_time->month;
*/
if($args['calendar']->show_only_current_slice == false || $args['calendar']->date_time->month == $args['slice']->start_time->month) {
template_echo_slice_date($args);
if($args['calendar']->show_activities == true) {
template_echo_slice_activities($args);
}
}
}
/////////////////////////////////
// template
/////////////////////////////////
function template_calendar(& $args) {
global $timedate;
if(isset($args['size']) && $args['size'] = 'small') {
$args['calendar']->show_activities = false;
$args['calendar']->show_week_on_month_view = false;
}
$newargs = array();
$newargs['view'] = $args['view'];
$newargs['calendar'] = $args['calendar'];
if(!isset($args['size']) || $args['size'] != 'small') {
template_cal_tabs($newargs);
}
if(isset($_REQUEST['view']) && $_REQUEST['view'] == 'shared') {
global $ids;
global $current_user;
global $mod_strings;
global $app_list_strings, $current_language, $currentModule, $action, $app_strings;
$current_module_strings = return_module_language($current_language, 'Calendar');
$ids = array();
$user_ids = $current_user->getPreference('shared_ids');
//get list of user ids for which to display data
if(!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['shared_ids'])) {
$ids = $user_ids;
}
elseif(isset($_REQUEST['shared_ids']) && count($_REQUEST['shared_ids']) > 0) {
$ids = $_REQUEST['shared_ids'];
$current_user->setPreference('shared_ids', $_REQUEST['shared_ids']);
} else {
//$ids = get_user_array(false);
//$ids = array_keys($ids);
$ids = array($current_user->id);
}
//get team id for which to display user list
$tools = '<div align="right"><a href="index.php?module='.$currentModule.'&action='.$action.'&view=shared" class="tabFormAdvLink">&nbsp;<a href="javascript: toggleDisplay(\'shared_cal_edit\');" class="tabFormAdvLink">'.SugarThemeRegistry::current()->getImage('edit', 'alt="'.$current_module_strings['LBL_EDIT'].'" border="0" align="absmiddle"').'&nbsp;'.$current_module_strings['LBL_EDIT'].'</a></div>';
echo get_form_header($mod_strings['LBL_SHARED_CAL_TITLE'], $tools, false);
if(empty($_SESSION['shared_ids']))
$_SESSION['shared_ids'] = "";
echo "
<script language=\"javascript\">
function up(name) {
var td = document.getElementById(name+'_td');
var obj = td.getElementsByTagName('select')[0];
obj =(typeof obj == \"string\") ? document.getElementById(obj) : obj;
if(obj.tagName.toLowerCase() != \"select\" && obj.length < 2)
return false;
var sel = new Array();
for(i=0; i<obj.length; i++) {
if(obj[i].selected == true) {
sel[sel.length] = i;
}
}
for(i in sel) {
if(sel[i] != 0 && !obj[sel[i]-1].selected) {
var tmp = new Array(obj[sel[i]-1].text, obj[sel[i]-1].value);
obj[sel[i]-1].text = obj[sel[i]].text;
obj[sel[i]-1].value = obj[sel[i]].value;
obj[sel[i]].text = tmp[0];
obj[sel[i]].value = tmp[1];
obj[sel[i]-1].selected = true;
obj[sel[i]].selected = false;
}
}
}
function down(name) {
var td = document.getElementById(name+'_td');
var obj = td.getElementsByTagName('select')[0];
if(obj.tagName.toLowerCase() != \"select\" && obj.length < 2)
return false;
var sel = new Array();
for(i=obj.length-1; i>-1; i--) {
if(obj[i].selected == true) {
sel[sel.length] = i;
}
}
for(i in sel) {
if(sel[i] != obj.length-1 && !obj[sel[i]+1].selected) {
var tmp = new Array(obj[sel[i]+1].text, obj[sel[i]+1].value);
obj[sel[i]+1].text = obj[sel[i]].text;
obj[sel[i]+1].value = obj[sel[i]].value;
obj[sel[i]].text = tmp[0];
obj[sel[i]].value = tmp[1];
obj[sel[i]+1].selected = true;
obj[sel[i]].selected = false;
}
}
}
</script>
<div id='shared_cal_edit' style='display: none;'>
<form name='shared_cal' action=\"index.php\" method=\"post\" >
<input type=\"hidden\" name=\"module\" value=\"".$currentModule."\">
<input type=\"hidden\" name=\"action\" value=\"".$action."\">
<input type=\"hidden\" name=\"view\" value=\"shared\">
<input type=\"hidden\" name=\"edit\" value=\"0\">
<table cellpadding=\"0\" cellspacing=\"3\" border=\"0\" align=\"center\">
<tr><th valign=\"top\" align=\"center\" colspan=\"2\">
";
echo $current_module_strings['LBL_SELECT_USERS'];
echo "
</th>
</tr>
<tr><td valign=\"top\">";
echo "
</td><td valign=\"top\">
<table cellpadding=\"1\" cellspacing=\"1\" border=\"0\" class=\"edit view\" align=\"center\">
<tr>
<td valign='top' nowrap><b>".$current_module_strings['LBL_USERS']."</b></td>
<td valign='top' id=\"shared_ids_td\"><select id=\"shared_ids\" name=\"shared_ids[]\" multiple size='3'>";
echo get_select_options_with_id(get_user_array(false), $ids);
echo " </select></td>
<td><a onclick=\"up('shared_ids');\">".SugarThemeRegistry::current()->getImage('uparrow_big', 'border="0" style="margin-bottom: 1px;" alt="'.$app_strings['LBL_SORT'].'"')."</a><br>
<a onclick=\"down('shared_ids');\">".SugarThemeRegistry::current()->getImage('downarrow_big', 'border="0" style="margin-top: 1px;" alt="'.$app_strings['LBL_SORT'].'"')."</a></td>
</tr>
<tr>";
echo "<td align=\"right\" colspan=\"2\"><input class=\"button\" type=\"submit\" title=\"".$app_strings['LBL_SELECT_BUTTON_TITLE']."\" accessKey=\"".$app_strings['LBL_SELECT_BUTTON_KEY']."\" value=\"".$app_strings['LBL_SELECT_BUTTON_LABEL']."\" /><input class=\"button\" onClick=\"javascript: toggleDisplay('shared_cal_edit');\" type=\"button\" title=\"".$app_strings['LBL_CANCEL_BUTTON_TITLE']."\" accessKey=\"".$app_strings['LBL_CANCEL_BUTTON_KEY']."\" value=\"".$app_strings['LBL_CANCEL_BUTTON_LABEL']."\"/></td>
</tr>
</table>
</td></tr>
</table>
</form>";
} // end "shared" view
echo "</div></p>";
if(isset($_REQUEST['edit']) && $_REQUEST['edit'])
echo " <script language=\"javascript\"> toggleDisplay('shared_cal_edit'); </script>";
echo "
<table id=\"daily_cal_table_outside\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"monthBox\">
<tr>
<td>
<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"monthHeader\">
<tr>
<td width=\"1%\" nowrap>";
if(!isset($args['size']) || $args['size'] != 'small') {
template_get_previous_calendar($args);
}
echo "
</td>
<td width=\" 98 % \" align=center scope='row'>";
if(isset( $args['size']) && $args['size'] = 'small')
{
?>
<a style="text-decoration: none;"
href="index.php?module=Calendar&action=index&view=month&<?php echo $args['calendar']->date_time->get_date_str();?>">
<?php
}
?>
<h3>
<?php template_echo_date_info($args['view'],$args['calendar']->date_time); ?>
</h3>
<?php
if(isset($args['size']) && $args['size'] = 'small') {
echo "</a>";
}
?>
</td>
<td align="right" width="1%" nowrap><?php
if(!isset($args['size']) || $args['size'] != 'small') {
template_get_next_calendar($args);
}
?> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="monthCalBody">
<?php
if($args['calendar']->view == 'month') {
template_calendar_month($args);
} else
if($args['calendar']->view == 'year') {
template_calendar_year($args);
} else
if($args['calendar']->view == 'shared') {
global $current_user, $shared_user;
$shared_args = array();
foreach($args as $key => $val) {
$shared_args[$key] = $val;
}
$shared_args['calendar'] = $args['calendar'];
$shared_user = new User();
foreach($ids as $member) {
$shared_user->retrieve($member);
$shared_args['calendar']->show_tasks = true;
$shared_args['calendar']->add_activities($shared_user);
$shared_args['show_link'] = 'off';
if(($shared_user->id == $current_user->id))
$shared_args['show_link'] = 'on';
echo '<h5 class="calSharedUser">'.$shared_user->full_name.'</h5>';
template_calendar_horizontal($shared_args);
}
} else {
template_calendar_vertical($args);
}
?>
</td>
</tr>
<tr>
<td>
<table width="100%" cellspacing="0" cellpadding="0" class="monthFooter">
<tr>
<td width="50%"><?php template_get_previous_calendar($args); ?></td>
<td align="right" width="50%"><?php template_get_next_calendar($args); ?></td>
</tr>
</table>
</td>
</tr>
</table>
<?php
}
function template_calendar_vertical(& $args) {
?>
<table id="daily_cal_table" border="0" cellpadding="0" cellspacing="1" width="100%">
<?php
// need to change these values after we find out what activities
// occur outside of these values
$start_slice_idx = $args['calendar']->get_start_slice_idx();
$end_slice_idx = $args['calendar']->get_end_slice_idx();
$cur_slice_idx = 1;
for($cur_slice_idx = $start_slice_idx; $cur_slice_idx <= $end_slice_idx; $cur_slice_idx ++) {
$calendar = $args['calendar'];
$args['slice'] = $calendar->slice_hash[$calendar->slices_arr[$cur_slice_idx]];
?>
<tr>
<?php template_cal_vertical_slice($args); ?>
</tr>
<?php
}
?>
</table>
<?php
}
function template_calendar_horizontal(& $args) {
echo "<table id=\"daily_cal_table\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"100%\"><tr>";
// need to change these values after we find out what activities
// occur outside of these values
$start_slice_idx = $args['calendar']->get_start_slice_idx();
$end_slice_idx = $args['calendar']->get_end_slice_idx();
$cur_slice_idx = 1;
for($cur_slice_idx = $start_slice_idx; $cur_slice_idx <= $end_slice_idx; $cur_slice_idx ++) {
$calendar = $args['calendar'];
$args['slice'] = $calendar->slice_hash[$calendar->slices_arr[$cur_slice_idx]];
template_cal_horizontal_slice($args);
}
echo "</tr></table>";
}
function template_cal_vertical_slice(& $args) {
global $timedate;
?>
<th width="1%" id="bodytime">
<?php template_echo_slice_date($args) ; ?>
</td>
<td width="99%" id="bodyitem">
<div style="display:none;" id='<?php echo template_echo_daily_view_24_hour($args); ?>_appt'> <?php
require_once('modules/Calls/CallFormBase.php');
$callForm = new CallFormBase();
echo $callForm->getFormBody('', 'Calls', 'inlineCal'.template_echo_daily_view_24_hour($args).'CallSave', $timedate->to_display_date($args['calendar']->date_time->get_mysql_date(), false), $timedate->to_display_time(template_echo_daily_view_24_hour($args).':00:00', true, false))."<br>";
?></div>
<?php template_echo_slice_activities($args); ?>
</td>
<?php
}
function template_cal_horizontal_slice(& $args) {
echo "<td width=\"14%\" id=\"bodyItem\" scope='row' valign=\"top\">";
if($args['show_link'] == 'on') {
template_echo_slice_date($args);
} else {
template_echo_slice_date_nolink($args);
}
template_echo_slice_activities_shared($args);
echo "</td>";
}
function template_calendar_year(& $args) {
$count = 0;
?>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td class="yearCalBody">
<table id="daily_cal_table" border="0" cellpadding="0" cellspacing="1" width="100%">
<?php
for($i = 0; $i < 4; $i ++) {
?>
<tr>
<?php
for($j = 0; $j < 3; $j ++) {
$args['slice'] = $args['calendar']->slice_hash[$args['calendar']->slices_arr[$count]];
?>
<td valign="top" align="center" scope='row' class="yearCalBodyMonth"><?php template_cal_month_slice($args); ?></td>
<?php
$count ++;
}
?>
</tr>
<?php
}
?>
</table>
</td>
</tr>
</table>
<?php
}
function template_calendar_month(& $args) {
global $mod_strings;
?>
<table width="100%" id="daily_cal_table" border="0" cellspacing="1" cellpadding="0" >
<?php
// need to change these values after we find out what activities
// occur outside of these values
/*
$start_slice_idx = $args['calendar']->get_start_slice_idx();
$end_slice_idx = $args['calendar']->get_end_slice_idx();
$cur_slice_idx = 1;
*/
$count = 0;
if($args['calendar']->slice_hash[$args['calendar']->slices_arr[35]]->start_time->month != $args['calendar']->date_time->month) {
$rows = 5;
} else {
$rows = 6;
}
?>
<tr class="monthCalBodyTH">
<?php if($args['calendar']->show_week_on_month_view ) { ?>
<th width="1%" scope='row'><?php echo $mod_strings['LBL_WEEK']; ?></th>
<?php } ?>
<?php
for($i = 0; $i < 7; $i ++) {
$first_row_slice = $args['calendar']->slice_hash[$args['calendar']->slices_arr[$i]];
?>
<th width="14%"><?php echo $first_row_slice->start_time->get_day_of_week_short(); ?></th>
<?php
}
?>
</tr>
<?php
if(isset($_REQUEST['view']) && $_REQUEST['view'] == 'month') {
$height_class = "monthViewDayHeight";
} else
if(isset($args['size']) && $args['size'] == 'small') {
$height_class = "";
} else {
$height_class = "monthViewDayHeight yearViewDayHeight";
}
for($i = 0; $i < $rows; $i ++) {
?>
<tr class="<?php echo $height_class; ?>">
<?php if($args['calendar']->show_week_on_month_view ) { ?>
<td scope='row'><a href="index.php?module=Calendar&action=index&view=week&<?php echo $args['calendar']->slice_hash[$args['calendar']->slices_arr[$count]]->start_time->get_date_str(); ?>"><?php echo $args['calendar']->slice_hash[$args['calendar']->slices_arr[$count + 1]]->start_time->week; ?></a></td>
<?php } ?>
<?php
for($j = 0; $j < 7; $j ++) {
$args['slice'] = $args['calendar']->slice_hash[$args['calendar']->slices_arr[$count]];
?>
<td <?php if($j==0 || $j==6) { ?>class="weekEnd"<?php } ?>><?php template_cal_day_slice($args); ?></td>
<?php
$count ++;
}
?>
</tr>
<?php
}
?>
</table>
<?php
}
function get_current_day(& $args) {
global $timedate;
static $user_today_timestamp = null;
// adjust for user's TZ
if(!isset($user_today_timestamp)) {
$gmt_today = $timedate->get_gmt_db_datetime();
$user_today = $timedate->handle_offset($gmt_today, $GLOBALS['timedate']->get_db_date_time_format());
preg_match_all('/\d*/', $user_today, $matches);
$matches = $matches[0];
$user_today_timestamp = mktime($matches[6], $matches[8], '0', $matches[2], $matches[4], $matches[0]);
}
$slice = $args['slice'];
if($slice->start_time->get_mysql_date() == date($GLOBALS['timedate']->get_db_date_time_format(), $user_today_timestamp)) {
return true;
}
}
function template_echo_daily_view_hour(& $args) {
$slice = $args['slice'];
$hour = $slice->start_time->get_hour();
return $hour;
}
function template_echo_daily_view_24_hour(& $args) {
$slice = $args['slice'];
$hour = $slice->start_time->get_24_hour();
return $hour;
}
function template_echo_slice_date(& $args) {
global $mod_strings;
global $timedate;
$slice = $args['slice'];
if($slice->view != 'hour') {
if($slice->start_time->get_day_of_week_short() == 'Sun' || $slice->start_time->get_day_of_week_short() == 'Sat') {
echo "<a href=\"index.php?module=Calendar&action=index&view=".$slice->get_view()."&".$slice->start_time->get_date_str()."\" ";
} else {
echo "<a href=\"index.php?module=Calendar&action=index&view=".$slice->get_view()."&".$slice->start_time->get_date_str()."\" ";
}
}
if($slice->view == 'day' &&($args['calendar']->view == 'week')) {
echo ">";
echo $slice->start_time->get_day_of_week_short();
echo "&nbsp;";
echo $slice->start_time->get_day();
}
elseif($args['calendar']->view == 'shared') {
echo ">";
echo $slice->start_time->get_day_of_week_short();
echo "&nbsp;";
echo $slice->start_time->get_day();
} else
if($slice->view == 'day') {
echo ">";
if($slice->start_time->get_month() == $args['calendar']->date_time->get_month()) {
echo $slice->start_time->get_day();
}
//echo $slice->start_time->get_day();
} else
if($slice->view == 'month') {
echo ">";
echo $slice->start_time->get_month_name();
} else
if($slice->view == 'hour') {
if($args['calendar']->toggle_appt == true) {
echo '<a href="javascript:void toggleDisplay(\''.$slice->start_time->get_24_hour().'_appt\');">';
}
//Bug 13324, We are now using the users time format instead of a custom AM/PM setting
echo $timedate->to_display_time($slice->start_time->get_24_hour() . ":00:00", true, false);
} else {
sugar_die("template_echo_slice_date: view not supported");
}
echo "</a>";
}
function template_echo_slice_date_nolink(& $args) {
global $mod_strings;
$slice = $args['slice'];
echo $slice->start_time->get_day_of_week_short();
echo "&nbsp;";
echo $slice->start_time->get_day();
}
function template_echo_date_info($view, $date_time) {
global $current_user;
$dateFormat = $current_user->getUserDateTimePreferences();
if($view == 'month') {
for($i=0; $i<strlen($dateFormat['date']); $i++) {
switch($dateFormat['date']{$i}) {
case "Y":
echo " ".$date_time->year;
break;
case "m":
echo " ".$date_time->get_month_name();
break;
}
}
} else
if($view == 'week' || $view == 'shared') {
$first_day = $date_time->get_day_by_index_this_week(0);
$last_day = $date_time->get_day_by_index_this_week(6);
for($i=0; $i<strlen($dateFormat['date']); $i++) {
switch($dateFormat['date']{$i}) {
case "Y":
echo " ".$first_day->year;
break;
case "m":
echo " ".$first_day->get_month_name();
break;
case "d":
echo " ".$first_day->get_day();
break;
}
}
echo " - ";
for($i=0; $i<strlen($dateFormat['date']); $i++) {
switch($dateFormat['date']{$i}) {
case "Y":
echo " ".$last_day->year;
break;
case "m":
echo " ".$last_day->get_month_name();
break;
case "d":
echo " ".$last_day->get_day();
break;
}
}
} else
if($view == 'day') {
echo $date_time->get_day_of_week()." ";
for($i=0; $i<strlen($dateFormat['date']); $i++) {
switch($dateFormat['date']{$i}) {
case "Y":
echo " ".$date_time->year;
break;
case "m":
echo " ".$date_time->get_month_name();
break;
case "d":
echo " ".$date_time->get_day();
break;
}
}
} else
if($view == 'year') {
echo $date_time->year;
} else {
sugar_die("echo_date_info: date not supported");
}
}
function template_get_next_calendar(& $args) {
global $mod_strings;
?>
<a href="index.php?action=index&module=Calendar&view=<?php echo $args['calendar']->view; ?>&<?php echo $args['calendar']->get_next_date_str(); ?>"><?php echo $mod_strings["LBL_NEXT_".$args['calendar']->get_view_name($args['calendar']->view)]; ?>&nbsp;<?php echo SugarThemeRegistry::current()->getImage('calendar_next','alt="'. $mod_strings["LBL_NEXT_".$args['calendar']->get_view_name($args['calendar']->view)].'" align="absmiddle" border="0"'); ?></a>
<?php
}
function template_get_previous_calendar(& $args) {
global $mod_strings;
?>
<a href="index.php?action=index&module=Calendar&view=<?php echo $args['calendar']->view; ?>&<?php echo $args['calendar']->get_previous_date_str(); ?>"><?php echo SugarThemeRegistry::current()->getImage('calendar_previous','alt="'. $mod_strings["LBL_PREVIOUS_".$args['calendar']->get_view_name($args['calendar']->view)].'" align="absmiddle" border="0"'); ?>&nbsp;&nbsp;<?php echo $mod_strings["LBL_PREVIOUS_".$args['calendar']->get_view_name($args['calendar']->view)]; ?></a>
<?php
}
?>

View File

@@ -0,0 +1,51 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/MVC/View/views/view.list.php');
class CalendarViewList extends ViewList{
function ActivitiesViewList(){
parent::ViewList();
}
function display(){
global $mod_strings, $export_module, $current_language, $theme, $current_user;
include('modules/Calendar/index.php');
}
}
?>