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

PHP file_prepare_standard_editor函数代码示例

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

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



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

示例1: build_editform

 function build_editform($item, $feedback, $cm)
 {
     global $DB, $CFG;
     require_once 'label_form.php';
     //get the lastposition number of the feedback_items
     $position = $item->position;
     $lastposition = $DB->count_records('feedback_item', array('feedback' => $feedback->id));
     if ($position == -1) {
         $i_formselect_last = $lastposition + 1;
         $i_formselect_value = $lastposition + 1;
         $item->position = $lastposition + 1;
     } else {
         $i_formselect_last = $lastposition;
         $i_formselect_value = $item->position;
     }
     //the elements for position dropdownlist
     $positionlist = array_slice(range(0, $i_formselect_last), 1, $i_formselect_last, true);
     //all items for dependitem
     $feedbackitems = feedback_get_depend_candidates_for_item($feedback, $item);
     $commonparams = array('cmid' => $cm->id, 'id' => isset($item->id) ? $item->id : NULL, 'typ' => $item->typ, 'items' => $feedbackitems, 'feedback' => $feedback->id);
     $this->context = get_context_instance(CONTEXT_MODULE, $cm->id);
     //preparing the editor for new file-api
     $item->presentationformat = FORMAT_HTML;
     $item->presentationtrust = 1;
     $item = file_prepare_standard_editor($item, 'presentation', $this->presentationoptions, $this->context, 'mod_feedback', 'item', $item->id);
     //build the form
     $this->item_form = new feedback_label_form('edit_item.php', array('item' => $item, 'common' => $commonparams, 'positionlist' => $positionlist, 'position' => $position, 'presentationoptions' => $this->presentationoptions));
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:28,代码来源:lib.php


示例2: definition

 /**
  * Called to define this moodle form
  *
  * @return void
  */
 public function definition()
 {
     global $DB;
     $mform =& $this->_form;
     $course = $this->_customdata['course'];
     $cm = $this->_customdata['cm'];
     $modcontext = $this->_customdata['modcontext'];
     $sessionid = $this->_customdata['sessionid'];
     if (!($sess = $DB->get_record('attendance_sessions', array('id' => $sessionid)))) {
         error('No such session in this course');
     }
     $dhours = floor($sess->duration / HOURSECS);
     $dmins = floor(($sess->duration - $dhours * HOURSECS) / MINSECS);
     $defopts = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'noclean' => true, 'context' => $modcontext);
     $sess = file_prepare_standard_editor($sess, 'description', $defopts, $modcontext, 'mod_attendance', 'session', $sess->id);
     $data = array('sessiondate' => $sess->sessdate, 'durtime' => array('hours' => $dhours, 'minutes' => $dmins), 'sdescription' => $sess->description_editor);
     $mform->addElement('header', 'general', get_string('changesession', 'attendance'));
     $mform->addElement('static', 'olddate', get_string('olddate', 'attendance'), userdate($sess->sessdate, get_string('strftimedmyhm', 'attendance')));
     $mform->addElement('date_time_selector', 'sessiondate', get_string('newdate', 'attendance'));
     for ($i = 0; $i <= 23; $i++) {
         $hours[$i] = sprintf("%02d", $i);
     }
     for ($i = 0; $i < 60; $i += 5) {
         $minutes[$i] = sprintf("%02d", $i);
     }
     $durselect[] =& $mform->createElement('select', 'hours', '', $hours);
     $durselect[] =& $mform->createElement('select', 'minutes', '', $minutes, false, true);
     $mform->addGroup($durselect, 'durtime', get_string('duration', 'attendance'), array(' '), true);
     $mform->addElement('editor', 'sdescription', get_string('description', 'attendance'), null, $defopts);
     $mform->setType('sdescription', PARAM_RAW);
     $mform->setDefaults($data);
     $submit_string = get_string('update', 'attendance');
     $this->add_action_buttons(true, $submit_string);
 }
开发者ID:lsuits,项目名称:moodle-mod_attendance,代码行数:39,代码来源:update_form.php


