Ejemplo n.º 1
0
 public function get($d = array())
 {
     parent::get($d);
     if (empty($this->_allTemplates)) {
         $directories = utilsCsp::getDirList(CSP_TEMPLATES_DIR);
         if (!empty($directories)) {
             foreach ($directories as $code => $dir) {
                 if ($xml = utilsCsp::getXml($dir['path'] . 'settings.xml')) {
                     $this->_allTemplates[$code] = $xml;
                     $this->_allTemplates[$code]->prevImg = CSP_TEMPLATES_PATH . $code . '/screenshot.png';
                 }
             }
         }
         if (is_dir(utilsCsp::getCurrentWPThemeDir() . 'csp' . DS)) {
             if ($xml = utilsCsp::getXml(utilsCsp::getCurrentWPThemeDir() . 'csp' . DS . 'settings.xml')) {
                 $code = utilsCsp::getCurrentWPThemeCode();
                 if (strpos($code, '/') !== false) {
                     // If theme is in sub-folder
                     $code = explode('/', $code);
                     $code = trim($code[count($code) - 1]);
                 }
                 $this->_allTemplates[$code] = $xml;
                 if (is_file(utilsCsp::getCurrentWPThemeDir() . 'screenshot.jpg')) {
                     $this->_allTemplates[$code]->prevImg = utilsCsp::getCurrentWPThemePath() . '/screenshot.jpg';
                 } else {
                     $this->_allTemplates[$code]->prevImg = utilsCsp::getCurrentWPThemePath() . '/screenshot.png';
                 }
             }
         }
     }
     if (isset($d['code']) && isset($this->_allTemplates[$d['code']])) {
         return $this->_allTemplates[$d['code']];
     }
     return $this->_allTemplates;
 }
Ejemplo n.º 2
0
 /**
  * Return the object with fields
  * @param array $d
  * @return array 
  */
 public function get($d = array())
 {
     parent::get($d);
     $fields = NULL;
     if (isset($d['id']) && is_numeric($d['id'])) {
         if ($d['id']) {
             frameCsp::_()->getTable('email_templates')->fillFromDB($d['id']);
         }
         $fields = frameCsp::_()->getTable('email_templates')->getFields();
         $fields['active']->addHtmlParam('checked', (bool) $fields['active']->value);
     } elseif (!empty($d) && is_array($d)) {
         $fields = frameCsp::_()->getTable('email_templates')->get('*', $d);
     } else {
         $fields = frameCsp::_()->getTable('email_templates')->getAll();
         if (!empty($fields)) {
             for ($i = 0; $i < count($fields); $i++) {
                 $fields[$i]['data'] = $fields[$i]['data'];
             }
         }
     }
     return $fields;
 }
Ejemplo n.º 3
0
 public function get($d = array())
 {
     if ($d['id'] && is_numeric($d['id'])) {
         $fields = frameCsp::_()->getTable('modules')->fillFromDB($d['id'])->getFields();
         $fields['types'] = array();
         $types = frameCsp::_()->getTable('modules_type')->fillFromDB();
         foreach ($types as $t) {
             $fields['types'][$t['id']->value] = $t['label']->value;
         }
         return $fields;
     } elseif (!empty($d)) {
         $data = frameCsp::_()->getTable('modules')->get('*', $d);
         return $data;
     } else {
         return frameCsp::_()->getTable('modules')->innerJoin(frameCsp::_()->getTable('modules_type'), 'type_id')->getAll(frameCsp::_()->getTable('modules')->alias() . '.*, ' . frameCsp::_()->getTable('modules_type')->alias() . '.label as type');
     }
     parent::get($d);
 }