Browse Source

Fixed bugs with validating forms

MOODLE_23_STABLE
Artem Andreev 13 years ago
parent
commit
3162293d01
  1. 12
      sessions.php

12
sessions.php

@ -43,8 +43,8 @@ switch ($att->pageparams->action) {
$url = $att->url_sessions(array('action' => att_sessions_page_params::ACTION_ADD)); $url = $att->url_sessions(array('action' => att_sessions_page_params::ACTION_ADD));
$mform = new mod_attforblock_add_form($url, $formparams); $mform = new mod_attforblock_add_form($url, $formparams);
if ($mform->is_submitted()) { if ($formdata = $mform->get_data()) {
$sessions = construct_sessions_data_for_add($mform->get_data()); $sessions = construct_sessions_data_for_add($formdata);
$att->add_sessions($sessions); $att->add_sessions($sessions);
redirect($url, get_string('sessionsgenerated','attforblock')); redirect($url, get_string('sessionsgenerated','attforblock'));
} }
@ -60,8 +60,8 @@ switch ($att->pageparams->action) {
redirect($att->url_manage()); redirect($att->url_manage());
} }
if ($mform->is_submitted()) { if ($formdata = $mform->get_data()) {
$att->update_session_from_form_data($mform->get_data(), $sessionid); $att->update_session_from_form_data($formdata, $sessionid);
redirect($att->url_manage(), get_string('sessionupdated','attforblock')); redirect($att->url_manage(), get_string('sessionupdated','attforblock'));
} }
@ -139,9 +139,7 @@ switch ($att->pageparams->action) {
redirect($att->url_manage()); redirect($att->url_manage());
} }
if ($mform->is_submitted()) { if ($formdata = $mform->get_data()) {
$formdata = $mform->get_data();
$sessionsids = explode('_', $fromform->ids); $sessionsids = explode('_', $fromform->ids);
$duration = $formdata->durtime['hours']*HOURSECS + $formdata->durtime['minutes']*MINSECS; $duration = $formdata->durtime['hours']*HOURSECS + $formdata->durtime['minutes']*MINSECS;
$att->update_sessions_duration($sessionsids, $duration); $att->update_sessions_duration($sessionsids, $duration);

Loading…
Cancel
Save