Browse Source

Partial $OUTPUT fixes. Lots of work still ahead

MOODLE_23_STABLE
Luis Ramon Lopez 14 years ago
parent
commit
40797e8cbf
  1. 46
      attendances.php
  2. 33
      db/access.php
  3. 60
      db/install.xml
  4. 8
      db/upgrade.php
  5. 1
      lang/en/attforblock.php
  6. 13
      lang/es/attforblock.php
  7. 12
      lib.php
  8. 8
      locallib.php
  9. 32
      manage.php
  10. 0
      pix/icon.gif
  11. 4
      version.php

46
attendances.php

@ -59,7 +59,7 @@
$i++;
}
}
$attforblockrecord = $DB->get_record('attforblock', array('course' => $course->id));
$attforblockrecord = $DB->get_record('attforblock', array('attendanceid' => $attforblock->id));
foreach($students as $student) {
if ($log = $DB->get_record('attendance_log', array('sessionid' => $sessionid, 'studentid'=> $student->studentid))) {
@ -79,11 +79,22 @@
}
/// Print headers
$navlinks[] = array('name' => $attforblock->name, 'link' => "view.php?id=$id", 'type' => 'activity');
$url = new moodle_url('/mod/attforblock/manage.php', array('id'=> $id, 'sessionid'=> $sessionid, 'grouptype' => $grouptype, 'group' => $group, 'sort' => $sort, 'copyfrom' => $copyfrom));
$PAGE->set_url($url);
$PAGE->set_title($course->shortname. ": ".$attforblock->name . ' - ' .get_string('update','attforblock'));
$PAGE->set_heading($course->fullname);
$PAGE->set_focuscontrol('');
$PAGE->set_cacheable(true);
$PAGE->set_button($OUTPUT->update_module_button($cm->id,'attforblock'));
$PAGE->navbar->add($attforblock->name);
echo $OUTPUT->header();
/*$navlinks[] = array('name' => $attforblock->name, 'link' => "view.php?id=$id", 'type' => 'activity');
$navlinks[] = array('name' => get_string('update', 'attforblock'), 'link' => null, 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
print_header("$course->shortname: ".$attforblock->name.' - ' .get_string('update','attforblock'), $course->fullname,
$navigation, "", "", true, " ", navmenu($course));
$navigation, "", "", true, " ", navmenu($course));*/
//check for hack
if (!$sessdata = $DB->get_record('attendance_sessions', array('id'=> $sessionid))) {
@ -97,7 +108,7 @@
print_heading(get_string('update','attforblock').' ' .get_string('attendanceforthecourse','attforblock').' :: ' .$course->fullname.$help);
} else {
require_capability('mod/attforblock:takeattendances', $context);
print_heading(get_string('attendanceforthecourse','attforblock').' :: ' .$course->fullname.$help);
echo $OUTPUT->heading(get_string('attendanceforthecourse','attforblock').' :: ' .$course->fullname.$help);
}
/// find out current groups mode
@ -105,7 +116,7 @@
$currentgroup = groups_get_activity_group($cm, true);
// get the viewmode & grid columns
$attforblockrecord = get_record('attforblock', 'id', $cm->instance);//'course', $course->id);'course', $course->id);
$attforblockrecord = $DB->get_record('attforblock', array('id'=> $cm->instance));//'course', $course->id);'course', $course->id);
$view = optional_param('view', -1, PARAM_INT);
if ($view != -1) {
set_user_preference("attforblock_viewmode", $view);
@ -123,7 +134,7 @@
echo '<table class="controls" cellspacing="0"><tr>'; //echo '<center>';
$options = array (SORTEDLISTVIEW => get_string('sortedlist','attforblock'), SORTEDGRIDVIEW => get_string('sortedgrid','attforblock'));
$dataurl = "attendances.php?id=$id&grouptype=$grouptype&gridcols=$gridcols";
$dataurl = "/mod/attforblock/attendances.php?id=$id&grouptype=$grouptype&gridcols=$gridcols";
if ($group!=-1) {
$dataurl = $dataurl . "&group=$group";
}
@ -141,29 +152,32 @@
}
$optionssessions[$sessdatarow->id] = $descr;
}
popup_form("$dataurl&sessionid=", $optionssessions, 'fastsessionmenu', $sessionid, '');
//popup_form("$dataurl&sessionid=", $optionssessions, 'fastsessionmenu', $sessionid, '');
echo $OUTPUT->single_select(new moodle_url('/mod/attforblock/attendances.php', array('id'=> $id, 'grouptype' => $grouptype, 'group' => $group, 'sort' => $sort)),'sessionid',$optionssessions, $sessionid);
echo "<td/><tr/><tr>";
}
$dataurl .= "&sessionid=$sessionid";
echo '<td class="right"><label for="viewmenu_jump">'. get_string('viewmode','attforblock') . "&nbsp;</label>";
popup_form("$dataurl&view=", $options, 'viewmenu', $view, '');
//popup_form("$dataurl&view=", $options, 'viewmenu', $view, '');
echo $OUTPUT->single_select(new moodle_url('/mod/attforblock/attendances.php', array('id'=> $id, 'sessionid'=>$sessionid, 'grouptype' => $grouptype, 'group' => $group, 'sort' => $sort)),'view',$options, $view);
if ($view == SORTEDGRIDVIEW) {
$options = array (1 => '1 '.get_string('column','attforblock'),'2 '.get_string('columns','attforblock'),'3 '.get_string('columns','attforblock'),
'4 '.get_string('columns','attforblock'),'5 '.get_string('columns','attforblock'),'6 '.get_string('columns','attforblock'),
'7 '.get_string('columns','attforblock'),'8 '.get_string('columns','attforblock'),'9 '.get_string('columns','attforblock'),
'10 '.get_string('columns','attforblock'));
$dataurl .= "&view=$view";
popup_form("$dataurl&gridcols=", $options, 'colsmenu', $gridcols, '');
//popup_form("$dataurl&gridcols=", $options, 'colsmenu', $gridcols, '');
echo $OUTPUT->single_select(new moodle_url('/mod/attforblock/attendances.php', array('id'=> $id, 'sessionid'=>$sessionid, 'view'=>$view, 'grouptype' => $grouptype, 'group' => $group, 'sort' => $sort)),'gridcols',$options, $gridcols);
}
echo '</td></tr></table>';//</center>';
if ($grouptype === 0) {
if ($currentgroup) {
$students = get_users_by_capability($context, 'moodle/legacy:student', '', "u.$sort ASC", '', '', $currentgroup, '', false);
$students = get_users_by_capability($context, 'mod/attforblock:canbelisted', '', "u.$sort ASC", '', '', $currentgroup, '', false);
} else {
$students = get_users_by_capability($context, 'moodle/legacy:student', '', "u.$sort ASC", '', '', '', '', false);
$students = get_users_by_capability($context, 'mod/attforblock:canbelisted', '', "u.$sort ASC", '', '', '', '', false);
}
} else {
$students = get_users_by_capability($context, 'moodle/legacy:student', '', "u.$sort ASC", '', '', $grouptype, '', false);
$students = get_users_by_capability($context, 'mod/attforblock:canbelisted', '', "u.$sort ASC", '', '', $grouptype, '', false);
}
$sort = $sort == 'firstname' ? 'firstname' : 'lastname';
@ -180,6 +194,7 @@
$statuses = get_statuses($attforblock->id);
$i = 3;
$tabhead = array();
foreach($statuses as $st) {
switch($view) {
case SORTEDLISTVIEW:
@ -269,7 +284,7 @@
$currentstatusid = $att===false ? -1 : $att->statusid;
$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) {
$data = $data . '<nobr><input name="student'.$student->id.'" type="radio" class="' . $st->acronym . '" value="'.$st->id.'" '.($st->id == $currentstatusid ? 'checked' : '').'>' . $st->acronym . "</nobr> ";
$data = $data . '<nobr><input name="student'.$student->id.'" type="radio" class="' . $st->acronym . '" value="'.$st->id.'" '.($st->id == $currentstatusid ? 'checked' : '').'>&nbsp;' . $st->acronym . "</nobr> ";
}
$table->data[($i-1) / ($gridcols)][] = $data;
}
@ -288,7 +303,8 @@
if (count($todaysessions)>1) {
echo '<br/><table class="controls" cellspacing="0"><tr><td class="center">';
echo '<label for="copysessionmenu_jump">'. get_string('copyfrom','attforblock') . "&nbsp;</label>";
popup_form("$dataurl&copyfrom=", $optionssessions, 'copysessionmenu', $sessionid, '');
//popup_form("$dataurl&copyfrom=", $optionssessions, 'copysessionmenu', $sessionid, '');
echo $OUTPUT->single_select(new moodle_url('/mod/attforblock/attendances.php', array('id'=> $id, 'sessionid'=>$sessionid, 'grouptype' => $grouptype, 'group' => $group, 'sort' => $sort)),'copyfrom',$optionssessions, $sessionid);
echo '</td></tr></table>';
}
@ -301,6 +317,6 @@
echo $st->acronym.' - '.$st->description.'<br />';
}
print_footer($course);
$OUTPUT->footer($course);
?>

