Esempio n. 1
0
         $file_comment = $_POST['file_comment'];
         $file = $_FILES['user_upload'];
         AnnouncementManager::edit_announcement($id, $emailTitle, $newContent, $_POST['selectedform'], $file, $file_comment, $sendToUsersInSession);
         /*		MAIL FUNCTION	*/
         if ($_POST['email_ann'] && empty($_POST['onlyThoseMails'])) {
             AnnouncementManager::send_email($id, $sendToUsersInSession);
         }
         $message = get_lang('AnnouncementModified');
     }
 } else {
     //insert mode
     if ($ctok == $_POST['sec_token']) {
         $file = $_FILES['user_upload'];
         $file_comment = $_POST['file_comment'];
         if (!empty($group_id)) {
             $insert_id = AnnouncementManager::add_group_announcement($safe_emailTitle, $safe_newContent, array('GROUP:' . $group_id), $_POST['selectedform'], $file, $file_comment, $sendToUsersInSession);
         } else {
             $insert_id = AnnouncementManager::add_announcement($safe_emailTitle, $safe_newContent, $_POST['selectedform'], $file, $file_comment, $sendToUsersInSession);
         }
         //store_resources($_SESSION['source_type'],$insert_id);
         $_SESSION['select_groupusers'] = "hide";
         $message = get_lang('AnnouncementAdded');
         /* MAIL FUNCTION */
         if ($_POST['email_ann'] && empty($_POST['onlyThoseMails'])) {
             AnnouncementManager::send_email($insert_id, $sendToUsersInSession);
         }
     }
     // end condition token
 }
 // isset
 // UNSET VARIABLES
Esempio n. 2
0
                    if (isset($_POST['email_ann']) && empty($_POST['onlyThoseMails'])) {
                        AnnouncementManager::send_email($id, $sendToUsersInSession, isset($data['send_to_hrm_users']));
                    }
                    Display::addFlash(Display::return_message(get_lang('AnnouncementModified'), 'success'));
                    header('Location: ' . $homeUrl);
                    exit;
                }
            } else {
                // Insert mode
                if (true) {
                    $file = $_FILES['user_upload'];
                    $file_comment = $data['file_comment'];
                    if (empty($group_id)) {
                        $insert_id = AnnouncementManager::add_announcement($data['title'], $data['content'], $data['users'], $file, $file_comment, null, $sendToUsersInSession);
                    } else {
                        $insert_id = AnnouncementManager::add_group_announcement($data['title'], $data['content'], array('GROUP:' . $group_id), $data['users'], $file, $file_comment, $sendToUsersInSession);
                    }
                    Display::addFlash(Display::return_message(get_lang('AnnouncementAdded'), 'success'));
                    /* MAIL FUNCTION */
                    if (isset($data['email_ann']) && $data['email_ann']) {
                        AnnouncementManager::send_email($insert_id, $sendToUsersInSession);
                    }
                    header('Location: ' . $homeUrl);
                    exit;
                }
                // end condition token
            }
        }
        $content = $form->returnForm();
        break;
}
        if (isset($id) && $id) {
            // there is an Id => the announcement already exists => update mode
            if ($ctok == $_POST['sec_token']) {
                $file_comment = $_POST['file_comment'];
                $file = $_FILES['user_upload'];
                AnnouncementManager::edit_announcement($id, $_POST['emailTitle'], $_POST['newContent'], $selected_form, $file, $file_comment, $sendEmail);
                $message = get_lang('AnnouncementModified');
            }
        } else {
            // Insert mode
            //if (1) {
            if ($ctok == $_REQUEST['sec_token']) {
                $file = $_FILES['user_upload'];
                $file_comment = $_POST['file_comment'];
                if (!empty($group_id)) {
                    $insert_id = AnnouncementManager::add_group_announcement($_POST['emailTitle'], $_POST['newContent'], array('GROUP:' . $group_id), $selected_form, $file, $file_comment, $sendEmail);
                } else {
                    $insert_id = AnnouncementManager::add_announcement($_POST['emailTitle'], $_POST['newContent'], $selected_form, $file, $file_comment, $sendEmail);
                }
                $message = get_lang('AnnouncementAdded');
            }
        }
    }
}
/* Tool introduction  */
if (empty($_GET['origin']) || $_GET['origin'] !== 'learnpath') {
    Display::display_introduction_section(TOOL_ANNOUNCEMENT);
}
/* DISPLAY LEFT COLUMN */
//condition for the session
$session_id = api_get_session_id();