Пример #1
0
     if (isset($_POST['publish']) && !empty($evt->eventid)) {
         if (($res = $evt->setStatePublished()) === true) {
             $success[] = __('Event published', fsCalendar::$plugin_textdom);
             // Check again if user has right to edit that one
             if (!$evt->userCanEditEvent()) {
                 $action = 'view';
                 $success[] = __("Automatically switched to view mode beacause you don't have permissions to edit a published event", fsCalendar::$plugin_textdom);
             }
         } else {
             $errors = $res;
         }
     }
     if (isset($_POST['jsaction'])) {
         switch ($_POST['jsaction']) {
             case 'draft':
                 if (($res = $evt->setStateDraft()) === true) {
                     $success[] = __('Event set to draft state', fsCalendar::$plugin_textdom);
                 } else {
                     $errors = $res;
                 }
                 break;
             case 'nosync':
                 $evt->disableSynchronization();
                 $success[] = __('Synchronization with post data has been disabled', fsCalendar::$plugin_textdom);
                 break;
         }
     }
 } else {
     if ($evt->eventid == 0 && !$copy) {
         // Calculate date and time
         $current = time();