33
db/access.php

@ -40,8 +40,7 @@ $mod_attforblock_capabilities = array(
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
'editingteacher' => CAP_ALLOW
)
),
@ -53,8 +52,7 @@ $mod_attforblock_capabilities = array(
'contextlevel' => CONTEXT_MODULE,
'legacy' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
'editingteacher' => CAP_ALLOW
)
),
@ -66,8 +64,7 @@ $mod_attforblock_capabilities = array(
'contextlevel' => CONTEXT_MODULE,
'legacy' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
'editingteacher' => CAP_ALLOW
)
),
@ -79,8 +76,7 @@ $mod_attforblock_capabilities = array(
'contextlevel' => CONTEXT_MODULE,
'legacy' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
'editingteacher' => CAP_ALLOW
)
),
@ -91,8 +87,7 @@ $mod_attforblock_capabilities = array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'legacy' => array(
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
'editingteacher' => CAP_ALLOW
)
),
@ -103,8 +98,7 @@ $mod_attforblock_capabilities = array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'legacy' => array(
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
'editingteacher' => CAP_ALLOW
)
),
@ -115,8 +109,19 @@ $mod_attforblock_capabilities = array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'legacy' => array(
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
'editingteacher' => CAP_ALLOW
)
),
'mod/attforblock:canbelisted' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'legacy' => array(
'student' => CAP_ALLOW
)
)
);

