function praxe_view_extteacher() { global $CFG, $tab, $USER, $tab_modes, $context; switch ($tab) { case PRAXE_TAB_EXTTEACHER_HOME: require_capability('mod/praxe:viewrecordstoownlocation', $context); $detail = optional_param('recordid', 0, PARAM_INT); if ($detail > 0 && ($record = praxe_get_record($detail))) { if ($record->teacherid != $USER->id) { print_error('notallowedaction', 'praxe'); } $schid = optional_param('scheduleid', 0, PARAM_INT); if ($schid > 0 && ($schedule = praxe_get_schedule($schid))) { $this->content .= self::show_schedule_detail($schedule) . "<hr>"; } $this->content .= self::show_record_detail($record); } else { $this->content .= self::show_records(); } break; case PRAXE_TAB_EXTTEACHER_MYLOCATIONS: $factual = optional_param('factualloc', 0, PARAM_INT); $fyear = optional_param('fyearloc', 0, PARAM_INT); $this->content .= self::show_all_my_locations($factual, $fyear); break; case PRAXE_TAB_EXTTEACHER_MYSCHOOLS: $schoolid = optional_param('schoolid', 0, PARAM_INT); $schools = praxe_get_schools(null, $USER->id); if ($schoolid == 0) { $this->content .= self::show_schools($schools); } else { if (isset($schools[$schoolid])) { require_once $CFG->dirroot . '/mod/praxe/view_headm.php'; $this->content .= praxe_view_headm::show_school($schoolid); } else { redirect(praxe_get_base_url(), get_string('notallowedaction', 'praxe')); } } break; case PRAXE_TAB_EXTTEACHER_EDITLOCATION: $locid = required_param('locationid', PARAM_INT); if (!($loc = praxe_get_location($locid, $USER->id))) { print_error('notallowedaction', 'praxe'); } require_once $CFG->dirroot . '/mod/praxe/c_addlocation.php'; $this->form = new praxe_addlocation($loc->school); $this->form->set_redirect_url(null, array('mode' => $tab_modes['extteacher'][PRAXE_TAB_EXTTEACHER_MYLOCATIONS])); $this->form->set_form_to_edit($loc); break; case PRAXE_TAB_EXTTEACHER_COPYLOCATION: // TODO break; default: break; } }
function praxe_view_editteacher() { global $DB, $tab, $CFG, $tab_modes, $context; switch ($tab) { case PRAXE_TAB_EDITTEACHER_HOME: $detail = optional_param('recordid', 0, PARAM_INT); require_once $CFG->dirroot . '/mod/praxe/view_extteacher.php'; if ($detail > 0 && ($record = praxe_get_record($detail))) { $schid = optional_param('scheduleid', 0, PARAM_INT); if ($schid > 0 && ($schedule = praxe_get_schedule($schid))) { $this->content .= praxe_view_extteacher::show_schedule_detail($schedule) . "<hr>"; } $this->content .= praxe_view_extteacher::show_record_detail($record); } else { $this->content .= self::show_all_students_records(); } break; case PRAXE_TAB_EDITTEACHER_ADDSCHOOL: require_capability('mod/praxe:manageallincourse', $context); require_once $CFG->dirroot . '/mod/praxe/c_addschool.php'; $this->form = new praxe_addschool(); break; case PRAXE_TAB_EDITTEACHER_SCHOOLS: require_once $CFG->dirroot . '/mod/praxe/view_headm.php'; $schoolid = optional_param('schoolid', 0, PARAM_INT); if ($schoolid == 0) { /// sorting list $sname = strtoupper(optional_param('sname', null, PARAM_ALPHA)); $stype = strtoupper(optional_param('stype', null, PARAM_ALPHA)); $sort = array(); $aSort = array(); if ($sname == 'ASC' || $sname == 'DESC') { $sort[] = 'name ' . $sname; $aSort['name'] = $sname; } if ($stype == 'ASC' || $stype == 'DESC') { $sort[] = 'type ' . $stype; $aSort['type'] = $stype; } $sort = count($sort) ? implode(', ', $sort) : ''; $schools = $DB->get_records('praxe_schools', array(), $sort); $this->content .= praxe_view_headm::show_schools($schools, array('mode' => $tab_modes['editteacher'][PRAXE_TAB_EDITTEACHER_EDITSCHOOL]), $aSort); } else { $this->content .= praxe_view_headm::show_school($schoolid, array('mode' => $tab_modes['editteacher'][PRAXE_TAB_EDITTEACHER_EDITSCHOOL])); } break; case PRAXE_TAB_EDITTEACHER_EDITSCHOOL: require_capability('mod/praxe:manageallincourse', $context); $schoolid = required_param('schoolid', PARAM_INT); if ($school = praxe_get_school($schoolid)) { require_once $CFG->dirroot . '/mod/praxe/c_addschool.php'; $this->form = new praxe_addschool(); $this->form->set_form_to_edit($school); } break; case PRAXE_TAB_EDITTEACHER_TEACHERS: $schoolid = optional_param('schoolid', 0, PARAM_INT); require_once $CFG->dirroot . '/mod/praxe/view_headm.php'; if ($schoolid > 0) { $this->content .= praxe_view_headm::school_teachers_by_schools(null, $schoolid); } else { $this->content .= praxe_view_headm::school_teachers_by_schools(); } break; case PRAXE_TAB_EDITTEACHER_ASSIGNTEACHERS: require_capability('mod/praxe:manageallincourse', $context); $schoolid = required_param('schoolid', PARAM_INT); require_once $CFG->dirroot . '/mod/praxe/c_assignteachers.php'; $this->form = new praxe_assignteachers($schoolid); break; case PRAXE_TAB_EDITTEACHER_LOCATIONS: $schoolid = optional_param('schoolid', 0, PARAM_INT); $locationid = optional_param('locationid', 0, PARAM_INT); $edit = optional_param('edit', null, PARAM_TEXT); $factual = optional_param('factualloc', 0, PARAM_INT); $fyear = optional_param('fyearloc', 0, PARAM_INT); /// edit location form /// if (!is_null($edit) && $locationid > 0) { if (!($loc = praxe_get_location($locationid))) { print_error('notallowedaction', 'praxe'); } require_once $CFG->dirroot . '/mod/praxe/c_addlocation.php'; $this->form = new praxe_addlocation($loc->school); $this->form->set_redirect_url(null, array('mode' => $tab_modes['editteacher'][PRAXE_TAB_EDITTEACHER_LOCATIONS], 'schoolid' => $schoolid)); $this->form->set_form_to_edit($loc); } else { /// sorting list $sortFields = array('sschool', 'sstudyfield', 'sisced', 'syear', 'ssubject', 'sactive'); $aSort = array(); foreach ($sortFields as $f) { $s_[$f] = strtoupper(optional_param($f, null, PARAM_ALPHA)); if ($s_[$f] == 'ASC' || $s_[$f] == 'DESC') { $aSort[$f] = $s_[$f]; } else { $aSort[$f] = null; } } require_once $CFG->dirroot . '/mod/praxe/view_headm.php'; $params = array('edit' => 'true', 'mode' => $tab_modes['editteacher'][PRAXE_TAB_EDITTEACHER_LOCATIONS], 'schoolid' => $schoolid); $this->content .= praxe_view_headm::show_locations($schoolid, null, $params, $factual, $fyear, $aSort); } break; case PRAXE_TAB_EDITTEACHER_ADDLOCATION: require_capability('mod/praxe:manageallincourse', $context); $schoolid = required_param('schoolid', PARAM_INT); require_once $CFG->dirroot . '/mod/praxe/c_addlocation.php'; $this->form = new praxe_addlocation($schoolid); break; default: break; } }
function praxe_view_student() { global $CFG, $tab, $tab_modes, $context, $DB, $sentForm; $viewaction = optional_param('viewaction', null, PARAM_ALPHA); $schoolid = optional_param('schoolid', 0, PARAM_INT); if ($viewaction == 'viewschool' && $schoolid) { require_once $CFG->dirroot . '/mod/praxe/view_headm.php'; $this->content .= praxe_view_headm::show_school($schoolid); $this->content .= praxe_praxehome_buttons(false); } else { $status = praxe_record::getData('rec_status'); switch ($tab) { case PRAXE_TAB_STUDENT_HOME: $after_tab = ''; $strd = get_string('done', 'praxe'); $strinpr = get_string('inprocess', 'praxe'); $cell = new html_table_cell(get_string('todo', 'praxe')); $cell->attributes['class'] = 'cell center'; $cell1 = clone $cell; $cell2 = clone $cell; if (is_null($status)) { $this->content .= '<div class="before_form">' . get_string('assigntolocation_text_forstudents', 'praxe') . '</div>'; $this->content .= self::make_assigntolocation_form(); $this->content .= "<hr>"; } else { $this->content .= "<div class=\"status_infobox\"><strong>" . get_string('status', 'praxe') . ": </strong>" . praxe_get_status_info($status, 'student') . "</div>"; if ($status == PRAXE_STATUS_REFUSED) { $this->content .= '<div class="before_form">' . get_string('assigntolocation_text_forstudents', 'praxe') . '</div>'; $this->content .= self::make_assigntolocation_form(); } else { if ($status == PRAXE_STATUS_ASSIGNED) { $cell->text = $strinpr; $cell->attributes['class'] .= ' orange'; } else { if ($status == PRAXE_STATUS_SCHEDULE_DONE) { $cell->text = $strd; $cell->attributes['class'] .= ' green'; $cell1->text = $strd; $cell1->attributes['class'] .= ' green'; } else { if ($status == PRAXE_STATUS_CONFIRMED) { $cell->text = $strd; $cell->attributes['class'] .= ' green'; $schlink = praxe_get_base_url(array("mode" => $tab_modes['student'][PRAXE_TAB_STUDENT_SCHEDULE])); $after_tab .= "<div class=\"infobox center\"><div>" . get_string('you_should_create_schedule', 'praxe') . ": <a href=\"{$schlink}\">" . get_string('my_schedule', 'praxe') . "</a></div></div>"; } else { if ($status == PRAXE_STATUS_EVALUATED) { $cell->text = $strd; $cell->attributes['class'] .= ' green'; $cell1->text = $strd; $cell1->attributes['class'] .= ' green'; $cell2->text = $strd; $cell2->attributes['class'] .= ' green'; } } } } } } /// table of parts of student's practice /// $table = new html_table(); $table->attributes['class'] = 'praxe generaltable boxaligncenter status'; $table->head = array(get_string('choosing_location', 'praxe'), get_string('schedule', 'praxe'), get_string('evaluated', 'praxe')); //get_string('praxe_completed','praxe')); $table->data[] = new html_table_row(array($cell, $cell1, $cell2)); $this->content .= html_writer::table($table); $this->content .= $after_tab; break; case PRAXE_TAB_STUDENT_MYSCHOOL: $this->content .= self::show_location(praxe_record::getData('rec_location')); break; case PRAXE_TAB_STUDENT_EDITLOC: $this->content .= self::change_location_form(); break; case PRAXE_TAB_STUDENT_SCHEDULE: $editlinks = array("mode" => $tab_modes['student'][PRAXE_TAB_STUDENT_ADDSCHEDULE], 'edit' => 'editschedule'); $schedules = praxe_get_schedules(praxe_record::getData('rec_id'), array('timestart', 'lesnumber')); self::show_schedule($schedules, false, $editlinks); /// schedule confirm form for validation /// if ($schedules) { $f = '<form method="post" class="form confirmschedule center">'; $f .= '<input type="hidden" name="sesskey" value="' . sesskey() . '" />' . '<input type="hidden" name="praxeaction" value="confirmschedule" />'; $f .= '<div>'; $f .= '<strong>' . get_string('confirmschedule_sendnotice', 'praxe') . '</strong><br />'; $f .= get_string('sendinfotoextteacher', 'praxe') . ": "; $f .= '<input type="checkbox" name="mailtoextteacher" value="1" checked="checked" />'; $f .= '</div><div class="center">'; $f .= '<input type="submit" name="confirmsubmitbutton" value="' . get_string('confirm') . '" />'; $f .= '</div>'; $f .= '</form>'; $this->content .= $f; } break; case PRAXE_TAB_STUDENT_ADDSCHEDULE: if (is_object($sentForm)) { if (!is_null(optional_param('edit', null, PARAM_TEXT))) { $scheduleid = optional_param('scheduleid', 0, PARAM_INT); $sentForm->set_form_to_edit((object) array('id' => $scheduleid)); } $sentForm->display_content_before(); $sentForm->display(); } else { require_capability('mod/praxe:addstudentschedule', $context); require_once $CFG->dirroot . '/mod/praxe/c_makeschedule.php'; $this->form = new praxe_makeschedule(); if (!is_null(optional_param('edit', null, PARAM_TEXT))) { $scheduleid = optional_param('scheduleid', 0, PARAM_INT); if ($schedule = $DB->get_record('praxe_schedules', array('id' => $scheduleid, 'record' => praxe_record::getData('rec_id')))) { if (!$this->form->set_form_to_edit($schedule)) { $this->form->add_to_content(get_string('date_of_schedule_has_expired', 'praxe') . "<br>" . get_string('noeditableitem', 'praxe'), true); } } else { print_error('notallowedaction', 'praxe'); } } } break; default: redirect(praxe_get_base_url()); break; } } }