Ejemplo n.º 1
0
 public function addEvent()
 {
     $pID = $_POST['propertyID'];
     $eventName = $_POST['eventName'];
     $eventTime = $_POST['timepicker1'];
     $eventInterval = $_POST['interval'];
     $description = $_POST['description'];
     $eventDate = $_POST['date'];
     $email = $_POST['email'];
     $addEvent = CalendarEvents::addEvent($pID, $eventName, $eventTime, $eventInterval, $description, $eventDate, $email);
     if ($addEvent == true) {
         $_SESSION['eventAdded'] = "true";
         header('Location:../PropertyOwner/calendar');
         exit;
     } else {
         $_SESSION['eventAdded'] = "false";
         header('Location:../PropertyOwner/calendar');
         exit;
     }
 }
Ejemplo n.º 2
0
                            <?php 
if ($pID == "" && $userType != "TENANT") {
    $events = CalendarEvents::getAllEvents($userName);
    foreach ($events as $event) {
        $interval = $event->eventInterval;
        $explodeDate = explode("/", $event->eventDate);
        echo ' <div class="event-tobe" data-tag="blue" data-repeat=' . $interval . ' data-day="' . $explodeDate[0] . '" data-month="' . $explodeDate[1] . '"
                                        data-year="' . $explodeDate[2] . '" data-type="link" data-href="#">
                                        <span class="tooltip-heading">' . $event->eventName . '</span>';
        if ($event->eventTime != "") {
            echo '<span class="label">Time:</span>' . $event->eventTime . '<br/>';
        }
        echo '<br/>' . $event->description . '</div>';
    }
} else {
    $events = CalendarEvents::getPropertyEvents($pID);
    foreach ($events as $event) {
        $interval = $event->eventInterval;
        $explodeDate = explode("/", $event->eventDate);
        echo ' <div class="event-tobe" data-tag="blue" data-repeat=' . $interval . ' data-day="' . $explodeDate[0] . '" data-month="' . $explodeDate[1] . '"
                                        data-year="' . $explodeDate[2] . '" data-type="link" data-href="#">
                                        <span class="tooltip-heading">' . $event->eventName . '</span>';
        if ($event->eventTime != "") {
            echo '<span class="label">Time:</span>' . $event->eventTime . '<br/>';
        }
        echo '<br/>' . $event->description . '</div>';
    }
}
?>

                        </div>
Ejemplo n.º 3
0
<?php

/**
 * Created by PhpStorm.
 * User: UltraKapes
 * Date: 9/20/2015
 * Time: 4:25 PM
 */
session_start();
require_once __DIR__ . '/../classes/CalendarEvents.php';
$pID = $_POST['propertyID'];
$eventName = $_POST['eventName'];
$eventTime = $_POST['timepicker1'];
$eventInterval = $_POST['interval'];
$description = $_POST['description'];
$eventDate = $_POST['date'];
$email = $_POST['email'];
$addEvent = CalendarEvents::addEvent($pID, $eventName, $eventTime, $eventInterval, $description, $eventDate, $email);
if ($addEvent == true) {
    $_SESSION['eventAdded'] = "true";
    header('Location: calendar.php');
    exit;
} else {
    $_SESSION['eventAdded'] = "false";
    header('Location: calendar.php');
    exit;
}
Ejemplo n.º 4
0
 function save($check_notify = FALSE)
 {
     global $timedate, $current_user;
     if (isset($this->date_start)) {
         $td = $timedate->fromDb($this->date_start);
         if (!$td) {
             $this->date_start = $timedate->to_db($this->date_start);
             $td = $timedate->fromDb($this->date_start);
         }
         if ($td) {
             if (isset($this->duration_hours) && $this->duration_hours != '') {
                 $td->modify("+{$this->duration_hours} hours");
             }
             if (isset($this->duration_minutes) && $this->duration_minutes != '') {
                 $td->modify("+{$this->duration_minutes} mins");
             }
             $this->date_end = $td->asDb();
         }
     }
     $check_notify = $this->send_invites;
     if ($this->send_invites == false) {
         $old_assigned_user_id = CalendarEvents::$old_assigned_user_id;
         if ((empty($GLOBALS['installing']) || $GLOBALS['installing'] != true) && (!empty($this->assigned_user_id) && $this->assigned_user_id != $GLOBALS['current_user']->id && $this->assigned_user_id != $old_assigned_user_id)) {
             $this->special_notification = true;
             $check_notify = true;
             CalendarEvents::$old_assigned_user_id = $this->assigned_user_id;
             if (isset($_REQUEST['assigned_user_name'])) {
                 $this->new_assigned_user_name = $_REQUEST['assigned_user_name'];
             }
         }
     }
     if (empty($this->status)) {
         $this->status = $this->getDefaultStatus();
     }
     // prevent a mass mailing for recurring meetings created in Calendar module
     if (empty($this->id) && !empty($_REQUEST['module']) && $_REQUEST['module'] == "Calendar" && !empty($_REQUEST['repeat_type']) && !empty($this->repeat_parent_id)) {
         $check_notify = false;
     }
     /*nsingh 7/3/08  commenting out as bug #20814 is invalid
     		if($current_user->getPreference('reminder_time')!= -1 &&  isset($_POST['reminder_checked']) && isset($_POST['reminder_time']) && $_POST['reminder_checked']==0  && $_POST['reminder_time']==-1){
     			$this->reminder_checked = '1';
     			$this->reminder_time = $current_user->getPreference('reminder_time');
     		}*/
     $return_id = parent::save($check_notify);
     $this->setUserInvitees($this->users_arr);
     if ($this->update_vcal) {
         $assigned_user = BeanFactory::getBean('Users', $this->assigned_user_id);
         vCal::cache_sugar_vcal($assigned_user);
         if ($this->assigned_user_id != $GLOBALS['current_user']->id) {
             vCal::cache_sugar_vcal($current_user);
         }
     }
     // CCL - Comment out call to set $current_user as invitee
     // set organizer to auto-accept
     // if there isn't a fetched row its new
     if ($this->assigned_user_id == $GLOBALS['current_user']->id && empty($this->fetched_row)) {
         $this->set_accept_status($GLOBALS['current_user'], 'accept');
     }
     return $return_id;
 }
