예제 #1
0
 public static function render($params = [])
 {
     isset($_POST['idStructure']) ? $idStructure = $_POST['idStructure'] : ($idStructure = '');
     isset($_POST['structure']) ? $structure = $_POST['structure'] : ($structure = '');
     isset($_POST['translationToC']) ? $translationToC = $_POST['translationToC'] : ($translationToC = '');
     isset($_POST['translationToJava']) ? $translationToJava = $_POST['translationToJava'] : ($translationToJava = '');
     isset($_POST['translationToJavascript']) ? $translationToJavascript = $_POST['translationToJavascript'] : ($translationToJavascript = '');
     isset($_POST['translationToPython']) ? $translationToPython = $_POST['translationToPython'] : ($translationToPython = '');
     isset($_POST['translationToPhp']) ? $translationToPhp = $_POST['translationToPhp'] : ($translationToPhp = '');
     isset($_POST['pseudoCodeToTest']) ? $pseudoCodeToTest = $_POST['pseudoCodeToTest'] : ($pseudoCodeToTest = '');
     isset($_POST['test']) ? $hadToTranslate = true : ($hadToTranslate = false);
     $user = AppController::getUser();
     if (!$user) {
         AppController::setMsg("warning", "Vous devez être connecté pour avoir accès à cette partie du site");
         AppController::redirect('index');
     }
     if (isset($_POST['erase'])) {
         unset($_POST['erase']);
         self::erase();
         die;
     }
     if (isset($_POST['save'])) {
         unset($_POST['save']);
         self::save(['idStructure' => $idStructure]);
         die;
     }
     parent::render(['idStructure' => $idStructure, 'structure' => $structure, 'pseudoCodeToTest' => $pseudoCodeToTest, 'translationToC' => $translationToC, 'translationToJava' => $translationToJava, 'translationToJavascript' => $translationToJavascript, 'translationToPhp' => $translationToPhp, 'translationToPython' => $translationToPython, 'hadToTranslate' => $hadToTranslate]);
 }
예제 #2
0
 function render($action = NULL, $layout = NULL, $file = NULL)
 {
     if ($action == null) {
         $action = $this->view_action;
     }
     $output = parent::render($action, $layout, $file);
     return $output;
 }
예제 #3
0
 /**
  * Fonction de rendu par défaut
  * @param type $params
  */
 public static function render($params = [])
 {
     $user = AppController::getUser();
     if (!$user) {
         AppController::setMsg("warning", "Vous devez être connecté pour avoir accès à cette zone.");
         AppController::redirect("index");
     }
     if (isset($_POST['action'])) {
         self::update();
         $user = AppController::getUser();
     }
     parent::render(['id' => $user->getId(), 'name' => $user->getName(), 'email' => $user->getEmail(), 'avatar' => $user->getAvatar()]);
 }
예제 #4
0
 public static function render($params = [])
 {
     $helpList = \Root\Src\Model\AlgorithmModel::getMostRecentHelped();
     $helpMsg = [];
     foreach ($helpList as $help) {
         $userId = \Root\Src\Model\MailModel::getMsgBySubject($help->getId())[0]->getOwnerId();
         $helpMsg[$help->getId()]["owner"] = \Root\Src\Model\UserModel::getUser($userId)->getName();
         $helpMsg[$help->getId()]["content"] = \Root\Src\Model\MailModel::getMsgBySubject($help->getId())[0]->getContent();
     }
     $news = [];
     $sharing = [];
     parent::render(["helpList" => $helpList, "helpMsg" => $helpMsg, "news" => $news, "sharing" => $sharing]);
 }
예제 #5
0
 protected function renderFile(\AppController $class)
 {
     $class->render(array('controller' => 'Usuarios', 'view' => 'administrador'), 'painel');
 }
예제 #6
0
<?php

/**
 * Yeah. You're definitely going to need this.
 * Probably don't edit anything in here.
 */
require getenv('DOCUMENT_ROOT') . '/app/bootstrap.php';
/**
 * And ah... don't forget to actually run the application.
 */
try {
    BadKitty::getInstance()->dispatch();
} catch (Exception $e) {
    $klass = new AppController();
    $klass->e = $e;
    if (__DEBUG__ == TRUE) {
        $klass->title = 'Error';
        echo $klass->render('error.php');
    } else {
        $klass->title = '404 Not Found';
        echo $klass->render('error404.php');
    }
}
예제 #7
0
 /**
  * Méthode de confirmation d'un compte utilisateur
  * @param type $params
  */
 public static function confirmAccount($params = [])
 {
     $id = null;
     $confirmToken = null;
     if (isset($params[0]) && isset($params[1])) {
         $id = $params[0];
         $confirmToken = $params[1];
     }
     $user = new \Root\Src\Model\UserModel('', '');
     $user->setId($id);
     $user->setConfirmToken($confirmToken);
     $validAccount = $user->activate();
     if ($validAccount) {
         AppController::setMsg("success", "Votre compte a bien été validé.");
         AppController::setMsg("success", "Votre êtes maintenant connecté.");
         AppController::setUser($validAccount);
     } else {
         AppController::setMsg("warning", "Information du compte non valide.");
     }
     AppController::render();
 }
