Пример #1
0
 /**
  * test conversion from DB date+time to local date+time with TZ handling
  * @dataProvider dateTestSet
  */
 public function testToDisplayDateTimeFormats($db, $df, $tf, $tz, $display, $dbdate)
 {
     $this->_setPrefs($df, $tf, $tz);
     $result = $this->time_date->to_display_date_time($db, true, true, $GLOBALS['current_user']);
     if (empty($tf)) {
         $result = $this->_dateOnly($result);
     }
     $this->assertEquals($display, $result, "Broken conversion for '{$df}' with date '{$db}' and TZ {$tz}");
 }
Пример #2
0
 /**
  * Define marker data for marker display view
  * @param $module_type bean name
  * @param $display bean fields array
  * $param $mod_strings_display mod_strings from display module
  * TODO: Use a custom defined field for the $marker['group']
  */
 function getMarkerData($module_type, $display, $center_marker = false, $mod_strings_display = array())
 {
     //        echo "<pre>";
     //        print_r($display);
     //        print_r($mod_strings_display);
     //        echo "</pre>";
     // Define Marker
     $marker = array();
     // Set only partial display data for efficiency
     $marker['name'] = $display['name'];
     // Or, Set all display data for flexibility
     //$marker = $display;
     if (empty($marker['name'])) {
         $marker['name'] = 'N/A';
     }
     $marker['id'] = $display['id'];
     $marker['module'] = $module_type;
     $marker['address'] = $display['jjwg_maps_address_c'];
     $marker['lat'] = $display['jjwg_maps_lat_c'];
     if (!$this->is_valid_lat($marker['lat'])) {
         $marker['lat'] = '0';
     }
     $marker['lng'] = $display['jjwg_maps_lng_c'];
     if (!$this->is_valid_lng($marker['lng'])) {
         $marker['lng'] = '0';
     }
     // Define a phone field: phone_office, phone_work, phone_mobile
     if (!empty($display['phone_office'])) {
         $marker['phone'] = $display['phone_office'];
     } elseif (!empty($display['phone_work'])) {
         $marker['phone'] = $display['phone_work'];
     } elseif (!empty($display['phone_mobile'])) {
         $marker['phone'] = $display['phone_mobile'];
     } else {
         $marker['phone'] = '';
     }
     if ($marker['lat'] != '0' && $marker['lng'] != '0') {
         // Check to see if marker point already exists and apply offset if needed
         // This often occurs when an address is only defined by city, state, zip.
         $i = 0;
         while (isset($this->map_marker_data_points[(string) $marker['lat']][(string) $marker['lng']]) && $i < $this->settings['map_markers_limit']) {
             $marker['lat'] = (double) $marker['lat'] + (double) $this->settings['map_duplicate_marker_adjustment'];
             $marker['lng'] = (double) $marker['lng'] + (double) $this->settings['map_duplicate_marker_adjustment'];
             $i++;
         }
         // Set Marker Point as Used (true)
         $this->map_marker_data_points[(string) $marker['lat']][(string) $marker['lng']] = true;
         if (isset($display['account_name'])) {
             $marker['account_name'] = $display['account_name'];
         }
         if (isset($display['account_id'])) {
             $marker['account_id'] = $display['account_id'];
         }
         $marker['assigned_user_name'] = isset($display['assigned_user_name']) ? $display['assigned_user_name'] : '';
         $marker['image'] = isset($display['marker_image']) ? $display['marker_image'] : '';
         // Define Marker Group
         if (!$center_marker) {
             // Group Field for the Display Module
             $group_field_name = $this->settings['map_markers_grouping_field'][$module_type];
             $group_field_value = $display[$group_field_name];
             // Check for DOM field types (enum type)
             if (isset($this->display_object->field_name_map[$group_field_name]['type']) && $this->display_object->field_name_map[$group_field_name]['type'] == 'enum') {
                 $group_field_dom = $this->display_object->field_name_map[$group_field_name]['options'];
                 $marker['group'] = $GLOBALS['app_list_strings'][$group_field_dom][$group_field_value];
             } elseif (!empty($display[$group_field_name])) {
                 $marker['group'] = $display[$group_field_name];
             } else {
                 $marker['group'] = $GLOBALS['mod_strings']['LBL_MAP_NULL_GROUP_NAME'];
                 // null group
             }
             if (!in_array($marker['group'], $this->bean->map_markers_groups)) {
                 $this->bean->map_markers_groups[] = $marker['group'];
             }
         }
         /**
          *  Define Dates for Meetings
          *  TimeDate.php to_display_date_time()
          *  Note, date time fields are converted to the User's date time settings
          */
         if ($module_type == 'Meetings') {
             require_once 'modules/Meetings/Meeting.php';
             require_once 'include/TimeDate.php';
             if (!isset($meetingTimeDate) || !is_object($meetingTimeDate)) {
                 $meetingTimeDate = new TimeDate();
             }
             $display['date_start'] = $meetingTimeDate->to_display_date_time($display['date_start'], true, true, $GLOBALS['current_user']);
             $display['date_end'] = $meetingTimeDate->to_display_date_time($display['date_end'], true, true, $GLOBALS['current_user']);
         }
         $current_user_data = get_object_vars($GLOBALS['current_user']);
         $this->sugarSmarty->assign('current_user', $current_user_data);
         $this->sugarSmarty->assign('current_user_address', $this->bean->defineMapsFormattedAddress($current_user_data, 'address'));
         $this->sugarSmarty->assign("mod_strings", $mod_strings_display);
         // Define Maps Info Window HTML by Sugar Smarty Template
         $this->sugarSmarty->assign("module_type", $module_type);
         $this->sugarSmarty->assign("address", $display['jjwg_maps_address_c']);
         $this->sugarSmarty->assign("fields", $display);
         // display fields array
         // Use @ error suppression to avoid issues with SugarCRM On-Demand
         $marker['html'] = @$this->sugarSmarty->fetch('./custom/modules/jjwg_Maps/tpls/' . $module_type . 'InfoWindow.tpl');
         if (empty($marker['html'])) {
             $marker['html'] = $this->sugarSmarty->fetch('./modules/jjwg_Maps/tpls/' . $module_type . 'InfoWindow.tpl');
         }
         $marker['html'] = preg_replace('/\\n\\r/', ' ', $marker['html']);
         //var_dump($marker['html']);
         return $marker;
     } else {
         return false;
     }
 }
