コード例 #1
0
ファイル: index.php プロジェクト: nikosv/openeclass
     $refobjid = ($_POST['refobjid'] == "0") ? $_POST['refcourse'] : $_POST['refobjid'];
     $visibility = null;
 }
 $start = $_POST['startdate'];
 $duration = $_POST['duration'];
 if (!empty($_POST['id'])) { //existing event
     $id = intval($_POST['id']);
     $recursion = null;
     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']);
     }
コード例 #2
0
    /**
     * Update existing group of recursive events and logs the action
     * @param int $eventid id in table personal_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_event($eventid, $title, $start, $duration, $content, $recursion = NULL, $reference_obj_id = NULL) {
        global $langNotValidInput;
        $rec_eventid = Database::get()->querySingle('SELECT source_event_id FROM personal_calendar WHERE id=?d',$eventid);
        if ($rec_eventid) {
            return Calendar_Events::update_event($rec_eventid->source_event_id, $title, $start, $duration, $content, true, $recursion, $reference_obj_id);
        } else {
            return array('success' => false, 'message' => $langNotValidInput);
        }
    }