
# $B3F9V5A$N=P7g%G!<%?(B
#    sessdata $B3:EvF|IU(B
#    takeby $B=P7g$r:N$C$?%f!<%6$N(BID $B<+F0!$H><+F0$N>l9g$OFC<l$JHV9f(B
#    method $B=P7g$r:N$kJ}K!!!(BM:$B<jF0(B($B650w$,<jF0$G$D$1$k(B)$B!$(BS:$BH><+F0(B($B3X@8$,%\%?%s$r%/%j%C%/(B)$B!$(BA:$B<+F0(B
#
CREATE TABLE `prefix_autoattend_sessions` (
  `id`           int(10) NOT NULL auto_increment,
  `courseid`     int(10) NOT NULL default '0',
  `creator`      int(10) NOT NULL default '0',
  `sessdate`     int(10) NOT NULL default '0',
  `takenby`      int(10) NOT NULL default '0',
  `timetaken`    int(10) NOT NULL default '0',
  `timemodified` int(10) NOT NULL default '0',

  `method`       char(1) NOT NULL default 'S',
  `state`        char(1) NOT NULL default 'N',
  `starttime`    int(10) NOT NULL default '0',
  `latetime`     int(10) NOT NULL default '0',
  `endtime`      int(10) NOT NULL default '0',
  `denysameip`   tinyint(2) NOT NULL default '1',

  `attendkey`    varchar(36)  default '',
  `allowip`      varchar(128) default '',
  `description`  varchar(128) NULL default '',

  PRIMARY KEY  (`id`),
  INDEX `courseid`  (`courseid`),
  INDEX `sessdate`  (`sessdate`),
  INDEX `starttime` (`starttime`)
);



#
# $B3X@8$N%G!<%?(B
#
CREATE TABLE `prefix_autoattend_students` (
  `id`        	int(10) NOT NULL auto_increment,
  `attsid`    	int(10) NOT NULL default '0',
  `studentid` 	int(10) NOT NULL default '0',
  `status`    	char(1) NOT NULL default 'Y',
  `called`    	char(1) NOT NULL default 'D',
  `calledby`  	int(10) NOT NULL default '0',
  `calledtime`  int(10) NOT NULL default '0',
  `remarks`   	varchar(50) default '',
  `ipaddress` 	varchar(20) default '',

  PRIMARY KEY  (`id`),
  INDEX `attsid`    (`attsid`),
  INDEX `studentid` (`studentid`),
  INDEX `status`    (`status`)
);



CREATE TABLE `prefix_autoattend_settings` (
  `id`          int(10) NOT NULL auto_increment,
  `courseid`    int(10) NOT NULL default '0',
  `status`      char(1) NOT NULL default 'Y',
  `grade`       tinyint(5) NOT NULL default '0',
  
  PRIMARY KEY  (`id`),
  INDEX `courseid` (`courseid`),
  INDEX `status` (`status`)

) COMMENT='Attendance settings';



INSERT INTO `prefix_autoattend_settings` VALUES (0, 0, 'P', '2');
INSERT INTO `prefix_autoattend_settings` VALUES (0, 0, 'L', '1');
INSERT INTO `prefix_autoattend_settings` VALUES (0, 0, 'E', '1');
INSERT INTO `prefix_autoattend_settings` VALUES (0, 0, 'X', '0');
INSERT INTO `prefix_autoattend_settings` VALUES (0, 0, 'Y', '0');