60
db/install.xml

@ -6,10 +6,10 @@
<TABLES>
<TABLE NAME="attforblock" COMMENT="Module for support Attendances" NEXT="attendance_sessions">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" COMMENT="id of the table, please edit me" NEXT="course"/>
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="course" NEXT="grade"/>
<FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="100" SEQUENCE="false" ENUM="false" COMMENT="This is maximum grade for instance" PREVIOUS="name"/>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" COMMENT="id of the table, please edit me" NEXT="course"/>
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" PREVIOUS="course" NEXT="grade"/>
<FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="100" SEQUENCE="false" COMMENT="This is maximum grade for instance" PREVIOUS="name"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for attforblock"/>
@ -20,16 +20,16 @@
</TABLE>
<TABLE NAME="attendance_sessions" COMMENT="attendance_sessions table retrofitted from MySQL" PREVIOUS="attforblock" NEXT="attendance_log">
<FIELDS>
<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="groupid"/>
<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="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="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="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="lasttakenby" NEXT="description"/>
<FIELD NAME="description" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="timemodified"/>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="courseid"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="groupid"/>
<FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="courseid" NEXT="attendanceid"/>
<FIELD NAME="attendanceid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="groupid" NEXT="sessdate"/>
<FIELD NAME="sessdate" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="attendanceid" NEXT="duration"/>
<FIELD NAME="duration" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="sessdate" NEXT="lasttaken"/>
<FIELD NAME="lasttaken" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="duration" NEXT="lasttakenby"/>
<FIELD NAME="lasttakenby" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="lasttaken" NEXT="timemodified"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="lasttakenby" NEXT="description"/>
<FIELD NAME="description" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="timemodified"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for attendance_sessions"/>
@ -43,14 +43,14 @@
</TABLE>
<TABLE NAME="attendance_log" COMMENT="attendance_log table retrofitted from MySQL" PREVIOUS="attendance_sessions" NEXT="attendance_statuses">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="sessionid"/>
<FIELD NAME="sessionid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="studentid"/>
<FIELD NAME="studentid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="sessionid" NEXT="statusid"/>
<FIELD NAME="statusid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="link with attendance_status table" PREVIOUS="studentid" NEXT="statusset"/>
<FIELD NAME="statusset" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="statusid" NEXT="timetaken"/>
<FIELD NAME="timetaken" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="When attendance of this student was taken" PREVIOUS="statusset" NEXT="takenby"/>
<FIELD NAME="takenby" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timetaken" NEXT="remarks"/>
<FIELD NAME="remarks" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="takenby"/>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="sessionid"/>
<FIELD NAME="sessionid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="studentid"/>
<FIELD NAME="studentid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="sessionid" NEXT="statusid"/>
<FIELD NAME="statusid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="link with attendance_status table" PREVIOUS="studentid" NEXT="statusset"/>
<FIELD NAME="statusset" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" PREVIOUS="statusid" NEXT="timetaken"/>
<FIELD NAME="timetaken" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="When attendance of this student was taken" PREVIOUS="statusset" NEXT="takenby"/>
<FIELD NAME="takenby" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="timetaken" NEXT="remarks"/>
<FIELD NAME="remarks" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" PREVIOUS="takenby"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for attendance_log"/>
@ -63,14 +63,14 @@
</TABLE>
<TABLE NAME="attendance_statuses" COMMENT="attendance_statuses table retrofitted from MySQL" PREVIOUS="attendance_log">
<FIELDS>
<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="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="attendanceid" NEXT="description"/>
<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="visible" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="grade" NEXT="deleted"/>
<FIELD NAME="deleted" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="visible"/>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="courseid"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="attendanceid"/>
<FIELD NAME="attendanceid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="courseid" NEXT="acronym"/>
<FIELD NAME="acronym" TYPE="char" LENGTH="2" NOTNULL="true" SEQUENCE="false" PREVIOUS="attendanceid" NEXT="description"/>
<FIELD NAME="description" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false" PREVIOUS="acronym" NEXT="grade"/>
<FIELD NAME="grade" TYPE="int" LENGTH="3" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="description" NEXT="visible"/>
<FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" PREVIOUS="grade" NEXT="deleted"/>
<FIELD NAME="deleted" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="visible"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for attendance_settings"/>

