Esempio n. 1
0
     $form->setRequired($element);
     if (!isset($announcement_to_modify)) {
         $announcement_to_modify = '';
     }
     $form->addElement('checkbox', 'email_ann', null, get_lang('EmailOption'));
 } else {
     if (!isset($announcement_to_modify)) {
         $announcement_to_modify = "";
     }
     $element = CourseManager::addGroupMultiSelect($form, $group_id, array());
     $form->setRequired($element);
     $form->addElement('checkbox', 'email_ann', null, get_lang('EmailOption'));
 }
 $announcementInfo = AnnouncementManager::get_by_id($course_id, $id);
 if (isset($announcementInfo) && !empty($announcementInfo)) {
     $to = AnnouncementManager::load_edit_users("announcement", $id);
     $defaults = array('title' => $announcementInfo['title'], 'content' => $announcementInfo['content'], 'id' => $announcementInfo['id'], 'users' => $to);
 } else {
     $defaults = array();
     if (!empty($to)) {
         $defaults['users'] = $to;
     }
 }
 $form->addElement('text', 'title', get_lang('EmailTitle'));
 $form->addElement('hidden', 'id');
 $htmlTags = "<b>" . get_lang('Tags') . "</b><br /><br />";
 $tags = AnnouncementManager::get_tags();
 foreach ($tags as $tag) {
     $htmlTags .= "<b>" . $tag . "</b><br />";
 }
 $form->addLabel(null, "<div class='alert alert-info'>" . $htmlTags . "</div>");
Esempio n. 2
0
     $display_form = true;
     // RETRIEVE THE CONTENT OF THE ANNOUNCEMENT TO MODIFY
     $id = intval($_GET['id']);
     if (!api_is_course_coach() || api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $id)) {
         $sql = "SELECT * FROM  {$tbl_announcement} WHERE c_id = {$course_id} AND id = '{$id}'";
         $rs = Database::query($sql);
         $myrow = Database::fetch_array($rs);
         $last_id = $id;
         $userUpload = isset($_FILES['user_upload']) ? $_FILES['user_upload'] : null;
         $edit_attachment = AnnouncementManager::edit_announcement_attachment_file($last_id, $userUpload, $file_comment);
         if ($myrow) {
             $announcement_to_modify = $myrow['id'];
             $content_to_modify = $myrow['content'];
             $title_to_modify = $myrow['title'];
             if ($originalresource !== "no") {
                 $to = AnnouncementManager::load_edit_users("announcement", $announcement_to_modify);
             }
             $display_announcement_list = false;
         }
         if ($to == "everyone" or !empty($group_id)) {
             $_SESSION['select_groupusers'] = "hide";
         } else {
             $_SESSION['select_groupusers'] = "show";
         }
     }
 }
 /* Move announcement up/down */
 if (isset($_GET['sec_token']) && $ctok == $_GET['sec_token']) {
     if (!empty($_GET['down'])) {
         $thisAnnouncementId = intval($_GET['down']);
         $sortDirection = "DESC";