} } if ($DB->update_record('praxe_records', $post) && false) { if ($post->status = PRAXE_STATUS_CONFIRMED) { $emuser = get_complete_user_data('id', $record->student); $emfrom = get_complete_user_data('id', $record->teacherid); require_once $CFG->dirroot . '/mod/praxe/mailing.php'; $mail = new praxe_mailing(); $fak = new stdClass(); $fak->name = fullname($emfrom); $fak->date = userdate(praxe_record::getData('datestart'), get_string('strftimedateshort')) . " - " . userdate(praxe_record::getData('dateend'), get_string('strftimedateshort')); $fak->subject = s($record->subject); $fak->school = s($record->name); $fak->studyfield = s(praxe_record::getData('studyfield_name')); $fak->praxename = praxe_record::getData('name'); $mail->setSubject(get_string('confirmedlocation', 'praxe')); $emtext = get_string('confirmlocation_mail', 'praxe', $fak); $mail->setPlain($emtext); $mail->setHtml($emtext); $mail->mailToUser($emuser, $emfrom); } redirect(praxe_get_base_url(), $msg); } break; case 'makeschedule': $aErrors = array(); require_capability('mod/praxe:addstudentschedule', $context); require_once 'c_makeschedule.php'; $form = new praxe_makeschedule(); if ($fdata = $form->get_data()) { if ($fdata->lesnumber == -1) {
redirect(praxe_get_base_url(array('mode' => 'schedule'))); } break; case 'confirmschedule': require_sesskey(); $teachermail = optional_param('mailtoextteacher', 0, PARAM_INT); $praxe = praxe_record::getData(); $schedules = $DB->get_records('praxe_schedules', array('record' => $praxe->rec_id)); if (empty($schedules)) { print_error('notallowedaction', 'praxe'); } $post = (object) array('id' => $praxe->rec_id, 'status' => PRAXE_STATUS_SCHEDULE_DONE); if ($DB->update_record('praxe_records', $post) && $teachermail == 1) { $emfrom = get_complete_user_data('id', $praxe->rec_student); require_once $CFG->dirroot . '/mod/praxe/mailing.php'; $mail = new praxe_mailing(); $fak = new stdClass(); $fak->name = fullname($emfrom); $fak->school = s($praxe->location->name); $mail->setSubject(get_string('confirmschedule_mailsubject', 'praxe')); $emtext = get_string('confirmschedule_mail', 'praxe', $fak); $mail->setPlain($emtext); $mail->setHtml($emtext); $emuser = get_complete_user_data('id', $praxe->location->teacherid); $mail->mailToUser($emuser, $emfrom); } redirect(praxe_get_base_url(array('mode' => 'schedule'))); break; } $echo .= "</div>"; echo $echo;