Example #1
0
 public function view()
 {
     if (!Core::checkRequiredGetVars("permalink")) {
         Go::to404();
     }
     $m = new ModelPost();
     $post = $m->oneByPermalink($_GET["permalink"]);
     Autoload::addComponent('Dabox');
     $this->setTitle($post['title_post']);
     $this->addContent("post", $post);
 }
Example #2
0
 public function view()
 {
     if (!Core::checkRequiredGetVars('permalink_list')) {
         Go::to404();
     }
     $m = new ModelList();
     $list = $m->getList($_GET['permalink_list']);
     if (!$list) {
         Go::to404();
     }
     if (Core::checkRequiredGetVars('edit') && $_GET["edit"] === true && AuthenticationHandler::$data['id_user'] == $list['id_user']) {
         Autoload::addScript('Savely.ListEdit');
         $this->setTemplate('l', 'edit');
     }
     $this->setTitle($list['name_list'] . ' - Savely.co');
     $this->addContent('data', $list);
 }
Example #3
0
 /**
  * Méthode de pré-traitement du formulaire avant envoi à la vue (parsing des libellés, des types de balises, définition des js/css requis)
  * @return void
  */
 public function prepareToView()
 {
     $this->cleanData();
     if (isset($this->post)) {
         $this->injectValues($this->post);
     }
     Autoload::addScript("Form");
     $this->countMendatory = 0;
     foreach ($this->data as $name => &$data) {
         switch ($data["tag"]) {
             case self::TAG_RICHEDITOR:
                 /** @ todo **/
                 trace("you must handle richeditor");
                 Autoload::addScript("ckeditor/ckeditor.js");
                 break;
             case self::TAG_UPLOAD:
                 Autoload::addComponent("Uploader");
                 Autoload::addScript("M4Tween");
                 $this->hasUpload = true;
                 break;
             case self::TAG_INPUT:
                 if (isset($data["attributes"]["type"]) && $data["attributes"]["type"] == "checkbox") {
                     unset($data["attributes"]["valueOff"]);
                 }
                 if (isset($data["autoComplete"])) {
                     Autoload::addComponent('Autocomplete');
                 }
                 if (isset($data["attributes"]["type"]) && $data["attributes"]["type"] == "file") {
                     Autoload::addComponent("Uploader");
                     Autoload::addScript("M4Tween");
                     $this->hasUpload = true;
                 } else {
                     if (isset($data["attributes"]["type"]) && $data["attributes"]["type"] == "submit" && Application::getInstance()->multiLanguage) {
                         $data["attributes"]["value"] = Dictionary::term($data["attributes"]["value"]);
                     }
                 }
                 break;
             case self::TAG_DATEPICKER:
                 Autoload::addComponent("Pikaday");
                 $this->hasDatePicker = true;
                 break;
             case self::TAG_COLORPICKER:
                 Autoload::addScript("jscolor/jscolor.js");
                 $this->hasColorPicker = true;
                 break;
             case self::TAG_RADIOGROUP:
             case self::TAG_CHECKBOXGROUP:
             case self::TAG_SELECT:
                 if (isset($data["fromModel"]) && is_array($data["fromModel"])) {
                     $condition = null;
                     $fm = $data["fromModel"];
                     if (isset($fm["condition"]) && is_array($fm["condition"])) {
                         $condition = Query::condition();
                         foreach ($fm["condition"] as $method => $parameters) {
                             call_user_func_array(array($condition, $method), $parameters);
                         }
                     }
                     $model = method_exists($fm["model"], "getInstance") ? $fm["model"]::getInstance() : new $fm["model"]();
                     $datas = $model->{$fm}["method"]($condition);
                     $options = array();
                     $defaultChecked = isset($data["attributes"]["checked"]) && !isset($this->post);
                     foreach ($datas as $donnees) {
                         if (is_object($donnees)) {
                             $donnees_name = $donnees->{$fm}["name"];
                             $donnees_value = $donnees->{$fm}["value"];
                         } else {
                             $donnees_name = isset($donnees[$fm['name']]) ? $donnees[$fm["name"]] : '';
                             $donnees_value = isset($donnees[$fm['value']]) ? $donnees[$fm["value"]] : '';
                         }
                         $options[] = array("name" => $donnees_name, "label" => $donnees_name, "value" => $donnees_value, "checked" => $defaultChecked);
                     }
                     if (!isset($data["options"])) {
                         $data["options"] = $options;
                     } else {
                         $data["options"] = array_merge($data["options"], $options);
                     }
                 }
                 if (isset($data["chosen"]) && $data["chosen"] == true) {
                     Autoload::addScript("chosen/chosen.min.js");
                     /** @todo componentify this */
                     Autoload::addStyle(Core::$path_to_components . "/chosen/style/chosen.css");
                 }
                 break;
         }
         if ($data["require"]) {
             $this->countMendatory++;
         }
         if (isset($data["attributes"]["valueGet"])) {
             if (isset($_GET[$data["attributes"]["valueGet"]])) {
                 $data["attributes"]["value"] = $_GET[$data["attributes"]["valueGet"]];
                 unset($this->data[$name]["attributes"]["valueGet"]);
             } else {
                 if (isset($data["attributes"]["type"]) && $data["attributes"]["type"] == "hidden") {
                     unset($this->data[$name]);
                 }
             }
         }
     }
 }
Example #4
0
<?php

date_default_timezone_set("Europe/Paris");
define("MEMORY_REAL_USAGE", true);
$timeInit = microtime(true);
$memInit = memory_get_usage(MEMORY_REAL_USAGE);
require_once __DIR__ . "/includes/libs/core/application/class.Singleton.php";
require_once __DIR__ . "/includes/libs/core/application/class.Autoload.php";
use core\application\Autoload;
use core\application\Core;
Autoload::$folder = __DIR__;
spl_autoload_register(array(Autoload::getInstance(), "load"));
Core::checkEnvironment();
Core::init();
Core::parseURL();
Core::execute(Core::getController(), Core::getAction(), Core::getTemplate());
Core::endApplication();
Example #5
0
 /**
  * @static
  * @return void
  */
 public static function prepare()
 {
     Autoload::addComponent("Debugger");
 }
 /**
  * Constructor
  * Se doit d'être appeler dans la classe fille
  * Vérifie si l'utilisateur est identifié
  * Définie le nom du controller (de la classe courante)
  */
 public function __construct()
 {
     $authHandler = Application::getInstance()->authenticationHandler;
     if (!call_user_func_array(array($authHandler, 'is'), array($authHandler::ADMIN))) {
         Go::to();
     }
     $class = explode("\\", get_class($this));
     $this->className = end($class);
     $this->formName = $this->className;
     Autoload::addScript("Backoffice");
     $this->h1 = new BOLabelList("h1", ucfirst($this->className));
     $this->titles = new BOLabelList("titles", ucfirst($this->className));
     $this->actions = new BOActionList();
     $this->actions->enable('view', 'view', true);
     $this->actions->enable('edit', 'edit', true);
     $this->actions->enable('delete', 'delete', true);
     $this->actions->enable('listing', 'listing', false);
     $this->actions->enable('add', 'add', false);
     $this->menu = new Menu(Core::$path_to_application . '/modules/back/menu.json');
 }
 /**
  * Méthode d'ajout de feuille de style &agrave; la vue
  * @param String $pStyle				Nom du fichier CSS
  * @return void
  */
 protected function addStyle($pStyle)
 {
     Autoload::addStyle($pStyle);
 }