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

PHP file_postupdate_standard_editor函数代码示例

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

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



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

示例1: update_content

 /**
  *
  */
 public function update_content($entry, array $values = null, $savenew = false)
 {
     global $DB;
     $entryid = $entry->id;
     $fieldid = $this->id;
     $contentid = isset($entry->{"c{$fieldid}_id"}) ? $entry->{"c{$fieldid}_id"} : null;
     // Delete if old content but not new.
     if ($contentid and empty($values)) {
         return $this->delete_content($entry->id);
     }
     $rec = new stdClass();
     $rec->fieldid = $fieldid;
     $rec->entryid = $entryid;
     if (!($rec->id = $contentid) or $savenew) {
         $rec->id = $DB->insert_record('dataform_contents', $rec);
     }
     if ($this->is_editor()) {
         // Editor content.
         $data = (object) $values;
         $data->{'editor_editor'} = $data->editor;
         $data = file_postupdate_standard_editor($data, 'editor', $this->editoroptions, $this->df->context, 'mod_dataform', 'content', $rec->id);
         $rec->content = $data->editor;
         $rec->content1 = $data->{'editorformat'};
     } else {
         // Text area content.
         $value = reset($values);
         if (is_array($value)) {
             // Import: One value as array of text,format,trust, so take the text.
             $value = reset($value);
         }
         $rec->content = clean_param($value, PARAM_NOTAGS);
     }
     return $DB->update_record('dataform_contents', $rec);
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:37,代码来源:textarea.php


示例2: update

 public function update($properties, $context = null, $maxbytes = null)
 {
     global $DB, $PAGE;
     $properties->id = $this->properties->id;
     $properties->lessonid = $this->lesson->id;
     if (empty($properties->qoption)) {
         $properties->qoption = '0';
     }
     $properties->timemodified = time();
     $properties = file_postupdate_standard_editor($properties, 'contents', array('noclean' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $PAGE->course->maxbytes), context_module::instance($PAGE->cm->id), 'mod_lesson', 'page_contents', $properties->id);
     $DB->update_record("lesson_pages", $properties);
     $answers = $this->get_answers();
     if (count($answers) > 1) {
         $answer = array_shift($answers);
         foreach ($answers as $a) {
             $DB->delete_record('lesson_answers', array('id' => $a->id));
         }
     } else {
         if (count($answers) == 1) {
             $answer = array_shift($answers);
         } else {
             $answer = new stdClass();
         }
     }
     $answer->timemodified = time();
     if (isset($properties->jumpto[0])) {
         $answer->jumpto = $properties->jumpto[0];
     }
     if (isset($properties->score[0])) {
         $answer->score = $properties->score[0];
     }
     if (!empty($answer->id)) {
         $DB->update_record("lesson_answers", $answer->properties());
     } else {
         $DB->insert_record("lesson_answers", $answer);
     }
     return true;
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:38,代码来源:endofcluster.php


示例3: stdClass

     if (isset($usernew->email) and $user->email != $usernew->email && !has_capability('moodle/user:update', $systemcontext)) {
         $a = new stdClass();
         $a->newemail = $usernew->preference_newemail = $usernew->email;
         $usernew->preference_newemailkey = random_string(20);
         $usernew->preference_newemailattemptsleft = 3;
         $a->oldemail = $usernew->email = $user->email;
         $emailchangedhtml = $OUTPUT->box(get_string('auth_changingemailaddress', 'auth', $a), 'generalbox', 'notice');
         $emailchangedhtml .= $OUTPUT->continue_button($returnurl);
         $emailchanged = true;
     }
 }
 $authplugin = get_auth_plugin($user->auth);
 $usernew->timemodified = time();
 // Description editor element may not exist!
 if (isset($usernew->description_editor) && isset($usernew->description_editor['format'])) {
     $usernew = file_postupdate_standard_editor($usernew, 'description', $editoroptions, $personalcontext, 'user', 'profile', 0);
 }
 // Pass a true old $user here.
 if (!$authplugin->user_update($user, $usernew)) {
     // Auth update failed.
     print_error('cannotupdateprofile');
 }
 // Update user with new profile data.
 user_update_user($usernew, false, false);
 // Update preferences.
 useredit_update_user_preference($usernew);
 // Update interests.
 if (isset($usernew->interests)) {
     useredit_update_interests($usernew, $usernew->interests);
 }
 // Update user picture.
开发者ID:ket-ed,项目名称:ketmoodle-core-changes,代码行数:31,代码来源:edit.php


示例4: edit

 /**
  * Updates this entry in the database. Access control checks must be done by calling code.
  *
  * @param mform $form Used for attachments
  * @return void
  */
 public function edit($params = array(), $form = null, $summaryoptions = array(), $attachmentoptions = array())
 {
     global $CFG, $USER, $DB, $PAGE;
     $sitecontext = get_context_instance(CONTEXT_SYSTEM);
     $entry = $this;
     $this->form = $form;
     foreach ($params as $var => $val) {
         $entry->{$var} = $val;
     }
     $entry = file_postupdate_standard_editor($entry, 'summary', $summaryoptions, $sitecontext, 'blog', 'post', $entry->id);
     $entry = file_postupdate_standard_filemanager($entry, 'attachment', $attachmentoptions, $sitecontext, 'blog', 'attachment', $entry->id);
     if (!empty($CFG->useblogassociations)) {
         $entry->add_associations();
     }
     $entry->lastmodified = time();
     // Update record
     $DB->update_record('post', $entry);
     tag_set('post', $entry->id, $entry->tags);
     add_to_log(SITEID, 'blog', 'update', 'index.php?userid=' . $USER->id . '&entryid=' . $entry->id, $entry->subject);
 }
开发者ID:nfreear,项目名称:moodle,代码行数:26,代码来源:locallib.php


示例5: get_data

    public function get_data() {
        $data = parent::get_data();

        if (!empty($this->_customdata->submission->id)) {
            $itemid = $this->_customdata->submission->id;
        } else {
            $itemid = null; //TODO: this is wrong, itemid MUST be known when saving files!! (skodak)
        }

        if ($data) {
            $editoroptions = $this->get_editor_options();
            switch ($this->_customdata->assignment->assignmenttype) {
                case 'upload' :
                case 'uploadsingle' :
                    $data = file_postupdate_standard_filemanager($data, 'files', $editoroptions, $this->_customdata->context, 'mod_assignment', 'response', $itemid);
                    break;
                default :
                    break;
            }
            $data = file_postupdate_standard_editor($data, 'submissioncomment', $editoroptions, $this->_customdata->context, $editoroptions['component'], $editoroptions['filearea'], $itemid);
        }
        return $data;
    }
开发者ID:nuckey,项目名称:moodle,代码行数:23,代码来源:lib.php


示例6: update

 /**
  * Updates a lesson page and its answers within the database
  *
  * @param object $properties
  * @return bool
  */
 public function update($properties, $context = null, $maxbytes = null)
 {
     global $DB, $PAGE;
     $answers = $this->get_answers();
     $properties->id = $this->properties->id;
     $properties->lessonid = $this->lesson->id;
     if (empty($properties->qoption)) {
         $properties->qoption = '0';
     }
     if (empty($context)) {
         $context = $PAGE->context;
     }
     if ($maxbytes === null) {
         $maxbytes = get_user_max_upload_file_size($context);
     }
     $properties->timemodified = time();
     $properties = file_postupdate_standard_editor($properties, 'contents', array('noclean' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $maxbytes), $context, 'mod_lesson', 'page_contents', $properties->id);
     $DB->update_record("lesson_pages", $properties);
     for ($i = 0; $i < $this->lesson->maxanswers; $i++) {
         if (!array_key_exists($i, $this->answers)) {
             $this->answers[$i] = new stdClass();
             $this->answers[$i]->lessonid = $this->lesson->id;
             $this->answers[$i]->pageid = $this->id;
             $this->answers[$i]->timecreated = $this->timecreated;
         }
         if (!empty($properties->answer_editor[$i]) && is_array($properties->answer_editor[$i])) {
             $this->answers[$i]->answer = $properties->answer_editor[$i]['text'];
             $this->answers[$i]->answerformat = $properties->answer_editor[$i]['format'];
         }
         if (!empty($properties->response_editor[$i]) && is_array($properties->response_editor[$i])) {
             $this->answers[$i]->response = $properties->response_editor[$i]['text'];
             $this->answers[$i]->responseformat = $properties->response_editor[$i]['format'];
         }
         // we don't need to check for isset here because properties called it's own isset method.
         if ($this->answers[$i]->answer != '') {
             if (isset($properties->jumpto[$i])) {
                 $this->answers[$i]->jumpto = $properties->jumpto[$i];
             }
             if ($this->lesson->custom && isset($properties->score[$i])) {
                 $this->answers[$i]->score = $properties->score[$i];
             }
             if (!isset($this->answers[$i]->id)) {
                 $this->answers[$i]->id = $DB->insert_record("lesson_answers", $this->answers[$i]);
             } else {
                 $DB->update_record("lesson_answers", $this->answers[$i]->properties());
             }
             // Save files in answers and responses.
             $this->save_answers_files($context, $maxbytes, $this->answers[$i], $properties->answer_editor[$i], $properties->response_editor[$i]);
         } else {
             if (isset($this->answers[$i]->id)) {
                 $DB->delete_records('lesson_answers', array('id' => $this->answers[$i]->id));
                 unset($this->answers[$i]);
             }
         }
     }
     return true;
 }
开发者ID:nikitskynikita,项目名称:moodle,代码行数:63,代码来源:locallib.php


示例7: file_postupdate_standard_editor

    } else {
        if (is_null($assessment->grade)) {
            $workshop->log('add example assessment', $workshop->exassess_url($assessment->id), $assessment->submissionid);
        } else {
            $workshop->log('update example assessment', $workshop->exassess_url($assessment->id), $assessment->submissionid);
        }
    }

    // Let the grading strategy subplugin save its data.
    $rawgrade = $strategy->save_assessment($assessment, $data);

    // Store the data managed by the workshop core.
    $coredata = (object)array('id' => $assessment->id);
    if (isset($data->feedbackauthor_editor)) {
        $coredata->feedbackauthor_editor = $data->feedbackauthor_editor;
        $coredata = file_postupdate_standard_editor($coredata, 'feedbackauthor', $workshop->overall_feedback_content_options(),
            $workshop->context, 'mod_workshop', 'overallfeedback_content', $assessment->id);
        unset($coredata->feedbackauthor_editor);
    }
    if (isset($data->feedbackauthorattachment_filemanager)) {
        $coredata->feedbackauthorattachment_filemanager = $data->feedbackauthorattachment_filemanager;
        $coredata = file_postupdate_standard_filemanager($coredata, 'feedbackauthorattachment',
            $workshop->overall_feedback_attachment_options(), $workshop->context, 'mod_workshop', 'overallfeedback_attachment',
            $assessment->id);
        unset($coredata->feedbackauthorattachment_filemanager);
        if (empty($coredata->feedbackauthorattachment)) {
            $coredata->feedbackauthorattachment = 0;
        }
    }
    if ($canmanage) {
        // Remember the last one who edited the reference assessment.
        $coredata->reviewerid = $USER->id;
开发者ID:verbazend,项目名称:AWFA,代码行数:32,代码来源:exassessment.php


示例8: update_or_check_rubric

 /**
  * Either saves the rubric definition into the database or check if it has been changed.
  * Returns the level of changes:
  * 0 - no changes
  * 1 - only texts or criteria sortorders are changed, students probably do not require re-grading
  * 2 - added levels but maximum score on rubric is the same, students still may not require re-grading
  * 3 - removed criteria or added levels or changed number of points, students require re-grading but may be re-graded automatically
  * 4 - removed levels - students require re-grading and not all students may be re-graded automatically
  * 5 - added criteria - all students require manual re-grading
  *
  * @param stdClass $newdefinition rubric definition data as coming from gradingform_rubric_editrubric::get_data()
  * @param int|null $usermodified optional userid of the author of the definition, defaults to the current user
  * @param boolean $doupdate if true actually updates DB, otherwise performs a check
  *
  */
 public function update_or_check_rubric(stdClass $newdefinition, $usermodified = null, $doupdate = false)
 {
     global $DB;
     // firstly update the common definition data in the {grading_definition} table
     if ($this->definition === false) {
         if (!$doupdate) {
             // if we create the new definition there is no such thing as re-grading anyway
             return 5;
         }
         // if definition does not exist yet, create a blank one
         // (we need id to save files embedded in description)
         parent::update_definition(new stdClass(), $usermodified);
         parent::load_definition();
     }
     if (!isset($newdefinition->rubric['options'])) {
         $newdefinition->rubric['options'] = self::get_default_options();
     }
     $newdefinition->options = json_encode($newdefinition->rubric['options']);
     $editoroptions = self::description_form_field_options($this->get_context());
     $newdefinition = file_postupdate_standard_editor($newdefinition, 'description', $editoroptions, $this->get_context(), 'grading', 'description', $this->definition->id);
     // reload the definition from the database
     $currentdefinition = $this->get_definition(true);
     // update rubric data
     $haschanges = array();
     if (empty($newdefinition->rubric['criteria'])) {
         $newcriteria = array();
     } else {
         $newcriteria = $newdefinition->rubric['criteria'];
         // new ones to be saved
     }
     $currentcriteria = $currentdefinition->rubric_criteria;
     $criteriafields = array('sortorder', 'description', 'descriptionformat');
     $levelfields = array('score', 'definition', 'definitionformat');
     foreach ($newcriteria as $id => $criterion) {
         // get list of submitted levels
         $levelsdata = array();
         if (array_key_exists('levels', $criterion)) {
             $levelsdata = $criterion['levels'];
         }
         $criterionmaxscore = null;
         if (preg_match('/^NEWID\\d+$/', $id)) {
             // insert criterion into DB
             $data = array('definitionid' => $this->definition->id, 'descriptionformat' => FORMAT_MOODLE);
             // TODO format is not supported yet
             foreach ($criteriafields as $key) {
                 if (array_key_exists($key, $criterion)) {
                     $data[$key] = $criterion[$key];
                 }
             }
             if ($doupdate) {
                 $id = $DB->insert_record('gradingform_rubric_criteria', $data);
             }
             $haschanges[5] = true;
         } else {
             // update criterion in DB
             $data = array();
             foreach ($criteriafields as $key) {
                 if (array_key_exists($key, $criterion) && $criterion[$key] != $currentcriteria[$id][$key]) {
                     $data[$key] = $criterion[$key];
                 }
             }
             if (!empty($data)) {
                 // update only if something is changed
                 $data['id'] = $id;
                 if ($doupdate) {
                     $DB->update_record('gradingform_rubric_criteria', $data);
                 }
                 $haschanges[1] = true;
             }
             // remove deleted levels from DB and calculate the maximum score for this criteria
             foreach ($currentcriteria[$id]['levels'] as $levelid => $currentlevel) {
                 if ($criterionmaxscore === null || $criterionmaxscore < $currentlevel['score']) {
                     $criterionmaxscore = $currentlevel['score'];
                 }
                 if (!array_key_exists($levelid, $levelsdata)) {
                     if ($doupdate) {
                         $DB->delete_records('gradingform_rubric_levels', array('id' => $levelid));
                     }
                     $haschanges[4] = true;
                 }
             }
         }
         foreach ($levelsdata as $levelid => $level) {
             if (isset($level['score'])) {
                 $level['score'] = (double) $level['score'];
//.........这里部分代码省略.........
开发者ID:JP-Git,项目名称:moodle,代码行数:101,代码来源:lib.php


示例9: view

 function view()
 {
     global $OUTPUT, $CFG, $USER, $PAGE;
     $edit = optional_param('edit', 0, PARAM_BOOL);
     $saved = optional_param('saved', 0, PARAM_BOOL);
     $context = get_context_instance(CONTEXT_MODULE, $this->cm->id);
     require_capability('mod/assignment:view', $context);
     $submission = $this->get_submission($USER->id, false);
     //Guest can not submit nor edit an assignment (bug: 4604)
     if (!is_enrolled($this->context, $USER, 'mod/assignment:submit')) {
         $editable = false;
     } else {
         $editable = $this->isopen() && (!$submission || $this->assignment->resubmit || !$submission->timemarked);
     }
     $editmode = ($editable and $edit);
     if ($editmode) {
         // prepare form and process submitted data
         $editoroptions = array('noclean' => false, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $this->course->maxbytes);
         $data = new stdClass();
         $data->id = $this->cm->id;
         $data->edit = 1;
         if ($submission) {
             $data->sid = $submission->id;
             $data->text = $submission->data1;
             $data->textformat = $submission->data2;
         } else {
             $data->sid = NULL;
             $data->text = '';
             $data->textformat = NULL;
         }
         $data = file_prepare_standard_editor($data, 'text', $editoroptions, $this->context, 'mod_assignment', $this->filearea, $data->sid);
         $mform = new mod_assignment_online_edit_form(null, array($data, $editoroptions));
         if ($mform->is_cancelled()) {
             redirect($PAGE->url);
         }
         if ($data = $mform->get_data()) {
             $submission = $this->get_submission($USER->id, true);
             //create the submission if needed & its id
             $data = file_postupdate_standard_editor($data, 'text', $editoroptions, $this->context, 'mod_assignment', $this->filearea, $submission->id);
             $submission = $this->update_submission($data);
             //TODO fix log actions - needs db upgrade
             add_to_log($this->course->id, 'assignment', 'upload', 'view.php?a=' . $this->assignment->id, $this->assignment->id, $this->cm->id);
             $this->email_teachers($submission);
             //redirect to get updated submission date and word count
             redirect(new moodle_url($PAGE->url, array('saved' => 1)));
         }
     }
     add_to_log($this->course->id, "assignment", "view", "view.php?id={$this->cm->id}", $this->assignment->id, $this->cm->id);
     /// print header, etc. and display form if needed
     if ($editmode) {
         $this->view_header(get_string('editmysubmission', 'assignment'));
     } else {
         $this->view_header();
     }
     $this->view_intro();
     $this->view_dates();
     if ($saved) {
         echo $OUTPUT->notification(get_string('submissionsaved', 'assignment'), 'notifysuccess');
     }
     if (is_enrolled($this->context, $USER)) {
         if ($editmode) {
             echo $OUTPUT->box_start('generalbox', 'onlineenter');
             $mform->display();
         } else {
             echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter', 'online');
             if ($submission && has_capability('mod/assignment:exportownsubmission', $this->context)) {
                 $text = file_rewrite_pluginfile_urls($submission->data1, 'pluginfile.php', $this->context->id, 'mod_assignment', $this->filearea, $submission->id);
                 echo format_text($text, $submission->data2, array('overflowdiv' => true));
                 if ($CFG->enableportfolios) {
                     require_once $CFG->libdir . '/portfoliolib.php';
                     $button = new portfolio_add_button();
                     $button->set_callback_options('assignment_portfolio_caller', array('id' => $this->cm->id), '/mod/assignment/locallib.php');
                     $fs = get_file_storage();
                     if ($files = $fs->get_area_files($this->context->id, 'mod_assignment', $this->filearea, $submission->id, "timemodified", false)) {
                         $button->set_formats(PORTFOLIO_FORMAT_RICHHTML);
                     } else {
                         $button->set_formats(PORTFOLIO_FORMAT_PLAINHTML);
                     }
                     $button->render();
                 }
             } else {
                 if ($this->isopen()) {
                     //fix for #4206
                     echo '<div style="text-align:center">' . get_string('emptysubmission', 'assignment') . '</div>';
                 }
             }
         }
         echo $OUTPUT->box_end();
         if (!$editmode && $editable) {
             if (!empty($submission)) {
                 $submitbutton = "editmysubmission";
             } else {
                 $submitbutton = "addsubmission";
             }
             echo "<div style='text-align:center'>";
             echo $OUTPUT->single_button(new moodle_url('view.php', array('id' => $this->cm->id, 'edit' => '1')), get_string($submitbutton, 'assignment'));
             echo "</div>";
         }
     }
     $this->view_feedback();
//.........这里部分代码省略.........
开发者ID:vuchannguyen,项目名称:web,代码行数:101,代码来源:assignment.class.php


示例10: update_or_check_guide

 /**
  * Either saves the guide definition into the database or check if it has been changed.
  *
  * Returns the level of changes:
  * 0 - no changes
  * 1 - only texts or criteria sortorders are changed, students probably do not require re-grading
  * 2 - added levels but maximum score on guide is the same, students still may not require re-grading
  * 3 - removed criteria or changed number of points, students require re-grading but may be re-graded automatically
  * 4 - removed levels - students require re-grading and not all students may be re-graded automatically
  * 5 - added criteria - all students require manual re-grading
  *
  * @param stdClass $newdefinition guide definition data as coming from gradingform_guide_editguide::get_data()
  * @param int|null $usermodified optional userid of the author of the definition, defaults to the current user
  * @param bool $doupdate if true actually updates DB, otherwise performs a check
  * @return int
  */
 public function update_or_check_guide(stdClass $newdefinition, $usermodified = null, $doupdate = false)
 {
     global $DB;
     // Firstly update the common definition data in the {grading_definition} table.
     if ($this->definition === false) {
         if (!$doupdate) {
             // If we create the new definition there is no such thing as re-grading anyway.
             return 5;
         }
         // If definition does not exist yet, create a blank one
         // (we need id to save files embedded in description).
         parent::update_definition(new stdClass(), $usermodified);
         parent::load_definition();
     }
     if (!isset($newdefinition->guide['options'])) {
         $newdefinition->guide['options'] = self::get_default_options();
     }
     $newdefinition->options = json_encode($newdefinition->guide['options']);
     $editoroptions = self::description_form_field_options($this->get_context());
     $newdefinition = file_postupdate_standard_editor($newdefinition, 'description', $editoroptions, $this->get_context(), 'grading', 'description', $this->definition->id);
     // Reload the definition from the database.
     $currentdefinition = $this->get_definition(true);
     // Update guide data.
     $haschanges = array();
     if (empty($newdefinition->guide['criteria'])) {
         $newcriteria = array();
     } else {
         $newcriteria = $newdefinition->guide['criteria'];
         // New ones to be saved.
     }
     $currentcriteria = $currentdefinition->guide_criteria;
     $criteriafields = array('sortorder', 'description', 'descriptionformat', 'descriptionmarkers', 'descriptionmarkersformat', 'shortname', 'maxscore');
     foreach ($newcriteria as $id => $criterion) {
         if (preg_match('/^NEWID\\d+$/', $id)) {
             // Insert criterion into DB.
             $data = array('definitionid' => $this->definition->id, 'descriptionformat' => FORMAT_MOODLE, 'descriptionmarkersformat' => FORMAT_MOODLE);
             // TODO format is not supported yet.
             foreach ($criteriafields as $key) {
                 if (array_key_exists($key, $criterion)) {
                     $data[$key] = $criterion[$key];
                 }
             }
             if ($doupdate) {
                 $id = $DB->insert_record('gradingform_guide_criteria', $data);
             }
             $haschanges[5] = true;
         } else {
             // Update criterion in DB.
             $data = array();
             foreach ($criteriafields as $key) {
                 if (array_key_exists($key, $criterion) && $criterion[$key] != $currentcriteria[$id][$key]) {
                     $data[$key] = $criterion[$key];
                 }
             }
             if (!empty($data)) {
                 // Update only if something is changed.
                 $data['id'] = $id;
                 if ($doupdate) {
                     $DB->update_record('gradingform_guide_criteria', $data);
                 }
                 $haschanges[1] = true;
             }
         }
     }
     // Remove deleted criteria from DB.
     foreach (array_keys($currentcriteria) as $id) {
         if (!array_key_exists($id, $newcriteria)) {
             if ($doupdate) {
                 $DB->delete_records('gradingform_guide_criteria', array('id' => $id));
             }
             $haschanges[3] = true;
         }
     }
     // Now handle comments.
     if (empty($newdefinition->guide['comments'])) {
         $newcomment = array();
     } else {
         $newcomment = $newdefinition->guide['comments'];
         // New ones to be saved.
     }
     $currentcomments = $currentdefinition->guide_comment;
     $commentfields = array('sortorder', 'description');
     foreach ($newcomment as $id => $comment) {
         if (preg_match('/^NEWID\\d+$/', $id)) {
//.........这里部分代码省略.........
开发者ID:nicusX,项目名称:moodle,代码行数:101,代码来源:lib.php


示例11: postupdate

 function postupdate($item)
 {
     global $DB;
     $context = get_context_instance(CONTEXT_MODULE, $item->cmid);
     $item = file_postupdate_standard_editor($item, 'presentation', $this->presentationoptions, $context, 'mod_feedback', 'item', $item->id);
     // $item = new stdClass();
     // $item->id = $data->id
     $DB->update_record('feedback_item', $item);
     return $item->id;
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:10,代码来源:lib.php


示例12: file_prepare_standard_editor

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);
        }
        // use new context id, it could have been changed
        redirect(new moodle_url('/cohort/index.php', array('contextid' => $data->contextid)));
    }
}
echo $OUTPUT->header();
echo $OUTPUT->heading($strheading);
echo $editform->display();
echo $OUTPUT->footer();
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:31,代码来源:edit.php


示例13: get_data

 /**
  * Return submitted data if properly submitted or returns NULL if validation fails or
  * if there is no submitted data.
  *
  * @return object submitted data; NULL if not valid or not submitted or cancelled
  */
 function get_data()
 {
     $data = parent::get_data();
     if ($data !== null) {
         $editoroptions = $this->_customdata['editoroptions'];
         if (!empty($data->usedefaultname)) {
             $data->name = null;
         }
         $data = file_postupdate_standard_editor($data, 'summary', $editoroptions, $editoroptions['context'], 'course', 'section', $data->id);
         $course = $this->_customdata['course'];
         foreach (course_get_format($course)->section_format_options() as $option => $unused) {
             // fix issue with unset checkboxes not being returned at all
             if (!isset($data->{$option})) {
                 $data->{$option} = null;
             }
         }
     }
     return $data;
 }
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:25,代码来源:editsection_form.php


示例14: grade_scale

    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;
            }
            $scale->courseid = !empty($data->standard) ? 0 : $courseid;
            $scale->insert();
            $data = file_postupdate_standard_editor($data, 'description', $editoroptions, $systemcontext, 'grade', 'scale', $scale->id);
            $DB->set_field($scale->table, 'description', $data->description, array('id' => $scale->id));
        } else {
            $data = file_postupdate_standard_editor($data, 'description', $editoroptions, $systemcontext, 'grade', 'scale', $id);
            grade_scale::set_properties($scale, $data);
            if (isset($data->standard)) {
                $scale->courseid = !empty($data->standard) ? 0 : $courseid;
            } else {
                unset($scale->courseid);
                // keep previous
            }
            $scale->update();
        }
        redirect($returnurl);
    }
}
print_grade_page_head($COURSE->id, 'scale', null, $heading, false, false, false);
$mform->display();
echo $OUTPUT->footer();
开发者ID:pzhu2004,项目名称:moodle,代码行数:31,代码来源:edit.php


示例15: postupdate

    public function postupdate($item) {
        global $DB;

        $context = context_localule::instance($item->cmid);
        $item = file_postupdate_standard_editor($item,
                                                'presentation',
                                                $this->presentationoptions,
                                                $context,
                                                'local_evaluations',
                                                'item',
                                                $item->id);

        $DB->update_record('evaluation_item', $item);
        return $item->id;
    }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:15,代码来源:lib.php


示例16: save_edit_strategy_form

 /**
  * Save the assessment dimensions into database
  *
  * Saves data into the main strategy form table. If the record->id is null or zero,
  * new record is created. If the record->id is not empty, the existing record is updated. Records with
  * empty 'description' field are removed from database.
  * The passed data object are the raw data returned by the get_data().
  *
  * @uses $DB
  * @param stdClass $data Raw data returned by the dimension editor form
  * @return void
  */
 public function save_edit_strategy_form(stdclass $data)
 {
     global $DB;
     $norepeats = $data->norepeats;
     $layout = $data->config_layout;
     $data = $this->prepare_database_fields($data);
     $deletedims = array();
     // dimension ids to be deleted
     $deletelevs = array();
     // level ids to be deleted
     if ($DB->record_exists('workshopform_rubric_config', array('workshopid' => $this->workshop->id))) {
         $DB->set_field('workshopform_rubric_config', 'layout', $layout, array('workshopid' => $this->workshop->id));
     } else {
         $record = new stdclass();
         $record->workshopid = $this->workshop->id;
         $record->layout = $layout;
         $DB->insert_record('workshopform_rubric_config', $record, false);
     }
     foreach ($data as $record) {
         if (0 == strlen(trim($record->description_editor['text']))) {
             if (!empty($record->id)) {
                 // existing record with empty description - to be deleted
                 $deletedims[] = $record->id;
                 foreach ($record->levels as $level) {
                     if (!empty($level->id)) {
                         $deletelevs[] = $level->id;
                     }
                 }
             }
             continue;
         }
         if (empty($record->id)) {
             // new field
             $record->id = $DB->insert_record('workshopform_rubric', $record);
         } else {
             // exiting field
             $DB->update_record('workshopform_rubric', $record);
         }
         // re-save with correct path to embeded media files
         $record = file_postupdate_standard_editor($record, 'description', $this->descriptionopts, $this->workshop->context, 'workshopform_rubric', 'description', $record->id);
         $DB->update_record('workshopform_rubric', $record);
         // create/update the criterion levels
         foreach ($record->levels as $level) {
             $level->dimensionid = $record->id;
             if (0 == strlen(trim($level->definition))) {
                 if (!empty($level->id)) {
                     $deletelevs[] = $level->id;
                 }
                 continue;
             }
             if (empty($level->id)) {
                 // new field
                 $level->id = $DB->insert_record('workshopform_rubric_levels', $level);
             } else {
                 // exiting field
                 $DB->update_record('workshopform_rubric_levels', $level);
             }
         }
     }
     $DB->delete_records_list('workshopform_rubric_levels', 'id', $deletelevs);
     $this->delete_dimensions($deletedims);
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:74,代码来源:lib.php


示例17: unset

     unset($tagnew->rawname);
 } else {
     // They might be trying to change the rawname, make sure it's a change that doesn't affect name
     $norm = tag_normalize($tagnew->rawname, TAG_CASE_LOWER);
     $tagnew->name = array_shift($norm);
     if ($tag->name != $tagnew->name) {
         // The name has changed, let's make sure it's not another existing tag
         if (tag_get_id($tagnew->name)) {
             // Something exists already, so flag an error
             $errorstring = s($tagnew->rawname) . ': ' . get_string('namesalreadybeeingused', 'tag');
         }
     }
 }
 if (empty($errorstring)) {
     // All is OK, let's save it
     $tagnew = file_postupdate_standard_editor($tagnew, 'description', $editoroptions, $systemcontext, 'tag', 'description', $tag->id);
     tag_description_set($tag_id, $tagnew->description, $tagnew->descriptionformat);
     $tagnew->timemodified = time();
     if (has_capability('moodle/tag:manage', $systemcontext)) {
         // rename tag
         if (!tag_rename($tag->id, $tagnew->rawname)) {
             print_error('errorupdatingrecord', 'tag');
         }
     }
     //log tag changes activity
     //if tag name exist from form, renaming is allow.  record log action as rename
     //otherwise, record log action as update
     if (isset($tagnew->name) && $tag->name != $tagnew->name) {
         add_to_log($COURSE->id, 'tag', 'update', 'index.php?id=' . $tag->id, $tag->name . '->' . $tagnew->name);
     } elseif ($tag->description != $tagnew->description) {
         add_to_log($COURSE->id, 'tag', 'update', 'index.php?id=' . $tag->id, $tag->name);
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:edit.php


示例18: update

    /**
     * Updates the page and its answers
     *
     * @global moodle_database $DB
     * @global moodle_page $PAGE
     * @param stdClass $properties
     * @return bool
     */
    public function update($properties) {
        global $DB, $PAGE;
        $answers  = $this->get_answers();
        $properties->id = $this->properties->id;
        $properties->lessonid = $this->lesson->id;
        $properties = file_postupdate_standard_editor($properties, 'contents', array('noclean'=>true, 'maxfiles'=>EDITOR_UNLIMITED_FILES, 'maxbytes'=>$PAGE->course->maxbytes), get_context_instance(CONTEXT_MODULE, $PAGE->cm->id), 'mod_lesson', 'page_contents', $properties->id);
        $DB->update_record("lesson_pages", $properties);

        // need to reset offset for correct and wrong responses
        $this->lesson->maxanswers = 2;
        for ($i = 0; $i < $this->lesson->maxanswers; $i++) {
            if (!array_key_exists($i, $this->answers)) {
                $this->answers[$i] = new stdClass;
                $this->answers[$i]->lessonid = $this->lesson->id;
                $this->answers[$i]->pageid = $this->id;
                $this->answers[$i]->timecreated = $this->timecreated;
            }

            if (!empty($properties->answer_editor[$i]) && is_array($properties->answer_editor[$i])) {
                $this->answers[$i]->answer = $properties->answer_editor[$i]['text'];
                $this->answers[$i]->answerformat = $properties->answer_editor[$i]['format'];
            }

            if (!empty($properties->response_editor[$i]) && is_array($properties->response_editor[$i])) {
                $this->answers[$i]->response = $properties->response_editor[$i]['text'];
                $this->answers[$i]->responseformat = $properties->response_editor[$i]['format'];
            }

            // we don't need to check for isset 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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