Beispiel #1
0
 public function localeDateTime($format, $locale)
 {
     if (is_null($lang)) {
         $lang = ZFE_Core::getLanguage();
     }
     $dt = new Zend_Date($this->getTimestamp());
     $formats = Zend_Locale_Data::getList($lang, 'datetime');
     if (isset($formats[$format])) {
         $format = $formats[$format];
     }
     return $dt->toString($format, null, $lang);
 }
Beispiel #2
0
 /**
  * When unserializing a cached object, reset the language
  * to the interface language
  */
 public function __wakeup()
 {
     $this->_lang = ZFE_Core::getLanguage();
 }
Beispiel #3
0
 public function __construct($options = array())
 {
     // TODO remove these once we are passing these values in
     if (!isset($options['language'])) {
         $options['language'] = ZFE_Core::getLanguage();
     }
     if (!isset($options['defaultLanguage'])) {
         // passes
         $ml = Zend_Registry::get('ZFE_MultiLanguage');
         $options['defaultLanguage'] = $ml->getDefault();
     }
     if (!isset($options['layoutPath'])) {
         $options['layoutPath'] = APPLICATION_PATH . '/emails/layouts';
     }
     if (!isset($options['scriptPath'])) {
         $options['scriptPath'] = APPLICATION_PATH . '/emails/scripts';
     }
     // set defaults
     // TODO remove layoutPath, scriptPath, defaultLayout as these strictly be passed in
     $options = array_merge(array('defaultLayout' => 'default', 'charset' => 'UTF-8'), $options);
     // check layoutPath has been set
     if (!isset($options['layoutPath'])) {
         throw new Exception('Layout path not set or not found');
     }
     // check scriptPath has been set
     if (!isset($options['scriptPath'])) {
         throw new Exception('Script path not set or not found');
     }
     // set the layout for the emails. this will be our lovely html header and
     // footers making our emails look warm and fuzzy :)
     $this->_layout = new Zend_Layout();
     $this->_layout->setLayoutPath($options['layoutPath']);
     if (isset($options['defaultLayout'])) {
         // TODO is this optional? should it be?
         $this->_layoutScript = $options['defaultLayout'];
         $this->_layout->setLayout($this->_layoutScript);
     }
     // set View
     $this->_view = new Zend_View();
     $this->_view->setScriptPath($options['scriptPath']);
     // set options
     $this->_options = $options;
     // $this->_view = new Zend_View();
     //
     // // set the base directory of where our emails scripts are located
     // $this->_view->setScriptPath(APPLICATION_PATH . "/emails/scripts");
     //
     // $this->_view->addHelperPath(ZFE_Environment::getLibraryPath() . "/View/Helper", 'ZFE_View_Helper');
     // $this->_view->addHelperPath(ZFE_Environment::getLibraryPath() . "/View/Helper", 'ACQ_View_Helper');
     //
     // $module = ZFE_Environment::getModuleName();
     // if ($module !== 'default') {
     //     $cls = ucfirst(strtolower($module)) . '_View_Helper';
     //     $this->_view->addHelperPath(ZFE_Environment::getModulePath() . "/views/helpers", $cls);
     // }
     //
     // $this->_layout = new Zend_Layout();
     // $this->_layout->setLayoutPath(APPLICATION_PATH . "/emails/layouts");
     // $this->_layoutScript = 'default';
     // $this->_layout->setLayout($this->_layoutScript);
     //
     // $this->_version = self::$_defaultVersion;
     //
     // $this->_options['language'] = ZFE_Core::getLanguage();
 }