Esempio n. 1
0
 public function onCCK_FieldPrepareStore(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     // Init
     if (count($inherit)) {
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
     } else {
         $name = $field->name;
     }
     $dispatcher = JDispatcher::getInstance();
     // Prepare
     $store = '';
     $text = '';
     $xi = 0;
     if (count($value)) {
         $store = '<br />';
         foreach ($value as $key => $val) {
             $store .= '<br />::cck_' . $name . '::' . $field->extended . '::/cck_' . $name . '::';
             $text .= '- ' . $field->label . ' ' . $xi . ': <ul style="line-height:10px;">';
             $fields = self::_getChildren($field, $config);
             if (count($fields)) {
                 foreach ($fields as $f) {
                     $f->storage = $field->storage;
                     $f->storage_table = $field->storage_table;
                     $f->storage_field = $field->storage_field;
                     $f->state = '';
                     //todo;
                     $f_label = $f->label;
                     $f_name = $f->name;
                     $f_value = @$val[$f_name];
                     $inherit = array('xk' => $key, 'xi' => $xi, 'parent' => $name, 'array_x' => 1, 'post' => $val);
                     $results = $dispatcher->trigger('onCCK_FieldPrepareStore', array(&$f, $f_value, &$config, $inherit, true));
                     $v = $results[0];
                     $store .= '<br />::' . $f_name . '|' . $xi . '|' . $name . '::' . $v . '::/' . $f_name . '|' . $xi . '|' . $name . '::';
                     $text .= '<li style="line-height:10px;">' . $f_label . ' : ' . $v . '</li>';
                     // todo: add childs (secondary) storages.. not primary!
                 }
             }
             $store .= '<br />::cckend_' . $name . '::::/cckend_' . $name . '::';
             $text .= '</ul>';
             $xi++;
         }
         $store .= '<br />';
     }
     $value = $xi;
     $field->value = $value;
     $field->text = $text;
     parent::g_onCCK_FieldPrepareStore_X($field, $name, $value, $store, $config);
 }
 public static function onCCK_FieldRenderForm($field, &$config = array())
 {
     return parent::g_onCCK_FieldRenderForm($field);
 }
Esempio n. 3
0
 public static function onCCK_FieldRenderForm(&$field, &$config = array())
 {
     $field->markup = 'none';
     return parent::g_onCCK_FieldRenderForm($field);
 }
Esempio n. 4
0
 public static function getValueFromOptions($field, $value, $config = array())
 {
     // Init
     $options2 = JCckDev::fromJSON($field->options2);
     $divider = '';
     $lang_code = '';
     $value2 = '';
     // Prepare
     self::_languageDetection($lang_code, $value2, $options2);
     if ($field->bool3) {
         $divider = $field->divider != '' ? $field->divider : ',';
     }
     $options_2 = self::_getOptionsList($options2, $field->bool2, $lang_code);
     $field->options = $field->options ? $field->options . '||' . $options_2 : $options_2;
     return parent::getValueFromOptions($field, $value, $config);
 }
Esempio n. 5
0
 public function onCCK_FieldPrepareStore(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     // Init
     if (count($inherit)) {
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
     } else {
         $name = $field->name;
     }
     $value = isset($config['post'][$name . '_hidden']) ? $config['post'][$name . '_hidden'] : $value;
     $dispatcher = JDispatcher::getInstance();
     // Prepare
     $store = '';
     $xk = 0;
     $xi = 0;
     if (count($value)) {
         $store = '<br />';
         //begin?
         $f = self::_getChild($field, $config);
         $f_name = $f->name;
         $f->state = '';
         //todo;
         foreach ($value as $val) {
             //if ( $val != '' ) {
             $inherit = array('name' => $name, 'xk' => $xk, 'xi' => $xi, 'parent' => $name);
             $results = $dispatcher->trigger('onCCK_FieldPrepareStore', array(&$f, $val, &$config, $inherit, true));
             $v = $results[0];
             if ($v != '') {
                 $store .= '<br />::' . $f_name . '|' . $xi . '|' . $name . '::' . $v . '::/' . $f_name . '|' . $xi . '|' . $name . '::';
                 $xi++;
             }
             // todo: add childs (secondary) storages.. not primary!
             //}
             $xk++;
         }
         $store .= '<br />';
         //end?
     }
     $value = $xi;
     $field->value = $value;
     parent::g_onCCK_FieldPrepareStore_X($field, $name, $value, $store, $config);
 }
Esempio n. 6
0
 public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     self::$path = parent::g_getPath(self::$type . '/');
     parent::g_onCCK_FieldPrepareForm($field, $config);
     // Init
     if (count($inherit)) {
         $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
     } else {
         $id = $field->name;
         $name = $field->name;
     }
     // Prepare
     $dispatcher = JDispatcher::getInstance();
     $fields = self::_getChildren($field, $config);
     $xn = $value ? $value : $field->rows;
     $form = array();
     for ($xi = 0; $xi < $xn; $xi++) {
         foreach ($fields as $f) {
             if (is_object($f)) {
                 $f_name = $f->name;
                 $f_value = '';
                 if ($config['pk']) {
                     $table = $f->storage_table;
                     if ($table && !isset($config['storages'][$table])) {
                         $config['storages'][$table] = '';
                         $dispatcher->trigger('onCCK_Storage_LocationPrepareForm', array(&$f, &$config['storages'][$table], $config['pk']));
                     }
                     $dispatcher->trigger('onCCK_StoragePrepareForm_Xi', array(&$f, &$f_value, &$config['storages'][$table], $name, $xi));
                 } elseif ($f->live) {
                     $dispatcher->trigger('onCCK_Field_LivePrepareForm', array(&$f, &$f_value, &$config));
                 }
                 $inherit = array();
                 $clone = clone $f;
                 $results = $dispatcher->trigger('onCCK_FieldPrepareForm', array(&$clone, $f_value, &$config, $inherit, true));
                 $form[$f_name] = $results[0];
                 @($form[$f_name]->name = $f->name);
                 $config['fields'][$f->name] = $form[$f_name];
             }
         }
     }
     // Set
     $field->form = $form;
     $field->value = '';
 }