本文整理汇总了PHP中AppController::getHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP AppController::getHeader方法的具体用法?PHP AppController::getHeader怎么用?PHP AppController::getHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppController
的用法示例。
在下文中一共展示了AppController::getHeader方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Fonction de rendu html par défaut
* @param type $params
*/
public static function render($params = [])
{
AppController::getHeader();
$class = substr(\get_called_class(), 0, -10) . 'View/';
$class = ucfirst(substr($class, 5));
$class = str_replace("\\Controller\\", '\\View\\', $class);
$class = str_replace('\\', '/', $class);
$class = $class . 'Render.php';
if (file_exists($class)) {
require $class;
} else {
debug('Le fichier ' . $class . ' n\'existe pas');
}
AppController::getFooter();
}
示例2: render
public static function render($params = [])
{
$user = AppController::getUser();
if (!$user) {
AppController::setMsg('warning', "La zone demandée n'est pas autorisé pour les personnes non inscrites.");
AppController::redirect('index');
}
$algorithms = \Root\Src\Model\AlgorithmModel::loadFunctionByUser($user->getId());
$structures = \Root\Src\Model\StructureModel::loadStructureByUser($user->getId());
$translationOfC = \Root\Src\Model\TranslationModel::loadTranslationByLanguage('c');
$translationOfJava = \Root\Src\Model\TranslationModel::loadTranslationByLanguage('java');
$translationOfJavascript = \Root\Src\Model\TranslationModel::loadTranslationByLanguage('javascript');
$translationOfPhp = \Root\Src\Model\TranslationModel::loadTranslationByLanguage('php');
$translationOfPython = \Root\Src\Model\TranslationModel::loadTranslationByLanguage('python');
parent::getHeader();
self::call('Render', ['algorithms' => $algorithms, 'structures' => $structures, 'translations' => ['c' => $translationOfC, 'java' => $translationOfJava, 'javascript' => $translationOfJavascript, 'php' => $translationOfPhp, 'python' => $translationOfPython]]);
parent::getFooter();
}
示例3: createAccount
/**
* Méthode de création d'un utilisateur
*/
public static function createAccount()
{
if (isset($_POST['action'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
$passwordConfirmation = $_POST['passwordConfirmation'];
$avatar = ' ';
if ($_POST['avatar'] != '') {
$avatar = $_POST['avatar'];
}
$user = new \Root\Src\Model\UserModel($name, $password);
$user->setEmail($email);
$user->setAvatar($avatar);
if (AppController::getUser()) {
AppController::setMsg('warning', 'Vous êtes déjà connecté. Veuillez vous déconnecter avant de créer un nouveau compte.');
}
if (!$user->canUse('name') || !$user->canUse('email')) {
AppController::setMsg("warning", "Le nom d'utilisateur ou l'adresse mail est déjà utilisé.");
}
if ($password != $passwordConfirmation) {
AppController::setMsg("warning", "Les deux mots de passe ne sont pas les mêmes.");
} else {
$user->setPassword($password);
}
if (!AppController::hasError()) {
if ($user->record()) {
$user = $user->exist(true);
if ($user) {
//self::sendMail($user);
AppController::setMsg("success", "Le compte a bien été crée.");
AppController::redirect("connection");
}
} else {
AppController::setMsg("error", "Une erreur s'est produite avec la connexion serveur. Veuillez recommencer plus tard.");
}
}
}
parent::getHeader();
self::call('createAccount');
parent::getFooter();
}
示例4: translate
/**
* Rendu de la page de traduction
*/
public static function translate()
{
$language = $_POST['language'];
$pseudoCode = "";
$privateFunctionIds = [];
$selectedUserStructures = [];
if (isset($_POST['selectedUserStructures'])) {
$structureIds = $_POST['selectedUserStructures'];
foreach ($structureIds as $id) {
array_push($selectedUserStructures, \Root\Src\Model\StructureModel::loadStructureById($id));
}
}
if (isset($_POST['privateFunctions'])) {
$privateFunctionIds = $_POST['privateFunctions'];
}
$privateFunctions = [];
foreach ($privateFunctionIds as $id) {
$currentFunction = \Root\Src\Model\AlgorithmModel::loadFunctionById($id);
if ($currentFunction) {
array_push($privateFunctions, $currentFunction);
}
}
$publicFunctionIds = [];
if (isset($_POST['publicFunctions'])) {
$publicFunctionIds = $_POST['publicFunctions'];
}
$publicFunctions = [];
foreach ($publicFunctionIds as $id) {
$currentFunction = \Root\Src\Model\AlgorithmModel::loadFunctionById($id);
array_push($publicFunctions, $currentFunction);
}
if (isset($_POST['pseudoCode'])) {
$pseudoCode = $_POST['pseudoCode'];
}
$id = $_POST['id'];
parent::getHeader();
self::call('translate', ['id' => $id, 'selectedLanguage' => $language, 'pseudoCode' => htmlentities($pseudoCode), 'privateFunctions' => $privateFunctions, 'publicFunctions' => $publicFunctions, 'selectedStructures' => $selectedUserStructures]);
parent::getFooter();
}