/** * 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; } } }