Пример #3
0
 /**
  * This function retrieves a record of the appropriate type from the DB.
  * It fills in all of the fields from the DB into the object it was called on.
  *
  * @param $id - If ID is specified, it overrides the current value of $this->id.  If not specified the current value of $this->id will be used.
  * @return this - The object that it was called apon or null if exactly 1 record was not found.
  *
  */
 function check_date_relationships_load()
 {
     global $disable_date_format;
     if (!empty($disable_date_format)) {
         return;
     }
     global $timedate;
     if (empty($timedate)) {
         $timedate = new TimeDate();
     }
     if (empty($this->field_defs)) {
         return;
     }
     foreach ($this->field_defs as $fieldDef) {
         $field = $fieldDef['name'];
         if (!isset($this->processed_dates_times[$field])) {
             $this->processed_dates_times[$field] = '1';
             if ($field == 'date_modified' || $field == 'date_entered') {
                 if (!empty($this->{$field})) {
                     $this->{$field} = $timedate->to_display_date_time($this->{$field});
                 }
             } elseif (!empty($this->{$field}) && isset($this->field_name_map[$field]['type'])) {
                 $type = $this->field_name_map[$field]['type'];
                 if ($type == 'relate' && isset($this->field_name_map[$field]['custom_module'])) {
                     $type = $this->field_name_map[$field]['type'];
                 }
                 if ($type == 'date') {
                     $this->{$field} = from_db_convert($this->{$field}, 'date');
                     if ($this->{$field} == '0000-00-00') {
                         $this->{$field} = '';
                     } elseif (!empty($this->field_name_map[$field]['rel_field'])) {
                         $rel_field = $this->field_name_map[$field]['rel_field'];
                         if (!empty($this->{$rel_field})) {
                             $this->{$rel_field} = from_db_convert($this->{$rel_field}, 'time');
                             $mergetime = $timedate->merge_date_time($this->{$field}, $this->{$rel_field});
                             $this->{$field} = $timedate->to_display_date($mergetime);
                             $this->{$rel_field} = $timedate->to_display_time($mergetime);
                         }
                     } else {
                         $this->{$field} = $timedate->to_display_date($this->{$field}, false);
                     }
                 } elseif ($type == 'datetime') {
                     if ($this->{$field} == '0000-00-00 00:00:00') {
                         $this->{$field} = '';
                     } else {
                         $this->{$field} = $timedate->to_display_date_time($this->{$field});
                     }
                 } elseif ($type == 'time') {
                     if ($this->{$field} == '00:00:00') {
                         $this->{$field} = '';
                     } else {
                         //$this->$field = from_db_convert($this->$field, 'time');
                         if (empty($this->field_name_map[$field]['rel_field'])) {
                             $this->{$field} = $timedate->to_display_time($this->{$field}, true, false);
                         }
                     }
                 } elseif ($type == 'encrypt') {
                     $this->{$field} = $this->decrypt_after_retrieve($this->{$field});
                 }
             }
         }
     }
 }
 /**
  * handles some date/time foramtting
  * @param string time Time (usually "now")
  * @param object user User, usually admin (id = '1')
  * @return string formatted time.
  */
 function handleDateFormat($time, $user = null)
 {
     global $timedate;
     if (!isset($timedate) || empty($timedate)) {
         $timedate = new TimeDate();
     }
     // get proper user
     $user = empty($user) ? $this->user : $user;
     $dbTime = gmdate('Y-m-d H:i:s', strtotime($time));
     $ret = $timedate->to_display_date_time($dbTime, true, true, $user);
     return $ret;
 }