예제 #8
0
 public static function render($params = [])
 {
     $method = false;
     $activeFunction = false;
     if (isset($_POST['translate'])) {
         $method = 'translate';
     }
     if (isset($_POST['new'])) {
         $method = 'erase';
     }
     if (isset($_POST['open'])) {
         $method = 'open';
     }
     if (isset($_POST['save'])) {
         $method = 'save';
     }
     if (isset($_POST['backup'])) {
         $method = 'backup';
     }
     if (isset($_POST['share'])) {
         $method = 'share';
     }
     if (isset($_POST['askForHelp'])) {
         $method = 'askForHelp';
     }
     if ($method) {
         self::$method();
         die;
     }
     $id = NULL;
     $pseudoCode = '';
     if (isset($params[0])) {
         $id = $params[0];
     }
     $language = 'php';
     $user = AppController::getUser();
     $privateFunctions = [];
     $userStructures = [];
     $selectedUserStructures = [];
     if (isset($_POST['selectedStructures'])) {
         $selectedUserStructures = $_POST['selectedStructures'];
     } else {
         if ($user) {
             $structures = \Root\Src\Model\StructureModel::loadStructureByUser($user->getId());
             foreach ($structures as $structure) {
                 array_push($selectedUserStructures, $structure->getId());
             }
         }
     }
     if (isset($_POST['id'])) {
         $id = $_POST['id'];
     }
     if ($user) {
         $privateFunctions = \Root\Src\Model\AlgorithmModel::loadFunctionByUser($user->getId());
         $userStructures = \Root\Src\Model\StructureModel::loadStructureByUser($user->getId());
         if ($id) {
             $function = \Root\Src\Model\AlgorithmModel::loadFunctionById($id);
             if ($function) {
                 if ($function->getOwnerId() != $user->getId()) {
                     $pseudoCode = '';
                     $id = '';
                     $_POST['id'] = NULL;
                 } else {
                     if ($pseudoCode == "") {
                         $pseudoCode = $function->getContent();
                         $activeFunction = $function;
                     }
                 }
             }
         }
     }
     $publicFunctions = [];
     $allPublicFunctions = \Root\Src\Model\AlgorithmModel::loadPublicFunction();
     foreach ($allPublicFunctions as $currentFunction) {
         if (!in_array($currentFunction, $privateFunctions)) {
             array_push($publicFunctions, $currentFunction);
         }
     }
     $selectedPrivateFunctions = [];
     if (isset($_POST['privateFunctions'])) {
         $selectedPrivateFunctions = $_POST['privateFunctions'];
     }
     $selectedPublicFunctions = [];
     if (isset($_POST['publicFunctions'])) {
         $selectedPublicFunctions = $_POST['publicFunctions'];
     }
     if (isset($_POST['language'])) {
         $language = $_POST['language'];
     }
     if (isset($_POST['pseudoCode'])) {
         $pseudoCode = $_POST['pseudoCode'];
     }
     $helpMsgs = \Root\Src\Model\MailModel::getMsgBySubject($id);
     parent::render(['id' => $id, 'selectedLanguage' => $language, 'pseudoCode' => $pseudoCode, 'user' => $user, 'privateFunctions' => $privateFunctions, 'publicFunctions' => $publicFunctions, 'selectedPrivateFunctions' => $selectedPrivateFunctions, 'selectedPublicFunctions' => $selectedPublicFunctions, 'userStructures' => $userStructures, 'selectedUserStructures' => $selectedUserStructures, 'activeFunction' => $activeFunction, 'helpMsgs' => $helpMsgs]);
 }
예제 #9
0
 public function error($method = NULL)
 {
     header('HTTP/1.0 404 Not Found');
     if (__DEBUG__) {
         throw new Exception($this->url . ' Not Found');
     } else {
         $klass = new AppController();
         $klass->url = '/' . $this->url;
         $klass->url = '404 Not Found';
         echo $klass->render('error404.php');
     }
 }
예제 #10
0
    $app_controller = new AppController();
} catch (Exception $e) {
    exit($e->getMessage());
}
?>

<!DOCTYPE html>
<html ng-app="myApp">
	<head>
		<title></title>
		<link rel="stylesheet" type="text/css" href="assets/css/normalize.css">
		<link rel="stylesheet" type="text/css" href="assets/css/app/animate.css">
		<link rel="stylesheet" type="text/css" href="assets/css/app/main.css">
	</head>
	<body>
		<header></header>
		<div id="container_id"></div>
		<a href="https://github.com/aj07mm/shellmanager" target="_blank"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>
		<?php 
$app_controller->render('index', array('model' => $model));
//TODO assumindo que getAllScripts() foi chamada
$app_controller->render('footer', array('totalScripts' => $model->getQuantityValidScripts()));
?>
	<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js"></script>
	<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular-animate.min.js"></script>
	<script type="text/javascript" src="assets/js/app/main.js"></script>
	<script type="text/javascript" src="config.json"></script>
</body>
</html>