Esempio n. 1
0
 /**
  * Called from __construct() as final step of object instantiation.
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     $module = new Digitalus_Module();
     $this->moduleData = $module->getData();
     $this->properties = Digitalus_Module_Property::load('mod_login');
 }
Esempio n. 2
0
 /**
  * Called from __construct() as final step of object instantiation.
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     //get the module data
     $module = new Digitalus_Module();
     $this->moduleData = $module->getData();
     $this->properties = Digitalus_Module_Property::load('mod_forward');
     $this->_redirect($this->moduleData->pagePath);
 }
Esempio n. 3
0
 public function contactFormAction()
 {
     //create the form
     $form = new Zend_Form();
     //this page should post back to itself
     $form->setAction($_SERVER['REQUEST_URI']);
     $form->setMethod('post');
     $name = $form->createElement('text', 'name');
     $name->setLabel($this->view->getTranslation('Your Name') . ': ');
     $name->setRequired(TRUE);
     $name->addFilter('StripTags');
     $name->addErrorMessage($this->view->getTranslation('Your name is required!'));
     $name->setAttrib('size', 30);
     $email = $form->createElement('text', 'email');
     $email->setLabel($this->view->getTranslation('Your Email') . ': ');
     $email->setRequired(TRUE);
     $email->addValidator('EmailAddress');
     $email->addErrorMessage($this->view->getTranslation('Invalid email address!'));
     $email->setAttrib('size', 30);
     $subject = $form->createElement('text', 'subject');
     $subject->setLabel($this->view->getTranslation('Subject') . ': ');
     $subject->setRequired(TRUE);
     $subject->addFilter('StripTags');
     $subject->addErrorMessage($this->view->getTranslation('The subject is required!'));
     $subject->setAttrib('size', 40);
     $message = $form->createElement('textarea', 'message');
     $message->setLabel($this->view->getTranslation('Message') . ': ');
     $message->setRequired(TRUE);
     $message->addErrorMessage($this->view->getTranslation('The message is required!'));
     $message->setAttrib('cols', 35);
     $message->setAttrib('rows', 10);
     $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $this->view->getTranslation('Please verify you\'re a human'), 'captcha' => array('captcha' => 'Figlet', 'wordLen' => 6, 'timeout' => 300)));
     $form->addElement($name);
     $form->addElement($email);
     $form->addElement($subject);
     $form->addElement($message);
     $form->addElement($captcha);
     $form->addElement('submit', 'submitContactForm', array('label' => $this->view->getTranslation('Send Message')));
     $this->view->form = $form;
     if ($this->_request->isPost() && Digitalus_Filter_Post::has('submitContactForm')) {
         if ($form->isValid($_POST)) {
             //get form data
             $data = $form->getValues();
             //get the module data
             $module = new Digitalus_Module();
             $moduleData = $module->getData();
             //render the message
             $this->view->data = $data;
             $htmlMessage = $this->view->render('public/message.phtml');
             $mail = new Digitalus_Mail();
             $this->view->isSent = $mail->send($moduleData->email, array($data['email'], $data['name']), $data['subject'], $htmlMessage);
         }
     }
 }
Esempio n. 4
0
 public function contactFormAction()
 {
     //create the form
     $form = new Contact_Form();
     // retrieve the id that is set in the <DigitalusControl>-tag
     $digControlId = $this->view->getFilter('DigitalusControl')->getId();
     $this->view->form = $form;
     if ($this->_request->isPost() && Digitalus_Filter_Post::has('submitContactForm')) {
         if ($form->isValid($_POST)) {
             //get form data
             $data = $form->getValues();
             //get the module data
             $module = new Digitalus_Module($digControlId);
             $moduleData = $module->getData();
             //render the message
             $this->view->data = $data;
             $htmlMessage = $this->view->render('public/message.phtml');
             $mail = new Digitalus_Mail();
             $this->view->isSent = $mail->send($moduleData->email, array($data['email'], $data['name']), $data['subject'], $htmlMessage);
         }
     }
 }
Esempio n. 5
0
 /**
  * Initialize translations
  *
  * @return Zend_Translate
  */
 protected function _initTranslation()
 {
     // Get site settings
     $settings = Zend_Registry::get('siteSettings');
     // Get site config
     $config = Zend_Registry::get('config');
     $languageFiles = $config->language->translations->toArray();
     // Get cache object
     $cache = Zend_Registry::get('cache');
     Zend_Translate::setCache($cache);
     $module = $this->_request->getModuleName();
     $controller = $this->_request->getControllerName();
     // Add translation file depending on current module ('public' or 'admin')
     if ('public' == $module || 'public' == $controller) {
         $end = 'front';
         $key = Digitalus_Language::getLanguage();
     } else {
         $end = 'back';
         $key = Digitalus_Language::getAdminLanguage();
     }
     // always load english translation file
     $adapter = new Zend_Translate('csv', $csvPath = $config->language->path . '/' . $end . '/' . $languageFiles['en'] . '.' . $end . '.csv', $key, array('disableNotices' => true));
     Zend_Registry::set('Zend_Translate', $adapter);
     $csvPath = $config->language->path . '/' . $end . '/' . $languageFiles[$key] . '.' . $end . '.csv';
     if (is_file($csvPath) && 'en' != $key) {
         $this->_addTranslation($csvPath, $key);
     }
     // Module translations (are NOT separated into  'back' and 'front')
     if ($modules = Digitalus_Module::getModules()) {
         foreach ($modules as $module) {
             $this->_addTranslation(APPLICATION_PATH . '/modules/' . $module . '/data/languages/' . $languageFiles[$key] . '.csv', $key);
         }
     }
     return $adapter;
 }
