• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP file_prepare_standard_filemanager函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中file_prepare_standard_filemanager函数的典型用法代码示例。如果您正苦于以下问题:PHP file_prepare_standard_filemanager函数的具体用法?PHP file_prepare_standard_filemanager怎么用?PHP file_prepare_standard_filemanager使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了file_prepare_standard_filemanager函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: definition

 /**
  * Define this form - called by the parent constructor
  */
 public function definition()
 {
     global $COURSE, $USER;
     $mform = $this->_form;
     $params = $this->_customdata;
     $mform->addElement('header', 'batchuploadfilesforusers', get_string('batchuploadfilesforusers', 'setaskfeedback_file', count($params['users'])));
     $mform->addElement('static', 'userslist', get_string('selectedusers', 'setaskfeedback_file'), $params['usershtml']);
     $data = new stdClass();
     $fileoptions = array('subdirs' => 1, 'maxbytes' => $COURSE->maxbytes, 'accepted_types' => '*', 'return_types' => FILE_INTERNAL);
     $data = file_prepare_standard_filemanager($data, 'files', $fileoptions, $params['context'], 'setaskfeedback_file', ASSIGNFEEDBACK_FILE_BATCH_FILEAREA, $USER->id);
     $mform->addElement('filemanager', 'files_filemanager', '', null, $fileoptions);
     $this->set_data($data);
     $mform->addElement('hidden', 'id', $params['cm']);
     $mform->setType('id', PARAM_INT);
     $mform->addElement('hidden', 'operation', 'plugingradingbatchoperation_file_uploadfiles');
     $mform->setType('operation', PARAM_ALPHAEXT);
     $mform->addElement('hidden', 'action', 'viewpluginpage');
     $mform->setType('action', PARAM_ALPHA);
     $mform->addElement('hidden', 'pluginaction', 'uploadfiles');
     $mform->setType('pluginaction', PARAM_ALPHA);
     $mform->addElement('hidden', 'plugin', 'file');
     $mform->setType('plugin', PARAM_PLUGIN);
     $mform->addElement('hidden', 'pluginsubtype', 'setaskfeedback');
     $mform->setType('pluginsubtype', PARAM_PLUGIN);
     $mform->addElement('hidden', 'selectedusers', implode(',', $params['users']));
     $mform->setType('selectedusers', PARAM_SEQUENCE);
     $this->add_action_buttons(true, get_string('uploadfiles', 'setaskfeedback_file'));
 }
开发者ID:krzpassrl,项目名称:SRL_Moodle_db,代码行数:31,代码来源:batchuploadfilesform.php


示例2: get_form_elements

 /**
  * Get form elements for grading form
  *
  * @param stdClass $grade
  * @param MoodleQuickForm $mform
  * @param stdClass $data
  * @return bool true if elements were added to the form
  */
 public function get_form_elements($grade, MoodleQuickForm $mform, stdClass $data)
 {
     $fileoptions = $this->get_file_options();
     $gradeid = $grade ? $grade->id : 0;
     $data = file_prepare_standard_filemanager($data, 'files', $fileoptions, $this->assignment->get_context(), 'assignfeedback_file', ASSIGNFEEDBACK_FILE_FILEAREA, $gradeid);
     $mform->addElement('filemanager', 'files_filemanager', '', null, $fileoptions);
     return true;
 }
开发者ID:rama1712,项目名称:moodle,代码行数:16,代码来源:locallib.php


