MDL-32768: mod_assign - Change plugin constants to use correct prefix for component
authorDamyon Wiese <damyon.wiese@netspot.com.au>
Fri, 4 May 2012 04:56:54 +0000 (12:56 +0800)
committerDamyon Wiese <damyon.wiese@netspot.com.au>
Mon, 7 May 2012 02:59:07 +0000 (10:59 +0800)
mod/assign/feedback/file/locallib.php
mod/assign/submission/file/locallib.php
mod/assign/submission/onlinetext/locallib.php

index fb1596b..20c4be7 100644 (file)
@@ -27,9 +27,8 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * File areas for file feedback assignment
  */
-define('ASSIGN_MAX_FEEDBACK_FILES', 20);
-define('ASSIGN_FILEAREA_FEEDBACK_FILES', 'feedback_files');
-define('ASSIGN_FEEDBACK_FILE_MAX_SUMMARY_FILES', 5);
+define('ASSIGNFEEDBACK_FILE_FILEAREA', 'feedback_files');
+define('ASSIGNFEEDBACK_FILE_MAXSUMMARYFILES', 5);
 
 /**
  * library class for file feedback plugin extending feedback plugin base class
@@ -87,7 +86,7 @@ class assign_feedback_file extends assign_feedback_plugin {
         $gradeid = $grade ? $grade->id : 0;
 
 
-        $data = file_prepare_standard_filemanager($data, 'files', $fileoptions, $this->assignment->get_context(), 'assignfeedback_file', ASSIGN_FILEAREA_FEEDBACK_FILES, $gradeid);
+        $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);
 
@@ -124,16 +123,16 @@ class assign_feedback_file extends assign_feedback_plugin {
         $fileoptions = $this->get_file_options();
 
 
-        $data = file_postupdate_standard_filemanager($data, 'files', $fileoptions, $this->assignment->get_context(), 'assignfeedback_file', ASSIGN_FILEAREA_FEEDBACK_FILES, $grade->id);
+        $data = file_postupdate_standard_filemanager($data, 'files', $fileoptions, $this->assignment->get_context(), 'assignfeedback_file', ASSIGNFEEDBACK_FILE_FILEAREA, $grade->id);
 
 
         $filefeedback = $this->get_file_feedback($grade->id);
         if ($filefeedback) {
-            $filefeedback->numfiles = $this->count_files($grade->id, ASSIGN_FILEAREA_FEEDBACK_FILES);
+            $filefeedback->numfiles = $this->count_files($grade->id, ASSIGNFEEDBACK_FILE_FILEAREA);
             return $DB->update_record('assignfeedback_file', $filefeedback);
         } else {
             $filefeedback = new stdClass();
-            $filefeedback->numfiles = $this->count_files($grade->id, ASSIGN_FILEAREA_FEEDBACK_FILES);
+            $filefeedback->numfiles = $this->count_files($grade->id, ASSIGNFEEDBACK_FILE_FILEAREA);
             $filefeedback->grade = $grade->id;
             $filefeedback->assignment = $this->assignment->get_instance()->id;
             return $DB->insert_record('assignfeedback_file', $filefeedback) > 0;
@@ -148,12 +147,12 @@ class assign_feedback_file extends assign_feedback_plugin {
      * @return string
      */
     public function view_summary(stdClass $grade, $showviewlink) {
-        $count = $this->count_files($grade->id, ASSIGN_FILEAREA_FEEDBACK_FILES);
+        $count = $this->count_files($grade->id, ASSIGNFEEDBACK_FILE_FILEAREA);
         // show a view all link if the number of files is over this limit
-        $showviewlink = $count > ASSIGN_FEEDBACK_FILE_MAX_SUMMARY_FILES;
+        $showviewlink = $count > ASSIGNFEEDBACK_FILE_MAXSUMMARYFILES;
 
-        if ($count <= ASSIGN_FEEDBACK_FILE_MAX_SUMMARY_FILES) {
-            return $this->assignment->render_area_files('assignfeedback_file', ASSIGN_FILEAREA_FEEDBACK_FILES, $grade->id);
+        if ($count <= ASSIGNFEEDBACK_FILE_MAXSUMMARYFILES) {
+            return $this->assignment->render_area_files('assignfeedback_file', ASSIGNFEEDBACK_FILE_FILEAREA, $grade->id);
         } else {
             return get_string('countfiles', 'assignfeedback_file', $count);
         }
@@ -165,7 +164,7 @@ class assign_feedback_file extends assign_feedback_plugin {
      * @return string
      */
     public function view(stdClass $grade) {
-        return $this->assignment->render_area_files('assignfeedback_file', ASSIGN_FILEAREA_FEEDBACK_FILES, $grade->id);
+        return $this->assignment->render_area_files('assignfeedback_file', ASSIGNFEEDBACK_FILE_FILEAREA, $grade->id);
     }
 
     /**
@@ -186,7 +185,7 @@ class assign_feedback_file extends assign_feedback_plugin {
      * @param stdClass $grade
      */
     public function is_empty(stdClass $grade) {
-        return $this->count_files($grade->id, ASSIGN_FILEAREA_FEEDBACK_FILES) == 0;
+        return $this->count_files($grade->id, ASSIGNFEEDBACK_FILE_FILEAREA) == 0;
     }
 
     /**
@@ -194,7 +193,7 @@ class assign_feedback_file extends assign_feedback_plugin {
      * @return array - An array of fileareas (keys) and descriptions (values)
      */
     public function get_file_areas() {
-        return array(ASSIGN_FILEAREA_FEEDBACK_FILES=>$this->get_name());
+        return array(ASSIGNFEEDBACK_FILE_FILEAREA=>$this->get_name());
     }
 
     /**
@@ -247,12 +246,12 @@ class assign_feedback_file extends assign_feedback_plugin {
                                                         // New file area
                                                         $this->assignment->get_context()->id,
                                                         'assignfeedback_file',
-                                                        ASSIGN_FILEAREA_FEEDBACK_FILES,
+                                                        ASSIGNFEEDBACK_FILE_FILEAREA,
                                                         $grade->id);
 
         // now count them!
         $filefeedback = new stdClass();
-        $filefeedback->numfiles = $this->count_files($grade->id, ASSIGN_FILEAREA_FEEDBACK_FILES);
+        $filefeedback->numfiles = $this->count_files($grade->id, ASSIGNFEEDBACK_FILE_FILEAREA);
         $filefeedback->grade = $grade->id;
         $filefeedback->assignment = $this->assignment->get_instance()->id;
         if (!$DB->insert_record('assignfeedback_file', $filefeedback) > 0) {
index 46e661f..450127d 100644 (file)
@@ -31,9 +31,9 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * File areas for file submission assignment
  */
-define('ASSIGN_MAX_SUBMISSION_FILES', 20);
-define('ASSIGN_SUBMISSION_FILE_MAX_SUMMARY_FILES', 5);
-define('ASSIGN_FILEAREA_SUBMISSION_FILES', 'submission_files');
+define('ASSIGNSUBMISSION_FILE_MAXFILES', 20);
+define('ASSIGNSUBMISSION_FILE_MAXSUMMARYFILES', 5);
+define('ASSIGNSUBMISSION_FILE_FILEAREA', 'submission_files');
 
 /**
  * library class for file submission plugin extending submission plugin base class
@@ -77,7 +77,7 @@ class assign_submission_file extends assign_submission_plugin {
 
         $settings = array();
         $options = array();
-        for($i = 1; $i <= ASSIGN_MAX_SUBMISSION_FILES; $i++) {
+        for($i = 1; $i <= ASSIGNSUBMISSION_FILE_MAXFILES; $i++) {
             $options[$i] = $i;
         }
 
@@ -148,7 +148,7 @@ class assign_submission_file extends assign_submission_plugin {
         $submissionid = $submission ? $submission->id : 0;
 
 
-        $data = file_prepare_standard_filemanager($data, 'files', $fileoptions, $this->assignment->get_context(), 'assignsubmission_file', ASSIGN_FILEAREA_SUBMISSION_FILES, $submissionid);
+        $data = file_prepare_standard_filemanager($data, 'files', $fileoptions, $this->assignment->get_context(), 'assignsubmission_file', ASSIGNSUBMISSION_FILE_FILEAREA, $submissionid);
         $mform->addElement('filemanager', 'files_filemanager', '', null, $fileoptions);
         return true;
     }
@@ -181,7 +181,7 @@ class assign_submission_file extends assign_submission_plugin {
         $fileoptions = $this->get_file_options();
 
 
-        $data = file_postupdate_standard_filemanager($data, 'files', $fileoptions, $this->assignment->get_context(), 'assignsubmission_file', ASSIGN_FILEAREA_SUBMISSION_FILES, $submission->id);
+        $data = file_postupdate_standard_filemanager($data, 'files', $fileoptions, $this->assignment->get_context(), 'assignsubmission_file', ASSIGNSUBMISSION_FILE_FILEAREA, $submission->id);
 
 
         $filesubmission = $this->get_file_submission($submission->id);
@@ -189,8 +189,8 @@ class assign_submission_file extends assign_submission_plugin {
         //plagiarism code event trigger when files are uploaded
 
         $fs = get_file_storage();
-        $files = $fs->get_area_files($this->assignment->get_context()->id, 'assignsubmission_file', ASSIGN_FILEAREA_SUBMISSION_FILES, $submission->id, "id", false);
-        $count = $this->count_files($submission->id, ASSIGN_FILEAREA_SUBMISSION_FILES);
+        $files = $fs->get_area_files($this->assignment->get_context()->id, 'assignsubmission_file', ASSIGNSUBMISSION_FILE_FILEAREA, $submission->id, "id", false);
+        $count = $this->count_files($submission->id, ASSIGNSUBMISSION_FILE_FILEAREA);
         // send files to event system
         // Let Moodle know that an assessable file was uploaded (eg for plagiarism detection)
         $eventdata = new stdClass();
@@ -207,11 +207,11 @@ class assign_submission_file extends assign_submission_plugin {
 
 
         if ($filesubmission) {
-            $filesubmission->numfiles = $this->count_files($submission->id, ASSIGN_FILEAREA_SUBMISSION_FILES);
+            $filesubmission->numfiles = $this->count_files($submission->id, ASSIGNSUBMISSION_FILE_FILEAREA);
             return $DB->update_record('assignsubmission_file', $filesubmission);
         } else {
             $filesubmission = new stdClass();
-            $filesubmission->numfiles = $this->count_files($submission->id, ASSIGN_FILEAREA_SUBMISSION_FILES);
+            $filesubmission->numfiles = $this->count_files($submission->id, ASSIGNSUBMISSION_FILE_FILEAREA);
             $filesubmission->submission = $submission->id;
             $filesubmission->assignment = $this->assignment->get_instance()->id;
             return $DB->insert_record('assignsubmission_file', $filesubmission) > 0;
@@ -228,7 +228,7 @@ class assign_submission_file extends assign_submission_plugin {
         $result = array();
         $fs = get_file_storage();
 
-        $files = $fs->get_area_files($this->assignment->get_context()->id, 'assignsubmission_file', ASSIGN_FILEAREA_SUBMISSION_FILES, $submission->id, "timemodified", false);
+        $files = $fs->get_area_files($this->assignment->get_context()->id, 'assignsubmission_file', ASSIGNSUBMISSION_FILE_FILEAREA, $submission->id, "timemodified", false);
 
         foreach ($files as $file) {
             $result[$file->get_filename()] = $file;
@@ -244,12 +244,12 @@ class assign_submission_file extends assign_submission_plugin {
      * @return string
      */
     public function view_summary(stdClass $submission, $showviewlink) {
-        $count = $this->count_files($submission->id, ASSIGN_FILEAREA_SUBMISSION_FILES);
+        $count = $this->count_files($submission->id, ASSIGNSUBMISSION_FILE_FILEAREA);
 
         // show we show a link to view all files for this plugin?
-        $showviewlink = $count > ASSIGN_SUBMISSION_FILE_MAX_SUMMARY_FILES;
-        if ($count <= ASSIGN_SUBMISSION_FILE_MAX_SUMMARY_FILES) {
-            return $this->assignment->render_area_files('assignsubmission_file', ASSIGN_FILEAREA_SUBMISSION_FILES, $submission->id);
+        $showviewlink = $count > ASSIGNSUBMISSION_FILE_MAXSUMMARYFILES;
+        if ($count <= ASSIGNSUBMISSION_FILE_MAXSUMMARYFILES) {
+            return $this->assignment->render_area_files('assignsubmission_file', ASSIGNSUBMISSION_FILE_FILEAREA, $submission->id);
         } else {
             return get_string('countfiles', 'assignsubmission_file', $count);
         }
@@ -262,7 +262,7 @@ class assign_submission_file extends assign_submission_plugin {
      * @return string
      */
     public function view(stdClass $submission) {
-        return $this->assignment->render_area_files('assignsubmission_file', ASSIGN_FILEAREA_SUBMISSION_FILES, $submission->id);
+        return $this->assignment->render_area_files('assignsubmission_file', ASSIGNSUBMISSION_FILE_FILEAREA, $submission->id);
     }
 
 
@@ -347,7 +347,7 @@ class assign_submission_file extends assign_submission_plugin {
                                                         // New file area
                                                         $this->assignment->get_context()->id,
                                                         'assignsubmission_file',
-                                                        ASSIGN_FILEAREA_SUBMISSION_FILES,
+                                                        ASSIGNSUBMISSION_FILE_FILEAREA,
                                                         $submission->id);
 
 
@@ -379,7 +379,7 @@ class assign_submission_file extends assign_submission_plugin {
      */
     public function format_for_log(stdClass $submission) {
         // format the info for each submission plugin add_to_log
-        $filecount = $this->count_files($submission->id, ASSIGN_FILEAREA_SUBMISSION_FILES);
+        $filecount = $this->count_files($submission->id, ASSIGNSUBMISSION_FILE_FILEAREA);
         $fileloginfo = '';
         $fileloginfo .= ' the number of file(s) : ' . $filecount . " file(s).<br>";
 
@@ -391,7 +391,7 @@ class assign_submission_file extends assign_submission_plugin {
      * @param stdClass $submission
      */
     public function is_empty(stdClass $submission) {
-        return $this->count_files($submission->id, ASSIGN_FILEAREA_SUBMISSION_FILES) == 0;
+        return $this->count_files($submission->id, ASSIGNSUBMISSION_FILE_FILEAREA) == 0;
     }
 
     /**
@@ -399,7 +399,7 @@ class assign_submission_file extends assign_submission_plugin {
      * @return array - An array of fileareas (keys) and descriptions (values)
      */
     public function get_file_areas() {
-        return array(ASSIGN_FILEAREA_SUBMISSION_FILES=>$this->get_name());
+        return array(ASSIGNSUBMISSION_FILE_FILEAREA=>$this->get_name());
     }
 
 }
index 73a9c01..23ca0c7 100644 (file)
@@ -28,7 +28,7 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * File area for online text submission assignment
  */
-define('ASSIGN_FILEAREA_SUBMISSION_ONLINETEXT', 'submissions_onlinetext');
+define('ASSIGNSUBMISSION_ONLINETEXT_FILEAREA', 'submissions_onlinetext');
 
 /**
  * library class for onlinetext submission plugin extending submission plugin base class
@@ -91,7 +91,7 @@ class assign_submission_onlinetext extends assign_submission_plugin {
         }
 
 
-        $data = file_prepare_standard_editor($data, 'onlinetext', $editoroptions, $this->assignment->get_context(), 'assignsubmission_onlinetext', ASSIGN_FILEAREA_SUBMISSION_ONLINETEXT, $submissionid);
+        $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;
     }
@@ -123,7 +123,7 @@ class assign_submission_onlinetext extends assign_submission_plugin {
 
         $editoroptions = $this->get_edit_options();
 
-        $data = file_postupdate_standard_editor($data, 'onlinetext', $editoroptions, $this->assignment->get_context(), 'assignsubmission_onlinetext', ASSIGN_FILEAREA_SUBMISSION_ONLINETEXT, $submission->id);
+        $data = file_postupdate_standard_editor($data, 'onlinetext', $editoroptions, $this->assignment->get_context(), 'assignsubmission_onlinetext', ASSIGNSUBMISSION_ONLINETEXT_FILEAREA, $submission->id);
 
         $onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
         if ($onlinetextsubmission) {
@@ -231,7 +231,7 @@ class assign_submission_onlinetext extends assign_submission_plugin {
 
             $fs = get_file_storage();
 
-            $fsfiles = $fs->get_area_files($this->assignment->get_context()->id, 'assignsubmission_onlinetext', ASSIGN_FILEAREA_SUBMISSION_ONLINETEXT, $submission->id, "timemodified", false);
+            $fsfiles = $fs->get_area_files($this->assignment->get_context()->id, 'assignsubmission_onlinetext', ASSIGNSUBMISSION_ONLINETEXT_FILEAREA, $submission->id, "timemodified", false);
 
             foreach ($fsfiles as $file) {
                 $files[$file->get_filename()] = $file;
@@ -256,7 +256,7 @@ class assign_submission_onlinetext extends assign_submission_plugin {
         if ($onlinetextsubmission) {
 
             // render for portfolio API
-            $result .= $this->assignment->render_editor_content(ASSIGN_FILEAREA_SUBMISSION_ONLINETEXT, $onlinetextsubmission->submission, $this->get_type(), 'onlinetext', 'assignsubmission_onlinetext');
+            $result .= $this->assignment->render_editor_content(ASSIGNSUBMISSION_ONLINETEXT_FILEAREA, $onlinetextsubmission->submission, $this->get_type(), 'onlinetext', 'assignsubmission_onlinetext');
 
         }
 
@@ -323,7 +323,7 @@ class assign_submission_onlinetext extends assign_submission_plugin {
                                                         // New file area
                                                         $this->assignment->get_context()->id,
                                                         'assignsubmission_onlinetext',
-                                                        ASSIGN_FILEAREA_SUBMISSION_ONLINETEXT,
+                                                        ASSIGNSUBMISSION_ONLINETEXT_FILEAREA,
                                                         $submission->id);
         return true;
     }
@@ -374,7 +374,7 @@ class assign_submission_onlinetext extends assign_submission_plugin {
      * @return array - An array of fileareas (keys) and descriptions (values)
      */
     public function get_file_areas() {
-        return array(ASSIGN_FILEAREA_SUBMISSION_ONLINETEXT=>$this->get_name());
+        return array(ASSIGNSUBMISSION_ONLINETEXT_FILEAREA=>$this->get_name());
     }
 
 }