Ejemplo n.º 5
0
 function save($check_notify = FALSE)
 {
     global $timedate;
     global $current_user;
     if (isset($this->date_start)) {
         $td = $timedate->fromDb($this->date_start);
         if (!$td) {
             $this->date_start = $timedate->to_db($this->date_start);
             $td = $timedate->fromDb($this->date_start);
         }
         if ($td) {
             if (isset($this->duration_hours) && $this->duration_hours != '') {
                 $td->modify("+{$this->duration_hours} hours");
             }
             if (isset($this->duration_minutes) && $this->duration_minutes != '') {
                 $td->modify("+{$this->duration_minutes} mins");
             }
             $this->date_end = $td->asDb();
         }
     }
     $check_notify = $this->send_invites;
     if ($this->send_invites == false) {
         $old_assigned_user_id = CalendarEvents::$old_assigned_user_id;
         if ((empty($GLOBALS['installing']) || $GLOBALS['installing'] != true) && (!empty($this->assigned_user_id) && $this->assigned_user_id != $GLOBALS['current_user']->id && $this->assigned_user_id != $old_assigned_user_id)) {
             $this->special_notification = true;
             $check_notify = true;
             CalendarEvents::$old_assigned_user_id = $this->assigned_user_id;
             if (isset($_REQUEST['assigned_user_name'])) {
                 $this->new_assigned_user_name = $_REQUEST['assigned_user_name'];
             }
         }
     }
     /*nsingh 7/3/08  commenting out as bug #20814 is invalid
     		if($current_user->getPreference('reminder_time')!= -1 &&  isset($_POST['reminder_checked']) && isset($_POST['reminder_time']) && $_POST['reminder_checked']==0  && $_POST['reminder_time']==-1){
     			$this->reminder_checked = '1';
     			$this->reminder_time = $current_user->getPreference('reminder_time');
     		}*/
     // prevent a mass mailing for recurring meetings created in Calendar module
     if (empty($this->id) && !empty($_REQUEST['module']) && $_REQUEST['module'] == "Calendar" && !empty($_REQUEST['repeat_type']) && !empty($this->repeat_parent_id)) {
         $check_notify = false;
     }
     if (empty($this->status)) {
         $this->status = $this->getDefaultStatus();
     }
     // Do any external API saving
     // Clear out the old external API stuff if we have changed types
     if (isset($this->fetched_row) && $this->fetched_row['type'] != $this->type) {
         $this->join_url = '';
         $this->host_url = '';
         $this->external_id = '';
         $this->creator = '';
     }
     if (!empty($this->type) && $this->type != 'Sugar') {
         require_once 'include/externalAPI/ExternalAPIFactory.php';
         $api = ExternalAPIFactory::loadAPI($this->type);
     }
     if (empty($this->type)) {
         $this->type = 'Sugar';
     }
     if (isset($api) && is_a($api, 'WebMeeting') && empty($this->in_relationship_update)) {
         // Make sure the API initialized and it supports Web Meetings
         // Also make sure we have an ID, the external site needs something to reference
         if (!isset($this->id) || empty($this->id)) {
             $this->id = create_guid();
             $this->new_with_id = true;
         }
         // formatting fix required because our schedule meeting APIs expect data in a specific format
         $this->fixUpFormatting();
         $response = $api->scheduleMeeting($this);
         if ($response['success'] == TRUE) {
             // Need to send out notifications
             if ($api->canInvite) {
                 $notifyList = $this->get_notification_recipients();
                 foreach ($notifyList as $person) {
                     $api->inviteAttendee($this, $person, $check_notify);
                 }
             }
         } else {
             // Generic Message Provides no value to End User - Log the issue with message detail and continue
             // SugarApplication::appendErrorMessage($GLOBALS['app_strings']['ERR_EXTERNAL_API_SAVE_FAIL']);
             $GLOBALS['log']->warn('ERR_EXTERNAL_API_SAVE_FAIL' . ": " . $this->type . " - " . $response['errorMessage']);
         }
         $api->logoff();
     }
     $return_id = parent::save($check_notify);
     $this->setUserInvitees($this->users_arr);
     if ($this->update_vcal) {
         $assigned_user = BeanFactory::getBean('Users', $this->assigned_user_id);
         vCal::cache_sugar_vcal($assigned_user);
         if ($this->assigned_user_id != $GLOBALS['current_user']->id) {
             vCal::cache_sugar_vcal($current_user);
         }
     }
     // CCL - Comment out call to set $current_user as invitee
     // set organizer to auto-accept
     // if there isn't a fetched row its new
     if ($this->assigned_user_id == $GLOBALS['current_user']->id && empty($this->fetched_row)) {
         $this->set_accept_status($GLOBALS['current_user'], 'accept');
     }
     return $return_id;
 }