get_lang('NoSaveChange'); } else { if ($newSpecialty == 1) { $specialtyId = Database::insert_id(); $_SESSION['sepe_message_info'] = $plugin->get_lang('SaveChange'); } } session_write_close(); header("Location: specialty-action-edit.php?new_specialty=0&specialty_id=".$specialtyId."&action_id=".$actionId); } else { $actionId = intval($_POST['action_id']); $specialtyId = intval($_POST['specialty_id']); $newSpecialty = intval($_POST['new_specialty']); Security::clear_token(); $token = Security::get_token(); $_SESSION['sepe_message_error'] = $plugin->get_lang('ProblemToken'); session_write_close(); header("Location: specialty-action-edit.php?new_specialty=".$newSpecialty."&specialty_id=".$specialtyId."&action_id=".$actionId); } } else { $token = Security::get_token(); } if (api_is_platform_admin()) { $id_course = getCourse(intval($_GET['action_id'])); $interbreadcrumb[] = [ "url" => "/plugin/sepe/src/sepe-administration-menu.php", "name" => $plugin->get_lang('MenuSepe'), ]; $interbreadcrumb[] = [ "url" => "formative-actions-list.php", "name" => $plugin->get_lang('FormativesActionsList'), ]; $interbreadcrumb[] = [ "url" => "formative-action.php?cid=".$id_course, "name" => $plugin->get_lang('FormativeAction'), ]; if (isset($_GET['new_specialty']) && intval($_GET['new_specialty']) == 1) { $templateName = $plugin->get_lang('NewSpecialtyAccion'); $tpl = new Template($templateName); $tpl->assign('action_id', intval($_GET['action_id'])); $info = []; $tpl->assign('info', $info); $tpl->assign('new_action', '1'); $yearStart = $yearEnd = date("Y"); } else { $templateName = $plugin->get_lang('EditSpecialtyAccion'); $tpl = new Template($templateName); $tpl->assign('action_id', intval($_GET['action_id'])); $info = getSpecialtActionInfo(intval($_GET['specialty_id'])); $tpl->assign('info', $info); if ($info['start_date'] != '0000-00-00' && $info['start_date'] != null) { $tpl->assign('day_start', date("j", strtotime($info['start_date']))); $tpl->assign('month_start', date("n", strtotime($info['start_date']))); $tpl->assign('year_start', date("Y", strtotime($info['start_date']))); $yearStart = date("Y", strtotime($info['start_date'])); } elseif (strpos($info['start_date'], '0000') === false) { $yearStart = date("Y", strtotime($info['start_date'])); } else { $yearStart = date("Y"); } if ($info['end_date'] != '0000-00-00' && $info['end_date'] != null) { $tpl->assign('day_end', date("j", strtotime($info['end_date']))); $tpl->assign('month_end', date("n", strtotime($info['end_date']))); $tpl->assign('year_end', date("Y", strtotime($info['end_date']))); $yearEnd = date("Y", strtotime($info['end_date'])); } elseif (strpos($info['end_date'], '0000') === false) { $yearEnd = date("Y", strtotime($info['end_date'])); } else { $yearEnd = date("Y"); } $tpl->assign('new_action', '0'); $tpl->assign('specialty_id', intval($_GET['specialty_id'])); $listClassroom = classroomList(intval($_GET['specialty_id'])); $tpl->assign('listClassroom', $listClassroom); $listTutors = tutorsList(intval($_GET['specialty_id'])); $tpl->assign('listTutors', $listTutors); } $yearList = []; if ($yearStart > $yearEnd) { $tmp = $yearStart; $yearStart = $yearEnd; $yearEnd = $tmp; } $yearStart -= 5; $yearEnd += 5; $fin_rango_anio = (($yearStart + 15) < $yearEnd) ? ($yearEnd + 1) : ($yearStart + 15); while ($yearStart <= $fin_rango_anio) { $yearList[] = $yearStart; $yearStart++; } $tpl->assign('list_year', $yearList); if (isset($_SESSION['sepe_message_info'])) { $tpl->assign('message_info', $_SESSION['sepe_message_info']); unset($_SESSION['sepe_message_info']); } if (isset($_SESSION['sepe_message_error'])) { $tpl->assign('message_error', $_SESSION['sepe_message_error']); unset($_SESSION['sepe_message_error']); } $tpl->assign('sec_token', $token); $listing_tpl = 'sepe/view/specialty-action-edit.tpl'; $content = $tpl->fetch($listing_tpl); $tpl->assign('content', $content); $tpl->display_one_col_template(); } else { header('Location:'.api_get_path(WEB_PATH)); exit; }