Example #1
0
             $emailOption = 0;
         }
     } else {
         $dialogBox->error(get_lang('The "visible from" date can\'t exceed the "visible until" date'));
         $emailOption = 0;
     }
 } elseif ('exCreate' == $cmd) {
     // One of the two visible date fields is null OR the "from" field is <= the "until" field
     if (is_null($visible_from) || is_null($visible_until) || $visible_from <= $visible_until) {
         // Determine the rank of the new announcement
         $insert_id = announcement_add_item($title, $content, $visible_from, $visible_until, $visibility);
         if ($insert_id) {
             $dialogBox->success(get_lang('Announcement has been added'));
             $currentLocator = ResourceLinker::$Navigator->getCurrentLocator(array('id' => (int) $insert_id));
             $resourceList = isset($_REQUEST['resourceList']) ? $_REQUEST['resourceList'] : array();
             ResourceLinker::updateLinkList($currentLocator, $resourceList);
             $eventNotifier->notifyCourseEvent('anouncement_added', claro_get_current_course_id(), claro_get_current_tool_id(), $insert_id, claro_get_current_group_id(), '0');
             if (CONFVAL_LOG_ANNOUNCEMENT_INSERT) {
                 $claroline->log('ANNOUNCEMENT', array('INSERT_ENTRY' => $insert_id));
             }
             $autoExportRefresh = true;
         } else {
             if ($failure = claro_failure::get_last_failure()) {
                 $dialogBox->error($failure);
             } else {
                 $dialogBox->error(get_lang('Impossible to add the announcement'));
             }
             $emailOption = 0;
         }
     } else {
         $dialogBox->error(get_lang('The "visible from" date can\'t exceed the "visible until" date'));