示例3: set_data

 /**
  * Load in existing data as form defaults
  *
  * @param stdClass|array $default_values object or array of default values
  */
 function set_data($default_values)
 {
     if (!is_object($default_values)) {
         // we need object for file_prepare_standard_editor
         $default_values = (object) $default_values;
     }
     $editoroptions = $this->_customdata['editoroptions'];
     $default_values = file_prepare_standard_editor($default_values, 'summary', $editoroptions, $editoroptions['context'], 'course', 'section', $default_values->id);
     $default_values->usedefaultname = strval($default_values->name) === '';
     parent::set_data($default_values);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:16,代码来源:editsection_form.php


示例4: build_editform

    public function build_editform($item, $evaluation, $cm,$classid) {
        global $DB, $CFG;
        require_once('label_form.php');

        //get the lastposition number of the evaluation_items
        $position = $item->position;
        $lastposition = $DB->count_records('evaluation_item', array('evaluation'=>$evaluation->id));
        if ($position == -1) {
            $i_formselect_last = $lastposition + 1;
            $i_formselect_value = $lastposition + 1;
            $item->position = $lastposition + 1;
        } else {
            $i_formselect_last = $lastposition;
            $i_formselect_value = $item->position;
        }
        //the elements for position dropdownlist
        $positionlist = array_slice(range(0, $i_formselect_last), 1, $i_formselect_last, true);

        //all items for dependitem
        $evaluationitems = evaluation_get_depend_candidates_for_item($evaluation, $item);
        $commonparams = array('cmid'=>$cm,
                              'clid'=>$classid,
                             'id'=>isset($item->id) ? $item->id : null,
                             'typ'=>$item->typ,
                             'items'=>$evaluationitems,
                             'evaluation'=>$evaluation->id);

     //   $this->context = context_localule::instance($cm->id);

        //preparing the editor for new file-api
        $item->presentationformat = FORMAT_HTML;
        $item->presentationtrust = 1;

        // Append editor context to presentation options, giving preference to existing context.
        $this->presentationoptions = array_merge(array('context' => $this->context),
                                                 $this->presentationoptions);

        $item = file_prepare_standard_editor($item,
                                            'presentation', //name of the form element
                                            $this->presentationoptions,
                                            $this->context,
                                            'local_evaluations',
                                            'item', //the filearea
                                            $item->id);

        //build the form
        $customdata = array('item' => $item,
                            'common' => $commonparams,
                            'positionlist' => $positionlist,
                            'position' => $position,
                            'presentationoptions' => $this->presentationoptions);

        $this->item_form = new evaluation_label_form('edit_item.php', $customdata);
    }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:54,代码来源:lib.php


示例5: get_form_elements

 /**
  * Add form elements for settings
  *
  * @param mixed $submission can be null
  * @param MoodleQuickForm $mform
  * @param stdClass $data
  * @return true if elements were added to the form
  */
 public function get_form_elements($submission, MoodleQuickForm $mform, stdClass $data)
 {
     $elements = array();
     $editoroptions = $this->get_edit_options();
     $submissionid = $submission ? $submission->id : 0;
     if (!isset($data->onlinetext)) {
         $data->onlinetext = '';
     }
     if (!isset($data->onlinetextformat)) {
         $data->onlinetextformat = editors_get_preferred_format();
     }
     if ($submission) {
         $onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
         if ($onlinetextsubmission) {
             $data->onlinetext = $onlinetextsubmission->onlinetext;
             $data->onlinetextformat = $onlinetextsubmission->onlineformat;
         }
     }
     $data = file_prepare_standard_editor($data, 'onlinetext', $editoroptions, $this->assignment->get_context(), 'assignsubmission_onlinetext', ASSIGNSUBMISSION_ONLINETEXT_FILEAREA, $submissionid);
     $mform->addElement('editor', 'onlinetext_editor', '', null, $editoroptions);
     return true;
 }
开发者ID:vinoth4891,项目名称:clinique,代码行数:30,代码来源:locallib.php


示例6: tag_display_name

$PAGE->set_subpage($tag->id);
$PAGE->set_context($systemcontext);
$PAGE->set_blocks_editing_capability('moodle/tag:editblocks');
$PAGE->set_pagelayout('base');
$tagname = tag_display_name($tag);
// set the relatedtags field of the $tag object that will be passed to the form
$tag->relatedtags = tag_get_related_tags_csv(tag_get_related_tags($tag->id, TAG_RELATED_MANUAL), TAG_RETURN_TEXT);
$options = new stdClass();
$options->smiley = false;
$options->filter = false;
// convert and remove any XSS
$tag->description = format_text($tag->description, $tag->descriptionformat, $options);
$tag->descriptionformat = FORMAT_HTML;
$errorstring = '';
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG->maxbytes, 'trusttext' => false, 'context' => $systemcontext, 'subdirs' => file_area_contains_subdirs($systemcontext, 'tag', 'description', $tag->id));
$tag = file_prepare_standard_editor($tag, 'description', $editoroptions, $systemcontext, 'tag', 'description', $tag->id);
$tagform = new tag_edit_form(null, compact('editoroptions'));
if ($tag->tagtype == 'official') {
    $tag->tagtype = '1';
} else {
    $tag->tagtype = '0';
}
$tagform->set_data($tag);
// If new data has been sent, update the tag record
if ($tagnew = $tagform->get_data()) {
    if (has_capability('moodle/tag:manage', $systemcontext)) {
        if ($tag->tagtype != 'default' && (!isset($tagnew->tagtype) || $tagnew->tagtype != '1')) {
            tag_type_set($tag->id, 'default');
        } elseif ($tag->tagtype != 'official' && $tagnew->tagtype == '1') {
            tag_type_set($tag->id, 'official');
        }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:edit.php


示例7: redirect

        $asid = $workshop->add_allocation($example, $USER->id, 0);
    }
    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;
开发者ID:rushi963,项目名称:moodle,代码行数:31,代码来源:exsubmission.php


示例8: cancel_email_update

} else {
    if ($node = $PAGE->navigation->find('myprofile', navigation_node::TYPE_ROOTNODE)) {
        $node->force_open();
    }
}
// Process email change cancellation.
if ($cancelemailchange) {
    cancel_email_update($user->id);
}
// Load user preferences.
useredit_load_preferences($user);
// Load custom profile fields data.
profile_load_data($user);
// Prepare the editor and create form.
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG->maxbytes, 'trusttext' => false, 'forcehttps' => false, 'context' => $personalcontext);
$user = file_prepare_standard_editor($user, 'description', $editoroptions, $personalcontext, 'user', 'profile', 0);
// Prepare filemanager draft area.
$draftitemid = 0;
$filemanagercontext = $editoroptions['context'];
$filemanageroptions = array('maxbytes' => $CFG->maxbytes, 'subdirs' => 0, 'maxfiles' => 1, 'accepted_types' => 'web_image');
file_prepare_draft_area($draftitemid, $filemanagercontext->id, 'user', 'newicon', 0, $filemanageroptions);
$user->imagefile = $draftitemid;
// Create form.
$userform = new user_edit_form(new moodle_url($PAGE->url, array('returnto' => $returnto)), array('editoroptions' => $editoroptions, 'filemanageroptions' => $filemanageroptions, 'user' => $user));
$emailchanged = false;
if ($usernew = $userform->get_data()) {
    // Deciding where to send the user back in most cases.
    if ($returnto === 'profile') {
        if ($course->id != SITEID) {
            $returnurl = new moodle_url('/user/view.php', array('id' => $user->id, 'course' => $course->id));
        } else {
开发者ID:ket-ed,项目名称:ketmoodle-core-changes,代码行数:31,代码来源:edit.php


示例9: set_data

 public function set_data($customlabel)
 {
     if (empty($customlabel->labelclass)) {
         $customlabel->labelclass = 'text';
         $customlabel->content = '';
         $customlabel->processedcontent = '';
         $customlabel->intro = '';
         $customlabel->introformat = 0;
     }
     $instance = customlabel_load_class($customlabel, $customlabel->labelclass);
     $formdata = $customlabel;
     // Get dynamic part of data and add to fixed model part from customlabel record.
     $formdatadyn = (array) json_decode(base64_decode($customlabel->content));
     foreach ($formdatadyn as $key => $value) {
         // Discard all moodle core data that should be there.
         if (in_array($key, array('coursemodule', 'instance', 'sesskey', 'module', 'section'))) {
             continue;
         }
         // Ignore old Moodle 1.9 stuff.
         if (in_array($key, array('safe_content', 'usesafe'))) {
             continue;
         }
         $formdata->{$key} = $value;
         if (is_object($formdata->{$key}) && isset($formdata->{$key}->text)) {
             $formdata->{$key} = (array) $formdata->{$key};
         }
     }
     // Prepare editor for intro standard field.
     // Prepare editors for all textarea|editor dynamic fields prepared in model.
     foreach ($instance->fields as $field) {
         if (preg_match('/editor|textarea/', $field->type)) {
             $fieldname = $field->name;
             $editorname = $fieldname . '_editor';
             $formdata->{$editorname} = array('text' => @$formdata->{$fieldname}, 'format' => FORMAT_HTML);
             $editoroptions = self::editor_options();
             $editoroptions['context'] = $this->context;
             // Fakes format field.
             $fieldnameformat = $fieldname . 'format';
             $customlabel->{$fieldnameformat} = FORMAT_HTML;
             $defaults = file_prepare_standard_editor($customlabel, $fieldname, $editoroptions, $this->context, 'mod_customlabel', 'contentfiles', @$customlabel->{$fieldname});
         }
         if (preg_match('/datasource$/', $field->type)) {
             $name = $field->name;
             $formdata->{$name} = @$formdatadyn[$name . 'option'];
         }
         // Todo : limit upload size on course settings
         $maxbytes = -1;
         if ($field->type == 'filepicker') {
             $draftitemid = file_get_submitted_draft_itemid($field->name);
             $groupname = $field->name . 'group';
             $maxfiles = 1;
             file_prepare_draft_area($draftitemid, $this->context->id, 'mod_customlabel', $field->name, 0, array('subdirs' => 0, 'maxbytes' => $maxbytes, 'maxfiles' => $maxfiles));
             $formdata->{$groupname} = array($field->name => $draftitemid);
         }
     }
     // Prepare type selector value.
     if ($tomodel = optional_param('type', '', PARAM_TEXT)) {
         $formdata->labelclass = $tomodel;
     }
     $formdata->sesskey = sesskey();
     parent::set_data($formdata);
 }
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:62,代码来源:mod_form.php


示例10: array

        $table->data[] = array(' ', ' ', $emailalllink);
        echo html_writer::table($table);
        break;
    case 'grade':
        // Trigger the essay grade viewed event.
        $event = \mod_lesson\event\essay_attempt_viewed::create(array('objectid' => $attempt->id, 'relateduserid' => $attempt->userid, 'context' => $context, 'courseid' => $course->id));
        $event->add_record_snapshot('lesson_attempts', $attempt);
        $event->trigger();
        // Grading form
        // Expects the following to be set: $attemptid, $answer, $user, $page, $attempt
        $essayinfo = lesson_page_type_essay::extract_useranswer($attempt->useranswer);
        $currentpage = $lesson->load_page($attempt->pageid);
        $mform = new essay_grading_form(null, array('scoreoptions' => $scoreoptions, 'user' => $user));
        $data = new stdClass();
        $data->id = $cm->id;
        $data->attemptid = $attemptid;
        $data->score = $essayinfo->score;
        $data->question = format_text($currentpage->contents, $currentpage->contentsformat, $formattextdefoptions);
        $data->studentanswer = format_text($essayinfo->answer, $essayinfo->answerformat, array('context' => $context, 'para' => true));
        $data->response = $essayinfo->response;
        $data->responseformat = $essayinfo->responseformat;
        $editoroptions = array('noclean' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG->maxbytes, 'context' => $context);
        $data = file_prepare_standard_editor($data, 'response', $editoroptions, $context, 'mod_lesson', 'essay_responses', $attempt->id);
        $mform->set_data($data);
        $mform->display();
        break;
    default:
        groups_print_activity_menu($cm, $url);
        break;
}
echo $OUTPUT->footer();
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:31,代码来源:essay.php


示例11: file_prepare_standard_editor

    $assessmenteditable = false;
}

// load the grading strategy logic
$strategy = $workshop->grading_strategy_instance();

// load the assessment form and process the submitted data eventually
$mform = $strategy->get_assessment_form($PAGE->url, 'assessment', $assessment, $assessmenteditable);

// Set data managed by the workshop core, subplugins set their own data themselves.
$currentdata = (object)array(
    'feedbackauthor' => $assessment->feedbackauthor,
    'feedbackauthorformat' => $assessment->feedbackauthorformat,
);
if ($assessmenteditable and $workshop->overallfeedbackmode) {
    $currentdata = file_prepare_standard_editor($currentdata, 'feedbackauthor', $workshop->overall_feedback_content_options(),
        $workshop->context, 'mod_workshop', 'overallfeedback_content', $assessment->id);
    if ($workshop->overallfeedbackfiles) {
        $currentdata = file_prepare_standard_filemanager($currentdata, 'feedbackauthorattachment',
            $workshop->overall_feedback_attachment_options(), $workshop->context, 'mod_workshop', 'overallfeedback_attachment',
            $assessment->id);
    }
}
$mform->set_data($currentdata);

if ($mform->is_cancelled()) {
    redirect($workshop->view_url());
} elseif ($assessmenteditable and ($data = $mform->get_data())) {
    if ($canmanage) {
        if (is_null($assessment->grade)) {
            $workshop->log('add reference assessment', $workshop->exassess_url($assessment->id), $assessment->submissionid);
        } else {
开发者ID:verbazend,项目名称:AWFA,代码行数:32,代码来源:exassessment.php


示例12: admin_externalpage_setup

    }
}
if (!$courseid) {
    require_once $CFG->libdir . '/adminlib.php';
    admin_externalpage_setup('scales');
}
// default return url
$gpr = new grade_plugin_return();
$returnurl = $gpr->get_return_url('index.php?id=' . $courseid);
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG->maxbytes, 'trusttext' => false, 'noclean' => true, 'context' => $systemcontext);
if (!empty($scale_rec->id)) {
    $editoroptions['subdirs'] = file_area_contains_subdirs($systemcontext, 'grade', 'scale', $scale_rec->id);
    $scale_rec = file_prepare_standard_editor($scale_rec, 'description', $editoroptions, $systemcontext, 'grade', 'scale', $scale_rec->id);
} else {
    $editoroptions['subdirs'] = false;
    $scale_rec = file_prepare_standard_editor($scale_rec, 'description', $editoroptions, $systemcontext, 'grade', 'scale', null);
}
$mform = new edit_scale_form(null, compact('gpr', 'editoroptions'));
$mform->set_data($scale_rec);
if ($mform->is_cancelled()) {
    redirect($returnurl);
} else {
    if ($data = $mform->get_data()) {
        $scale = new grade_scale(array('id' => $id));
        $data->userid = $USER->id;
        if (empty($scale->id)) {
            $data->description = $data->description_editor['text'];
            $data->descriptionformat = $data->description_editor['format'];
            grade_scale::set_properties($scale, $data);
            if (!has_capability('moodle/grade:manage', $systemcontext)) {
                $data->standard = 0;
开发者ID:pzhu2004,项目名称:moodle,代码行数:31,代码来源:edit.php


示例13: require_login

} else {
    require_login();
    print_error('needcoursecategroyid');
}

// Prepare course and the editor
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes'=>$CFG->maxbytes, 'trusttext'=>false, 'noclean'=>true);
if (!empty($course)) {
    //add context for editor
    $editoroptions['context'] = $coursecontext;
    $course = file_prepare_standard_editor($course, 'summary', $editoroptions, $coursecontext, 'course', 'summary', 0);

} else {
    //editor should respect category context if course context is not set.
    $editoroptions['context'] = $catcontext;
    $course = file_prepare_standard_editor($course, 'summary', $editoroptions, null, 'course', 'summary', null);
}

// first create the form
$editform = new course_edit_form(NULL, array('course'=>$course, 'category'=>$category, 'editoroptions'=>$editoroptions, 'returnto'=>$returnto));
if ($editform->is_cancelled()) {
        switch ($returnto) {
            case 'category':
                $url = new moodle_url($CFG->wwwroot.'/course/category.php', array('id'=>$categoryid));
                break;
            case 'topcat':
                $url = new moodle_url($CFG->wwwroot.'/course/');
                break;
            default:
                if (!empty($course->id)) {
                    $url = new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id));
开发者ID:ncsu-delta,项目名称:moodle,代码行数:31,代码来源:edit.php


示例14: stdClass

    $email = new stdClass();
    $email->id = null;
    $email->subject = optional_param('subject', '', PARAM_TEXT);
    $email->message = optional_param('message_editor[text]', '', PARAM_RAW);
    $email->mailto = optional_param('mailto', '', PARAM_TEXT);
    $email->format = $USER->mailformat;
}
$email->messageformat = $email->format;
$email->messagetext = $email->message;
$default_sigid = $DB->get_field('block_clampmail_signatures', 'id', array('userid' => $USER->id, 'default_flag' => 1));
$email->sigid = $default_sigid ? $default_sigid : -1;
// Some setters for the form.
$email->type = $type;
$email->typeid = $typeid;
$editor_options = array('trusttext' => true, 'subdirs' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'context' => $context);
$email = file_prepare_standard_editor($email, 'message', $editor_options, $context, 'block_clampmail', $type, $email->id);
$selected = array();
if (!empty($email->mailto)) {
    foreach (explode(',', $email->mailto) as $id) {
        $selected[$id] = $users[$id];
        unset($users[$id]);
    }
}
$form = new email_form(null, array('editor_options' => $editor_options, 'selected' => $selected, 'users' => $users, 'roles' => $roles, 'groups' => $groups, 'users_to_roles' => $users_to_roles, 'users_to_groups' => $users_to_groups, 'sigs' => array_map(function ($sig) {
    return $sig->title;
}, $sigs), 'alternates' => $alternates));
$warnings = array();
if ($form->is_cancelled()) {
    redirect(new moodle_url('/course/view.php?id=' . $courseid));
} else {
    if ($data = $form->get_data()) {
开发者ID:sryder,项目名称:clampmail,代码行数:31,代码来源:email.php


示例15: array

}
if ($id !== 0) {
    $PAGE->set_url('/group/group.php', array('id' => $id));
} else {
    $PAGE->set_url('/group/group.php', array('courseid' => $courseid));
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('moodle/course:managegroups', $context);
$returnurl = $CFG->wwwroot . '/group/index.php?id=' . $course->id . '&group=' . $id;
// Prepare the description editor: We do support files for group descriptions
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $course->maxbytes, 'trust' => false, 'context' => $context, 'noclean' => true);
if (!empty($group->id)) {
    $group = file_prepare_standard_editor($group, 'description', $editoroptions, $context, 'group', 'description', $group->id);
} else {
    $group = file_prepare_standard_editor($group, 'description', $editoroptions, $context, 'group', 'description', null);
}
/// First create the form
$editform = new group_form(null, array('editoroptions' => $editoroptions));
$editform->set_data($group);
if ($editform->is_cancelled()) {
    redirect($returnurl);
} elseif ($data = $editform->get_data()) {
    if (!has_capability('moodle/course:changeidnumber', $context)) {
        // Remove the idnumber if the user doesn't have permission to modify it
        unset($data->idnumber);
    }
    if ($data->id) {
        groups_update_group($data, $editform, $editoroptions);
    } else {
        $id = groups_create_group($data, $editform, $editoroptions);
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:31,代码来源:group.php


示例16: array

        $tool->costcenterid = $tool->costcenterid;
        $tool->costcenter_name = $DB->get_field('local_costcenter', 'fullname', array('id' => $tool->costcenterid));
    } else {
        //$tool->role_name = 'Manager';
        $tool->costcenter_name = 'All';
    }
    $usercontext = context_user::instance($tool->id);
    $editoroptions = array(
        'maxfiles' => EDITOR_UNLIMITED_FILES,
        'maxbytes' => $CFG->maxbytes,
        'trusttext' => false,
        'forcehttps' => false,
        'context' => $usercontext
    );

    $tool = file_prepare_standard_editor($tool, 'description', $editoroptions, $usercontext, 'user', 'profile', 0);
} else {
	 require_capability('moodle/user:update', $systemcontext);
    $tool = new stdClass();
    $tool->id = $id;
    $usercontext = null;
    // This is a new user, we don't want to add files here
    $editoroptions = array(
        'maxfiles' => 0,
        'maxbytes' => 0,
        'trusttext' => false,
        'forcehttps' => false,
        'context' => context_system::instance()
    );
}
// Prepare filemanager draft area.
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:31,代码来源:user.php


示例17: get_definition_for_editing

 /**
  * Converts the current definition into an object suitable for the editor form's set_data()
  *
  * @param boolean $addemptycriterion whether to add an empty criterion if the rubric is completely empty (just being created)
  * @return stdClass
  */
 public function get_definition_for_editing($addemptycriterion = false)
 {
     $definition = $this->get_definition();
     $properties = new stdClass();
     $properties->areaid = $this->areaid;
     if ($definition) {
         foreach (array('id', 'name', 'description', 'descriptionformat', 'status') as $key) {
             $properties->{$key} = $definition->{$key};
         }
         $options = self::description_form_field_options($this->get_context());
         $properties = file_prepare_standard_editor($properties, 'description', $options, $this->get_context(), 'grading', 'description', $definition->id);
     }
     $properties->rubric = array('criteria' => array(), 'options' => $this->get_options());
     if (!empty($definition->rubric_criteria)) {
         $properties->rubric['criteria'] = $definition->rubric_criteria;
     } else {
         if (!$definition && $addemptycriterion) {
             $properties->rubric['criteria'] = array('addcriterion' => 1);
         }
     }
     return $properties;
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:28,代码来源:lib.php


示例18: moodle_url

    echo $OUTPUT->header();
    echo $OUTPUT->heading($strheading);
    $yesurl = new moodle_url('/cohort/edit.php', array('id' => $cohort->id, 'delete' => 1, 'confirm' => 1, 'sesskey' => sesskey()));
    $message = get_string('delconfirm', 'cohort', format_string($cohort->name));
    echo $OUTPUT->confirm($message, $yesurl, $returnurl);
    echo $OUTPUT->footer();
    die;
}
$editoroptions = array('maxfiles' => 0, 'context' => $context);
if ($cohort->id) {
    // edit existing
    $cohort = file_prepare_standard_editor($cohort, 'description', $editoroptions, $context);
    $strheading = get_string('editcohort', 'cohort');
} else {
    // add new
    $cohort = file_prepare_standard_editor($cohort, 'description', $editoroptions, $context);
    $strheading = get_string('addcohort', 'cohort');
}
$PAGE->set_title($strheading);
$PAGE->set_heading($COURSE->fullname);
$PAGE->navbar->add($strheading);
$editform = new cohort_edit_form(null, array('editoroptions' => $editoroptions, 'data' => $cohort));
if ($editform->is_cancelled()) {
    redirect($returnurl);
} else {
    if ($data = $editform->get_data()) {
        $data = file_postupdate_standard_editor($data, 'description', $editoroptions, $context);
        if ($data->id) {
            cohort_update_cohort($data);
        } else {
            cohort_add_cohort($data);
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:31,代码来源:edit.php


示例19: prepare

 /**
  * Static function to prepare the summary editor for working with a course
  * request.
  *
  * @static
  * @param null|stdClass $data Optional, an object containing the default values
  *                       for the form, these may be modified when preparing the
  *                       editor so this should be called before creating the form
  * @return stdClass An object that can be used to set the default values for
  *                   an mforms form
  */
 public static function prepare($data = null)
 {
     if ($data === null) {
         $data = new stdClass();
     }
     $data = file_prepare_standard_editor($data, 'summary', self::summary_editor_options());
     return $data;
 }
开发者ID:numbas,项目名称:moodle,代码行数:19,代码来源:lib.php


示例20: get_feedbackauthor_form

    /**
     * Returns the mform the teachers use to put a feedback for the author on their submission
     *
     * @param moodle_url $actionurl
     * @param stdClass $submission
     * @param array $options editable
     * @return workshop_feedbackauthor_form
     */
    public function get_feedbackauthor_form(moodle_url $actionurl, stdclass $submission, $options=array()) {
        global $CFG;
        require_once(dirname(__FILE__) . '/feedbackauthor_form.php');

        $current = new stdclass();
        $current->submissionid          = $submission->id;
        $current->published             = $submission->published;
        $current->grade                 = $this->real_grade($submission->grade);
        $current->gradeover             = $this->real_grade($submission->gradeover);
        $current->feedbackauthor        = $submission->feedbackauthor;
        $current->feedbackauthorformat  = $submission->feedbackauthorformat;
        if (is_null($current->grade)) {
            $current->grade = get_string('nullgrade', 'workshop');
        }
        if (!isset($options['editable'])) {
            $editable = true;   // by default
        } else {
            $editable = (bool)$options['editable'];
        }

        // prepare wysiwyg editor
        $current = file_prepare_standard_editor($current, 'feedbackauthor', array());

        return new workshop_feedbackauthor_form($actionurl,
                array('workshop' => $this, 'current' => $current, 'editoropts' => array(), 'options' => $options),
                'post', '', null, $editable);
    }
开发者ID:nuckey,项目名称:moodle,代码行数:35,代码来源:locallib.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP file_prepare_standard_filemanager函数代码示例发布时间:2022-05-15
下一篇:
PHP file_prepare_draft_area函数代码示例发布时间: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