Fixed alignment issues and removed underscore from variable name

This commit is contained in:
Mark Nelson 2013-07-23 12:43:56 +08:00
parent 3d4811cc0c
commit 2df3ee4fa5
2 changed files with 17 additions and 14 deletions

View file

@ -57,9 +57,9 @@ class customcert_element_date extends customcert_element_base {
$mform->addHelpButton('dateformat', 'dateformat', 'customcertelement_date');
parent::render_form_elements($mform);
}
}
/**
/**
* This will handle how form data will be saved into the data column in the
* customcert_elements table.
*
@ -69,8 +69,8 @@ class customcert_element_date extends customcert_element_base {
public function save_unique_data($data) {
// Array of data we will be storing in the database.
$arrtostore = array(
'dateitem' => $data->dateitem,
'dateformat' => $data->dateformat
'dateitem' => $data->dateitem,
'dateformat' => $data->dateformat
);
// Encode these variables before saving into the DB.
@ -169,7 +169,7 @@ class customcert_element_date extends customcert_element_base {
parent::definition_after_data($mform);
}
/**
/**
* Helper function to return all the date formats.
*
* @return array the list of date formats
@ -196,9 +196,12 @@ class customcert_element_date extends customcert_element_base {
if (!in_array(($day % 100), array(11, 12, 13))) {
switch ($day % 10) {
// Handle 1st, 2nd, 3rd.
case 1: return get_string('numbersuffix_st', 'customcertelement_date');
case 2: return get_string('numbersuffix_nd', 'customcertelement_date');
case 3: return get_string('numbersuffix_rd', 'customcertelement_date');
case 1:
return get_string('numbersuffix_st', 'customcertelement_date');
case 2:
return get_string('numbersuffix_nd', 'customcertelement_date');
case 3:
return get_string('numbersuffix_rd', 'customcertelement_date');
}
}
return 'th';

View file

@ -57,9 +57,9 @@ class customcert_element_grade extends customcert_element_base {
$mform->addHelpButton('gradeformat', 'gradeformat', 'customcertelement_grade');
parent::render_form_elements($mform);
}
}
/**
/**
* This will handle how form data will be saved into the data column in the
* customcert_elements table.
*
@ -155,13 +155,13 @@ class customcert_element_grade extends customcert_element_base {
for ($i = 0; $i <= count($sections) - 1; $i++) {
// Confirm the index exists, should always be true.
if (isset($sections[$i])) {
// Get the individual section.
// Get the individual section.
$section = $sections[$i];
// Get the mods for this section.
$sectionmods = explode(",", $section->sequence);
// Loop through the section mods.
foreach ($sectionmods as $sectionmod) {
// Should never happen unless DB is borked.
// Should never happen unless DB is borked.
if (empty($mods[$sectionmod])) {
continue;
}
@ -170,8 +170,8 @@ class customcert_element_grade extends customcert_element_base {
$instance = $DB->get_record($mod->modname, array('id' => $mod->instance));
// Get the grade items for this activity.
if ($grade_items = grade_get_grade_items_for_activity($mod)) {
$mod_item = grade_get_grades($COURSE->id, 'mod', $mod->modname, $mod->instance);
$gradeitem = reset($mod_item->items);
$moditem = grade_get_grades($COURSE->id, 'mod', $mod->modname, $mod->instance);
$gradeitem = reset($moditem->items);
if (isset($gradeitem->grademax)) {
$modules[$mod->id] = $sectionlabel . ' ' . $section->section . ' : ' . $instance->name;
}