public function add($params)
 {
     $path = Controller_carousel::getPathCarousel();
     //Ajout des documents de upload_files
     FoxFWKernel::addController('Upload_files');
     Upload_files::deplacer($path);
     FoxFWKernel::loadRouter('carousel_gestion');
 }
 public function index($params)
 {
     //FoxFWKernel::addVendor('foxFW/Page.php');
     FoxFWKernel::addModel('Page');
     //liste new article
     $page = new Page();
     $liste = $page->liste(array('max' => 20, 'type' => 'Article'));
     //return $GLOBALS['Twig']->render( _BUNDLE.'foxfw/view/index.html.twig', array('liste'=>$liste));
     return $GLOBALS['Twig']->render(FoxFWKernel::getView('index'), array('liste' => $liste));
 }
Example #3
0
 public static function viewEdit($path_dir)
 {
     $path = Upload_files::getUrlBuffer();
     //verifier si le repertoire existe sinon ont le creer
     if (!is_dir($path)) {
         mkdir($path, 0755, true);
     }
     //lister repertoire
     $files = Upload_files::getFilesDir($path);
     $dir = Upload_files::getFilesDir($path_dir);
     //affichage
     return $GLOBALS['Twig']->render(FoxFWKernel::getView('upload_files_view'), array('upload_buffer' => $files, 'path_dir' => $dir, 'max_upload_file' => FoxFWFile::convertFileSize($GLOBALS['Config']['Upload_files']['max_upload_file'], 'ko') . ' Ko'));
 }
Example #4
0
 public static function add($tab)
 {
     //Recherce URL dispo pour l'évent
     $compte = 0;
     $buffer = FoxFWKernel::URLencode($tab['titre']);
     while (!empty(R::find('evenement', 'url=?', [$buffer]))) {
         $compte++;
         $buffer = FoxFWKernel::URLencode($tab['titre'] . '-' . $compte);
     }
     //Création événement
     $event = R::dispense('evenement');
     $event->url = $buffer;
     $event->date = $tab['date'];
     $event->date_end = $tab['dateEnd'];
     $event->titre = $tab['titre'];
     $event->body = $tab['body'];
     $event->lieu = $tab['lieu'];
     $event->tag = $tab['tag'];
     R::store($event);
     return $event->url;
 }
Example #5
0
 public static function add($data)
 {
     //verification de l'id dispo
     $compte = 0;
     $buffer = FoxFWKernel::URLencode($data['titre']);
     while (!empty(R::find('page', 'url=?', [$buffer]))) {
         $compte++;
         $buffer = FoxFWKernel::URLencode($data['titre'] . '-' . $compte);
     }
     //preparation de l'article
     $article = R::dispense('page');
     $article->url = $buffer;
     $article->titre = $data['titre'];
     $article->tag = $data['tag'];
     $article->auteur = $data['auteur'];
     $article->filename = $buffer;
     $article->type = $data['type'];
     $article->twig = $data['twig'];
     $article->img = '';
     $article->date = time();
     if (isset($data['date'])) {
         $article->date = $data['date'];
     }
     //création du fichier qui recevra le body
     $filename = _WEB . Page::$buffer_dir . $buffer . '.html';
     file_put_contents($filename, $data['body']);
     if (!file_exists($filename)) {
         //si le fichier existe pas
         die('Erreur Création fichier BODY !: ' . $filename);
     }
     //telechargement de l'image
     $buffer = FoxFWFile::uploadFile($data['path']);
     if (isset($buffer[0])) {
         $article->img = $buffer[0];
     }
     R::store($article);
     return $article->url;
 }
 public function viewMVC($params)
 {
     return $GLOBALS['Twig']->render(FoxFWKernel::getView('admin_viewMVC'), array('model' => $GLOBALS['Config']['Model'], 'view' => $GLOBALS['Config']['View'], 'controller' => $GLOBALS['Config']['Controller']));
 }
Example #7
0
<?php

/*--------
By      : Teysseire Guillaume
Date    : 12/03/2015
Update  : 21/12/2015
Licence : © Copyright
Version : 1.2
-------------------------
*/
require_once 'vendor/foxFW/FoxFWBuild.php';
require_once 'vendor/foxFW/FoxFWKernel.php';
//FoxFWKernel::scriptTimeStart();
$config = FoxFWBuild::build('./home/config.json', './cache/config.json');
FoxFWKernel::build($config);
//FoxFWKernel::scriptTimeStop();
 public function confirmEditFile($params)
 {
     $_POST['file'] = htmlspecialchars_decode($_POST['file']);
     $_POST['body'] = htmlspecialchars_decode($_POST['body']);
     file_put_contents($_POST['file'], $_POST['body']);
     FoxFWKernel::loadRouter('Document_view');
 }
Example #9
0
 public static function addBundleFile($file)
 {
     return FoxFWKernel::addFile(_BUNDLE . $file);
 }
