Ejemplo n.º 1
0
     if (!empty($_POST['frequencyperiod']) && intval($_POST['frequencynumber']) > 0 && !empty($_POST['enddate'])) {
         $recursion = array('unit' => $_POST['frequencyperiod'], 'repeat' => $_POST['frequencynumber'], 'end' => $_POST['enddate']);
     }
     if (is_null($visibility)) {
         if(isset($_POST['rep']) && $_POST['rep'] == 'yes'){
             $resp = Calendar_Events::update_recursive_event($id, $newTitle, $start, $duration, $newContent, $recursion, $refobjid);
         } else {
           $resp = Calendar_Events::update_event($id, $newTitle, $start, $duration, $newContent, false, $recursion, $refobjid);
         }
         
     } else {
         $resp = Calendar_Events::update_admin_event($id, $newTitle, $start, $duration, $newContent, $visibility, $recursion);
         if(isset($_POST['rep']) && $_POST['rep'] == 'yes'){
                 $resp = Calendar_Events::update_recursive_admin_event($id, $newTitle, $start, $duration, $newContent, $visibility, $recursion);
         } else {
             $resp = Calendar_Events::update_admin_event($id, $newTitle, $start, $duration, $newContent, $visibility, $recursion);
         }
     }
     if ($resp['success']) {
         Session::Messages($langEventModify, 'alert-success');
     } else {
         Session::Messages($resp['message']);
     }
     redirect_to_home_page('main/personal_calendar/index.php');
 } else { // new event 
     $recursion = null;
     if (!empty($_POST['frequencyperiod']) && intval($_POST['frequencynumber']) > 0 && !empty($_POST['enddate'])) {
         $recursion = array('unit' => $_POST['frequencyperiod'], 'repeat' => $_POST['frequencynumber'], 'end' => $_POST['enddate']);
     }
     $resp = Calendar_Events::add_event($newTitle, $newContent, $start, $duration, $recursion, $refobjid, $visibility);
     if ($resp['success']) {
Ejemplo n.º 2
0
    /**
     * Updates existing group of administrative recursive events and logs the action
     * @param int $eventid id in table admin_calendar
     * @param string $title event title
     * @param string $start event datetime
     * @param text $content event details
     * @param string $reference_obj_id refernced object by note. It contains the object type (from $ref_object_types) and object id (id in the corresponding db table), e.g., video_link:5
     */

    public static function update_recursive_admin_event($eventid, $title, $start, $duration, $content, $visibility_level, $recursion = NULL){
        global $langNotValidInput;
        $rec_eventid = Database::get()->querySingle('SELECT source_event_id FROM admin_calendar WHERE id=?d',$eventid);
        if ($rec_eventid) {
            return Calendar_Events::update_admin_event($rec_eventid->source_event_id, $title, $start, $duration, $content, $visibility_level, $recursion, true);
        } else {
            return array('success' => false, 'message' => $langNotValidInput);
        }
    }