Exemplo n.º 1
0
 /**
  * MODULE : Configuration
  */
 public function config()
 {
     if ($this->getPost('submit')) {
         if ($this->getPost('password')) {
             if ($this->getPost('password') === $this->getPost('confirm')) {
                 $password = $this->getPost('password', helpers::PASSWORD);
             } else {
                 $password = $this->getData('config', 'password');
                 template::$notices['confirm'] = 'La confirmation ne correspond pas au nouveau mot de passe';
             }
         } else {
             $password = $this->getData('config', 'password');
         }
         $this->setData('config', ['title' => $this->getPost('title', helpers::STRING), 'description' => $this->getPost('description', helpers::STRING), 'password' => $password, 'index' => $this->getPost('index', helpers::STRING), 'theme' => $this->getPost('theme', helpers::STRING)]);
         $this->saveData(true);
         $this->setNotification('Configuration enregistrée avec succès !');
         helpers::redirect($this->getUrl());
     }
     self::$title = 'Configuration';
     self::$content = template::openForm() . template::openRow() . template::text('title', ['label' => 'Titre du site', 'required' => true, 'value' => $this->getData('config', 'title')]) . template::newRow() . template::textarea('description', ['label' => 'Description du site', 'required' => true, 'value' => $this->getData('config', 'description')]) . template::newRow() . template::password('password', ['label' => 'Nouveau mot de passe', 'col' => 6]) . template::password('confirm', ['label' => 'Confirmation du mot de passe', 'col' => 6]) . template::newRow() . template::select('index', helpers::arrayCollumn($this->getData('pages'), 'title', 'SORT_ASC', true), ['label' => 'Page d\'accueil', 'required' => true, 'selected' => $this->getData('config', 'index')]) . template::newRow() . template::select('theme', helpers::listThemes(), ['label' => 'Thème par défaut', 'required' => true, 'selected' => $this->getData('config', 'theme')]) . template::newRow() . template::text('version', ['label' => 'Version de ZwiiCMS', 'value' => self::VERSION, 'disabled' => true]) . template::newRow() . template::button('clean', ['value' => 'Vider le cache', 'href' => '?clean', 'col' => 3, 'offset' => 4]) . template::button('export', ['value' => 'Exporter les données', 'href' => '?export', 'col' => 3]) . template::submit('submit', ['col' => 2]) . template::closeRow() . template::closeForm();
 }
Exemplo n.º 2
0
 /**
  * MODULE : Liste des news
  */
 public function index()
 {
     if ($this->getData($this->getUrl(0))) {
         $pagination = helpers::pagination($this->getData($this->getUrl(0)), $this->getUrl());
         $news = helpers::arrayCollumn($this->getData($this->getUrl(0)), 'date', 'SORT_DESC');
         for ($i = $pagination['first']; $i < $pagination['last']; $i++) {
             self::$content .= '<h3>' . $this->getData($this->getUrl(0), $news[$i], 'title') . '</h3>' . '<h4>' . date('d/m/Y - H:i', $this->getData($this->getUrl(0), $news[$i], 'date')) . '</h4>' . $this->getData($this->getUrl(0), $news[$i], 'content');
         }
         self::$content .= $pagination['pages'];
     }
 }