8
db/upgrade.php

@ -241,11 +241,11 @@ function xmldb_attforblock_upgrade($oldversion=0) {
$table = new xmldb_table('attendance_sessions');
$field = new xmldb_field('attendanceid');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'groupid');
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'groupid');
$dbman->add_field($table, $field);
$index = new xmldb_table('attendanceid');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('attendanceid'));
$index->set_attributes(XMLDB_INDEX_NOTUNIQUE, array('attendanceid'));
$dbman->add_index($table, $index);
$sql = "UPDATE {attendance_sessions} AS ses,{attforblock} AS att SET ses.attendanceid=att.id WHERE att.course=ses.courseid";
@ -254,10 +254,10 @@ function xmldb_attforblock_upgrade($oldversion=0) {
$table = new xmldb_table('attendance_statuses');
$field = new xmldb_field('attendanceid');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'courseid');
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'courseid');
$dbman->add_field($table, $field);
$index = new xmldb_index('attendanceid');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('attendanceid'));
$index->set_attributes(XMLDB_INDEX_NOTUNIQUE, array('attendanceid'));
$dbman->add_index($table, $index);
$sql = "UPDATE {attendance_statuses} AS sta,{attforblock} AS att SET sta.attendanceid=att.id WHERE att.course=sta.courseid";

