Example #1
0
 /**
  * Initialize Galette relevant objects
  *
  * @param I18n $i18n I18n
  * @param Db   $zdb  Database instance
  *
  * @return boolean
  */
 public function initObjects($i18n, $zdb)
 {
     if ($this->isInstall()) {
         $preferences = new Preferences($zdb, false);
         $ct = new \Galette\Entity\ContributionsTypes();
         $status = new \Galette\Entity\Status();
         include_once '../includes/fields_defs/members_fields.php';
         include_once '../includes/fields_defs/members_fields_cats.php';
         $fc = new \Galette\Entity\FieldsConfig(\Galette\Entity\Adherent::TABLE, $members_fields, $members_fields_cats, true);
         //$fc = new \Galette\Entity\FieldsCategories();
         include_once GALETTE_ROOT . 'includes/fields_defs/texts_fields.php';
         $texts = new \Galette\Entity\Texts($texts_fields, $preferences);
         $titles = new \Galette\Repository\Titles();
         include_once GALETTE_ROOT . 'includes/fields_defs/pdfmodels_fields.php';
         $models = new \Galette\Repository\PdfModels($zdb, $preferences);
         $this->_error = false;
         //Install preferences
         $res = $preferences->installInit($i18n->getID(), $this->getAdminLogin(), $this->getAdminPass());
         $this->_proceedReport(_T("Preferences"), $res);
         //Install contributions types
         $res = $ct->installInit();
         $this->_proceedReport(_T("Contributions types"), $res);
         //Install statuses
         $res = $status->installInit();
         $this->_proceedReport(_T("Status"), $res);
         //Install fields configuration and categories
         $res = $fc->installInit($zdb);
         $this->_proceedReport(_T("Fields config and categories"), $res);
         //Install texts
         $res = $texts->installInit(false);
         $this->_proceedReport(_T("Mails texts"), $res);
         //Install titles
         $res = $titles->installInit($zdb);
         $this->_proceedReport(_T("Titles"), $res);
         //Install PDF models
         $res = $models->installInit($pdfmodels_fields, false);
         $this->_proceedReport(_T("PDF Models"), $res);
         return !$this->_error;
     } else {
         if ($this->isUpgrade()) {
             $preferences = new Preferences($zdb);
             $preferences->store();
             $this->_proceedReport(_T("Update preferences"), true);
             return true;
         }
     }
 }
Example #2
0
         $preferences->pref_admin_login = $_POST['install_adminlogin'];
         $preferences->pref_admin_pass = $_POST['install_adminpass'];
         $preferences->store();
     }
 }
 include_once GALETTE_ROOT . 'includes/fields_defs/texts_fields.php';
 $texts = new Galette\Entity\Texts($texts_fields, $preferences);
 $res = $texts->installInit();
 if ($res !== false) {
     if ($res !== true) {
         $errs[] = '<li class="install-bad">' . _T("Default texts cannot be initialized.") . '<span>' . $res->getMessage() . '</span></li>';
     } else {
         $oks[] = '<li class="install-ok">' . _T("Default texts were successfully stored.") . '</li>';
     }
 }
 $models = new Galette\Repository\PdfModels($zdb, $preferences);
 include_once GALETTE_ROOT . 'includes/fields_defs/pdfmodels_fields.php';
 $res = $models->installInit($pdfmodels_fields);
 if ($res === true) {
     $oks[] = '<li class="install-ok">' . _T("PDF models were successfully stored.") . '</li>';
 } else {
     if ($res !== false) {
         //false is returned when table has already been filled
         $errs[] = '<li class="install-bad">' . _T("PDF models cannot be initialized.") . '<span>' . $res->getMessage() . '</span></li>';
     }
 }
 ?>
     <div<?php 
 if (count($errs) == 0) {
     echo ' id="infobox"';
 }