public function updateAction() { if (empty($_GET['id']) || !($language = DBFactory::get($this->module)->get($_GET['id'])) instanceof Language) { Header::location(UrlFactory::module($this->module)); } $this->valid($language, $_POST); $view = $this->getView('Form'); $view->language = $language; $layout = $this->getLayout('Default', $view); $layout->addBreadcrumbsLink(new Link(Translator::get('module_languages'), UrlFactory::module($this->module))); $layout->addBreadcrumbsLink(new Link($language->name, UrlFactory::update($this->module, $language))); $layout->addBreadcrumbsLink(new Link(Translator::get('module_update'))); }
public function send() { if ($this->request->responseType == 'json') { $response = array('status' => $this->status); if (!empty($this->location)) { $response['location'] = $this->location; } if ($this->layout instanceof Layout) { $response['content'] = $this->layout->renderJson(); } echo json_encode($response); } else { Header::httpHeader($this->status->getDescription(), $this->status->getCode()); if (!empty($this->location)) { Header::location($this->location); } if ($this->layout instanceof Layout) { $this->layout->renderHtml(); } } }
$extraContentForm = new FormValidator('block_extra_data', 'post', '#', null, array('id' => 'block-extra-data', 'class' => ''), FormValidator::LAYOUT_BOX_NO_LABEL); $extraContentFormRenderer = $extraContentForm->getDefaultRenderer(); if ($extraContentForm->validate()) { $extraData = $extraContentForm->getSubmitValues(); $extraData = array_map(['Security', 'remove_XSS'], $extraData); if (!empty($extraData['block'])) { if (!is_dir($adminExtraContentDir)) { mkdir($adminExtraContentDir, api_get_permissions_for_new_directories(), true); } if (!is_writable($adminExtraContentDir)) { die; } $fullFilePath = $adminExtraContentDir . $extraData['block']; $fullFilePath .= "_extra.html"; file_put_contents($fullFilePath, $extraData['extra_content']); Header::location(api_get_self()); } } $extraContentForm->addTextarea('extra_content', null, ['id' => 'extra_content']); $extraContentFormRenderer->setElementTemplate('<div class="form-group">{element}</div>', 'extra_content'); $extraContentForm->addElement('hidden', 'block', null, array('id' => 'extra-block')); $extraContentForm->addButtonExport(get_lang('Save'), 'submit_extra_content'); $tpl->assign('extraDataForm', $extraContentForm->returnForm()); } // The template contains the call to the AJAX version checker $admin_template = $tpl->get_template('admin/settings_index.tpl'); $content = $tpl->fetch($admin_template); $tpl->assign('content', $content); $tpl->assign('message', $message); $tpl->display_one_col_template(); // Note: version checking mechanism has now been moved to main/inc/ajax/admin.ajax.php
/* For licensing terms, see /license.txt */ require_once '../../../global.inc.php'; if (api_is_anonymous()) { api_not_allowed(true); } $roomName = isset($_GET['room']) ? $_GET['room'] : null; $room = VideoChat::getChatRoomByName($roomName); if ($room === false) { Header::location(api_get_path(WEB_PATH)); } $friend_html = SocialManager::listMyFriendsBlock($user_id, $link_shared, $show_full_profile); $isSender = $room['from_user'] == api_get_user_id(); $isReceiver = $room['to_user'] == api_get_user_id(); if (!$isSender && !$isReceiver) { Header::location(api_get_path(WEB_PATH)); } if ($isSender) { $chatUser = api_get_user_info($room['to_user']); } elseif ($isReceiver) { $chatUser = api_get_user_info($room['from_user']); } $idUserLocal = api_get_user_id(); $userLocal = api_get_user_info($idUserLocal, true); $htmlHeadXtra[] = '<script type="text/javascript" src="' . api_get_path(WEB_PATH) . 'web/assets/simplewebrtc/latest.js' . '"></script>' . "\n"; $template = new Template(); $template->assign('room', $room); $template->assign('chat_user', $chatUser); $template->assign('user_local', $userLocal); $template->assign('block_friends', $friend_html); $content = $template->fetch('default/chat/video.tpl');
continue; } } $certificateStudent['certificates'][] = array('createdAt' => api_convert_and_format_date($certificate['created_at']), 'id' => $certificate['id']); } if (count($certificateStudent['certificates']) > 0) { $certificateStudents[] = $certificateStudent; } } } } } elseif ($searchStudentOnly) { $selectedStudentInfo = api_get_user_info($selectedStudent); if (empty($selectedStudentInfo)) { Session::write('reportErrorMessage', get_lang('NoUser')); Header::location($selfUrl); } $sessionList = SessionManager::getSessionsFollowedByUser($selectedStudent); foreach ($sessionList as $session) { $sessionCourseList = SessionManager::get_course_list_by_session_id($session['id']); foreach ($sessionCourseList as $sessionCourse) { $gradebookCategories = Category::load(null, null, $sessionCourse['code'], null, false, $session['id']); $gradebook = null; if (!empty($gradebookCategories)) { $gradebook = current($gradebookCategories); } if (!is_null($gradebook)) { $sessionName = $session['name']; $courseName = $sessionCourse['title']; $certificateStudent = ['fullName' => $selectedStudentInfo['complete_name'], 'sessionName' => $sessionName, 'courseName' => $courseName, 'certificates' => []]; $studentCertificates = GradebookUtils::get_list_gradebook_certificates_by_user_id($selectedStudent, $gradebook->get_id());
} } } } $request->langue = $response->langue = $userLangue; define('LANGUE', $request->langue->code); define('BASE_URL_LANGUE', BASE_URL . $request->langue->code . '/'); ini_set('default_charset', CHARSET); setlocale(LC_TIME, $request->langue->locale . '.' . mb_strtolower(CHARSET)); if (in_array('translations', $backoModules) && file_exists(ROOT . 'traductions.inc.php')) { Translator::init($request->langue->code, DEFAULT_LANG); } require_once APPLICATION_ROOT . 'UrlFactory.php'; UrlSingleton::init(new UrlFactory(), $request->langue); if (in_array('admins', $allowedModules) && (empty($_SESSION['admin']) || !($admin = DBFactory::get('admins')->get($_SESSION['admin'])) instanceof Admin) && $request->url != UrlFactory::module('admins', 'login') && $request->url != UrlFactory::module('admins', 'init')) { Header::location(UrlFactory::module('admins', 'login')); } try { if (!file_exists($file = APPLICATION_MODULES . $request->module . DS . $request->controller . '.php')) { throw new Error404Exception($response); } require $file; $controller = new $request->controller($response); Logger::addPhpLog($request); if (!method_exists($controller, $request->method)) { throw new Error404Exception($response); } $controller->handleRequest($request); } catch (Error404Exception $exception) { require APPLICATION_MODULES . 'errors' . DS . 'ErrorsController.php'; $controller = new ErrorsController($response);
continue; } $skillList[$skill['id']] = $skill['name']; } foreach ($allGradebooks as $gradebook) { $gradebookList[$gradebook['id']] = $gradebook['name']; } /* Form */ $editForm = new FormValidator('skill_edit'); $editForm->addHeader(get_lang('SkillEdit')); $editForm->addText('name', get_lang('Name'), true, ['id' => 'name']); $editForm->addText('short_code', get_lang('ShortCode'), false, ['id' => 'short_code']); $editForm->addSelect('parent_id', get_lang('Parent'), $skillList, ['id' => 'parent_id']); $editForm->addSelect('gradebook_id', [get_lang('Gradebook'), get_lang('WithCertificate')], $gradebookList, ['id' => 'gradebook_id', 'multiple' => 'multiple', 'size' => 10]); $editForm->addTextarea('description', get_lang('Description'), ['id' => 'description', 'rows' => 7]); $editForm->addButtonSave(get_lang('Save')); $editForm->addHidden('id', null); $editForm->setDefaults($skillDefaultInfo); if ($editForm->validate()) { $updated = $objSkill->edit($editForm->getSubmitValues()); if ($updated) { Session::write('message', Display::return_message(get_lang('TheSkillHasBeenUpdated'), 'success')); } else { Session::write('message', Display::return_message(get_lang('CannotUpdateSkill'), 'error')); } Header::location(api_get_path(WEB_CODE_PATH) . 'admin/skill_list.php'); } /* view */ $tpl = new Template(get_lang('SkillEdit')); $tpl->assign('content', $editForm->returnForm()); $tpl->display_one_col_template();
public function generateAction() { if (!empty($_POST)) { require_once MODEL . 'Translation.php'; $translation = new Translation(); foreach ($_POST as $variable => $languages) { $translation->languages = $languages; $translation->variable = $variable; $translation->save(); } } $this->generate(); Header::location(UrlFactory::module($this->module)); }
/** * @static * @param string $pModule * @param string $pController * @param string $pAction * @param array $pParams * @return void */ public static function toModule($pModule = 'front', $pController = "", $pAction = "", $pParams = array()) { $rewriteURL = Configuration::$server_url . $pModule . "/"; $rewriteURL .= Core::rewriteURL($pController, $pAction, $pParams); Header::location($rewriteURL); }
public function initAction() { DBFactory::get($this->module)->init(); $this->getLayout('Default', ''); Header::location(UrlFactory::module($this->module)); }
} // Student Session inscription if ($data['newStatus'] == ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED) { SessionManager::suscribe_users_to_session($data['sessionId'], array($data['studentUserId']), null, false); } // Send mails $result['mailIds'] = $plugin->sendMail($data, $data['mailAction']); // Check if mails were sent if (!empty($result['mailIds'])) { $result['error'] = false; $result['errorMessage'] = 'User has been processed'; // Check if exist mail to render if (isset($result['mailIds']['render'])) { // Render mail $url = $plugin->getRenderMailUrl(array('queueId' => $result['mailIds']['render'])); Header::location($url); exit; } } } else { $result['errorMessage'] = 'User queue can not be updated'; } } break; default: $result['errorMessage'] = 'This action does not exist!'; } } if ($showJSON) { // Echo result as json echo json_encode($result);