Permalink
Browse files

Added preference to allow for default attendance status for unedited

rolls.  (it used to be just 'present' now it can be any of the three.
  • Loading branch information...
jungwirr
jungwirr committed Sep 19, 2003
1 parent 233c877 commit cddc26f6fbd27c69150143928e6d2434654c7173
Showing with 60 additions and 58 deletions.
  1. +18 −18 mod/attendance/db/mysql.php
  2. +30 −30 mod/attendance/db/mysql.sql
  3. +2 −1 mod/attendance/lib.php
  4. +9 −8 mod/attendance/mod.html
  5. +1 −1 mod/attendance/version.php
@@ -1,18 +1,18 @@
<?PHP
function attendance_upgrade($oldversion) {
/// This function does anything necessary to upgrade
/// older versions to match current functionality
global $CFG;
if ($oldversion < 2003091001) {
# Do something ...
}
return true;
}
?>
<?PHP
function attendance_upgrade($oldversion) {
/// This function does anything necessary to upgrade
/// older versions to match current functionality
global $CFG;
if ($oldversion < 2003091801) {
execute_sql("ALTER TABLE `attendance` ADD `edited` TINYINT( 1 ) DEFAULT '0' NOT NULL;");
execute_sql("UPDATE `attendance` set `edited` = 1;");
}
return true;
}
?>
@@ -1,30 +1,30 @@
#
# Table structure for table `prefix_attendance`
#
CREATE TABLE prefix_attendance (
id int(10) unsigned NOT NULL auto_increment,
name varchar(255) NOT NULL default '',
course int(10) NOT NULL default '0',
day int(10) unsigned NOT NULL default '0',
hours tinyint(1) NOT NULL default '0',
roll tinyint(1) NOT NULL default '0',
notes varchar(64) NOT NULL default '',
timemodified int(10) unsigned NOT NULL default '0',
dynsection tinyint(1) NOT NULL default '0',
PRIMARY KEY (id)
) TYPE=MyISAM;
#
# Table structure for table `prefix_attendance_roll`
#
CREATE TABLE prefix_attendance_roll (
id int(11) NOT NULL auto_increment,
dayid int(10) unsigned NOT NULL default '0',
userid int(11) NOT NULL default '0',
hour tinyint(1) unsigned NOT NULL default '0',
status int(11) NOT NULL default '0',
notes varchar(64) NOT NULL default '',
PRIMARY KEY (id)
) TYPE=MyISAM;
#
# Table structure for table `prefix_attendance`
#
CREATE TABLE prefix_attendance (
id int(10) unsigned NOT NULL auto_increment,
name varchar(255) NOT NULL default '',
course int(10) NOT NULL default '0',
day int(10) unsigned NOT NULL default '0',
hours tinyint(1) NOT NULL default '0',
roll tinyint(1) NOT NULL default '0',
notes varchar(64) NOT NULL default '',
timemodified int(10) unsigned NOT NULL default '0',
dynsection tinyint(1) NOT NULL default '0',
PRIMARY KEY (id)
) TYPE=MyISAM;
#
# Table structure for table `prefix_attendance_roll`
#
CREATE TABLE prefix_attendance_roll (
id int(11) NOT NULL auto_increment,
dayid int(10) unsigned NOT NULL default '0',
userid int(11) NOT NULL default '0',
hour tinyint(1) unsigned NOT NULL default '0',
status int(11) NOT NULL default '0',
notes varchar(64) NOT NULL default '',
PRIMARY KEY (id)
) TYPE=MyISAM;
View
@@ -42,7 +42,7 @@ function attendance_add_instance($attendance) {
if (isset($attendance->notes)) {
$attendance->name = $attendance->name . " - " . $attendance->notes;
}
$attendance->edited = 0;
if ($attendance->dynsection) {
if ($mod->course) {
if (! $course = get_record("course", "id", $mod->course)) {
@@ -66,6 +66,7 @@ function attendance_add_instance($attendance) {
function attendance_update_instance($attendance) {
global $mod;
$attendance->edited = 1;
$attendance->timemodified = time();
// $attendance->oldid=$attendance->id;
$attendance->id = $attendance->instance;
View
@@ -106,15 +106,16 @@
for($j=1;$j<=$form->hours;$j++) {
// set the attendance defaults for each student
$r1c=$r2c=$r3c=" ";
if ($sroll[$student->id][$j]->status == 1) {$r2c="checked";}
elseif ($sroll[$student->id][$j]->status == 2) {$r3c="checked";}
else {$r1c="checked";}
$radio1="<input type=\"radio\" name=\"student_".$student->id."_".$j."\" value=\"0\" ".$r1c.">";
$rollstatus = (($form->edited==0)?$CFG->attendance_default_student_status:$sroll[$student->id][$j]->status);
if ($rollstatus==1) {$r2c="checked";}
elseif ($rollstatus==2) {$r3c="checked";}
else {$r1c="checked";}
$radio1="<input type=\"radio\" name=\"student_".$student->id."_".$j."\" value=\"0\" ".$r1c.">";
$radio2="<input type=\"radio\" name=\"student_".$student->id."_".$j."\" value=\"1\" ".$r2c.">";
$radio3="<input type=\"radio\" name=\"student_".$student->id."_".$j."\" value=\"2\" ".$r3c.">";
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-left: 1px dotted; border-top: 1px solid;\">".$radio1."</td>\n";
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$radio2."</td>\n";
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$radio3."</td>\n";
$radio3="<input type=\"radio\" name=\"student_".$student->id."_".$j."\" value=\"2\" ".$r3c.">";
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-left: 1px dotted; border-top: 1px solid;\">".$radio1."</td>\n";
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$radio2."</td>\n";
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$radio3."</td>\n";
} // for loop
echo "</tr>\n";
// $radio1="<input type=\"radio\" name=\"student_".$student->id."\" value=\"0\" checked>";
@@ -5,7 +5,7 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2003091800; // The current module version (Date: YYYYMMDDXX)
$module->version = 2003091801; // The current module version (Date: YYYYMMDDXX)
$module->cron = 0; // Period for cron to check this module (secs)
?>

0 comments on commit cddc26f

Please sign in to comment.