Browse Source

Solved installation errors. Fixed some database queries.

MOODLE_23_STABLE
Luis Ramon Lopez 14 years ago
parent
commit
d7c45d3ed8
  1. 11
      CHANGES
  2. 20
      attendances.php
  3. 10
      db/install.xml
  4. 3
      locallib.php
  5. 2
      manage.php

11
CHANGES

@ -1,3 +1,14 @@
2011-01-15 lrlopez
* db/install.xml:
Bugs fixed.
* attendances.php: locallib.php: manage.php:
Fixed some minor bugs and code readibility issues. Now, in grid view
mode, statuses are always next to their radio buttons.
2010-12-30 - 2011-01-04 lrlopez 2010-12-30 - 2011-01-04 lrlopez
* lang/: es_utf8/attforblock.php: * lang/: es_utf8/attforblock.php:

20
attendances.php

@ -58,7 +58,7 @@
$i++; $i++;
} }
} }
$attforblockrecord = get_record('attforblock', 'course', $course->id); $attforblockrecord = get_record('attforblock', 'id', $cm->instance);//'course', $course->id);
foreach($students as $student) { foreach($students as $student) {
if ($log = get_record('attendance_log', 'sessionid', $sessionid, 'studentid', $student->studentid)) { if ($log = get_record('attendance_log', 'sessionid', $sessionid, 'studentid', $student->studentid)) {
@ -104,17 +104,17 @@
$currentgroup = groups_get_activity_group($cm, true); $currentgroup = groups_get_activity_group($cm, true);
// get the viewmode & grid columns (default is set in module settings) // get the viewmode & grid columns (default is set in module settings)
$attforblockrecord = get_record('attforblock', 'course', $course->id); $attforblockrecord = get_record('attforblock', 'id', $cm->instance);//'course', $course->id);'course', $course->id);
$view = optional_param('view', get_user_preferences("attforblock_viewmode",0), PARAM_INT); $view = optional_param('view', get_user_preferences("attforblock_viewmode", SORTEDLISTVIEW), PARAM_INT);
$gridcols = optional_param('gridcols', get_user_preferences("attforblock_gridcolumns",5), PARAM_INT); $gridcols = optional_param('gridcols', get_user_preferences("attforblock_gridcolumns",5), PARAM_INT);
echo '<center>'; echo '<center>';
$options = array (0 => get_string('sortedlist','attforblock'), 1 => get_string('sortedgrid','attforblock')); $options = array (SORTEDLISTVIEW => get_string('sortedlist','attforblock'), SORTEDGRIDVIEW => get_string('sortedgrid','attforblock'));
$data = "attendances.php?id=$id&sessionid=$sessionid&grouptype=$grouptype&gridcols=$gridcols"; $data = "attendances.php?id=$id&sessionid=$sessionid&grouptype=$grouptype&gridcols=$gridcols";
if ($group!=-1) { if ($group!=-1) {
$data = $data . "&group=$group"; $data = $data . "&group=$group";
} }
popup_form("$data&view=", $options, 'viewmenu', $view, ''); popup_form("$data&view=", $options, 'viewmenu', $view, '');
if ($view==1) { if ($view == SORTEDGRIDVIEW) {
set_user_preference("attforblock_viewmode", $view); set_user_preference("attforblock_viewmode", $view);
set_user_preference("attforblock_gridcolumns", $gridcols); set_user_preference("attforblock_gridcolumns", $gridcols);
$options = array (1 => '1 '.get_string('column','attforblock'),'2 '.get_string('columns','attforblock'),'3 '.get_string('columns','attforblock'), $options = array (1 => '1 '.get_string('column','attforblock'),'2 '.get_string('columns','attforblock'),'3 '.get_string('columns','attforblock'),
@ -154,10 +154,10 @@
$i = 3; $i = 3;
foreach($statuses as $st) { foreach($statuses as $st) {
switch($view) { switch($view) {
case 0: case SORTEDLISTVIEW:
$tabhead[] = "<a href=\"javascript:select_all_in('TD', 'cell c{$i}', null);\"><u>$st->acronym</u></a>"; $tabhead[] = "<a href=\"javascript:select_all_in('TD', 'cell c{$i}', null);\"><u>$st->acronym</u></a>";
break; break;
case 1: case SORTEDGRIDVIEW:
$tabhead[] = "<a href=\"javascript:select_all_in('INPUT', '". $st->acronym . "', null);\"><u>$st->acronym</u></a>"; $tabhead[] = "<a href=\"javascript:select_all_in('INPUT', '". $st->acronym . "', null);\"><u>$st->acronym</u></a>";
break; break;
} }
@ -179,7 +179,7 @@
unset($table); unset($table);
switch($view) { switch($view) {
case 0: // sorted list case SORTEDLISTVIEW: // sorted list
$table->width = '0%'; $table->width = '0%';
$table->head[] = '#'; $table->head[] = '#';
$table->align[] = 'center'; $table->align[] = 'center';
@ -212,7 +212,7 @@
$table->data[$student->id][] = '<input type="text" name="remarks'.$student->id.'" size="" value="'.($att ? $att->remarks : '').'">'; $table->data[$student->id][] = '<input type="text" name="remarks'.$student->id.'" size="" value="'.($att ? $att->remarks : '').'">';
} }
break; break;
case 1: // sorted grid case SORTEDGRIDVIEW: // sorted grid
$table->width = '0%'; $table->width = '0%';
$data = ''; $data = '';
@ -237,7 +237,7 @@
$data = "<span class='userinfobox' style='font-size:80%;border:none'>" . print_user_picture($student, $course->id, $student->picture, true, true, '', fullname($student)) . "<br/>" . fullname($student) . "<br/></span>";//, $returnstring=false, $link=true, $target=''); $data = "<span class='userinfobox' style='font-size:80%;border:none'>" . print_user_picture($student, $course->id, $student->picture, true, true, '', fullname($student)) . "<br/>" . fullname($student) . "<br/></span>";//, $returnstring=false, $link=true, $target='');
foreach($statuses as $st) { foreach($statuses as $st) {
$data = $data . '<input name="student'.$student->id.'" type="radio" class="' . $st->acronym . '" value="'.$st->id.'" '.($st->id == $att->statusid ? 'checked' : '').'>' . $st->acronym; $data = $data . '<nobr><input name="student'.$student->id.'" type="radio" class="' . $st->acronym . '" value="'.$st->id.'" '.($st->id == $att->statusid ? 'checked' : '').'>' . $st->acronym . "</nobr> ";
} }
$table->data[($i-1) / ($gridcols)][] = $data; $table->data[($i-1) / ($gridcols)][] = $data;
} }

10
db/install.xml

@ -24,7 +24,7 @@
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="groupid"/> <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="groupid"/>
<FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="attendanceid"/> <FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="attendanceid"/>
<FIELD NAME="attendanceid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="groupid" NEXT="sessdate"/> <FIELD NAME="attendanceid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="groupid" NEXT="sessdate"/>
<FIELD NAME="sessdate" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="groupid" NEXT="duration"/> <FIELD NAME="sessdate" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="attendanceid" NEXT="duration"/>
<FIELD NAME="duration" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="sessdate" NEXT="lasttaken"/> <FIELD NAME="duration" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="sessdate" NEXT="lasttaken"/>
<FIELD NAME="lasttaken" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="duration" NEXT="lasttakenby"/> <FIELD NAME="lasttaken" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="duration" NEXT="lasttakenby"/>
<FIELD NAME="lasttakenby" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="lasttaken" NEXT="timemodified"/> <FIELD NAME="lasttakenby" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="lasttaken" NEXT="timemodified"/>
@ -38,7 +38,7 @@
<INDEX NAME="courseid" UNIQUE="false" FIELDS="courseid" NEXT="groupid"/> <INDEX NAME="courseid" UNIQUE="false" FIELDS="courseid" NEXT="groupid"/>
<INDEX NAME="groupid" UNIQUE="false" FIELDS="groupid" PREVIOUS="courseid" NEXT="attendanceid"/> <INDEX NAME="groupid" UNIQUE="false" FIELDS="groupid" PREVIOUS="courseid" NEXT="attendanceid"/>
<INDEX NAME="attendanceid" UNIQUE="false" FIELDS="attendanceid" PREVIOUS="groupid" NEXT="sessdate"/> <INDEX NAME="attendanceid" UNIQUE="false" FIELDS="attendanceid" PREVIOUS="groupid" NEXT="sessdate"/>
<INDEX NAME="sessdate" UNIQUE="false" FIELDS="sessdate" PREVIOUS="groupid"/> <INDEX NAME="sessdate" UNIQUE="false" FIELDS="sessdate" PREVIOUS="attendanceid"/>
</INDEXES> </INDEXES>
</TABLE> </TABLE>
<TABLE NAME="attendance_log" COMMENT="attendance_log table retrofitted from MySQL" PREVIOUS="attendance_sessions" NEXT="attendance_statuses"> <TABLE NAME="attendance_log" COMMENT="attendance_log table retrofitted from MySQL" PREVIOUS="attendance_sessions" NEXT="attendance_statuses">
@ -64,7 +64,8 @@
<TABLE NAME="attendance_statuses" COMMENT="attendance_statuses table retrofitted from MySQL" PREVIOUS="attendance_log"> <TABLE NAME="attendance_statuses" COMMENT="attendance_statuses table retrofitted from MySQL" PREVIOUS="attendance_log">
<FIELDS> <FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="courseid"/> <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="courseid"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="acronym"/> <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="attendanceid"/>
<FIELD NAME="attendanceid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="acronym"/>
<FIELD NAME="acronym" TYPE="char" LENGTH="2" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="description"/> <FIELD NAME="acronym" TYPE="char" LENGTH="2" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="description"/>
<FIELD NAME="description" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="acronym" NEXT="grade"/> <FIELD NAME="description" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="acronym" NEXT="grade"/>
<FIELD NAME="grade" TYPE="int" LENGTH="3" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="description" NEXT="visible"/> <FIELD NAME="grade" TYPE="int" LENGTH="3" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="description" NEXT="visible"/>
@ -75,7 +76,8 @@
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for attendance_settings"/> <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for attendance_settings"/>
</KEYS> </KEYS>
<INDEXES> <INDEXES>
<INDEX NAME="courseid" UNIQUE="false" FIELDS="courseid" NEXT="visible"/> <INDEX NAME="courseid" UNIQUE="false" FIELDS="courseid" NEXT="attendanceid"/>
<INDEX NAME="attendanceid" UNIQUE="false" FIELDS="visible" PREVIOUS="courseid" NEXT="visible"/>
<INDEX NAME="visible" UNIQUE="false" FIELDS="visible" PREVIOUS="courseid" NEXT="deleted"/> <INDEX NAME="visible" UNIQUE="false" FIELDS="visible" PREVIOUS="courseid" NEXT="deleted"/>
<INDEX NAME="deleted" UNIQUE="false" FIELDS="deleted" PREVIOUS="visible"/> <INDEX NAME="deleted" UNIQUE="false" FIELDS="deleted" PREVIOUS="visible"/>
</INDEXES> </INDEXES>

3
locallib.php

@ -12,6 +12,9 @@ define('WITHOUT_SELECTOR', 0);
define('GROUP_SELECTOR', 1); define('GROUP_SELECTOR', 1);
define('SESSION_TYPE_SELECTOR', 2); define('SESSION_TYPE_SELECTOR', 2);
define('SORTEDLISTVIEW', 0);
define('SORTEDGRIDVIEW', 1);
function show_tabs($cm, $context, $currenttab='sessions') function show_tabs($cm, $context, $currenttab='sessions')
{ {
$toprow = array(); $toprow = array();

2
manage.php

@ -95,7 +95,7 @@
function print_sessions_list($course, $attforblock) { function print_sessions_list($course, $attforblock) {
global $CFG, $context, $cm, $current, $view, $id; global $CFG, $context, $cm, $current, $view, $id, $showendtime;
$strhours = get_string('hours'); $strhours = get_string('hours');
$strmins = get_string('min'); $strmins = get_string('min');

Loading…
Cancel
Save