Esempio n. 6
0
 /**
  * Initialize the controllers
  *
  * @return void
  */
 protected function _initControllers()
 {
     $this->bootstrap('config');
     // Get config resource
     $config = $this->getResource('config');
     $modules = $config->globalModules->module->toArray();
     // Setup core cms modules
     $this->_front->addControllerDirectory(APPLICATION_PATH . '/admin/controllers', 'admin');
     $this->_front->addControllerDirectory(APPLICATION_PATH . '/public/controllers', 'public');
     // Setup extension modules
     $this->_front->setParam('pathToModules', APPLICATION_PATH . '/modules');
     $cmsModules = null;
     if ($modules = Digitalus_Module::getModules()) {
         foreach ($modules as $module) {
             $cmsModules['mod_' . $module] = $module;
             $this->_front->addControllerDirectory(APPLICATION_PATH . '/modules/' . $module . '/controllers', 'mod_' . $module);
         }
     }
     if (is_array($cmsModules)) {
         $this->_front->setParam('cmsModules', $cmsModules);
     }
 }
Esempio n. 7
0
 public function init()
 {
     parent::init();
     $module = new Digitalus_Module();
     $this->moduleData = $module->getData();
 }
Esempio n. 8
0
 /**
  * Initialize the controllers
  *
  * @return void
  */
 protected function _initControllers()
 {
     // Setup core cms modules
     $this->_front->addControllerDirectory(APPLICATION_PATH . '/admin/controllers', 'admin');
     $this->_front->addControllerDirectory(APPLICATION_PATH . '/public/controllers', 'public');
     // Setup extension modules
     $this->_front->setParam('pathToModules', APPLICATION_PATH . '/modules');
     $cmsModules = null;
     if ($modules = Digitalus_Module::getModules()) {
         foreach ($modules as $module) {
             $cmsModules['mod_' . $module] = $module;
             $this->_front->addControllerDirectory(APPLICATION_PATH . '/modules/' . $module . '/controllers', 'mod_' . $module);
         }
     }
     if (is_array($cmsModules)) {
         $this->_front->setParam('cmsModules', $cmsModules);
     }
 }