diff --git a/modules/gradebook/README.txt b/modules/gradebook/README.txt
--- a/modules/gradebook/README.txt
+++ b/modules/gradebook/README.txt
@@ -18,9 +18,8 @@ Gradebook assignments (and student responses when the gradebook responses submod
enabled) can be created using one or more content types. Custom content
types using CCK, or types supplied by other modules (such as Webform and others) that
will only be used as gradebook assignments are good choices. Additional fields are added
-to assignment content types to allow the teacher to select the gradebook category,
-the possible number of points for the assignment, the due date for the assignment, and
-the date to publish the assignment. Gradebook provides a gradebook page that
+to assignment content types to allow the teacher to select the gradebook category and
+the possible number of points for the assignment. Gradebook provides a gradebook page that
lists all assignments that have been published, and tabulates grades by student. Teachers
enter grades into the gradebook by clicking on cells within this table. This brings up an
add grade form that also allows the teachers to leave a text note, or exempt
@@ -114,10 +113,6 @@ gradebook administrator can take over, if desired.
assignments (and, optionally, student responses). Checking these boxes will enable the form elements
described above, so only select custom content types that you have created for these purposes.
-5. On the same page, choose an appropriate default time between creation of assignment node and
- due date. The actual due date will be selected on the assignment form, but its easier to work
- with if the select form starts at a reasonable date.
-
III. Usage (for students and teachers)
----------------
@@ -125,7 +120,7 @@ III. Usage (for students and teachers)
a. Note that this link is not enabled by default, so the system administrator must visit
Administer >> SiteBuilding >> Menus >>Navigation to enable it.
2. Clicking on one of the listed gradebooks reveals a table of assignments (sorted by title,
- possible, category or date) with scores for each student.
+ possible or category) with scores for each student.
a. Students will only see their own name and grades listed.
b. Teachers will see all the students in the gradebook. Clicking on a particular student
name will filter the list to show assignments for one student.
diff --git a/modules/gradebook/gradebook.module b/modules/gradebook/gradebook.module
--- a/modules/gradebook/gradebook.module
+++ b/modules/gradebook/gradebook.module
@@ -465,12 +465,6 @@ function gradebook_get_sorted_assignments($gradebook, $tids, $pager, $order, $so
case 'title':
$result = gradebookapi_select_nodes($gradebook, $tids, 'or', 0, $pager, 'n.title '. $sort);
break;
- case 'due':
- $result = gradebookapi_select_nodes($gradebook, $tids, 'or', 0, $pager, 'a.due_date '. $sort);
- break;
- case 'publish':
- $result = gradebookapi_select_nodes($gradebook, $tids, 'or', 0, $pager, 'a.publish_date '. $sort);
- break;
case 'possible':
$result = gradebookapi_select_nodes($gradebook, $tids, 'or', 0, $pager, 'a.possible '. $sort);
break;
@@ -581,7 +575,6 @@ function theme_gradebook_student_page($gradebook, $assignments, $student, $stude
'category' => array(l('category', 'gradebook/'. $gradebook->tid, array('query' => 'order=category&sort='. $sort))),
'weight' => ($showweight) ? array(t('weight')) : array(),
'possible' => array(l('possible', 'gradebook/'. $gradebook->tid, array('query' => 'order=possible&sort='. $sort))),
- 'due' => array(l('due date', 'gradebook/'. $gradebook->tid, array('query' => 'order=due&sort='. $sort))),
'title' => array(l('title', 'gradebook/'. $gradebook->tid, array('query' => 'order=title&sort='. $sort))),
);
$headers['category'][] = array('data' => '', 'class' => 'category');
@@ -589,7 +582,6 @@ function theme_gradebook_student_page($gradebook, $assignments, $student, $stude
$headers['weight'][] = array('data' => '', 'class' => 'category');
}
$headers['possible'][] = array('data' => '', 'class' => 'possible');
- $headers['due'][] = array('data' => '', 'class' => 'date');
$headers['title'][] = array('data' => '', 'class' => 'title');
foreach ($assignments as $assignment) {
@@ -610,7 +602,6 @@ function theme_gradebook_student_page($gradebook, $assignments, $student, $stude
$headers['weight'][] = array('data' => isset($weights['category'][$term->tid]) ? $weights['category'][$term->tid] .'%' : '0%', 'class' => 'category');
}
$headers['possible'][] = array('data' => $assignment->possible, 'class' => 'possible');
- $headers['due'][] = array('data' => format_date($assignment->due_date, 'custom', variable_get('gradebookapi_assignments_date_format', 'm/d/Y')), 'class' => 'date');
$headers['title'][] = array('data' => l($assignment->title, 'node/'. $assignment->nid), 'class' => 'title');
}
$rows = array();
@@ -649,8 +640,6 @@ function theme_gradebook_teacher_page($gradebook, $assignments, $students, $stud
'category' => array(l('category', 'gradebook/'. $gradebook->tid, array('query' => 'order=category&sort='. $sort))),
'weight' => ($showweight) ? array(t('weight')) : array(),
'possible' => array(l('possible', 'gradebook/'. $gradebook->tid, array('query' => 'order=possible&sort='. $sort))),
- 'due' => array(l('due date', 'gradebook/'. $gradebook->tid, array('query' => 'order=due&sort='. $sort))),
- 'publish' => array(l('published', 'gradebook/'. $gradebook->tid, array('query' => 'order=publish&sort='. $sort))),
'title' => array(l('title', 'gradebook/'. $gradebook->tid, array('query' => 'order=title&sort='. $sort))),
'edit-all' => array(''),
'average' => array(''),
@@ -660,8 +649,6 @@ function theme_gradebook_teacher_page($gradebook, $assignments, $students, $stud
$headers['weight'][] = array('data' => '', 'class' => 'category');
}
$headers['possible'][] = array('data' => '', 'class' => 'possible');
- $headers['publish'][] = array('data' => '', 'class' => 'date');
- $headers['due'][] = array('data' => '', 'class' => 'date');
$headers['title'][] = array('data' => '', 'class' => 'title');
$headers['edit-all'][] = array('data' => '', 'class' => 'edit-all');
$headers['average'][] = array('data' => t('Averages'), 'class' => 'average');
@@ -684,8 +671,6 @@ function theme_gradebook_teacher_page($gradebook, $assignments, $students, $stud
$headers['weight'][] = array('data' => isset($weights['category'][$term->tid]) ? $weights['category'][$term->tid] .'%' : '0%', 'class' => 'category');
}
$headers['possible'][] = array('data' => $assignment->possible, 'class' => 'possible');
- $headers['publish'][] = array('data' => format_date($assignment->publish_date, 'custom', variable_get('gradebookapi_assignments_date_format', 'm/d/Y')), 'class' => 'date');
- $headers['due'][] = array('data' => format_date($assignment->due_date, 'custom', variable_get('gradebookapi_assignments_date_format', 'm/d/Y')), 'class' => 'date');
$headers['title'][] = array('data' => l($assignment->title, 'node/'. $assignment->nid), 'class' => 'title');
$headers['edit-all'][] = array('data' => l('[edit all]', 'gradebook/'. $gradebook->tid .'/grade-assignment/'. $assignment->nid), 'class' => 'edit-all');
}
@@ -746,8 +731,6 @@ function theme_gradebook_export_page($gradebook, $assignments, $students, $stude
$headers['weight'] = array(t('weight'), '');
}
$headers['possible'] = array(t('possible'), '');
- $headers['due'] = array(t('due date'), '');
- $headers['publish'] = array(t('published'), '');
$headers['title'] = array(t('title'), '');
$headers['average'] = array('', t('average'));
@@ -775,8 +758,6 @@ function theme_gradebook_export_page($gradebook, $assignments, $students, $stude
$headers['weight'][] = isset($weights['category'][$term->tid]) ? $weights['category'][$term->tid] .'%' : '0%';
}
$headers['possible'][] = $assignment->possible;
- $headers['publish'][] = format_date($assignment->publish_date, 'custom', variable_get('gradebookapi_assignments_date_format', 'm/d/Y'));
- $headers['due'][] = format_date($assignment->due_date, 'custom', variable_get('gradebookapi_assignments_date_format', 'm/d/Y'));
$headers['title'][] = $assignment->title;
}
// Total assignment score across all graded students.
@@ -976,7 +957,6 @@ function _gradebook_block_view($delta) {
case 0:
$block['subject'] = t('Current Assignments');
// Get all assignments for user and display in a block.
- $now = time();
// TODO: add css classes
$start = '
';
@@ -989,13 +969,10 @@ function _gradebook_block_view($delta) {
// Get the assignments.
$assignments = array();
$tids = array();
- $assignments = gradebook_get_sorted_assignments($gradebook, $tids, FALSE, 'due', '');
+ $assignments = gradebook_get_sorted_assignments($gradebook, $tids, FALSE, 'title', '');
$items = '';
foreach ($assignments as $assignment) {
- if ($now <= $assignment->due_date) {
- $items .= ''. l($assignment->title, 'node/'. $assignment->nid) .' ('. $assignment->possible .') ';
- $items .= '
Due: '. format_date($assignment->due_date, 'custom', variable_get('gradebookapi_assignments_date_format', 'm/d/Y')) .'';
- }
+ $items .= ''. l($assignment->title, 'node/'. $assignment->nid) .' ('. $assignment->possible .')';
}
if ($items != '') {
$block['content'] .= $header . $start . $items . $stop;
@@ -1047,8 +1024,6 @@ function gradebook_teacher_settings($form_state, $gradebook) {
'#type' => 'radios',
'#options' => array('category' => t('Alphabetically by Category'),
'title' => t('Alphabetically by Assignment Title'),
- 'due' => t('Due Date'),
- 'publish' => t('Publish Date'),
'possible' => t('Points Possible'), ),
'#default_value' => $default[$gradebook->tid],
'#description' => t('Select the default order to sort the gradebook page.'),
diff --git a/modules/gradebook/gradebook.pages.inc b/modules/gradebook/gradebook.pages.inc
--- a/modules/gradebook/gradebook.pages.inc
+++ b/modules/gradebook/gradebook.pages.inc
@@ -162,8 +162,6 @@ function gradebook_grade_form_submit($form, &$form_state) {
$grade = (object)$form_state['values']['grade'][$key];
if ($form_state['values']['teacher']) {
$node = node_load($form_state['values']['grade'][$key]['nid']);
- $grade->due_date = $node->due_date;
- $grade->publish_date = $node->publish_date;
$percentage = $form_state['values']['grade'][$key]['percentage'];
$earned = $form_state['values']['grade'][$key]['earned'];
if ($earned != $form['grade'][$key]['#oldearned']) {// use which one changed... if both changed, use points...
diff --git a/modules/gradebook/gradebookapi.admin.inc b/modules/gradebook/gradebookapi.admin.inc
--- a/modules/gradebook/gradebookapi.admin.inc
+++ b/modules/gradebook/gradebookapi.admin.inc
@@ -23,47 +23,6 @@ function gradebookapi_admin_settings() {
'#weight' => -10,
);
- $intervals = array(
- '+1 day' => t('1 day'),
- '+1 week' => t('1 week'),
- '+2 week' => t('2 weeks'),
- '+1 month' => t('1 month'),
- '+2 month' => t('2 months'),
- '+3 month' => t('3 months'),
- '+6 month' => t('6 months'),
- '+1 year' => t('1 year'),
- );
-
- $form['gradebookapi_assignments_interval'] = array(
- '#type' => 'radios',
- '#options' => $intervals,
- '#title' => t('Default time between creation of assignment node and due date'),
- '#default_value' => variable_get('gradebookapi_assignments_interval', '+1 month'),
- '#description' => t('This will be added to the current date to set the default due date.'),
- '#required' => FALSE,
- '#prefix' => '',
- '#suffix' => '
',
- '#weight' => -8,
- );
-
- $usedateapi = module_exists('date_popup');
- $form['gradebookapi_use_dateapi'] = array(
- '#type' => 'checkbox',
- '#title' => t('Use Date Popup for date selection'),
- '#description' => $usedateapi ? t('The Date Popup module is enabled, check the box if you would like to use a Date Popup for date selection.') : t('The Date Popup module is not available. Install and enable it to access this feature.'),
- '#default_value' => $usedateapi ? variable_get('gradebookapi_use_dateapi', FALSE) : FALSE,
- '#disabled' => !$usedateapi,
- '#weight' => -7,
- );
-
- $form['gradebookapi_assignments_date_format'] = array(
- '#type' => 'textfield',
- '#title' => t('Date format to use on gradebook page and block'),
- '#default_value' => variable_get('gradebookapi_assignments_date_format', 'm/d/Y'),
- '#description' => t('Define a php date format string like "m/d/Y". See http://php.net/date for more details.', array('@php-net-url' => url("http://php.net/date"))),
- '#required' => FALSE,
- '#weight' => -6,
- );
$form['#submit'][]= 'gradebookapi_admin_settings_submit'; // custom submit handler
return system_settings_form($form);
}
diff --git a/modules/gradebook/gradebookapi.install b/modules/gradebook/gradebookapi.install
--- a/modules/gradebook/gradebookapi.install
+++ b/modules/gradebook/gradebookapi.install
@@ -15,22 +15,6 @@ function gradebookapi_schema() {
'fields' => array(
'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
'possible' => array('type' => 'float', 'unsigned' => FALSE, 'not null' => TRUE, 'default' => 0),
- 'publish_date' => array(
- 'description' => 'Date assignment becomes effective.',
- 'type' => 'int',
- 'unsigned' => FALSE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- 'due_date' => array(
- 'description' => 'Date assignment is due.',
- 'type' => 'int',
- 'unsigned' => FALSE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
),
'primary key' => array('nid'),
);
@@ -162,4 +146,11 @@ function gradebookapi_update_6004() {
return $ret;
}
+function gradebookapi_update_6005() {
+ // fix mistakes made on gradebookapi_files fields and keys
+ $ret = array();
+ db_drop_field($ret, 'gradebookapi_assignment', 'due_date');
+ db_drop_field($ret, 'gradebookapi_assignment', 'publish_date');
+ return $ret;
+}
diff --git a/modules/gradebook/gradebookapi.module b/modules/gradebook/gradebookapi.module
--- a/modules/gradebook/gradebookapi.module
+++ b/modules/gradebook/gradebookapi.module
@@ -26,7 +26,6 @@ function gradebookapi_perm() {
function gradebookapi_theme() {
return array(
'gradebookapi_assignment_possible' => array('arguments' => array('possible')),
- 'gradebookapi_assignment_due_date' => array('arguments' => array('assignment')),
);
}
@@ -324,7 +323,7 @@ function gradebookapi_get_grades($param = array()) {
}
$cond = implode(' AND ', $cond);
// MN Removed a.sid....consequences?
- $result = db_query('SELECT g.uid, g.nid, g.earned, g.exempt, a.possible, g.timestamp, g.note, a.due_date, a.publish_date FROM {gradebookapi_grade} g INNER JOIN {gradebookapi_assignment} a ON g.nid = a.nid WHERE '. $cond, $arguments);
+ $result = db_query('SELECT g.uid, g.nid, g.earned, g.exempt, a.possible, g.timestamp, g.note FROM {gradebookapi_grade} g INNER JOIN {gradebookapi_assignment} a ON g.nid = a.nid WHERE '. $cond, $arguments);
while ($grade = db_fetch_object($result)) {
// can't use module_invoke here because it won't pass by reference..is there a better way to do this?
$modules = module_implements('gradebookapi_grade');
@@ -623,7 +622,7 @@ function gradebookapi_assignment_terms($node) {
* an array of form default values
*/
function gradebookapi_assignment_load($node) {
- $additions = db_fetch_array(db_query('SELECT possible, publish_date, due_date FROM {gradebookapi_assignment} WHERE nid = %d', $node->nid));
+ $additions = db_fetch_array(db_query('SELECT possible FROM {gradebookapi_assignment} WHERE nid = %d', $node->nid));
return $additions;
}
@@ -637,22 +636,8 @@ function gradebookapi_assignment_load($node) {
* @return NONE
*/
function gradebookapi_assignment_insert($node) {
- require_once('gradebook.datetime.inc');
-
- if (_gradebookapi_usedateapi()) {
- $node->publish_date = _gradebookapi_datepopup2unixtime($node->publish_date);
- $node->due_date = _gradebookapi_datepopup2unixtime($node->due_date);
- }
- else {
- $node->publish_date = _gradebookapi_drupaldate2unixtime($node->publish_date);
- $node->due_date = _gradebookapi_drupaldate2unixtime($node->due_date);
- }
-
- $now = time();
- $node->status = ($now > $node->publish_date) ? 1 : 0;
-
// this assumes that gradebookapi has a lighter weight than any submodules so it is called first:
- db_query("INSERT INTO {gradebookapi_assignment} (nid, possible, publish_date, due_date) VALUES (%d, %f, '%d', '%d')", $node->nid, $node->possible, $node->publish_date, $node->due_date);
+ db_query("INSERT INTO {gradebookapi_assignment} (nid, possible) VALUES (%d, %f)", $node->nid, $node->possible);
// we have to manually update terms as we can't control module order
taxonomy_node_save($node, $node->taxonomy);
@@ -669,18 +654,8 @@ function gradebookapi_assignment_insert($node) {
* @return NONE
*/
function gradebookapi_assignment_update(&$node) {
- require_once('gradebook.datetime.inc');
-
- if (_gradebookapi_usedateapi()) {
- $node->publish_date = _gradebookapi_datepopup2unixtime($node->publish_date);
- $node->due_date = _gradebookapi_datepopup2unixtime($node->due_date);
- }
- else {
- $node->publish_date = _gradebookapi_drupaldate2unixtime($node->publish_date);
- $node->due_date = _gradebookapi_drupaldate2unixtime($node->due_date);
- }
if (db_result(db_query('SELECT * FROM {gradebookapi_assignment} a WHERE a.nid = %d', $node->nid))) {
- db_query("UPDATE {gradebookapi_assignment} SET possible = '%s', publish_date = '%d', due_date = '%d' WHERE nid = %d", $node->possible, $node->publish_date, $node->due_date, $node->nid);
+ db_query("UPDATE {gradebookapi_assignment} SET possible = '%s' WHERE nid = %d", $node->possible, $node->nid);
}
else { // assignment doesn't exist in gradebookapi_assignment table, so insert it
gradebookapi_assignment_insert($node);
@@ -749,10 +724,6 @@ function gradebookapi_assignment_view(&$node, $teaser = FALSE, $page = FALSE) {
'#value' => theme('gradebookapi_assignment_possible', $node->possible),
'#weight' => -100,
);
- $node->content['due_date'] = array(
- '#value' => theme('gradebookapi_assignment_due_date', $node->due_date),
- '#weight' => -100,
- );
// TODO: Check to see if user has a note or attached file in the gradebook for this
// assignment and provide a note for them so they can go and retrieve it.
@@ -784,7 +755,6 @@ function theme_gradebookapi_assignment_possible($possible) {
* additional form array elements for the assignment create form.
*/
function gradebookapi_assignment_form_elements($node) {
- require_once('gradebook.datetime.inc');
$form = array();
// store the old gradebook term id in case user changes category
$oldtax = $node->taxonomy;
@@ -805,7 +775,6 @@ function gradebookapi_assignment_form_elements($node) {
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#weight' => 0,
- '#validate' => array('gradebookapi_assignment_validate' => array()),
);
$form['gradebookapi']['possible'] = array(
'#type' => 'textfield',
@@ -815,64 +784,7 @@ function gradebookapi_assignment_form_elements($node) {
'#maxlength' => 10,
'#required' => TRUE,
);
- if ($node->due_date == NULL) {
- $node->due_date = strtotime(variable_get('gradebookapi_assignments_interval', '+1 month'));
- }
-
- if ($node->publish_date == NULL) {
- $node->publish_date = time();
- }
- $datetype = _gradebookapi_usedateapi() ? 'date_popup': 'date';
-
- $default = is_numeric($node->due_date) ? (
- ($datetype == 'date_popup') ?
- _gradebookapi_unixtime2datepopup($node->due_date) : _gradebookapi_unixtime2drupaldate($node->due_date))
- : $node->due_date;
-
- $form['gradebookapi']['due_date'] = array(
- '#prefix' => '',
- '#suffix' => '
',
- '#type' => $datetype,
- '#title' => t('Assignment due date'),
- '#default_value' => $default,
- '#date_label_position' => 'within',
- '#date_increment' => 15,
- '#date_year_range' => '-3:+3',
- '#date_format' => 'Y-m-d H:i',
- );
-
- if ($datetype == 'date') { // include a time field element
- $form['gradebookapi']['due_time'] = array(
- '#type' => 'test_time',
- '#title' => t('Due at'),
- '#default_value' => variable_get('due_time', array('hour' => 12, 'minute' => 0, 'meridiem' => 'pm')),
- );
- }
- $default = is_numeric($node->publish_date) ? (
- ($datetype == 'date_popup') ?
- _gradebookapi_unixtime2datepopup($node->publish_date) : _gradebookapi_unixtime2drupaldate($node->publish_date))
- : $node->publish_date;
-
- $form['gradebookapi']['publish_date'] = array(
- '#prefix' => '',
- '#suffix' => '
',
- '#type' => $datetype,
- '#title' => t('Publish date'),
- '#default_value' => $default,
- '#date_label_position' => 'within',
- '#date_increment' => 15,
- '#date_year_range' => '-3:+3',
- '#date_format' => 'Y-m-d H:i',
- );
- if ($datetype == 'date') { // include a time field element
- $form['gradebookapi']['publish_time'] = array(
- '#type' => 'test_time',
- '#title' => t('Publish time'),
- '#default_value' => variable_get('publish_time', array('hour' => 12, 'minute' => 0, 'meridiem' => 'pm')),
- );
- }
- $form['#submit'][] = 'gradebookapi_assignment_submit';
if (isset($oldtid)) {
$form['gradebookapi']['oldtid'] = array('#type' => 'hidden', '#value' => $oldtid);
}
@@ -880,57 +792,6 @@ function gradebookapi_assignment_form_elements($node) {
}
/**
- * Implementation of hook_validate().
- * Verify the form elements have acceptable values.
- * @param $node
- * the assignment node
- * @param $form
- * the $form parameter passed from node_validate
- * @return NONE
- */
-function gradebookapi_assignment_validate($node, $form = NULL) {
- require_once('gradebook.datetime.inc');
- if ($node) {
- if (_gradebookapi_usedateapi()) {
- $due_date = _gradebookapi_datepopup2unixtime($node->due_date);
- $publish_date = _gradebookapi_datepopup2unixtime($node->publish_date);
- }
- else {
- $due_date = _gradebookapi_drupaldate2unixtime($node->due_date);
- $publish_date = _gradebookapi_drupaldate2unixtime($node->publish_date);
- }
- if ($publish_date >= $due_date) {
- form_set_error('publish_date', t('The publish date of an assignment must be before its due date.'));
- }
- }
-}
-
-/**
- * Implementation of hook_submit().
- * This checks if the assignment should be marked as published.
- */
-function gradebookapi_assignment_submit($form, &$form_state) {
- require_once('gradebook.datetime.inc');
- if (_gradebookapi_usedateapi()) {
- $due_date = _gradebookapi_datepopup2unixtime($form_state['values']['due_date']);
- $publish_date = _gradebookapi_datepopup2unixtime($form_state['values']['publish_date']);
- }
- else {
- $due_date = _gradebookapi_drupaldate2unixtime($form_state['values']['due_date']);
- $publish_date = _gradebookapi_drupaldate2unixtime($form_state['values']['publish_date']);
- }
-
- $now = time();
- $form_state['values']['status'] = ($now >= $publish_date);
- if ($form_state['values']['status']) {
- drupal_set_message(t('The assignment is currently active.'));
- }
- else {
- drupal_set_message(t('The assignment will become active on !date.', array('!date' => format_date($publish_date, 'small'))));
- }
-}
-
-/**
* Implementation of hook_form_alter().
*
* @return NONE
@@ -972,9 +833,6 @@ function gradebookapi_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
case 'view':
gradebookapi_assignment_view($node, $a3, $a4);
break;
- case 'validate':
- gradebookapi_assignment_validate($node, $a3);
- break;
}
}
}
@@ -1103,68 +961,6 @@ function gradebookapi_get_teachers($gradebook) {
}
/**
- * Implementation of hook_cron().
- *
- * This function allows gradebookapi to insert its own actions when
- * the cron.php script is run usually by the system cron system. This is useful
- * when performing periodic asynchronous tasks like, as in this case, checking to
- * see if any assignments should be published.
- *
- * @return
- * Nothing.
- *
- * More detail at @link http://api.drupal.org/api/HEAD/function/hook_cron API page @endlink .
- */
-function gradebookapi_cron() {
- $types = (array)gradebookapi_get_assignment_types();
-
- // Mark ready assignments as published.
- $sql = "UPDATE {node} SET status = 1 WHERE type IN ( '". implode("', '", $types) ."') AND status = 0 AND nid IN (SELECT nid FROM {gradebookapi_assignment} WHERE publish_date <= %d)";
- $the_time = time();
- $query_result = db_query($sql, $the_time);
- //watchdog('gradebookapi', 'Checking assignment status using %sql at timestamp %time, returned %res.', array('%res' => $query_result, '%time' => $the_time, '%sql' => $sql), WATCHDOG_INFO);
-
-}
-
-/**
- *
- */
-function _gradebookapi_assignment_status(&$node) {
- require_once('gradebook.datetime.inc');
- if (_gradebookapi_usedateapi()) {
- $node->publish_date = _gradebookapi_datepopup2unixtime($node->publish_date);
- $node->due_date = _gradebookapi_datepopup2unixtime($node->due_date);
- }
- else {
- $node->publish_date = _gradebookapi_drupaldate2unixtime($node->publish_date);
- $node->due_date = _gradebookapi_drupaldate2unixtime($node->due_date);
- }
- $now = time();
- $node->status = ($now > $node->publish_date) ? 1 : 0;
-}
-
-/**
- * Theme the assignment due date.
- *
- * @param $due_date
- * The date array.
- *
- * @return
- * The HTML string ready to display/
- */
-function theme_gradebookapi_assignment_due_date($due_date) {
- $output = ''. t('Assignment is due on') .' ';
- $output .= ''. format_date($due_date, 'custom', 'F j, Y');
- $output .= t(' at ') . format_date($due_date, 'custom', 'h:i a') .'';
- $output .= '
';
- return $output;
-}
-
-function _gradebookapi_usedateapi() {
- return (module_exists('date_popup') && variable_get('gradebookapi_use_dateapi', FALSE));
-}
-
-/**
* gradebookapi_load_marks().
* Gradebook UI modules can provide marks to replace numerical grades.
* This is done by defining a function hook_gradebookapi_marks that returns a string of not more than
diff --git a/modules/gradebook/gradebookapi.views.inc b/modules/gradebook/gradebookapi.views.inc
--- a/modules/gradebook/gradebookapi.views.inc
+++ b/modules/gradebook/gradebookapi.views.inc
@@ -45,38 +45,6 @@ function gradebookapi_views_data() {
),
);
- // Due_date.
- $data['gradebookapi_assignment']['due_date'] = array(
- 'title' => t('Due Date'),
- 'help' => t('Date on which the Gradebook Assignment is due.'),
- 'field' => array(
- 'handler' => 'views_handler_field_date',
- 'click sortable' => TRUE,
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_date',
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- );
-
- // Publish_date.
- $data['gradebookapi_assignment']['publish_date'] = array(
- 'title' => t('Publish Date'),
- 'help' => t('Date on which the Gradebook Assignment was published.'),
- 'field' => array(
- 'handler' => 'views_handler_field_date',
- 'click sortable' => TRUE,
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_date',
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- );
-
// Possible.
$data['gradebookapi_assignment']['possible'] = array(
'title' => t('Possible'),
@@ -131,20 +99,3 @@ function gradebookapi_views_data() {
return $data;
}
-/**
- * Implementation of hook_date_api_fields().
- */
-function gradebookapi_date_api_fields($field) {
- if ($field == 'gradebookapi_assignment.publish_date') {
- return array(
- 'sql_type' => DATE_UNIX, // DATE_ISO or DATE_UNIX or DATE_DATETIME
- 'tz_handling' => 'site', // 'site' or 'none' or 'date' or 'utc'
- );
- }
- if ($field == 'gradebookapi_assignment.due_date') {
- return array(
- 'sql_type' => DATE_UNIX, // DATE_ISO or DATE_UNIX or DATE_DATETIME
- 'tz_handling' => 'site', // 'site' or 'none' or 'date' or 'utc'
- );
- }
-}