Пример #5
0
 function GoogleCalls(&$bean, $event, $arguments)
 {
     echo "<br>aa " . $bean->id;
     echo "<br>aa " . $bean->name;
     echo "<br>sess delete " . $_SESSION["mass_upd_assigned"];
     echo "<br>sess delete" . $_REQUEST["massupdate"];
     echo "<br>";
     $okev = true;
     $_SESSION["mass_upd_assigned"] = false;
     if (isset($_REQUEST["massupdate"])) {
         if ($_REQUEST["massupdate"] == true) {
             $okev = false;
             if ($_REQUEST['assigned_user_id'] != "" or $_REQUEST['date_start'] != "") {
                 $okev = true;
             }
             if ($_REQUEST['assigned_user_id'] != "") {
                 $_SESSION["mass_upd_assigned"] = true;
             }
         }
     }
     if ($okev == true) {
         if ($_SESSION["called_from_sync"] == false or $_SESSION["called_from_sync"] == "") {
             ### skip if called from sync.php logic hook
             echo "<br>delete from sugar logic hook ";
             global $timedate;
             $offset_val = ".000+02:00";
             $td = new TimeDate();
             echo "<br>old bean id " . $bean->id;
             echo "<br>old bean name " . $bean->name;
             echo "<br>tablename ";
             $tablename = $bean->table_name;
             $a = $response['list'][$tn1];
             $s = array();
             $s["title"] = $bean->name;
             if ($tablename == 'meetings') {
                 $s["title"] = "Meeting: " . $s["title"];
             }
             if ($tablename == 'calls') {
                 $s["title"] = "Call: " . $s["title"];
             }
             if ($tablename == 'tasks') {
                 $s["title"] = "Task: " . $s["title"];
             }
             echo "<br>bean date start " . $bean->date_start;
             $s["content"] = $bean->description;
             $s["where"] = $bean->location;
             $s["startDay"] = $bean->date_start;
             $s["startTime"] = $bean->time_start;
             $s["endDay"] = $bean->date_end;
             $s["reminder_time"] = $bean->reminder_time / 60;
             if ($s["reminder_time"] == '' or $s["reminder_time"] == 0) {
                 $s["reminder_time"] = 10;
             }
             if ($bean->date_start == '' and $bean->date_due != "") {
                 $s["startDay"] = $bean->date_due;
                 #### for tasks if no start date
             } else {
                 $s["startDay"] = $bean->date_start;
             }
             #   print_r($s);
             global $current_user;
             $pd = $s["startDay"];
             ####260608
             #$pd= $td->handle_offset($td->get_date_time_format(true, $current_user), $td->get_date_time_format(true, $current_user), false,$current_user);
             $date_start_in_db_fmt = $td->swap_formats($s["startDay"], $td->get_date_time_format(true, $current_user), $td->get_db_date_time_format());
             $date_end_in_db_fmt1 = $td->swap_formats($bean->date_due, $td->get_date_time_format(true, $current_user), $td->get_db_date_time_format());
             $date_start_array = split(" ", trim($date_start_in_db_fmt));
             $date_time_start = DateTimeUtil::get_time_start($date_start_array[0], $date_start_array[1]);
             $tt1 = $td->to_display_date_time($bean->date_start, true, true, false);
             $user = $current_user;
             $s["startTime"] = $td->handle_offset($date_start_in_db_fmt, "H:i:s", false, $current_user);
             $date_end_in_db_fmt1 = $td->handle_offset($date_end_in_db_fmt1, "Y-m-d H:i:s", false, $current_user);
             echo "<br>bean date start1 " . $s["startTime"];
             ##260806 $s["startTime"]=$date_start_array[1];
             echo "<br>bean date start2 " . $s["startTime"];
             $ch = explode(" ", $s["startDay"]);
             if ($ch['1'] == "00:00" or $ch['1'] == "00.00") {
                 #### 120608 bogdan if task and 12:00 goes to next day $s["startDay"]  = $td->handle_offset($date_start_in_db_fmt, "Y-m-d", false,$current_user);
                 $s["startDay"] = $td->handle_offset($date_start_in_db_fmt, "Y-m-d", false, $current_user);
                 $s["startDay1"] = $td->handle_offset($date_start_in_db_fmt, "Y-m-d H:i:s", false, $current_user);
             } else {
                 $s["startDay"] = $td->handle_offset($date_start_in_db_fmt, "Y-m-d", false, $current_user);
                 $s["startDay1"] = $td->handle_offset($date_start_in_db_fmt, "Y-m-d H:i:s", false, $current_user);
             }
             $plugin_format = "d/m/Y H:i";
             if ($td->get_date_time_format(true, $current_user) != $plugin_format) {
                 ##260608 $plugin_date_start=$td->swap_formats($pd, $td->get_date_time_format(true, $current_user),  $plugin_format);
                 $plugin_date_due = $td->swap_formats($bean->date_due, $td->get_date_time_format(true, $current_user), $plugin_format);
             } else {
                 ##260608  $plugin_date_start=$pd;
                 $plugin_date_due = $bean->date_due;
             }
             $plugin_date_start = $td->swap_formats($s["startDay1"], "Y-m-d H:i:s", $plugin_format);
             $plugin_date_due1 = $td->swap_formats($date_end_in_db_fmt1, "Y-m-d H:i:s", $plugin_format);
             echo "<br>plg date start " . $plugin_date_start;
             #################################################
             $d1 = explode("/", $plugin_date_start);
             global $current_user;
             $d1[2] = explode(" ", $d1[2]);
             $d1[2] = $d1[2][0];
             if ($bean->time_start != '' and 1 == 2) {
                 $t1 = explode(":", $bean->time_start);
             } else {
                 $fort1 = explode(" ", $plugin_date_start);
                 $fort1 = $fort1[1];
                 $t1 = explode(":", $fort1);
             }
             $t1[1] = round($t1[1]);
             print_r($t1);
             $untill = mktime($t1[0] + $bean->duration_hours, $t1[1] + $bean->duration_minutes, $t1[2], $d1[1], $d1[0], $d1[2]);
             if ($tablename == 'tasks') {
                 if ($plugin_date_due == "" or $bean->date_due == "") {
                     $forexp = $plugin_date_start;
                     echo "<br>date due " . $plugin_date_due . " " . $bean->date_due;
                 } else {
                     $forexp = $plugin_date_due;
                     $forexp = $plugin_date_due1;
                 }
                 $d1d = explode("/", $forexp);
                 $d1d[2] = explode(" ", $d1d[2]);
                 $d1d[2] = $d1d[2][0];
                 $fort1d = explode(" ", $forexp);
                 $fort1d = $fort1d[1];
                 $t1d = explode(":", $fort1d);
                 $untill = mktime($t1d[0], $t1d[1], $t1d[2], $d1d[1], $d1d[0], $d1d[2]);
             }
             $date_due = date("Y-m-d", $untill);
             $time_due = date("H:i:s", $untill);
             $s["endTime"] = $time_due;
             $s["endDay"] = $date_due;
             echo "<br>start day " . $s["startDay"] . "   " . $s["startTime"] . "     " . $plugin_date_start;
             echo "<br>end day " . $s["endDay"] . "   " . $s["endTime"] . "   " . $plugin_date_due;
             if ($bean->assigned_user_id == '') {
                 $userid = $bean->created_by;
             } else {
                 $userid = $bean->assigned_user_id;
             }
             $user = new User();
             $user->retrieve($userid);
             $user_data = get_user_email_pass1($user->id);
             if ($user_data[0] != '' and $user_data[1] != '') {
                 echo "<br>**Got user " . $user_data[0];
                 $assigned_link = $user->google_mcalendar_c;
                 if ($assigned_link == "" or $assigned_link == "1") {
                     $assigned_link = "nolinkfromhook";
                     $assigned_link = "http://www.google.com/calendar/feeds/default/private/full";
                 }
                 $gc = new GoogleCalendarWrapper($user_data[0], $user_data[1], "", $assigned_link);
                 global $current_user;
                 $add_notifications = $user->google_mnotifications_c;
                 $gc->delete_event($s, $bean->id, $tablename, $user_data, $bean, $add_notifications);
                 echo "<br>do event" . $doevent . " tb name " . $tablename;
                 $_SESSION["mass_upd_assigned"] = false;
                 //////////  dmc290609
                 #echo print_r($bean);
                 #  exit;
                 if ($bean->table_name == "calls") {
                     $mdname = "Calls";
                 }
                 if ($bean->table_name == "meetings") {
                     $mdname = "Meetings";
                 }
                 if ($bean->table_name == "tasks") {
                     $mdname = "Tasks";
                 }
                 global $db;
                 $_REQUEST['allready_retrieved_user_acceptDecline'] = true;
                 $sq = "select * from google_calendar_rel where obj_id='" . $bean->id . "' and obj_type='" . $mdname . "' and deleted=0";
                 $res = $db->query($sq);
                 while ($row_oldsaved = $db->fetchByAssoc($res)) {
                     $user_data = get_user_email_pass1($row_oldsaved['user_id']);
                     $_REQUEST['delete_invite_user_id'] = $row_oldsaved['user_id'];
                     $_REQUEST['delete_invite_url'] = $row_oldsaved['old_link_edit_c'];
                     if ($user_data[0] != '' and $user_data[1] != '') {
                         $assigned_link = "";
                         $gc = new GoogleCalendarWrapper($user_data[0], $user_data[1], "", $assigned_link);
                         $gc->delete_event($s, $bean->id, $tablename, $user_data, $bean, $add_notifications);
                         #echo "<br>url ".$_REQUEST['delete_invite_url'];
                     }
                 }
                 //////////  dmc290609
             }
         }
     }
 }