Example #10
0
 public static function build($config_start, $cache_config)
 {
     //Verifier si une compilation de la configuration existe déja
     if (file_exists($cache_config)) {
         return json_decode(file_get_contents($cache_config), true);
     }
     //chargement configuration basique
     $config = json_decode(file_get_contents($config_start), true);
     if ($config == NULL) {
         exit('Config .json error !');
     }
     //-------------------------------------------------------
     //preparation structure
     $config['Controller'] = [];
     $config['Model'] = [];
     $config['View'] = [];
     //-------------------------------------------------------
     //recherche les bundles disponible si il ne sont pas précisé
     if (!isset($config['Bundle'])) {
         $config['Bundle'] = [];
         $bundle_url = $config['Define']['_BUNDLE'];
         $bundle = scandir($bundle_url);
         foreach ($bundle as $key => $value) {
             if ($value != '.') {
                 if ($value != '..') {
                     $config['Bundle'][$value] = $bundle_url . $value . '/';
                 }
             }
         }
     }
     //recupére les paths des fichiers ce trouvant dans le dossier
     $searchAddFile = function ($dossier) {
         $ret = [];
         //Detections des objects
         if (file_exists($dossier)) {
             $scan = scandir($dossier);
             foreach ($scan as $key2 => $value2) {
                 if ($value2 != '.') {
                     if ($value2 != '..') {
                         $tab = explode('.', $value2);
                         $ret[$tab[0]] = $dossier . $value2;
                     }
                 }
             }
         }
         return $ret;
     };
     //-------------------------------------------------------
     //chargement controller / model / view
     foreach ($config['Bundle'] as $key => $value) {
         $file = $config['Bundle'][$key] . 'config.json';
         if (file_exists($file)) {
             //chargement et fusion de la configuration
             $data = json_decode(file_get_contents($file), true);
             $config = FoxFWKernel::merge_object($config, $data);
         }
         //Detections des controllers
         $config['Controller'] += $searchAddFile($value . 'controller/');
         //Detection des models
         $config['Model'] += $searchAddFile($value . 'model/');
         //Detection des view
         $config['View'] += $searchAddFile($value . 'view/');
     }
     //-------------------------------------------------------
     //ajout configuration bundle home
     $file = $config['Define']['_HOME'] . 'config.json';
     $config['Bundle']['home'] = $config['Define']['_HOME'];
     if (file_exists($file)) {
         //chargement et fusion de la configuration
         $data = json_decode(file_get_contents($file), true);
         $config = FoxFWKernel::merge_object($config, $data);
     }
     //Surcharge des bundles par le bundle master
     if (isset($config['Define']['_HOME'])) {
         //Detections des controllers
         $tab = $searchAddFile($config['Define']['_HOME'] . 'controller/');
         foreach ($tab as $key => $value) {
             $config['Controller'][$key] = $value;
         }
         //Detection des models
         $tab = $searchAddFile($config['Define']['_HOME'] . 'model/');
         foreach ($tab as $key => $value) {
             $config['Model'][$key] = $value;
         }
         //Detection des view
         $tab = $searchAddFile($config['Define']['_HOME'] . 'view/');
         foreach ($tab as $key => $value) {
             $config['View'][$key] = $value;
         }
     }
     /*$tab = $searchAddFile( $path ); //Marche pas: $config['View'] += $searchAddFile( $path );
     		foreach ($tab as $key => $value)
     			$config['View'][ $key ] = $value;*/
     //-------------------------------------------------------
     //compilation de la config si cache ON
     if (isset($config['FoxFW'])) {
         if ($config['FoxFW']['cache']) {
             file_put_contents($cache_config, json_encode($config));
         }
     }
     //-------------------------------------------------------
     return $config;
 }
 public function adminViewListEvenement()
 {
     $event = Evenement::listeAll(0);
     return $GLOBALS['Twig']->render(FoxFWKernel::getView('calendrier_adminviewListe'), array('event' => $event, 'tagColor' => $GLOBALS['Config']['Calendrier']['tag']));
 }
Example #12
0
 public function panelUser()
 {
     return $GLOBALS['Twig']->render(FoxFWKernel::getView('user_panel'));
 }
Example #13
0
//twig extension function controller
$GLOBALS['Twig']->addFunction(new Twig_SimpleFunction('controller', function ($method, $params = array()) {
    $error = FoxFWKernel::controller($method, $params);
    if ($error != 200) {
        die('Error Controller Twig Appel ! ');
    }
}, array('is_safe' => array('html'))));
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
//
//
//
//--------------------------------------------------------------------------------
//renvoi la view
$GLOBALS['Twig']->addFunction(new Twig_SimpleFunction('getView', function ($view) {
    return FoxFWKernel::getView($view);
}));
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
//
//
//
//--------------------------------------------------------------------------------
//decodage des htmlspecialchars
$GLOBALS['Twig']->addFunction(new Twig_SimpleFunction('htmlspecialchars_decode', function ($text) {
    return htmlspecialchars_decode($text);
}));
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
//
//
    public function search()
    {
        $groupe = '';
        if (isset($_POST['groupe'])) {
            $groupe = 'AND groupe=\'' . $_POST['groupe'] . '\'';
        }
        $search = $_POST['search'];
        //préparation de la structure
        $list = FoxFWbdd::sql('SELECT * FROM contacts WHERE
		(( nom LIKE ?) OR ( prenom LIKE ?) OR ( telfixe LIKE ?) OR ( telportable LIKE ?) OR ( structure LIKE ?) OR ( email LIKE ?)) ' . $groupe, [$search . '%', $search . '%', $search . '%', $search . '%', $search . '%', $search . '%']);
        $list_groupe = FoxFWbdd::bdd('contacts', 'getListValTable', array('table' => 'groupe'));
        if (!isset($list_groupe['groupe'])) {
            $list_groupe['groupe'] = [];
        }
        return $GLOBALS['Twig']->render(FoxFWKernel::getView('contacts_liste'), array('list' => $list, 'groupe' => $list_groupe['groupe']));
    }
Example #15
0
 public function e500()
 {
     return $GLOBALS['Twig']->render(FoxFWKernel::getView('error_error'), array('error' => '500', 'message' => 'Erreur interne du serveur !'));
 }
Example #16
0
 public function viewListeAdminPage($params)
 {
     if (isset($params['id'])) {
         $data = $this->page->liste(array('order_by' => 'titre', 'type' => $params['id']));
     } else {
         $data = $this->page->liste(array('order_by' => 'titre'));
     }
     return $GLOBALS['Twig']->render(FoxFWKernel::getView('pages_listePage'), array('liste' => $data));
 }