Esempio n. 1
0
 public function approveSuggestion($id)
 {
     if (!Current_User::authorized('calendar', 'edit_public') || Current_User::isRestricted('calendar')) {
         PHPWS_Core::errorPage('403');
     }
     PHPWS_Core::initModClass('calendar', 'Suggestion.php');
     $suggestion = new Calendar_Suggestion((int) $id);
     if (!$suggestion->id) {
         PHPWS_Core::errorPage('404');
     }
     $values = PHPWS_Core::stripObjValues($suggestion);
     unset($values['id']);
     $event = new Calendar_Event();
     $event->loadSchedule($suggestion->schedule_id);
     $event->public = 1;
     PHPWS_Core::plugObject($event, $values);
     $result = $event->save();
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         return false;
     }
     $suggestion->delete();
 }