Example #1
0
$tpl->registerClass('GaletteMail', '\\Galette\\Core\\GaletteMail');
/**
 * Return member name. Smarty cannot directly use static functions
 *
 * @param array $params Parameters
 *
 * @return Adherent::getSName
 * @see Adherent::getSName
 */
function getMemberName($params)
{
    extract($params);
    return Galette\Entity\Adherent::getSName($id);
}
$tpl->registerPlugin('function', 'memberName', 'getMemberName');
$s = new Galette\Entity\Status();
$statuses_list = $s->getList();
/**
 * Return status label
 *
 * @param array $params Parameters
 *
 * @return string
 */
function getStatusLabel($params)
{
    extract($params);
    global $statuses_list;
    return $statuses_list[$id];
}
$tpl->registerPlugin('function', 'statusLabel', 'getStatusLabel');
Example #2
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 #3
0
$tpl->assign('member', $member);
$tpl->assign('data', $adherent);
$tpl->assign('self_adh', false);
$tpl->assign('dynamic_fields', $dynamic_fields);
$tpl->assign('error_detected', $error_detected);
$tpl->assign('success_detected', $success_detected);
if (isset($session['mail_warning'])) {
    //warning will be showed here, no need to keep it longer into session
    unset($session['mail_warning']);
}
$tpl->assign('warning_detected', $warning_detected);
$tpl->assign('languages', $i18n->getList());
$tpl->assign('require_calendar', true);
// pseudo random int
$tpl->assign('time', time());
// genre
$tpl->assign('titles_list', Titles::getList($zdb));
//Status
$statuts = new Galette\Entity\Status();
$tpl->assign('statuts', $statuts->getList());
//Groups
$groups = new Groups();
$groups_list = $groups->getSimpleList(true);
$tpl->assign('groups', $groups_list);
$form_elements = $fc->getFormElements();
$tpl->assign('fieldsets', $form_elements['fieldsets']);
$tpl->assign('hidden_elements', $form_elements['hiddens']);
// page generation
$content = $tpl->fetch('member.tpl');
$tpl->assign('content', $content);
$tpl->display('page.tpl');
Example #4
0
define("PREFIX_DB", "' . $_POST['install_dbprefix'] . '");
define("STOCK_FILES", "tempimages");
?>';
            fwrite($fd, $data);
            fclose($fd);
            $oks[] = '<li class="install-ok">' . _T("Configuration file created!") . '</li>';
        } else {
            $str = str_replace('%path', GALETTE_CONFIG_PATH . 'config.inc.php', _T("Unable to create configuration file (%path)"));
            $errs[] = '<li class="install-bad">' . $str . '</li>';
            $error = true;
        }
        $preferences = null;
        if ($step == 'i9') {
            $preferences = new Galette\Core\Preferences($zdb, false);
            $ct = new Galette\Entity\ContributionsTypes();
            $status = new Galette\Entity\Status();
            include_once '../includes/fields_defs/members_fields.php';
            $fc = new Galette\Entity\FieldsConfig(Galette\Entity\Adherent::TABLE, $members_fields, true);
            $titles = new Galette\Repository\Titles();
            //init default values
            $admpass = password_hash($_POST['install_adminpass'], PASSWORD_BCRYPT);
            $res = $preferences->installInit($i18n->getID(), $_POST['install_adminlogin'], $admpass);
            if ($res !== true) {
                $errs[] = '<li class="install-bad">' . _T("Default preferences cannot be initialized.") . '<span>' . $res->getMessage() . '</span></li>';
            } else {
                $oks[] = '<li class="install-ok">' . _T("Default preferences were successfully stored.") . '</li>';
            }
            $res = $ct->installInit();
            if ($res !== true) {
                $errs[] = '<li class="install-bad">' . _T("Default contributions types cannot be initialized.") . '<span>' . $res->getMessage() . '</span></li>';
            } else {