require_once $CFG->dirroot . '/mod/publication/mod_publication_grantextension_form.php';
$id = optional_param('id', 0, PARAM_INT);
// Course Module ID.
$userids = required_param_array('userids', PARAM_INT);
// User id.
$url = new moodle_url('/mod/publication/grantextension.php', array('id' => $id));
if (!($cm = get_coursemodule_from_id('publication', $id, 0, false, MUST_EXIST))) {
    print_error('invalidcoursemodule');
}
if (!($course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST))) {
    print_error('coursemisconf');
}
require_login($course, false, $cm);
$context = context_module::instance($cm->id);
require_capability('mod/publication:grantextension', $context);
$publication = new publication($context, $cm, $course);
$url = new moodle_url('/mod/publication/grantextension.php', array('cmid' => $cm->id));
if (!empty($id)) {
    $url->param('id', $id);
}
$PAGE->set_url($url);
// Create a new form object.
$mform = new mod_publication_grantextension_form(null, array('publication' => $publication, 'userids' => $userids));
if ($mform->is_cancelled()) {
    redirect(new moodle_url('/mod/publication/view.php', array('id' => $cm->id)));
} else {
    if ($data = $mform->get_data()) {
        // Store updated set of files.
        $dataobject = array();
        $dataobject['publication'] = $publication->get_instance()->id;
        foreach ($data->userids as $uid) {
예제 #2
0
 * @create 08.05.2012
 * @update
 */
//	Запрет на обращение к файлу.
if (realpath($_SERVER['SCRIPT_FILENAME']) == realpath(__FILE__)) {
    header('Location: /');
    exit;
}
// Определение переменных
// панель управления для визуального редактора
$ToolbarSet = 'Basic';
$editorWidth = 500;
$editorHeight = 200;
// TODO: Получать дефолтовую страницу с публикациями автоматически
$publicpage['link'] = '/public/';
$public = new publication();
$public->db =& $DB;
$public->lang = $current_lang;
$public->__lang = $this->getLocalizeLang();
$contests = new contests();
$contests->db =& $DB;
$contests->lang = $current_lang;
$contests->__lang = $this->getLocalizeLang();
$action = Text::get_get('action') != '' ? Text::get_get('action') : '';
$url = preg_replace("/\\?(.*)\$/i", '', $_SERVER['REQUEST_URI']);
if (preg_match('/\\.html$/i', $url)) {
    $action = 'view';
}
// Получение всех данных о пользователе
$profile = $user->getProfile($user_id);
// Обработчик
예제 #3
0
$modinfo = get_fast_modinfo($course);
foreach ($modinfo->instances['publication'] as $cm) {
    if (!$cm->uservisible) {
        continue;
    }
    // Show dimmed if the mod is hidden!
    $class = $cm->visible ? '' : 'dimmed';
    $link = html_writer::tag('a', format_string($cm->name), array('href' => 'view.php?id=' . $cm->id, 'class' => $class));
    $printsection = '';
    if ($usesections) {
        if ($cm->sectionnum !== $currentsection) {
            if ($cm->sectionnum) {
                $printsection = get_section_name($course, $sections[$cm->sectionnum]);
            }
            if ($currentsection !== '') {
                $table->data[] = 'hr';
            }
            $currentsection = $cm->sectionnum;
        }
    }
    $publication = new publication(null, $cm, $course);
    $desc = $publication->get_instance()->intro;
    if ($usesections) {
        $table->data[] = array($printsection, $link, $desc);
    } else {
        $table->data[] = array($link, $desc);
    }
}
echo html_writer::empty_tag('br');
echo html_writer::table($table);
echo $OUTPUT->footer();
예제 #4
0
 * @copyright     2014 Academic Moodle Cooperation {@link http://www.academic-moodle-cooperation.org}
 * @license       http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once '../../config.php';
require_once $CFG->dirroot . '/mod/publication/locallib.php';
require_once $CFG->dirroot . '/mod/publication/mod_publication_files_form.php';
$id = required_param('id', PARAM_INT);
// Course Module ID.
$url = new moodle_url('/mod/publication/view.php', array('id' => $id));
$cm = get_coursemodule_from_id('publication', $id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_login($course, true, $cm);
$PAGE->set_url($url);
$context = context_module::instance($cm->id);
require_capability('mod/publication:view', $context);
$publication = new publication($context, $cm, $course);
$event = \mod_publication\event\course_module_viewed::create(array('objectid' => $PAGE->cm->instance, 'context' => $PAGE->context));
$event->add_record_snapshot('course', $PAGE->course);
$event->trigger();
$pagetitle = strip_tags($course->shortname . ': ' . format_string($publication->get_instance()->name));
$action = optional_param('action', 'view', PARAM_ALPHA);
$savevisibility = optional_param('savevisibility', false, PARAM_RAW);
$download = optional_param('download', 0, PARAM_INT);
if ($download > 0) {
    $publication->download_file($download);
}
if ($savevisibility) {
    require_capability('mod/publication:approve', $context);
    $files = optional_param_array('files', array(), PARAM_INT);
    $sql = 'UPDATE {publication_file} SET teacherapproval=:approval WHERE publication=:pubid AND fileid  IN ';
    $params = array();
예제 #5
0
require_once $CFG->dirroot . '/mod/publication/locallib.php';
require_once $CFG->dirroot . '/mod/publication/upload_form.php';
$cmid = required_param('cmid', PARAM_INT);
// Course Module ID.
$id = optional_param('id', 0, PARAM_INT);
// EntryID.
if (!($cm = get_coursemodule_from_id('publication', $cmid))) {
    print_error('invalidcoursemodule');
}
if (!($course = $DB->get_record('course', array('id' => $cm->course)))) {
    print_error('coursemisconf');
}
require_login($course, false, $cm);
$context = context_module::instance($cm->id);
require_capability('mod/publication:upload', $context);
$publication = new publication($context, $cm, $course);
$url = new moodle_url('/mod/publication/upload.php', array('cmid' => $cm->id));
if (!empty($id)) {
    $url->param('id', $id);
}
$PAGE->set_url($url);
$entry = new stdClass();
$entry->id = $USER->id;
$entry->definition = '';
// Updated later.
$entry->definitionformat = FORMAT_HTML;
// Updated later.
$maxfiles = $publication->get_instance()->maxfiles;
$maxbytes = $publication->get_instance()->maxbytes;
// Patch accepted filetypes.
if (isset($publication->get_instance()->allowedfiletypes) and !empty($publication->get_instance()->allowedfiletypes)) {