1
lang/en/attforblock.php

@ -24,6 +24,7 @@ $string['attendancepercent'] = 'Attendance percent';
$string['attendancereport'] = 'Attendance report';
$string['attendancesuccess'] = 'Attendance has been successfully taken';
$string['attendanceupdated'] = 'Attendance successfully updated';
$string['attforblock:canbelisted'] = 'Appears in the roster';
$string['attforblock:changepreferences'] = 'Changing Preferences';
$string['attforblock:changeattendances'] = 'Changing Attendances';
$string['attforblock:export'] = 'Export Reports';

13
lang/es/attforblock.php

@ -24,6 +24,7 @@ $string['attendancepercent'] = 'Porcentaje';
$string['attendancereport'] = 'Informe de Asistencia';
$string['attendancesuccess'] = 'Asistencia tomada con éxito';
$string['attendanceupdated'] = 'Asistencia actualizada con éxito';
$string['attforblock:canbelisted'] = 'Aparecer en la lista';
$string['attforblock:changeattendances'] = 'Cambiar Asistencias';
$string['attforblock:changepreferences'] = 'Cambiar preferencias';
$string['attforblock:export'] = 'Exportar Informes';
@ -128,12 +129,12 @@ $string['sortedlist'] = 'Lista alfabética';
$string['startofperiod'] = 'Fecha de comienzo';
$string['status'] = 'Estado';
$string['statusdeleted'] = 'Estado eliminado';
$string['strftimedm'] = '%%d.%%m';
$string['strftimedmy'] = '%%d.%%m.%%Y';
$string['strftimedmyhm'] = '%%d.%%m.%%Y %%H.%%M';
$string['strftimedmyw'] = '%%d.%%m.%%y&nbsp;(%%a)';
$string['strftimehm'] = '%%H:%%M';
$string['strftimeshortdate'] = '%%d.%%m.%%Y';
$string['strftimedm'] = '%d.%m';
$string['strftimedmy'] = '%d.%m.%Y';
$string['strftimedmyhm'] = '%d.%m.%Y %H.%M';
$string['strftimedmyw'] = '%d.%m.%y&nbsp;(%a)';
$string['strftimehm'] = '%H:%M';
$string['strftimeshortdate'] = '%d.%m.%Y';
$string['studentid'] = 'ID de Estudiante';
$string['takeattendance'] = 'Iniciar Asistencia';
$string['thiscourse'] = 'Este curso';

12
lib.php

