| 9 |
* Implementation of hook_perm(). |
* Implementation of hook_perm(). |
| 10 |
*/ |
*/ |
| 11 |
function gradebook_perm() { |
function gradebook_perm() { |
| 12 |
return array('admin gradebook', 'access gradebook'); |
return array('admin gradebook', 'access gradebook', 'attach files to gradebook'); |
| 13 |
} |
} |
| 14 |
|
|
| 15 |
/** |
/** |
| 19 |
return array( |
return array( |
| 20 |
'gradebook_page' => array('arguments' => array('gradebook', 'assignments', 'student_grades')), |
'gradebook_page' => array('arguments' => array('gradebook', 'assignments', 'student_grades')), |
| 21 |
'gradebook_table' => array('arguments' => array('headers', 'rows', 'attributes', 'caption')), |
'gradebook_table' => array('arguments' => array('headers', 'rows', 'attributes', 'caption')), |
| 22 |
'gradebook_assignment_grade' => array('arguments' => array('gradebook', 'grade')), |
// 'gradebook_assignment_grade' => array('arguments' => array('gradebook', 'grade')), |
| 23 |
'gradebook_term_grade' => array('arguments' => array('gradebook', 'grade')), |
'gradebook_term_grade' => array('arguments' => array('gradebook', 'grade')), |
| 24 |
'gradebook_assignment_note' => array('arguments' => array('tid', 'account', 'node', 'grade')), |
'gradebook_grade_form' => array('arguments' => array('form' => NULL)), |
| 25 |
); |
); |
| 26 |
} |
} |
| 27 |
|
|
| 98 |
'weight' => 5, |
'weight' => 5, |
| 99 |
'type' => MENU_LOCAL_TASK, |
'type' => MENU_LOCAL_TASK, |
| 100 |
); |
); |
| 101 |
|
// TODO: Why doesn't title callback work? |
| 102 |
|
|
| 103 |
$items['gradebook/%gradebookapi_gradebook'] = array( |
$items['gradebook/%gradebookapi_gradebook'] = array( |
| 104 |
'title' => 'Gradebook Name', |
'title' => 'Gradebook Name', |
| 108 |
'page arguments' => array(1, 2), // optional path element specifies user id |
'page arguments' => array(1, 2), // optional path element specifies user id |
| 109 |
'access callback' => 'user_access', |
'access callback' => 'user_access', |
| 110 |
'access arguments' => array('access gradebook'), |
'access arguments' => array('access gradebook'), |
| 111 |
'type' => MENU_LOCAL_TASK, |
'type' => MENU_CALLBACK, |
| 112 |
); |
); |
| 113 |
|
|
| 114 |
$items['gradebook/%gradebookapi_gradebook/view'] = array( |
$items['gradebook/%gradebookapi_gradebook/view'] = array( |
| 115 |
'title' => 'view', |
'title' => 'view', |
| 116 |
|
'access callback' => 'user_access', |
| 117 |
|
'access arguments' => array('access gradebook'), |
| 118 |
'type' => MENU_DEFAULT_LOCAL_TASK, |
'type' => MENU_DEFAULT_LOCAL_TASK, |
| 119 |
'weight' => -10, |
'weight' => -10, |
| 120 |
); |
); |
| 350 |
|
|
| 351 |
$sql = 'SELECT DISTINCT t.tid, t.name FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE h.parent = 0 AND t.vid = '. $vid; |
$sql = 'SELECT DISTINCT t.tid, t.name FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE h.parent = 0 AND t.vid = '. $vid; |
| 352 |
$sql .= tablesort_sql($header, 'weight, '); |
$sql .= tablesort_sql($header, 'weight, '); |
| 353 |
$result = pager_query($sql, variable_get('gradebooks_per_page', 25)); |
$result = pager_query($sql, variable_get('gradebook_gradebooks_per_page', 25)); |
| 354 |
while ($term = db_fetch_object($result)) { |
while ($term = db_fetch_object($result)) { |
| 355 |
$rows[] = array('name' => l($term->name, 'gradebook/'. $term->tid)); |
$rows[] = array('name' => l($term->name, 'gradebook/'. $term->tid)); |
| 356 |
} |
} |
| 401 |
|
|
| 402 |
switch ($order) { |
switch ($order) { |
| 403 |
case 'title': |
case 'title': |
| 404 |
$result = gradebookapi_select_nodes($gradebook, $tids, 'or', 0, FALSE, 'n.title '. $sort); |
$result = gradebookapi_select_nodes($gradebook, $tids, 'or', 0, TRUE, 'n.title '. $sort); |
| 405 |
break; |
break; |
| 406 |
case 'due': |
case 'due': |
| 407 |
$result = gradebookapi_select_nodes($gradebook, $tids, 'or', 0, FALSE, 'a.due_date '. $sort); |
$result = gradebookapi_select_nodes($gradebook, $tids, 'or', 0, TRUE, 'a.due_date '. $sort); |
| 408 |
break; |
break; |
| 409 |
case 'publish': |
case 'publish': |
| 410 |
$result = gradebookapi_select_nodes($gradebook, $tids, 'or', 0, FALSE, 'a.publish_date '. $sort); |
$result = gradebookapi_select_nodes($gradebook, $tids, 'or', 0, TRUE, 'a.publish_date '. $sort); |
| 411 |
break; |
break; |
| 412 |
case 'possible': |
case 'possible': |
| 413 |
$result = gradebookapi_select_nodes($gradebook, $tids, 'or', 0, FALSE, 'a.possible '. $sort); |
$result = gradebookapi_select_nodes($gradebook, $tids, 'or', 0, TRUE, 'a.possible '. $sort); |
| 414 |
break; |
break; |
| 415 |
case 'category': |
case 'category': |
| 416 |
default: |
default: |
| 417 |
$result = gradebookapi_select_nodes($gradebook, $tids, 'or', 0, FALSE, 'td.name '. $sort); |
$result = gradebookapi_select_nodes($gradebook, $tids, 'or', 0, TRUE, 'td.name '. $sort); |
| 418 |
} |
} |
| 419 |
|
|
| 420 |
$assignments = array(); |
$assignments = array(); |
| 605 |
$output = '<div id="gradebook-container">'; |
$output = '<div id="gradebook-container">'; |
| 606 |
$output .= theme('gradebook_table', $headers, $rows, array('class' => 'gradebook')); |
$output .= theme('gradebook_table', $headers, $rows, array('class' => 'gradebook')); |
| 607 |
$output .= '</div>'; |
$output .= '</div>'; |
| 608 |
|
$output .= theme('pager', NULL, variable_get('gradebook_grades_per_page', 10), 0); // configure at admin screen! |
| 609 |
|
|
| 610 |
return $output; |
return $output; |
| 611 |
} |
} |
| 726 |
$output .= "</tbody></table>\n"; |
$output .= "</tbody></table>\n"; |
| 727 |
return $output; |
return $output; |
| 728 |
} |
} |
|
|
|
|
|
|