MDL-53626 tool_lp: Change mentions of 'context' to 'category'
authorFrederic Massart <fred@moodle.com>
Wed, 30 Mar 2016 08:33:51 +0000 (16:33 +0800)
committerFrederic Massart <fred@moodle.com>
Mon, 18 Apr 2016 02:59:00 +0000 (10:59 +0800)
admin/tool/lp/classes/external/competency_framework_exporter.php
admin/tool/lp/classes/external/template_exporter.php
admin/tool/lp/classes/form/competency_framework.php
admin/tool/lp/classes/form/template.php
admin/tool/lp/lang/en/tool_lp.php
admin/tool/lp/templates/manage_competency_frameworks_page.mustache
admin/tool/lp/templates/manage_templates_page.mustache

index 2b602e3..4d53ede 100644 (file)
@@ -52,10 +52,12 @@ class competency_framework_exporter extends persistent_exporter {
      */
     protected function get_other_values(renderer_base $output) {
         $filters = array('competencyframeworkid' => $this->persistent->get_id());
+        $context = $this->persistent->get_context();
         return array(
-            'canmanage' => has_capability('tool/lp:competencymanage', $this->persistent->get_context()),
+            'canmanage' => has_capability('tool/lp:competencymanage', $context),
             'competenciescount' => api::count_competencies($filters),
-            'contextname' => $this->persistent->get_context()->get_context_name()
+            'contextname' => $context->get_context_name(),
+            'contextnamenoprefix' => $context->get_context_name(false)
         );
     }
 
@@ -74,6 +76,9 @@ class competency_framework_exporter extends persistent_exporter {
             ),
             'contextname' => array(
                 'type' => PARAM_TEXT
+            ),
+            'contextnamenoprefix' => array(
+                'type' => PARAM_TEXT
             )
         );
     }
index 9c491d1..2a7a394 100644 (file)
@@ -42,13 +42,15 @@ class template_exporter extends persistent_exporter {
     }
 
     protected function get_other_values(renderer_base $output) {
+        $context = $this->persistent->get_context();
         return array(
             'duedateformatted' => userdate($this->persistent->get_duedate()),
             'cohortscount' => template_cohort::count_records(array('templateid' => $this->persistent->get_id())),
             'planscount' => plan::count_records(array('templateid' => $this->persistent->get_id())),
             'canmanage' => $this->persistent->can_manage(),
             'canread' => $this->persistent->can_read(),
-            'contextname' => $this->persistent->get_context()->get_context_name()
+            'contextname' => $context->get_context_name(),
+            'contextnamenoprefix' => $context->get_context_name(false)
         );
     }
 
@@ -71,6 +73,9 @@ class template_exporter extends persistent_exporter {
             ),
             'contextname' => array(
                 'type' => PARAM_TEXT,
+            ),
+            'contextnamenoprefix' => array(
+                'type' => PARAM_TEXT,
             )
         );
     }
index 21b0d9f..84e2c96 100644 (file)
@@ -91,8 +91,8 @@ class competency_framework extends persistent {
         $mform->setDefault('visible', true);
         $mform->addHelpButton('visible', 'visible', 'tool_lp');
 
-        $mform->addElement('static', 'context', get_string('context', 'core_role'));
-        $mform->setDefault('context', $context->get_context_name());
+        $mform->addElement('static', 'context', get_string('category', 'tool_lp'));
+        $mform->setDefault('context', $context->get_context_name(false));
 
         $mform->addElement('header', 'taxonomyhdr', get_string('taxonomies', 'tool_lp'));
         $taxonomies = \tool_lp\competency_framework::get_taxonomies_list();
index 97c22d0..a593907 100644 (file)
@@ -68,8 +68,8 @@ class template extends persistent {
         $mform->setDefault('visible', true);
         $mform->addHelpButton('visible', 'visible', 'tool_lp');
 
-        $mform->addElement('static', 'context', get_string('context', 'core_role'));
-        $mform->setDefault('context', $context->get_context_name());
+        $mform->addElement('static', 'context', get_string('category', 'tool_lp'));
+        $mform->setDefault('context', $context->get_context_name(false));
         // Disable short forms.
         $mform->setDisableShortforms();
 
index 70d77ac..5419115 100644 (file)
@@ -45,6 +45,7 @@ $string['cancelreviewrequest'] = 'Cancel review request';
 $string['cannotaddrules'] = 'This competency cannot be configured.';
 $string['cannotcreateuserplanswhentemplateduedateispassed'] = 'New user plans can not be created: this template\'s due date has, or is about to, expire.';
 $string['cannotcreateuserplanswhentemplatehidden'] = 'New user plans can not be created while this template is hidden.';
+$string['category'] = 'Category';
 $string['chooserating'] = 'Choose a rating...';
 $string['cohortssyncedtotemplate'] = 'Cohorts synced to this template';
 $string['competencies'] = 'Competencies';
index cdc64d9..c22cda0 100644 (file)
@@ -44,7 +44,7 @@
         <tr>
             <th scope="col">{{#str}}competencyframeworkname, tool_lp{{/str}}</th>
             <th scope="col">{{#str}}competencies, tool_lp{{/str}}</th>
-            <th scope="col">{{#str}}context, core_role{{/str}}</th>
+            <th scope="col">{{#str}}category, tool_lp{{/str}}</th>
             <th scope="col">{{#str}}actions, tool_lp{{/str}}</th>
         </tr>
     </thead>
@@ -53,7 +53,7 @@
         <tr class="drag-samenode" data-frameworkid="{{id}}">
             <td><span class="drag-handlecontainer"></span><span><a href="{{pluginbaseurl}}/competencies.php?competencyframeworkid={{id}}&amp;pagecontextid={{pagecontextid}}">{{shortname}} ({{idnumber}})</a></span> {{^visible}}{{#str}}hiddenhint, tool_lp{{/str}}{{/visible}}</td>
             <td>{{competenciescount}}</td>
-            <td>{{contextname}}</td>
+            <td>{{contextnamenoprefix}}</td>
             <td>
             {{#canmanage}}
             <ul title="{{#str}}edit{{/str}}" class="competencyframeworkactions">
index b48abd3..13a1bca 100644 (file)
@@ -42,7 +42,7 @@
     <thead>
         <tr>
             <th scope="col">{{#str}}templatename, tool_lp{{/str}}</th>
-            <th scope="col">{{#str}}context, core_role{{/str}}</th>
+            <th scope="col">{{#str}}category, tool_lp{{/str}}</th>
             <th scope="col">{{#str}}cohorts, core_cohort{{/str}}</th>
             <th scope="col">{{#str}}userplans, tool_lp{{/str}}</th>
             {{#canmanage}}
@@ -54,7 +54,7 @@
         {{#templates}}
         <tr class="drag-samenode" data-templateid="{{id}}">
             <td><a href="{{pluginbaseurl}}/templatecompetencies.php?templateid={{id}}&amp;pagecontextid={{pagecontextid}}">{{shortname}}</a></span> {{^visible}}{{#str}}hiddenhint, tool_lp{{/str}}{{/visible}}</td>
-            <td>{{contextname}}</td>
+            <td>{{contextnamenoprefix}}</td>
             <td><a class="template-cohorts" href="{{pluginbaseurl}}/template_cohorts.php?id={{id}}&amp;pagecontextid={{pagecontextid}}">{{cohortscount}}</a></td>
             <td><a class="template-userplans" href="{{pluginbaseurl}}/template_plans.php?id={{id}}&amp;pagecontextid={{pagecontextid}}">{{planscount}}</a></td>
             <td>