Ejemplo n.º 1
0
 function render()
 {
     if (!$this->_application->isAdmin()) {
         if ($this->_content['result']) {
             org_glizy_helpers_Array::arrayMultisortByLabel($this->_content['result'], '__weight__');
         }
         if (!$this->getAttribute('skipFormTag')) {
             parent::render_html_onStart();
         }
         parent::render();
         if (!$this->getAttribute('skipFormTag')) {
             parent::render_html_onEnd();
         }
     }
 }
Ejemplo n.º 2
0
 function process()
 {
     $this->_content = $this->getAttribute('value');
     if (is_object($this->_content)) {
         // legge il contenuto da un dataProvider
         $contentSource =& $this->getAttribute('value');
         $this->_content = $contentSource->loadContent($this->getId(), $this->getAttribute('bindTo'));
     } else {
         if (is_null($this->_content)) {
             // richiede il contenuto al padre
             $this->_content = $this->_parent->loadContent($this->getId(), $this->getAttribute('bindTo'));
         }
     }
     $this->readFromXml();
     $this->readFromFolder();
     $this->readFromModules();
     org_glizy_helpers_Array::arrayMultisortByLabel($this->items, 'label');
 }
Ejemplo n.º 3
0
 function loadDictionary($field, $queryName = NULL, $skipEmpty = false, $delimiter = '', $version = 'PUBLISHED')
 {
     $application =& org_glizy_ObjectValues::get('org.glizy', 'application');
     if (is_null($queryName)) {
         $field = explode(',', $field);
         $filter = $this->_fieldsList[count($field) > 1 ? $field[1] : $field[0]]['filter'];
         $sql = 'SELECT DISTINCT UPPER(' . $field[0] . ') as k, ' . (count($field) > 1 ? $field[1] : $field[0]) . ' as v';
         $sql .= ' FROM ' . $this->_tablesName['mainTable'];
         $sql .= ' INNER JOIN ' . $this->_tablesName['detailTable'] . ' ON (' . implode('=', $this->_joinFields) . ')';
         $sql .= ' WHERE 1=1';
         foreach ($this->_fieldsList as $k => $v) {
             if (isset($v['languageField']) && $v['languageField'] === true) {
                 $sql .= ' AND ' . $k . '=' . (method_exists($application, 'getEditingLanguageId') ? $application->getEditingLanguageId() : $application->getLanguageId());
             }
             if (isset($v['versionField']) && $v['versionField'] === true) {
                 $sql .= ' AND ' . $k . '=\'' . $version . '\'';
             }
             if (isset($v['defaultSelectValue'])) {
                 $sql .= ' AND ' . $k . '=\'' . $v['defaultSelectValue'] . '\'';
             }
         }
         $sql .= ' ORDER BY v';
     } else {
         $filter = null;
         $sql = $this->_getQuerySqlString($queryName);
     }
     $result = array();
     $usedKeys = array();
     $rs =& $this->_execute($sql);
     while (!$rs->EOF) {
         if (!($skipEmpty && empty($rs->fields['v']))) {
             $value = $rs->fields['v'];
             if (!empty($filter)) {
                 $filter->apply($value, $this);
             }
             if (!$delimiter) {
                 $result[] = array('key' => $rs->fields['k'], 'value' => $value);
             } else {
                 $kk = explode($delimiter, $rs->fields['k']);
                 $vv = explode($delimiter, $value);
                 $l = count($kk);
                 for ($i = 0; $i < $l; $i++) {
                     if (!in_array($kk[$i], $usedKeys)) {
                         $usedKeys[] = $kk[$i];
                         $result[] = array('key' => $kk[$i], 'value' => $vv[$i]);
                     }
                 }
             }
         }
         $rs->MoveNext();
     }
     if ($delimiter) {
         org_glizy_helpers_Array::arrayMultisortByLabel($result, 'value');
     }
     return $result;
 }
Ejemplo n.º 4
0
 function loadDictionary($field, $queryName = null, $queryParams = null, $skipEmpty = false, $delimiter = '')
 {
     if ($queryName) {
         $this->iterator->load($queryName, $queryParams);
         $k = 'k';
         $v = 'v';
     } else {
         $field = explode(',', $field);
         if (count($field) == 1) {
             $k = $field[0];
             $v = $field[0];
         } else {
             $k = $field[0];
             $v = $field[1];
         }
         if (method_exists($this->iterator, 'selectDistinct')) {
             $this->iterator->selectDistinct($v);
         }
         $this->iterator->orderBy($v);
     }
     $result = array();
     $usedKeys = array();
     foreach ($this->iterator as $ar) {
         $key = $ar->{$k};
         $value = $ar->{$v};
         if ($skipEmpty && empty($value)) {
             continue;
         }
         if (!$delimiter) {
             $result[] = array('key' => $key, 'value' => $value);
         } else {
             $kk = explode($delimiter, $key);
             $vv = explode($delimiter, $value);
             $l = count($kk);
             for ($i = 0; $i < $l; $i++) {
                 if (!in_array($kk[$i], $usedKeys)) {
                     $usedKeys[] = $kk[$i];
                     $result[] = array('key' => $kk[$i], 'value' => $vv[$i]);
                 }
             }
         }
     }
     if ($delimiter) {
         org_glizy_helpers_Array::arrayMultisortByLabel($result, 'value');
     }
     return $result;
 }