Пример #6
0
 function GoogleCalls(&$bean, $event, $arguments)
 {
     $okev = true;
     $_SESSION["mass_upd_assigned"] = false;
     if (isset($_REQUEST["massupdate"])) {
         if ($_REQUEST["massupdate"] == true) {
             $okev = false;
             if ($_REQUEST['assigned_user_id'] != "" or $_REQUEST['date_start'] != "") {
                 $okev = true;
             }
             if ($_REQUEST['assigned_user_id'] != "") {
                 $_SESSION["mass_upd_assigned"] = true;
             }
         }
     }
     if ($okev == true) {
         if ($_SESSION["called_from_sync"] == false or $_SESSION["called_from_sync"] == "") {
             ### skip if called from sync.php logic hook
             global $timedate;
             $offset_val = ".000+02:00";
             $td = new TimeDate();
             $tablename = $bean->table_name;
             $a = $response['list'][$tn1];
             $s = array();
             #  echo "<br>**********Event ******* id=$a[id] ***** name=$a[name]";
             $s["title"] = $bean->name;
             if ($tablename == 'meetings') {
                 $s["title"] = "Meeting: " . $s["title"];
             }
             if ($tablename == 'calls') {
                 $s["title"] = "Call: " . $s["title"];
             }
             if ($tablename == 'tasks') {
                 $s["title"] = "Task: " . $s["title"];
             }
             $s["content"] = $bean->description;
             $s["where"] = $bean->location;
             $s["startDay"] = $bean->date_start;
             $s["startTime"] = $bean->time_start;
             $s["endDay"] = $bean->date_end;
             $s["reminder_time"] = $bean->reminder_time / 60;
             if ($s["reminder_time"] == '' or $s["reminder_time"] == 0) {
                 $s["reminder_time"] = 10;
             }
             if ($bean->date_start == '' and $bean->date_due != "") {
                 $s["startDay"] = $bean->date_due;
                 #### for tasks if no start date
             } else {
                 $s["startDay"] = $bean->date_start;
             }
             #   print_r($s);
             global $current_user;
             $pd = $s["startDay"];
             ####260608
             #$pd= $td->handle_offset($td->get_date_time_format(true, $current_user), $td->get_date_time_format(true, $current_user), false,$current_user);
             $date_start_in_db_fmt = $td->swap_formats($s["startDay"], $td->get_date_time_format(true, $current_user), $td->get_db_date_time_format());
             $date_end_in_db_fmt1 = $td->swap_formats($bean->date_due, $td->get_date_time_format(true, $current_user), $td->get_db_date_time_format());
             $date_start_array = split(" ", trim($date_start_in_db_fmt));
             $date_time_start = DateTimeUtil::get_time_start($date_start_array[0], $date_start_array[1]);
             $tt1 = $td->to_display_date_time($bean->date_start, true, true, false);
             $user = $current_user;
             $s["startTime"] = $td->handle_offset($date_start_in_db_fmt, "H:i:s", false, $current_user);
             $date_end_in_db_fmt1 = $td->handle_offset($date_end_in_db_fmt1, "Y-m-d H:i:s", false, $current_user);
             ###### problem with offset ... if record is at 23.15 gmt +2 .. date problem
             $ch = explode(" ", $s["startDay"]);
             if ($ch['1'] == "00:00" or $ch['1'] == "00.00") {
                 #### 120608 bogdan if task and 12:00 goes to next day $s["startDay"]  = $td->handle_offset($date_start_in_db_fmt, "Y-m-d", false,$current_user);
                 $s["startDay"] = $td->handle_offset($date_start_in_db_fmt, "Y-m-d", false, $current_user);
                 $s["startDay1"] = $td->handle_offset($date_start_in_db_fmt, "Y-m-d H:i:s", false, $current_user);
             } else {
                 $s["startDay"] = $td->handle_offset($date_start_in_db_fmt, "Y-m-d", false, $current_user);
                 $s["startDay1"] = $td->handle_offset($date_start_in_db_fmt, "Y-m-d H:i:s", false, $current_user);
             }
             $plugin_format = "d/m/Y H:i";
             if ($td->get_date_time_format(true, $current_user) != $plugin_format) {
                 ##260608 $plugin_date_start=$td->swap_formats($pd, $td->get_date_time_format(true, $current_user),  $plugin_format);
                 $plugin_date_due = $td->swap_formats($bean->date_due, $td->get_date_time_format(true, $current_user), $plugin_format);
             } else {
                 ##260608  $plugin_date_start=$pd;
                 $plugin_date_due = $bean->date_due;
             }
             $plugin_date_start = $td->swap_formats($s["startDay1"], "Y-m-d H:i:s", $plugin_format);
             $plugin_date_due1 = $td->swap_formats($date_end_in_db_fmt1, "Y-m-d H:i:s", $plugin_format);
             #################################################
             $d1 = explode("/", $plugin_date_start);
             global $current_user;
             $d1[2] = explode(" ", $d1[2]);
             $d1[2] = $d1[2][0];
             if ($bean->time_start != '' and 1 == 2) {
                 $t1 = explode(":", $bean->time_start);
             } else {
                 $fort1 = explode(" ", $plugin_date_start);
                 $fort1 = $fort1[1];
                 $t1 = explode(":", $fort1);
             }
             $t1[1] = round($t1[1]);
             $untill = mktime($t1[0] + $bean->duration_hours, $t1[1] + $bean->duration_minutes, $t1[2], $d1[1], $d1[0], $d1[2]);
             if ($tablename == 'tasks') {
                 if ($plugin_date_due == "" or $bean->date_due == "") {
                     $forexp = $plugin_date_start;
                 } else {
                     $forexp = $plugin_date_due;
                     $forexp = $plugin_date_due1;
                 }
                 $d1d = explode("/", $forexp);
                 $d1d[2] = explode(" ", $d1d[2]);
                 $d1d[2] = $d1d[2][0];
                 $fort1d = explode(" ", $forexp);
                 $fort1d = $fort1d[1];
                 $t1d = explode(":", $fort1d);
                 $untill = mktime($t1d[0], $t1d[1], $t1d[2], $d1d[1], $d1d[0], $d1d[2]);
             }
             $date_due = date("Y-m-d", $untill);
             $time_due = date("H:i:s", $untill);
             $s["endTime"] = $time_due;
             $s["endDay"] = $date_due;
             if ($bean->assigned_user_id == '') {
                 $userid = $bean->created_by;
             } else {
                 $userid = $bean->assigned_user_id;
             }
             //////////  dmc290609
             if (isset($_REQUEST['allready_retrieved_user_acceptDecline'])) {
                 $userid = $current_user->id;
             }
             //////////  dmc290609
             $user = new User();
             $user->retrieve($userid);
             $user_data = get_user_email_pass1($user->id);
             if ($user_data[0] != '' and $user_data[1] != '') {
             } else {
             }
             if ($user_data[0] != '' and $user_data[1] != '') {
                 $assigned_link = $user->google_mcalendar_c;
                 if ($assigned_link == "" or $assigned_link == "1") {
                     $assigned_link = "nolinkfromhook";
                     $assigned_link = "http://www.google.com/calendar/feeds/default/private/full";
                 }
                 $gc = new GoogleCalendarWrapper($user_data[0], $user_data[1], "", $assigned_link);
                 global $current_user;
                 $doevent = false;
                 if ($tablename == "calls" and $user->google_mcalls_c == "on") {
                     $doevent = true;
                     if ($user->google_mplannedcalls_c == "on" and $bean->status != "Planned") {
                         $doevent = false;
                     }
                 }
                 if ($tablename == "meetings" and $user->google_mmeetings_c == "on") {
                     $doevent = true;
                 }
                 if ($tablename == "tasks" and $user->google_mtasks_c == "on") {
                     $doevent = true;
                 }
                 if ($doevent == true) {
                     $add_notifications = $user->google_mnotifications_c;
                     $gc->add_event_onl($s, $bean->id, $tablename, $user_data, $bean, $add_notifications);
                 }
                 $_SESSION["mass_upd_assigned"] = false;
             }
         }
     }
 }
Пример #7
0
 /**
  * handles some date/time foramtting
  * @param string time Time (usually "now")
  * @param object user User, usually admin (id = '1')
  * @param boolean to_local, convert to user's time format
  * @return string formatted time.
  */
 function handleDateFormat($time, $user = null, $to_local = true)
 {
     global $timedate;
     if (!isset($timedate) || empty($timedate)) {
         $timedate = new TimeDate();
     }
     // get proper user
     $user = empty($user) ? $this->user : $user;
     $dbTime = $timedate->nowDb();
     if ($to_local) {
         $ret = $timedate->to_display_date_time($dbTime, true, true, $user);
         return $ret;
     }
     return $dbTime;
 }