示例3: get_string

}
$title = get_string('editfiles', 'wiki');
$struser = get_string('user');
$url = new moodle_url('/mod/wiki/filesedit.php', array('subwiki' => $subwiki->id, 'pageid' => $pageid));
$PAGE->set_url($url);
$PAGE->set_context($context);
$PAGE->set_title($title);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add(format_string(get_string('wikifiles', 'wiki')), $CFG->wwwroot . '/mod/wiki/files.php?pageid=' . $pageid);
$PAGE->navbar->add(format_string($title));
$data = new stdClass();
$data->returnurl = $returnurl;
$data->subwikiid = $subwiki->id;
$maxbytes = get_max_upload_file_size($CFG->maxbytes, $COURSE->maxbytes);
$options = array('subdirs' => 0, 'maxbytes' => $maxbytes, 'maxfiles' => -1, 'accepted_types' => '*', 'return_types' => FILE_INTERNAL | FILE_REFERENCE);
file_prepare_standard_filemanager($data, 'files', $options, $context, 'mod_wiki', 'attachments', $subwiki->id);
$mform = new mod_wiki_filesedit_form(null, array('data' => $data, 'options' => $options));
if ($mform->is_cancelled()) {
    redirect($returnurl);
} else {
    if ($formdata = $mform->get_data()) {
        $formdata = file_postupdate_standard_filemanager($formdata, 'files', $options, $context, 'mod_wiki', 'attachments', $subwiki->id);
        redirect($returnurl);
    }
}
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($wiki->name));
echo $OUTPUT->box(format_module_intro('wiki', $wiki, $PAGE->cm->id), 'generalbox', 'intro');
echo $OUTPUT->box_start('generalbox');
$mform->display();
echo $OUTPUT->box_end();
开发者ID:alanaipe2015,项目名称:moodle,代码行数:31,代码来源:filesedit.php


