- Posts: 3
Help with Grading System
- Jorge O Cerpa
- Topic Author
- Offline
- New Member
-
Less
More
11 years 6 months ago #1
by Jorge O Cerpa
Help with Grading System was created by Jorge O Cerpa
Hello,
Hope you are doing fine!!! I'm trying to create a Joomla Menu for Moodle Grading System and when I open the menu page, it says: No course selected, but I selected a Course in Options. What I'm doing wrong? If I select the other option to see grades for all courses it works, but I want to show grades by Course, because is more complete that way, and it let me show the final grades. Please some help!
I'm using Joomla 3.3.3 and Joomdle 0.95 and Moodle 2.6.1
Sincerely,
Jorge
Hope you are doing fine!!! I'm trying to create a Joomla Menu for Moodle Grading System and when I open the menu page, it says: No course selected, but I selected a Course in Options. What I'm doing wrong? If I select the other option to see grades for all courses it works, but I want to show grades by Course, because is more complete that way, and it let me show the final grades. Please some help!
I'm using Joomla 3.3.3 and Joomdle 0.95 and Moodle 2.6.1
Sincerely,
Jorge
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7909
11 years 6 months ago #2
by Antonio Durán
Replied by Antonio Durán on topic Help with Grading System
Hi.
Thanks for the bug report.
It seems the problem is a file that should not be there. You can delete your menu item, and then delete this file:
components/com_joomdle/views/rubrics/tmpl/default.xml
Then you can create the menu item again, and it should work fine.
Thanks for the bug report.
It seems the problem is a file that should not be there. You can delete your menu item, and then delete this file:
components/com_joomdle/views/rubrics/tmpl/default.xml
Then you can create the menu item again, and it should work fine.
Please Log in or Create an account to join the conversation.
- Jorge O Cerpa
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 3
11 years 6 months ago #3
by Jorge O Cerpa
Replied by Jorge O Cerpa on topic Help with Grading System
Hello Antonio!
Thanks for your reply! It worked! But I'm having almost same problem creating Joomdle User Grades, selecting the option Gradebook. when I open the page it is blank, but if I select Basic it works, but I want to show the Gradebook. Please let me know.
jorge
Thanks for your reply! It worked! But I'm having almost same problem creating Joomdle User Grades, selecting the option Gradebook. when I open the page it is blank, but if I select Basic it works, but I want to show the Gradebook. Please let me know.
jorge
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7909
11 years 6 months ago #4
by Antonio Durán
Replied by Antonio Durán on topic Help with Grading System
I checked it and right now the gradebook option is only showing courses which have defined categories in their grades.
I have done some mods to the function that returns this data, so it returns all courses, even when there are no grade categories.
You can modify function get_grade_user_report in moodle/auth/joomdle/auth.php with this version:
I have done some mods to the function that returns this data, so it returns all courses, even when there are no grade categories.
You can modify function get_grade_user_report in moodle/auth/joomdle/auth.php with this version:
Code:
function get_grade_user_report ($id, $username)
{
global $CFG, $DB;
$username = utf8_decode ($username);
$username = strtolower ($username);
$conditions = array ('username' => $username);
$user = $DB->get_record('user',$conditions);
if (!$user)
return array();
$gpr = new grade_plugin_return(array('type'=>'report', 'plugin'=>'user', 'courseid'=>$id, 'userid'=>$user->id));
$context = context_course::instance($id);
$report = new grade_report_user($id, $gpr, $context, $user->id);
// Get course total
$query =
"select id
from {$CFG->prefix}grade_items
where courseid = '$id'
AND itemtype='course'
";
$cat_item = $DB->get_record_sql($query);
$query = "SELECT g.finalgrade,g.rawgrademax
FROM {$CFG->prefix}grade_grades g
WHERE g.itemid = ?
AND g.userid = ?";
$params = array ($cat_item->id, $user->id);
$grade = $DB->get_record_sql($query, $params);
$total['fullname'] = '';
$total['finalgrade'] = (float) $grade->finalgrade;
$total['grademax'] = (float) $grade->rawgrademax;
$total['items'] = array();
$total['letter'] = '';
if (! $grade_grade = grade_grade::fetch(array('itemid'=>$cat_item->id,'userid'=>$user->id))) {
$grade_grade = new grade_grade();
$grade_grade->userid = $user->id;
$grade_grade->itemid = $cat_item->id;
}
$grade_grade->load_grade_item();
$total['letter'] = grade_format_gradevalue($grade->finalgrade, $grade_grade->grade_item, true, GRADE_DISPLAY_TYPE_LETTER);
$data = array ();
$data[] = $total;
$query =
"select {$CFG->prefix}grade_categories.fullname, {$CFG->prefix}grade_items.id, {$CFG->prefix}grade_items.grademax, {$CFG->prefix}grade_categories.id
from {$CFG->prefix}grade_categories, {$CFG->prefix}grade_items
where {$CFG->prefix}grade_categories.id = {$CFG->prefix}grade_items.iteminstance
and {$CFG->prefix}grade_items.courseid='$id' and itemtype='category';
";
$cats = $DB->get_records_sql($query);
if (count ($cats) == 0)
{
// No cats, get items in "main"
$query =
"select {$CFG->prefix}grade_categories.fullname, {$CFG->prefix}grade_items.id, {$CFG->prefix}grade_items.grademax, {$CFG->prefix}grade_categories.id
from {$CFG->prefix}grade_categories, {$CFG->prefix}grade_items
where {$CFG->prefix}grade_categories.id = {$CFG->prefix}grade_items.iteminstance
and {$CFG->prefix}grade_items.courseid='$id' and itemtype='course';
";
$cats = $DB->get_records_sql($query);
}
foreach ($cats as $r)
{
if ($r->fullname != '?')
$e['fullname'] = $r->fullname;
else $e['fullname'] = '';
$e['grademax'] = (float) $r->grademax;
$cat_id = $r->id;
// Get category grade total
$query =
"select id
from {$CFG->prefix}grade_items
where iteminstance = '$cat_id'
";
$cat_item = $DB->get_record_sql($query);
$query = "SELECT g.finalgrade
FROM {$CFG->prefix}grade_grades g
WHERE g.itemid = ?
AND g.userid = ?";
$params = array ($cat_item->id, $user->id);
$grade = $DB->get_record_sql($query, $params);
if ($grade)
$e['finalgrade'] = (float) $grade->finalgrade;
else $e['finalgrade'] = (float) 0;
if (! $grade_grade = grade_grade::fetch(array('itemid'=>$cat_item->id,'userid'=>$user->id))) {
$grade_grade = new grade_grade();
$grade_grade->userid = $user->id;
$grade_grade->itemid = $cat_item->id;
}
$grade_grade->load_grade_item();
$e['letter'] = grade_format_gradevalue($grade->finalgrade, $grade_grade->grade_item, true, GRADE_DISPLAY_TYPE_LETTER);
// Get items
$query =
"select *
from {$CFG->prefix}grade_items
where categoryId = '$cat_id'
";
$items = $DB->get_records_sql($query);
$category_items = array ();
if (count ($items) == 0)
continue;
foreach ($items as $item)
{
$category_item['name'] = $item->itemname;
$category_item['grademax'] = $item->grademax;
switch ($item->itemmodule)
{
case 'quiz':
$conditions = array ('id' => $item->iteminstance);
$quiz = $DB->get_record('quiz',$conditions);
$category_item['due'] = $quiz->timeclose;
break;
case 'assignment':
$conditions = array ('id' => $item->iteminstance);
$assignment = $DB->get_record('assignment',$conditions);
$category_item['due'] = $assignment->timedue;
break;
default:
$category_item['due'] = 0;
break;
}
$query = "SELECT g.finalgrade, g.feedback
FROM {$CFG->prefix}grade_grades g
WHERE g.itemid = ?
AND g.userid = ?";
$params = array ($item->id, $user->id);
$grade = $DB->get_record_sql($query, $params);
if (! $grade_grade = grade_grade::fetch(array('itemid'=>$item->id,'userid'=>$user->id))) {
$grade_grade = new grade_grade();
$grade_grade->userid = $user->id;
$grade_grade->itemid = $item->id;
}
$grade_grade->load_grade_item();
if ($grade)
{
$category_item['finalgrade'] = (float) $grade->finalgrade;
$category_item['feedback'] = $grade->feedback;
if ($report->showlettergrade)
$category_item['letter'] = grade_format_gradevalue($grade->finalgrade, $grade_grade->grade_item, true, GRADE_DISPLAY_TYPE_LETTER);
else
$category_item['letter'] = '';
}
else
{
$category_item['finalgrade'] = (float) 0;
$category_item['feedback'] = '';
$category_item['letter'] = '';
}
$category_items[] = $category_item;
}
$e['items'] = $category_items;
$data[] = $e;
}
// don't return total if there is nothing else
if (count ($data) == 1)
$rdo['data'] = array();
else
$rdo['data'] = $data;
$rdo['config']['showlettergrade'] = (int) $report->showlettergrade;
return $rdo;
}
Please Log in or Create an account to join the conversation.
- Jorge O Cerpa
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 3
11 years 6 months ago #5
by Jorge O Cerpa
Replied by Jorge O Cerpa on topic Help with Grading System
It worked!! Thanks
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7909
11 years 6 months ago #6
by Antonio Durán
Replied by Antonio Durán on topic Help with Grading System
Great, thanks for the feedback.
Please Log in or Create an account to join the conversation.