Ignore:
Timestamp:
May 2, 2016, 12:09:23 PM (3 years ago)
Author:
jrpelegrina
Message:

Updated to moodle 3.0.3

Location:
moodle/trunk/fuentes/completion/criteria
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • moodle/trunk/fuentes/completion/criteria/completion_criteria.php

    r136 r1331  
    169169
    170170        if (!isset($params['criteriatype']) || !isset($COMPLETION_CRITERIA_TYPES[$params['criteriatype']])) {
    171             error('invalidcriteriatype', 'completion');
     171            print_error('invalidcriteriatype', 'completion');
    172172        }
    173173
     
    234234
    235235    /**
     236     * Return pix_icon for display in reports.
     237     *
     238     * @param string $alt The alt text to use for the icon
     239     * @param array $attributes html attributes
     240     * @return pix_icon
     241     */
     242    public function get_icon($alt, array $attributes = null) {
     243        global $COMPLETION_CRITERIA_TYPES;
     244
     245        $criteriatype = $COMPLETION_CRITERIA_TYPES[$this->criteriatype];
     246        return new pix_icon('i/'.$criteriatype, $alt, 'moodle', $attributes);
     247    }
     248
     249    /**
    236250     * Return criteria status text for display in reports
    237251     *
  • moodle/trunk/fuentes/completion/criteria/completion_criteria_activity.php

    r136 r1331  
    6161     */
    6262    public function config_form_display(&$mform, $data = null) {
    63         $mform->addElement('checkbox', 'criteria_activity['.$data->id.']', ucfirst(self::get_mod_name($data->module)).' - '.$data->name);
     63        $modnames = get_module_types_names();
     64        $mform->addElement('checkbox', 'criteria_activity['.$data->id.']',
     65                $modnames[self::get_mod_name($data->module)].
     66                ' - '.
     67                format_string($data->name));
    6468
    6569        if ($this->id) {
     
    148152
    149153        // If the activity is complete
    150         if (in_array($data->completionstate, array(COMPLETION_COMPLETE, COMPLETION_COMPLETE_PASS))) {
     154        if (in_array($data->completionstate, array(COMPLETION_COMPLETE, COMPLETION_COMPLETE_PASS, COMPLETION_COMPLETE_FAIL))) {
    151155            if ($mark) {
    152156                $completion->mark_complete();
     
    178182        $activity = $DB->get_record($this->module, array('id' => $module->instance));
    179183
    180         return shorten_text(urldecode($activity->name));
     184        return shorten_text(format_string($activity->name, true,
     185                array('context' => context_module::instance($module->id))));
    181186    }
    182187
     
    230235                mc.completionstate = '.COMPLETION_COMPLETE.'
    231236             OR mc.completionstate = '.COMPLETION_COMPLETE_PASS.'
     237             OR mc.completionstate = '.COMPLETION_COMPLETE_FAIL.'
    232238                )
    233239        ';
     
    283289        return $details;
    284290    }
     291
     292    /**
     293     * Return pix_icon for display in reports.
     294     *
     295     * @param string $alt The alt text to use for the icon
     296     * @param array $attributes html attributes
     297     * @return pix_icon
     298     */
     299    public function get_icon($alt, array $attributes = null) {
     300        return new pix_icon('icon', $alt, 'mod_'.$this->module, $attributes);
     301    }
    285302}
  • moodle/trunk/fuentes/completion/criteria/completion_criteria_date.php

    r136 r1331  
    203203        return $details;
    204204    }
     205
     206    /**
     207     * Return pix_icon for display in reports.
     208     *
     209     * @param string $alt The alt text to use for the icon
     210     * @param array $attributes html attributes
     211     * @return pix_icon
     212     */
     213    public function get_icon($alt, array $attributes = null) {
     214        return new pix_icon('i/calendar', $alt, 'moodle', $attributes);
     215    }
    205216}
  • moodle/trunk/fuentes/completion/criteria/completion_criteria_grade.php

    r136 r1331  
    6666        $mform->disabledIf('criteria_grade_value', 'criteria_grade');
    6767        $mform->setType('criteria_grade_value', PARAM_RAW); // Uses unformat_float.
    68         $mform->setDefault('criteria_grade_value', format_float($data));
     68        // Grades are stored in Moodle with 5 decimal points, make sure we do not accidentally round them
     69        // when setting the form value.
     70        $mform->setDefault('criteria_grade_value', format_float($data, 5));
    6971
    7072        if ($this->id) {
    7173            $mform->setDefault('criteria_grade', 1);
    72             $mform->setDefault('criteria_grade_value', format_float($this->gradepass));
     74            $mform->setDefault('criteria_grade_value', format_float($this->gradepass, 5));
    7375        }
    7476    }
     
    142144     */
    143145    public function get_title_detailed() {
    144         $graderequired = round($this->gradepass, 2).'%';
     146        global $CFG;
     147        require_once($CFG->libdir . '/gradelib.php');
     148        $decimalpoints = grade_get_setting($this->course, 'decimalpoints', $CFG->grade_decimalpoints);
     149        $graderequired = format_float($this->gradepass, $decimalpoints);
    145150        return get_string('gradexrequired', 'completion', $graderequired);
    146151    }
     
    162167     */
    163168    public function get_status($completion) {
     169        global $CFG;
     170        require_once($CFG->libdir . '/gradelib.php');
     171        $decimalpoints = grade_get_setting($this->course, 'decimalpoints', $CFG->grade_decimalpoints);
     172
    164173        $grade = $this->get_grade($completion);
    165174        $graderequired = $this->get_title_detailed();
    166175
    167176        if ($grade) {
    168             $grade = round($grade, 2).'%';
     177            $grade = format_float($grade, $decimalpoints);
    169178        } else {
    170179            $grade = get_string('nograde');
     
    236245     */
    237246    public function get_details($completion) {
     247        global $CFG;
     248        require_once($CFG->libdir . '/gradelib.php');
     249        $decimalpoints = grade_get_setting($this->course, 'decimalpoints', $CFG->grade_decimalpoints);
     250
    238251        $details = array();
    239252        $details['type'] = get_string('coursegrade', 'completion');
    240253        $details['criteria'] = get_string('graderequired', 'completion');
    241         $details['requirement'] = round($this->gradepass, 2).'%';
     254        $details['requirement'] = format_float($this->gradepass, $decimalpoints);
    242255        $details['status'] = '';
    243256
    244         $grade = round($this->get_grade($completion), 2);
     257        $grade = format_float($this->get_grade($completion), $decimalpoints);
    245258        if ($grade) {
    246             $details['status'] = $grade.'%';
     259            $details['status'] = $grade;
    247260        }
    248261
    249262        return $details;
    250263    }
     264
     265    /**
     266     * Return pix_icon for display in reports.
     267     *
     268     * @param string $alt The alt text to use for the icon
     269     * @param array $attributes html attributes
     270     * @return pix_icon
     271     */
     272    public function get_icon($alt, array $attributes = null) {
     273        return new pix_icon('i/grades', $alt, 'moodle', $attributes);
     274    }
    251275}
  • moodle/trunk/fuentes/completion/criteria/completion_criteria_role.php

    r136 r1331  
    124124        global $DB;
    125125        $role = $DB->get_record('role', array('id' => $this->role));
     126        if (!$role) {
     127            return '['.get_string('roleidnotfound', 'completion', $this->role).']';
     128        }
    126129        return role_get_name($role, context_course::instance($this->course));
    127130    }
  • moodle/trunk/fuentes/completion/criteria/completion_criteria_self.php

    r136 r1331  
    150150        return $details;
    151151    }
     152
     153    /**
     154     * Return pix_icon for display in reports.
     155     *
     156     * @param string $alt The alt text to use for the icon
     157     * @param array $attributes html attributes
     158     * @return pix_icon
     159     */
     160    public function get_icon($alt, array $attributes = null) {
     161        return new pix_icon('i/completion_self', $alt, 'moodle', $attributes);
     162    }
    152163}
  • moodle/trunk/fuentes/completion/criteria/completion_criteria_unenrol.php

    r136 r1331  
    132132        return $details;
    133133    }
     134
     135    /**
     136     * Return pix_icon for display in reports.
     137     *
     138     * @param string $alt The alt text to use for the icon
     139     * @param array $attributes html attributes
     140     * @return pix_icon
     141     */
     142    public function get_icon($alt, array $attributes = null) {
     143        return new pix_icon('i/user', $alt, 'moodle', $attributes);
     144    }
    134145}
Note: See TracChangeset for help on using the changeset viewer.