示例4: require_capability

    }
} else {
    // new entry
    require_capability('mod/glossary:write', $context);
    // note: guest user does not have any write capability
    $entry = new stdClass();
    $entry->id = null;
}
$maxfiles = 99;
// TODO: add some setting
$maxbytes = $course->maxbytes;
// TODO: add some setting
$definitionoptions = array('trusttext' => true, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes, 'context' => $context, 'subdirs' => file_area_contains_subdirs($context, 'mod_glossary', 'entry', $entry->id));
$attachmentoptions = array('subdirs' => false, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes);
$entry = file_prepare_standard_editor($entry, 'definition', $definitionoptions, $context, 'mod_glossary', 'entry', $entry->id);
$entry = file_prepare_standard_filemanager($entry, 'attachment', $attachmentoptions, $context, 'mod_glossary', 'attachment', $entry->id);
$entry->cmid = $cm->id;
// create form and set initial data
$mform = new mod_glossary_entry_form(null, array('current' => $entry, 'cm' => $cm, 'glossary' => $glossary, 'definitionoptions' => $definitionoptions, 'attachmentoptions' => $attachmentoptions));
if ($mform->is_cancelled()) {
    if ($id) {
        redirect("view.php?id={$cm->id}&mode=entry&hook={$id}");
    } else {
        redirect("view.php?id={$cm->id}");
    }
} else {
    if ($entry = $mform->get_data()) {
        $timenow = time();
        $categories = empty($entry->categories) ? array() : $entry->categories;
        unset($entry->categories);
        $aliases = trim($entry->aliases);
开发者ID:abhilash1994,项目名称:moodle,代码行数:31,代码来源:edit.php


示例5: file_prepare_standard_filemanager

        file_prepare_standard_filemanager($course, 'overviewfiles', $overviewfilesoptions, $coursecontext, 'course', 'overviewfiles', 0);
    }
    // Inject current aliases.
    $aliases = $DB->get_records('role_names', array('contextid' => $coursecontext->id));
    foreach ($aliases as $alias) {
        $course->{'role_' . $alias->roleid} = $alias->name;
    }
    // Populate course tags.
    $course->tags = core_tag_tag::get_item_tags_array('core', 'course', $course->id);
} else {
    // Editor should respect category context if course context is not set.
    $editoroptions['context'] = $catcontext;
    $editoroptions['subdirs'] = 0;
    $course = file_prepare_standard_editor($course, 'summary', $editoroptions, null, 'course', 'summary', null);
    if ($overviewfilesoptions) {
        file_prepare_standard_filemanager($course, 'overviewfiles', $overviewfilesoptions, null, 'course', 'overviewfiles', 0);
    }
}
// First create the form.
$args = array('course' => $course, 'category' => $category, 'editoroptions' => $editoroptions, 'returnto' => $returnto, 'returnurl' => $returnurl);
$editform = new course_edit_form(null, $args);
if ($editform->is_cancelled()) {
    // The form has been cancelled, take them back to what ever the return to is.
    redirect($returnurl);
} else {
    if ($data = $editform->get_data()) {
        // Process data if submitted.
        if (empty($course->id)) {
            // In creating the course.
            $course = create_course($data, $editoroptions);
            // Get the context of the newly created course.
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:edit.php


示例6: redirect

        echo $output->header();
        echo $output->box(get_string('assessmentreferenceconflict', 'workshopplus'));
        echo $output->continue_button($workshopplus->view_url());
        echo $output->footer();
        die;
    }
    redirect($workshopplus->exassess_url($asid));
}
if ($edit and $canmanage) {
    require_once dirname(__FILE__) . '/submission_form.php';
    $maxfiles = $workshopplus->nattachments;
    $maxbytes = $workshopplus->maxbytes;
    $contentopts = array('trusttext' => true, 'subdirs' => false, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes, 'context' => $workshopplus->context);
    $attachmentopts = array('subdirs' => true, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes);
    $example = file_prepare_standard_editor($example, 'content', $contentopts, $workshopplus->context, 'mod_workshopplus', 'submission_content', $example->id);
    $example = file_prepare_standard_filemanager($example, 'attachment', $attachmentopts, $workshopplus->context, 'mod_workshopplus', 'submission_attachment', $example->id);
    $mform = new workshopplus_submission_form($PAGE->url, array('current' => $example, 'workshopplus' => $workshopplus, 'contentopts' => $contentopts, 'attachmentopts' => $attachmentopts));
    if ($mform->is_cancelled()) {
        redirect($workshopplus->view_url());
    } elseif ($canmanage and $formdata = $mform->get_data()) {
        if ($formdata->example == 1) {
            // this was used just for validation, it must be set to one when dealing with example submissions
            unset($formdata->example);
        } else {
            throw new coding_exception('Invalid submission form data value: example');
        }
        $timenow = time();
        if (is_null($example->id)) {
            $formdata->workshopplusid = $workshopplus->id;
            $formdata->example = 1;
            $formdata->authorid = $USER->id;
开发者ID:mortezaaa,项目名称:moodle-activity_workshopplus,代码行数:31,代码来源:exsubmission.php


示例7: strip_tags

$PAGE->set_context($context);
$title = strip_tags($course->fullname . ': ' . get_string('modulename', 'assignment') . ': ' . format_string($assignment->name, true));
$PAGE->set_title($title);
$PAGE->set_heading($title);
$instance = new assignment_onlinejudge($cm->id, $assignment, $cm, $course);
$submission = $instance->get_submission($formdata->userid, true);
$filemanager_options = array('subdirs' => 1, 'maxbytes' => $assignment->maxbytes, 'maxfiles' => $assignment->var1, 'accepted_types' => '*', 'return_types' => FILE_INTERNAL);
$mform = new mod_assignment_upload_form(null, array('contextid' => $contextid, 'userid' => $formdata->userid, 'options' => $filemanager_options));
if ($mform->is_cancelled()) {
    redirect(new moodle_url('/mod/assignment/view.php', array('id' => $cm->id)));
} else {
    if ($formdata = $mform->get_data()) {
        $instance->upload($mform, $filemanager_options);
        die;
    }
}
echo $OUTPUT->header();
echo $OUTPUT->box_start('generalbox');
if ($instance->can_upload_file($submission) && $id == null) {
    $data = new stdClass();
    // move submission files to user draft area
    $data = file_prepare_standard_filemanager($data, 'files', $filemanager_options, $context, 'mod_assignment', 'submission', $submission->id);
    // set file manager itemid, so it will find the files in draft area
    $mform->set_data($data);
    $mform->display();
} else {
    echo $OUTPUT->notification(get_string('uploaderror', 'assignment'));
    echo $OUTPUT->continue_button(new moodle_url('/mod/assignment/view.php', array('id' => $cm->id)));
}
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
开发者ID:boychunli,项目名称:moodle-local_onlinejudge,代码行数:31,代码来源:upload.php


示例8: redirect

    }
    if ($asid == workshop::ALLOCATION_EXISTS) {
        // the training assessment of the example was not found but the allocation already
        // exists. this probably means that the user is the author of the reference assessment.
        echo $output->header();
        echo $output->box(get_string('assessmentreferenceconflict', 'workshop'));
        echo $output->continue_button($workshop->view_url());
        echo $output->footer();
        die;
    }
    redirect($workshop->exassess_url($asid));
}
if ($edit and $canmanage) {
    require_once dirname(__FILE__) . '/submission_form.php';
    $example = file_prepare_standard_editor($example, 'content', $workshop->submission_content_options(), $workshop->context, 'mod_workshop', 'submission_content', $example->id);
    $example = file_prepare_standard_filemanager($example, 'attachment', $workshop->submission_attachment_options(), $workshop->context, 'mod_workshop', 'submission_attachment', $example->id);
    $mform = new workshop_submission_form($PAGE->url, array('current' => $example, 'workshop' => $workshop, 'contentopts' => $workshop->submission_content_options(), 'attachmentopts' => $workshop->submission_attachment_options()));
    if ($mform->is_cancelled()) {
        redirect($workshop->view_url());
    } elseif ($canmanage and $formdata = $mform->get_data()) {
        if ($formdata->example == 1) {
            // this was used just for validation, it must be set to one when dealing with example submissions
            unset($formdata->example);
        } else {
            throw new coding_exception('Invalid submission form data value: example');
        }
        $timenow = time();
        if (is_null($example->id)) {
            $formdata->workshopid = $workshop->id;
            $formdata->example = 1;
            $formdata->authorid = $USER->id;
开发者ID:rushi963,项目名称:moodle,代码行数:31,代码来源:exsubmission.php


示例9: edit_load_user_data

 /**
  * during editing this prepares the file manager with the correct file reference
  * @param   object   instance of the userdata for this form (course edit form)
  */
 function edit_load_user_data(&$user)
 {
     global $DB;
     //, $FILEPICKER_OPTIONS;
     $options = filepicker_options();
     //$dataid = $this->data;
     //if (!empty($dataid)) {
     if ($dataid = $DB->get_field('course_meta_info_data', 'id', array('courseid' => $this->courseid, 'fieldid' => $this->fieldid))) {
         $user->{$this->inputname} = file_prepare_standard_filemanager($user, $this->inputname, $options, $options['context'], 'course_meta_customfield', 'course_meta_filemanager', $dataid);
     }
 }
开发者ID:EpicBrasil,项目名称:moodle-course_meta,代码行数:15,代码来源:field.class.php


示例10: get_form_elements_for_user

 /**
  * Get form elements for grading form.
  *
  * @param stdClass $grade
  * @param MoodleQuickForm $mform
  * @param stdClass $data
  * @param int $userid The userid we are currently grading
  * @return bool true if elements were added to the form
  */
 public function get_form_elements_for_user($grade, MoodleQuickForm $mform, stdClass $data, $userid)
 {
     $fileoptions = $this->get_file_options();
     $gradeid = $grade ? $grade->id : 0;
     $elementname = 'files_' . $userid;
     $data = file_prepare_standard_filemanager($data, $elementname, $fileoptions, $this->seplment->get_context(), 'seplfeedback_file', ASSIGNFEEDBACK_FILE_FILEAREA, $gradeid);
     $mform->addElement('filemanager', $elementname . '_filemanager', $this->get_name(), null, $fileoptions);
     return true;
 }
开发者ID:krzpassrl,项目名称:SRL_Moodle_Baseline,代码行数:18,代码来源:locallib.php


示例11: get_form_elements_for_user

    /**
     * Get form elements for grading form.
     *
     * @param stdClass $grade
     * @param MoodleQuickForm $mform
     * @param stdClass $data
     * @param int $userid The userid we are currently grading
     * @return bool true if elements were added to the form
     */
    public function get_form_elements_for_user($grade, MoodleQuickForm $mform, stdClass $data, $userid) {

        $fileoptions = $this->get_file_options();
        $gradeid = $grade ? $grade->id : 0;
        $elementname = 'files_' . $userid;

        $data = file_prepare_standard_filemanager($data,
                                                  $elementname,
                                                  $fileoptions,
                                                  $this->assignment->get_context(),
                                                  'assignfeedback_file',
                                                  ASSIGNFEEDBACK_FILE_FILEAREA,
                                                  $gradeid);
        $mform->addElement('filemanager', $elementname . '_filemanager', html_writer::tag('span', $this->get_name(),
            array('class' => 'accesshide')), null, $fileoptions);

        return true;
    }
开发者ID:Burick,项目名称:moodle,代码行数:27,代码来源:locallib.php


示例12: get_form_elements

 /**
  * Add elements to submission form
  *
  * @param mixed $submission stdClass|null
  * @param MoodleQuickForm $mform
  * @param stdClass $data
  * @return bool
  */
 public function get_form_elements($submission, MoodleQuickForm $mform, stdClass $data)
 {
     global $DB;
     if ($this->get_config('maxfilesubmissions') <= 0) {
         return false;
     }
     $fileoptions = $this->get_file_options();
     $submissionid = $submission ? $submission->id : 0;
     $context = $this->assignment->get_context();
     $fs = get_file_storage();
     $coversheetfiles = $fs->get_area_files($context->id, 'assignsubmission_pdf', ASSIGNSUBMISSION_PDF_FA_COVERSHEET, false, '', false);
     if ($coversheetfiles) {
         $file = reset($coversheetfiles);
         $fileurl = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(), $file->get_filearea(), null, $file->get_filepath(), $file->get_filename());
         $filelink = html_writer::link($fileurl, $file->get_filename(), array('target' => '_blank'));
         $mform->addElement('static', 'pdf_coversheet', '', get_string('coversheetnotice', 'assignsubmission_pdf') . ': ' . $filelink);
     }
     file_prepare_standard_filemanager($data, 'pdfs', $fileoptions, $this->assignment->get_context(), 'assignsubmission_pdf', ASSIGNSUBMISSION_PDF_FA_DRAFT, $submissionid);
     $label = html_writer::tag('span', get_string('pdfsubmissions', 'assignsubmission_pdf'), array('class' => 'accesshide'));
     $mform->addElement('filemanager', 'pdfs_filemanager', $label, null, $fileoptions);
     if ($coversheetfiles) {
         if ($templateid = $this->get_config('templateid')) {
             $templateitems = $DB->get_records('assignsubmission_pdf_tmplit', array('templateid' => $templateid));
             $templatedata = array();
             if ($submissionid) {
                 if ($templatedata = $DB->get_field('assignsubmission_pdf', 'templatedata', array('submission' => $submissionid))) {
                     $templatedata = unserialize($templatedata);
                 }
             }
             foreach ($templateitems as $item) {
                 $elname = "pdf_template[{$item->id}]";
                 if ($item->type == 'shorttext') {
                     $mform->addElement('text', $elname, s($item->setting));
                 } else {
                     if ($item->type == 'text') {
                         $mform->addElement('textarea', $elname, s($item->setting));
                     } else {
                         continue;
                     }
                 }
                 $mform->setType($elname, PARAM_TEXT);
                 $mform->addRule($elname, null, 'required', null, 'client');
                 if (isset($templatedata[$item->id])) {
                     $mform->setDefault($elname, $templatedata[$item->id]);
                 }
             }
         }
     }
     return true;
 }
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:58,代码来源:locallib.php


示例13: redirect

        echo $output->header();
        echo $output->box(get_string('assessmentreferenceconflict', 'teamwork'));
        echo $output->continue_button($teamwork->view_url());
        echo $output->footer();
        die;
    }
    redirect($teamwork->exassess_url($asid));
}
if ($edit and $canmanage) {
    require_once dirname(__FILE__) . '/submission_form.php';
    $maxfiles = $teamwork->nattachments;
    $maxbytes = $teamwork->maxbytes;
    $contentopts = array('trusttext' => true, 'subdirs' => false, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes, 'context' => $teamwork->context);
    $attachmentopts = array('subdirs' => true, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes);
    $example = file_prepare_standard_editor($example, 'content', $contentopts, $teamwork->context, 'mod_teamwork', 'submission_content', $example->id);
    $example = file_prepare_standard_filemanager($example, 'attachment', $attachmentopts, $teamwork->context, 'mod_teamwork', 'submission_attachment', $example->id);
    $mform = new teamwork_submission_form($PAGE->url, array('current' => $example, 'teamwork' => $teamwork, 'contentopts' => $contentopts, 'attachmentopts' => $attachmentopts));
    if ($mform->is_cancelled()) {
        redirect($teamwork->view_url());
    } elseif ($canmanage and $formdata = $mform->get_data()) {
        if ($formdata->example == 1) {
            // this was used just for validation, it must be set to one when dealing with example submissions
            unset($formdata->example);
        } else {
            throw new coding_exception('Invalid submission form data value: example');
        }
        $timenow = time();
        if (is_null($example->id)) {
            $formdata->teamworkid = $teamwork->id;
            $formdata->example = 1;
            $formdata->authorid = $USER->id;
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:31,代码来源:exsubmission.php


示例14: get_form_elements

 /**
  * Add elements to submission form
  *
  * @param mixed $submission stdClass|null
  * @param MoodleQuickForm $mform
  * @param stdClass $data
  * @return bool
  */
 public function get_form_elements($submission, MoodleQuickForm $mform, stdClass $data)
 {
     if ($this->get_config('maxfilesubmissions') <= 0) {
         return false;
     }
     $fileoptions = $this->get_file_options();
     $submissionid = $submission ? $submission->id : 0;
     $data = file_prepare_standard_filemanager($data, 'files', $fileoptions, $this->setaskment->get_context(), 'setasksubmission_file', ASSIGNSUBMISSION_FILE_FILEAREA, $submissionid);
     $mform->addElement('filemanager', 'files_filemanager', $this->get_name(), null, $fileoptions);
     return true;
 }
开发者ID:krzpassrl,项目名称:SRL_Moodle_db,代码行数:19,代码来源:locallib.php


示例15: array

    $chapter = $DB->get_record('giportfolio_userchapters', array('id' => $chapterid, 'giportfolioid' => $giportfolio->id, 'iduser' => $USER->id), '*', MUST_EXIST);
}
// Chapter is hidden for students.
if ($chapter->hidden) {
    require_capability('mod/giportfolio:viewhiddenchapters', $context);
}
giportfolio_add_fake_block($chapters, $chapter, $giportfolio, $cm, 0, 0);
// Add TOC.
$editoroptions = array('noclean' => true, 'subdirs' => true, 'maxfiles' => -1, 'maxbytes' => 0, 'context' => $context);
$attachmentoptions = array('subdirs' => false, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes);
$contribution = null;
if ($contributionid) {
    $contribution = $DB->get_record('giportfolio_contributions', array('id' => $contributionid, 'chapterid' => $chapterid, 'userid' => $USER->id), '*', MUST_EXIST);
    $formdata = clone $contribution;
    $formdata = file_prepare_standard_editor($formdata, 'content', $editoroptions, $context, 'mod_giportfolio', 'contribution', $formdata->id);
    $formdata = file_prepare_standard_filemanager($formdata, 'attachment', $attachmentoptions, $context, 'mod_giportfolio', 'attachment', $formdata->id);
    $formdata->contributionid = $formdata->id;
} else {
    $formdata = new stdClass();
}
$formdata->id = $cm->id;
$formdata->chapterid = $chapter->id;
// Header and strings.
$PAGE->set_title(format_string($giportfolio->name));
$PAGE->add_body_class('mod_giportfolio');
$PAGE->set_heading(format_string($course->fullname));
$redir = new moodle_url('/mod/giportfolio/viewgiportfolio.php', array('id' => $cm->id, 'chapterid' => $chapter->id));
// Handle delete / show / hide actions.
if ($action) {
    if (!$contribution) {
        print_error('invalidcontributionid', 'giportfolio');
开发者ID:andrewhancox,项目名称:moodle-mod_giportfolio,代码行数:31,代码来源:editcontribution.php


示例16: optional_param

$courseid = optional_param('courseid', '', PARAM_INT);
$context = get_context_instance(CONTEXT_COURSE, $courseid);
if (!has_capability('mod/csv_enrol:uploadcsv', $context, $USER->id)) {
    die("Unauthorized.");
}
$title = get_string('csvenrol', 'block_csv_enrol');
$struser = get_string('user');
$PAGE->set_url('/blocks/csv_enrol/edit.php');
$PAGE->set_context($context);
$PAGE->set_title($title);
$PAGE->set_heading($title);
$PAGE->set_pagelayout('incourse');
$PAGE->set_pagetype('user-private-files');
$data = new stdClass();
$options = array('subdirs' => 1, 'maxbytes' => $CFG->userquota, 'maxfiles' => -1, 'accepted_types' => '*.csv', 'return_types' => FILE_INTERNAL);
file_prepare_standard_filemanager($data, 'files', $options, $context, 'user', 'csvenrol', 0);
$course = $DB->get_record('course', array('id' => $courseid));
//used for coursename
$data->coursename = $course->fullname;
$data->courseid = $courseid;
$mform = new block_csv_enrol_form(null, array('data' => $data, 'options' => $options));
$formdata = $mform->get_data();
//3 options: file uploaded, cancelled, or saved
if ($mform->is_cancelled()) {
    redirect(new moodle_url($CFG->wwwroot . '/course/view.php', array('id' => $courseid)));
} else {
    if ($formdata && $mform->get_file_content('userfile')) {
        //upload file, store, and process csv
        $content = $mform->get_file_content('userfile');
        //save uploaded file
        $fs = get_file_storage();
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:31,代码来源:edit.php


示例17: require_login

require_login($course);
require_capability('moodle/course:managefiles', $context);
$PAGE->set_url($url);
$heading = get_string('coursefiles') . ': ' . format_string($course->fullname, true, array('context' => $context));
$strfiles = get_string("files");
if ($node = $PAGE->settingsnav->find('coursefiles', navigation_node::TYPE_SETTING)) {
    $node->make_active();
} else {
    $PAGE->navbar->add($strfiles);
}
$PAGE->set_context($context);
$PAGE->set_title($heading);
$PAGE->set_heading($heading);
$PAGE->set_pagelayout('incourse');
$data = new stdClass();
$options = array('subdirs' => 1, 'maxfiles' => -1, 'accepted_types' => '*', 'return_types' => FILE_INTERNAL);
file_prepare_standard_filemanager($data, 'files', $options, $context, $component, $filearea, $itemid);
$form = new coursefiles_edit_form(null, array('data' => $data, 'contextid' => $contextid));
$returnurl = new moodle_url('/files/index.php', array('contextid' => $contextid));
if ($form->is_cancelled()) {
    redirect($returnurl);
}
if ($data = $form->get_data()) {
    $data = file_postupdate_standard_filemanager($data, 'files', $options, $context, $component, $filearea, $itemid);
    redirect($returnurl);
}
echo $OUTPUT->header();
echo $OUTPUT->container_start();
$form->display();
echo $OUTPUT->container_end();
echo $OUTPUT->footer();
开发者ID:alanaipe2015,项目名称:moodle,代码行数:31,代码来源:coursefilesedit.php


示例18: get_coursemodule_from_id

// Course module ID
$cm = get_coursemodule_from_id('folder', $id, 0, false, MUST_EXIST);
$context = get_context_instance(CONTEXT_MODULE, $cm->id, MUST_EXIST);
$folder = $DB->get_record('folder', array('id' => $cm->instance), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_login($course, false, $cm);
require_capability('mod/folder:managefiles', $context);
add_to_log($course->id, 'folder', 'edit', 'edit.php?id=' . $cm->id, $folder->id, $cm->id);
$PAGE->set_url('/mod/folder/edit.php', array('id' => $cm->id));
$PAGE->set_title($course->shortname . ': ' . $folder->name);
$PAGE->set_heading($course->fullname);
$PAGE->set_activity_record($folder);
$data = new stdClass();
$data->id = $cm->id;
$options = array('subdirs' => 1, 'maxbytes' => $CFG->maxbytes, 'maxfiles' => -1, 'accepted_types' => '*');
file_prepare_standard_filemanager($data, 'files', $options, $context, 'mod_folder', 'content', 0);
$mform = new mod_folder_edit_form(null, array('data' => $data, 'options' => $options));
if ($mform->is_cancelled()) {
    redirect(new moodle_url('/mod/folder/view.php', array('id' => $cm->id)));
} else {
    if ($formdata = $mform->get_data()) {
        $formdata = file_postupdate_standard_filemanager($formdata, 'files', $options, $context, 'mod_folder', 'content', 0);
        $DB->set_field('folder', 'revision', $folder->revision + 1, array('id' => $folder->id));
        redirect(new moodle_url('/mod/folder/view.php', array('id' => $cm->id)));
    }
}
echo $OUTPUT->header();
echo $OUTPUT->box_start('generalbox foldertree');
$mform->display();
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:31,代码来源:edit.php


示例19: moodle_url

    $returnbutton = false;
    $returnurl = new moodle_url('/user/files.php');
}
$context = get_context_instance(CONTEXT_USER, $USER->id);
require_capability('moodle/user:manageownfiles', $context);
$title = get_string('myfiles');
$struser = get_string('user');
$PAGE->set_url('/user/files.php');
$PAGE->set_context($context);
$PAGE->set_title($title);
$PAGE->set_heading($title);
$PAGE->set_pagelayout('mydashboard');
$PAGE->set_pagetype('user-files');
$data = new stdClass();
$data->returnurl = $returnurl;
$options = array('subdirs' => 1, 'maxbytes' => $CFG->userquota, 'maxfiles' => -1, 'accepted_types' => '*');
file_prepare_standard_filemanager($data, 'files', $options, $context, 'user', 'private', 0);
$mform = new user_files_form(null, array('data' => $data, 'options' => $options, 'cancelbutton' => $returnbutton));
if ($mform->is_cancelled()) {
    redirect($returnurl);
} else {
    if ($formdata = $mform->get_data()) {
        $formdata = file_postupdate_standard_filemanager($formdata, 'files', $options, $context, 'user', 'private', 0);
        redirect($returnurl);
    }
}
echo $OUTPUT->header();
echo $OUTPUT->box_start('generalbox');
$mform->display();
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
开发者ID:rama1712,项目名称:moodle,代码行数:31,代码来源:files.php


示例20: array

                case CONTEXT_COURSE:
                    $entry->courseassoc = $assocrec->contextid;
                    break;
                case CONTEXT_MODULE:
                    $entry->modassoc = $assocrec->contextid;
                    break;
            }
        }
    }
}
require_once 'edit_form.php';
$summaryoptions = array('maxfiles' => 99, 'maxbytes' => $CFG->maxbytes, 'trusttext' => true, 'context' => $sitecontext, 'subdirs' => file_area_contains_subdirs($sitecontext, 'blog', 'post', $entry->id));
$attachmentoptions = array('subdirs' => false, 'maxfiles' => 99, 'maxbytes' => $CFG->maxbytes);
$blogeditform = new blog_edit_form(null, compact('entry', 'summaryoptions', 'attachmentoptions', 'sitecontext', 'courseid', 'modid'));
$entry = file_prepare_standard_editor($entry, 'summary', $summaryoptions, $sitecontext, 'blog', 'post', $entry->id);
$entry = file_prepare_standard_filemanager($entry, 'attachment', $attachmentoptions, $sitecontext, 'blog', 'attachment', $entry->id);
if (!empty($CFG->usetags) && !empty($entry->id)) {
    include_once $CFG->dirroot . '/tag/lib.php';
    $entry->tags = tag_get_tags_array('post', $entry->id);
}
$entry->action = $action;
// set defaults
$blogeditform->set_data($entry);
if ($blogeditform->is_cancelled()) {
    redirect($returnurl);
} else {
    if ($data = $blogeditform->get_data()) {
        switch ($action) {
            case 'add':
                $blogentry = new blog_entry(null, $data, $blogeditform);
                $blogentry->add();
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:31,代码来源:edit.php



注:本文中的file_prepare_standard_filemanager函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP file_put函数代码示例发布时间:2022-05-15
下一篇:
PHP file_prepare_standard_editor函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap