Ejemplo n.º 1
0
 /**
  * Get the config model for the website or default config model if not found
  * 
  * @param type $path
  * @return Core_Model_Config | string value 
  */
 public function getConfig($path = null)
 {
     if (!$this->_config) {
         $this->_config = App_Main::getConfig()->loadWebsiteConfig($this->getId());
     }
     if (!empty($path)) {
         return $this->_config->getConfigData($path);
     }
     return $this->_config;
 }
Ejemplo n.º 2
0
 /**
  * Initializes the database with the init data for the config module.
  */
 public function init()
 {
     // create config entries
     $configModel = new Core_Model_Config();
     if ($configModel->getResource()->countRows() == 0) {
         $entries = array();
         $this->_buildConfigEntries_r($entries, $this->_init->options['config'], array());
         foreach ($entries as $key => $value) {
             $a = array('key' => $key, 'value' => $value);
             $r = $configModel->create($a);
             $this->_check($r, $a);
         }
     }
     // create templates
     $templatesModel = new Core_Model_Templates();
     if ($templatesModel->getResource()->countRows() == 0) {
         foreach ($this->_init->options['init']['templates'] as $key => $value) {
             $a = array('template' => $key, 'subject' => $value['subject'], 'body' => $value['body']);
             $r = $templatesModel->create($a);
             $this->_check($r, $a);
         }
     }
     // create messages
     $messagesModel = new Core_Model_Messages();
     if ($messagesModel->getResource()->countRows() == 0) {
         foreach ($this->_init->options['init']['messages'] as $key => $value) {
             $a = array('key' => $key, 'value' => $value);
             $r = $messagesModel->create($a);
             $this->_check($r, $a);
         }
     }
 }