/[drupal]/contributions/modules/gradebook/gradebook.module
ViewVC logotype

Diff of /contributions/modules/gradebook/gradebook.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.15.4.2.2.4, Mon Jan 19 03:57:08 2009 UTC revision 1.15.4.2.2.5, Sun Feb 1 05:11:47 2009 UTC
# Line 9  Line 9 
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  /**  /**
# Line 19  function gradebook_theme() { Line 19  function gradebook_theme() {
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    
# Line 98  function gradebook_menu() { Line 98  function gradebook_menu() {
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',
# Line 107  function gradebook_menu() { Line 108  function gradebook_menu() {
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    );    );
# Line 347  function gradebook_list_page() { Line 350  function gradebook_list_page() {
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    }    }
# Line 398  function gradebook_get_sorted_assignment Line 401  function gradebook_get_sorted_assignment
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();
# Line 602  function theme_gradebook_page($gradebook Line 605  function theme_gradebook_page($gradebook
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  }  }
# Line 722  function theme_gradebook_table($headers, Line 726  function theme_gradebook_table($headers,
726    $output .= "</tbody></table>\n";    $output .= "</tbody></table>\n";
727    return $output;    return $output;
728  }  }
   
   

Legend:
Removed from v.1.15.4.2.2.4  
changed lines
  Added in v.1.15.4.2.2.5

  ViewVC Help
Powered by ViewVC 1.1.2