Esempio n. 1
0
 private function limits($selected)
 {
     $f = SPConfig::fields($this->settings()->get('section'), array('chbxgroup', 'select', 'radio'));
     $fields = array('' => null);
     if (count($f)) {
         foreach ($f as $id => $type) {
             $labels = SPFactory::db()->select(array('sValue', 'language', 'sKey'), 'spdb_language', array('fid' => $id, 'oType' => 'field_option'))->loadAssocList();
             /** @var SPField $field */
             $field = SPFactory::Model('field');
             $field->init($id)->loadType();
             $options = $field->get('options');
             if (count($options)) {
                 foreach ($options as $value) {
                     $label = $value['label'];
                     foreach ($labels as $l) {
                         if ($l['sKey'] == $value['label']) {
                             $label = $l['sValue'];
                         }
                     }
                     if (isset($value['options'])) {
                         $fields[$type][$id . '::group::' . $value['id']] = '<b>' . $label . '</b>';
                         foreach ($value['options'] as $subOption) {
                             $fields[$type][$id . '::' . $subOption['id']] = $label . ' &gt; ' . $subOption['label'];
                         }
                     } else {
                         $fields[$type][$id . '::' . $value['id']] = $label;
                     }
                 }
             }
         }
     }
     return SPHtml_Input::select('jform[params][spLimit]', $fields, $selected, false, array('style' => 'width: 300px'));
 }
Esempio n. 2
0
 public static function fields($sid = 0, $types = null)
 {
     if (!$sid) {
         $sid = SPRequest::sid('request', Sobi::Section(), false);
     }
     if (!$types) {
         $types = SPRequest::string('types', null);
         $types = SPFactory::config()->structuralData($types, true);
     }
     $fields = SPConfig::fields($sid, $types);
     if (SPRequest::bool('fields-xhr')) {
         SPFactory::mainframe()->cleanBuffer()->customHeader();
         exit(json_encode($fields));
     } else {
         return $fields;
     }
 }