@ -33,17 +33,7 @@ function attforblock_add_instance($attforblock) {
$attforblock->timemodified = time();
/*if ($att = get_record('attforblock', 'course', $attforblock->course)) {
$modnum = get_field('modules', 'id', 'name', 'attforblock');
if (!get_record('course_modules', 'course', $attforblock->course, 'module', $modnum)) {
delete_records('attforblock', 'course', $attforblock->course);
$attforblock->id = insert_record('attforblock', $attforblock);
/*} else {
return false;
}
} else {*/
$attforblock->id = insert_record('attforblock', $attforblock);
//}
$attforblock->id = $DB->insert_record('attforblock', $attforblock);
//Copy statuses for new instance from defaults
//if (!$DB->get_records('attendance_statuses', array('courseid'=> $attforblock->course))) {

8
locallib.php

@ -54,9 +54,9 @@ function get_statuses($attendanceid, $onlyvisible = true)
global $DB;
if ($onlyvisible) {
$result = get_records_select('attendance_statuses', "attendanceid = $attendanceid AND visible = 1 AND deleted = 0", 'grade DESC');
$result = $DB->get_records_select('attendance_statuses', "attendanceid = :aid AND visible = 1 AND deleted = 0", array('aid' => $attendanceid), 'grade DESC');
} else {
$result = get_records_select('attendance_statuses', "attendanceid = $attendanceid AND deleted = 0", 'grade DESC');
$result = $DB->get_records_select('attendance_statuses', "attendanceid = :aid AND deleted = 0", array('aid' => $attendanceid), 'grade DESC');
// $result = get_records('attendance_statuses', 'courseid', $courseid, 'grade DESC');
}
return $result;
@ -128,7 +128,7 @@ function get_maxgrade($userid, $course, $attendance)
$maxgrade = 0;
if ($logs) {
$stat_grades = records_to_menu(get_records('attendance_statuses', array('attendanceid'=> $attendance->id)), 'id', 'grade');
$stat_grades = $DB->records_to_menu($DB->get_records('attendance_statuses', array('attendanceid'=> $attendance->id)), 'id', 'grade');
foreach ($logs as $log) {
$ids = array_flip(explode(',', $log->statusset));
// $grades = array_intersect_key($stat_grades, $ids); // require PHP 5.1.0 and higher
@ -283,7 +283,7 @@ function print_user_attendaces($user, $cm, $attforblock, $course = 0, $printing
WHERE al.studentid = ?
GROUP BY cid
ORDER BY cid,aid asc";
$recs = get_records_sql($stqry, array($user->id));
$recs = $DB->get_records_sql($stqry, array($user->id));
foreach ($recs as $rec) {
echo '<hr />';
echo '<table border="0" cellpadding="0" cellspacing="0" width="100%" class="list1">';

32
manage.php

@ -7,7 +7,7 @@
require_once('locallib.php');
$id = required_param('id', PARAM_INT); // Course Module ID, or
$from = optional_param('from', PARAM_ACTION);
$from = optional_param('from', '', PARAM_ACTION);
$view = optional_param('view', NULL, PARAM_ALPHA); // which page to show
$current = optional_param('current', 0, PARAM_INT);
$showendtime = optional_param('showendtime', get_user_preferences("attforblock_showendtime",0), PARAM_INT);
@ -70,13 +70,18 @@
}
/// Print headers
$navlinks[] = array('name' => $attforblock->name, 'link' => null, 'type' => 'activity');
$navigation = build_navigation($navlinks);
print_header("$course->shortname: ".$attforblock->name, $course->fullname,
$navigation, "", "", true, update_module_button($cm->id, $course->id, get_string('modulename', 'attforblock')),
navmenu($course));
print_heading(get_string('attendanceforthecourse','attforblock').' :: ' .$course->fullname);
$url = new moodle_url('/mod/attforblock/manage.php', array('id'=> $id, 'from'=> $from, 'view' => $view, 'current' => $current, 'showendtime' => $showendtime));
$PAGE->set_url($url);
$PAGE->set_title($course->shortname. ": ".$attforblock->name);
$PAGE->set_heading($course->fullname);
$PAGE->set_focuscontrol('');
$PAGE->set_cacheable(true);
$PAGE->set_button($OUTPUT->update_module_button($cm->id,'attforblock'));
$PAGE->navbar->add($attforblock->name);
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('attendanceforthecourse','attforblock').' :: ' .$course->fullname);
if(!$DB->count_records_select('attendance_sessions', "courseid = ? AND attendanceid = ? AND sessdate >= ?", array($course->id, $attforblock->id, $course->startdate))) { // no session exists for this course
show_tabs($cm, $context);
@ -91,11 +96,11 @@
}
// require_once('lib.php');
// $t = attforblock_get_user_grades($attforblock); ////////////////////////////////////////////
print_footer($course);
$OUTPUT->footer();//print_footer($course);
function print_sessions_list($course, $attforblock) {
global $CFG, $context, $cm, $current, $view, $id, $showendtime, $DB;
global $CFG, $context, $cm, $current, $view, $id, $showendtime, $DB, $OUTPUT;
$strhours = get_string('hours');
$strmins = get_string('min');
@ -122,6 +127,7 @@ function print_sessions_list($course, $attforblock) {
$qry = $DB->get_records_select('attendance_sessions', $where, array('cid' => $course->id, 'aid' => $attforblock->id, 'sdate' => $course->startdate,'sdate2' => $startdate, 'edate'=> $enddate, 'cgroup'=> $currentgroup), 'sessdate asc');
$i = 0;
$table = new html_table();
$table->width = '100%';
//$table->tablealign = 'center';
$table->head = array('#', get_string('sessiontypeshort', 'attforblock'), get_string('date'), get_string('from'), ($showendtime=='0') ? get_string('duration', 'attforblock') : get_string('to'), get_string('description','attforblock'), get_string('actions'), get_string('select'));
@ -152,17 +158,17 @@ function print_sessions_list($course, $attforblock) {
if ($allowtake) {
$title = get_string('takeattendance','attforblock');
$actions = "<a title=\"$title\" href=\"attendances.php?id=$cm->id&amp;sessionid={$sessdata->id}&amp;grouptype={$sessdata->groupid}\">".
"<img src=\"{$CFG->pixpath}/t/go.gif\" alt=\"$title\" /></a>&nbsp;";
"<img src=\"" . $OUTPUT->pix_url('t/go') . "\" alt=\"$title\" /></a>&nbsp;";
}
}
// }
if($allowmanage) {
$title = get_string('editsession','attforblock');
$actions .= "<a title=\"$title\" href=\"sessions.php?id=$cm->id&amp;sessionid={$sessdata->id}&amp;action=update\">".
"<img src=\"{$CFG->pixpath}/t/edit.gif\" alt=\"$title\" /></a>&nbsp;";
"<img src=\"" . $OUTPUT->pix_url('t/edit') . "\" alt=\"$title\" /></a>&nbsp;";
$title = get_string('deletesession','attforblock');
$actions .= "<a title=\"$title\" href=\"sessions.php?id=$cm->id&amp;sessionid={$sessdata->id}&amp;action=delete\">".
"<img src=\"{$CFG->pixpath}/t/delete.gif\" alt=\"$title\" /></a>&nbsp;";
"<img src=\"" . $OUTPUT->pix_url('t/delete') . "\" alt=\"$title\" /></a>&nbsp;";
}
$table->data[$sessdata->id][] = $i;
@ -182,7 +188,7 @@ function print_sessions_list($course, $attforblock) {
echo '<div align="center"><div class="generalbox attwidth">';
echo "<form method=\"post\" action=\"sessions.php?id={$cm->id}\">"; //&amp;sessionid={$sessdata->id}
print_table($table);
print_table($table);//echo $OUTPUT->table($table);
$hiddensess = $DB->count_records_select('attendance_sessions', "courseid = ? AND attendanceid = ? AND sessdate < ?", array($course->id, $attforblock->id, $course->startdate));
echo '<table width="100%"><tr><td valign="top">';
echo '<div align="left">'.helpbutton('hiddensessions', '--', 'attforblock', true, true, '', true); //TODO: Change '--'

0
icon.gif → pix/icon.gif

Before

Width:  |  Height:  |  Size: 125 B

After

Width:  |  Height:  |  Size: 125 B

4
version.php

@ -5,7 +5,7 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2010123003; // The current module version (Date: YYYYMMDDXX)
$module->release = '2.2.1';
$module->version = 2011020901; // The current module version (Date: YYYYMMDDXX)
$module->release = '2.2.5';
$module->cron = 0; // Period for cron to check this module (secs)
?>

Loading…
Cancel
Save