Beispiel #1
0
 /**
  * Validate the form
  */
 protected function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         $this->frm->cleanupFields();
         // validation
         if ($this->frm->isCorrect()) {
             BackendModel::setModuleSetting($this->URL->getModule(), 'default_group', (string) $this->frm->getField('default_group')->getValue());
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_saved_settings');
             // redirect to the settings page
             $this->redirect(BackendModel::createURLForAction('settings') . '&report=saved');
         }
     }
 }
 public function install()
 {
     // install the module in the database
     $this->addModule('FormBuilderMailer');
     // install the locale, this is set here because we need the module for this
     $this->importLocale(dirname(__FILE__) . '/Data/locale.xml');
     $this->setModuleRights(1, 'FormBuilderMailer');
     $this->setActionRights(1, 'FormBuilderMailer', 'Settings');
     // settings navigation
     $navigationSettingsId = $this->setNavigation(null, 'Settings');
     $navigationModulesId = $this->setNavigation($navigationSettingsId, 'Modules');
     $this->setNavigation($navigationModulesId, 'FormBuilderMailer', 'form_builder_mailer/settings');
     BackendModel::setModuleSetting('FormBuilderMailer', 'enabled', true);
     BackendModel::subscribeToEvent('Formbuilder', 'after_submission', 'FormBuilderMailer', array('Backend\\Modules\\FormBuilderMailer\\Engine\\Model', 'afterFormSubmission'));
 }
 /**
  * Validate the form
  */
 private function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         if ($this->frm->isCorrect()) {
             // get the settings
             $settings = array();
             $settings['activeList'] = $this->frm->getField('list')->getValue();
             // save the new settings
             BackendModel::setModuleSetting($this->getModule(), 'activeList', $settings['activeList']);
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_saved_settings');
             // redirect to the settings page
             $this->redirect(BackendModel::createURLForAction('settings') . '&report=saved');
         }
     }
 }
 /**
  * Validates the settings form
  */
 private function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         if ($this->frm->isCorrect()) {
             $enabled = (bool) $this->frm->getField('enabled')->getValue();
             BackendModel::setModuleSetting($this->URL->getModule(), 'enabled', $enabled);
             if ($enabled) {
                 BackendModel::subscribeToEvent('Formbuilder', 'after_submission', 'FormBuilderMailer', array('\\Backend\\Modules\\FormBuilderMailer\\Engine\\Model', 'afterFormSubmission'));
             } else {
                 BackendModel::unsubscribeFromEvent('Formbuilder', 'after_submission', 'FormBuilderMailer');
             }
             BackendModel::setModuleSetting($this->URL->getModule(), 'log', (bool) $this->frm->getField('log')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'add_data', (bool) $this->frm->getField('add_data')->getValue());
             BackendModel::triggerEvent($this->getModule(), 'after_saved_settings');
             $this->redirect(BackendModel::createURLForAction('settings') . '&report=saved');
         }
     }
 }
 /**
  * Parse the form
  */
 protected function parse()
 {
     parent::parse();
     // Add jsTree plugin
     $this->header->addJS('jstree.min.js', $this->getModule(), false, false);
     $this->header->addCSS('jstree/style.min.css', $this->getModule(), false, false);
     // Show the API key form if we don't have one set
     if (!isset($this->apiKey)) {
         $this->tpl->assign('NoApiKey', true);
         $this->tpl->assign('Wizard', true);
         // create api key form
         $this->frmApiKey = new BackendForm('apiKey');
         $this->frmApiKey->addText('key', $this->apiKey);
         if ($this->frmApiKey->isSubmitted()) {
             $this->frmApiKey->getField('key')->isFilled(BL::err('FieldIsRequired'));
             if ($this->frmApiKey->isCorrect()) {
                 BackendModel::setModuleSetting($this->getModule(), 'api_key', $this->frmApiKey->getField('key')->getValue());
                 $this->redirect(BackendModel::createURLForAction('Settings') . '&report=saved');
             }
         }
         $this->frmApiKey->parse($this->tpl);
     } else {
         // show the settings form
         $this->tpl->assign('EverythingIsPresent', true);
         $this->loadCompressionSettingsForm();
         $this->tpl->assign('directoryTree', $this->directoryTreeHtml);
         $this->validateCompressionSettingsForm();
         $this->frmCompressionSettings->parse($this->tpl);
     }
 }
Beispiel #6
0
 /**
  * Validates the settings form
  */
 private function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         if ($this->frm->isCorrect()) {
             // set our settings
             BackendModel::setModuleSetting($this->URL->getModule(), 'overview_num_items', (int) $this->frm->getField('overview_number_of_items')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'recent_products_full_num_items', (int) $this->frm->getField('recent_products_full_number_of_items')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'spamfilter', (bool) $this->frm->getField('spamfilter')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'allow_comments', (bool) $this->frm->getField('allow_comments')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'moderation', (bool) $this->frm->getField('moderation')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'notify_by_email_on_new_comment_to_moderate', (bool) $this->frm->getField('notify_by_email_on_new_comment_to_moderate')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'notify_by_email_on_new_comment', (bool) $this->frm->getField('notify_by_email_on_new_comment')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'width1', (int) $this->frm->getField('width1')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'height1', (int) $this->frm->getField('height1')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'allow_enlargment1', (bool) $this->frm->getField('allow_enlargment1')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'force_aspect_ratio1', (bool) $this->frm->getField('force_aspect_ratio1')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'width2', (int) $this->frm->getField('width2')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'height2', (int) $this->frm->getField('height2')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'allow_enlargment2', (bool) $this->frm->getField('allow_enlargment2')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'force_aspect_ratio2', (bool) $this->frm->getField('force_aspect_ratio2')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'width3', (int) $this->frm->getField('width3')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'height3', (int) $this->frm->getField('height3')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'allow_enlargment3', (bool) $this->frm->getField('allow_enlargment3')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'force_aspect_ratio3', (bool) $this->frm->getField('force_aspect_ratio3')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'allow_multiple_categories', (bool) $this->frm->getField('allow_multiple_categories')->getValue());
             // redirect to the settings page
             $this->redirect(BackendModel::createURLForAction('settings') . '&report=saved');
         }
     }
 }