Browse Source

Merge pull request #141 from ycastillo/yoselyn.6743

create a new attendance sheet if there is none -refs 6743
ycastillo 11 years ago
parent
commit
56e9f6e867
1 changed files with 6 additions and 1 deletions
  1. 6 1
      main/attendance/attendance_list.php

+ 6 - 1
main/attendance/attendance_list.php

@@ -19,7 +19,12 @@ if (api_is_allowed_to_edit(null, true)) {
 	echo '<a href="index.php?'.api_get_cidreq().$param_gradebook.'&action=attendance_add">'.Display::return_icon('new_attendance_list.png',get_lang('CreateANewAttendance'),'',ICON_SIZE_MEDIUM).'</a>';	
 	echo '</div>';
 }
-   
+$attendance = new Attendance();
+if ($attendance->get_number_of_attendances() == 0) {
+    $attendance->set_name(get_lang('Attendances'));
+    $attendance->set_description(get_lang('Attendances'));
+    $attendance->attendance_add();
+}   
 $table = new SortableTable('attendance_list', array('Attendance', 'get_number_of_attendances'), array('Attendance', 'get_attendance_data'), $default_column);
 $table->set_additional_parameters($parameters);
 $table->set_header(0, '', false, array('style'=>'width:20px;'));