Beispiel #1
0
 protected function edit()
 {
     SPLoader::loadClass('html.tooltip');
     $this->_type = 'entry_form';
     $id = $this->get('entry.id');
     if ($id) {
         $this->addHidden($id, 'entry.id');
     }
     if (Sobi::Cfg('legacy.sigsiutree', false)) {
         /* load the SigsiuTree class */
         $tree = SPLoader::loadClass('mlo.tree');
         /* create new instance */
         $tree = new $tree(Sobi::Cfg('list.categories_ordering'));
         $link = "javascript:SP_selectCat( '{sid}' )";
         $tree->setHref($link);
         $tree->setTask('category.chooser');
         $tree->disable(Sobi::Section());
         $tree->init(Sobi::Section());
         $head = SPFactory::header();
         $params = array();
         $params['URL'] = Sobi::Url(array('task' => 'category.parents', 'out' => 'json'), true, false, true);
         $params['MAXCATS'] = Sobi::Cfg('legacy.maxCats', '5');
         $params['SEPARATOR'] = Sobi::Cfg('string.path_separator', ' > ');
         $head->addJsVarFile('edit', md5(Sobi::Section() . Sobi::Section(true) . serialize($params)), $params);
     }
     $type = $this->key('template_type', 'xslt');
     if ($type != 'php' && Sobi::Cfg('global.disable_xslt', false)) {
         $type = 'php';
     }
     if ($type == 'xslt') {
         $data = $this->entryData(false);
         $fields = $this->get('fields');
         $f = array();
         if (count($fields)) {
             foreach ($fields as $field) {
                 if ($field->enabled('form')) {
                     $pf = null;
                     $pfm = null;
                     if (!$field->get('isFree') && $field->get('fee') && !Sobi::Can('entry.payment.free')) {
                         $pf = SPLang::currency($field->get('fee'));
                         $pfm = Sobi::Txt('EN.FIELD_NOT_FREE_MSG', array('fee' => $pf, 'fieldname' => $field->get('name')));
                     }
                     $f[$field->get('nid')] = array('_complex' => 1, '_data' => array('label' => array('_complex' => 1, '_data' => $field->get('name'), '_attributes' => array('lang' => Sobi::Lang(false), 'show' => $field->__get('showEditLabel'))), 'data' => array('_complex' => 1, '_xml' => 1, '_data' => $field->field(true)), 'description' => array('_complex' => 1, '_xml' => 1, '_data' => $field->get('description')), 'fee' => $pf, 'fee_msg' => $pfm), '_attributes' => array('id' => $field->get('id'), 'type' => $field->get('type'), 'suffix' => $field->get('suffix'), 'position' => $field->get('position'), 'required' => $field->get('required'), 'css_edit' => $field->get('cssClassEdit'), 'width' => $field->get('bsWidth'), 'css_class' => strlen($field->get('cssClass')) ? $field->get('cssClass') : 'spField'));
                 }
             }
         }
         $f['save_button'] = array('_complex' => 1, '_data' => array('data' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::submit('save', Sobi::Txt('EN.SAVE_ENTRY_BT')))));
         $f['cancel_button'] = array('_complex' => 1, '_data' => array('data' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::button('cancel', Sobi::Txt('EN.CANCEL_BT'), array('onclick' => 'SPcancelEdit();')))));
         if (Sobi::Cfg('legacy.sigsiutree', false)) {
             $data['entry']['_data']['category_chooser'] = array('path' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::textarea('parent_path', $this->get('parent_path'), false, 500, 60, array('id' => 'entry.path', 'class' => 'inputbox required', 'readonly' => 'readonly'))), 'selected' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::text('entry.parent', $this->get('parents'), array('id' => 'entry.parent', 'size' => 15, 'maxlength' => 50, 'class' => 'inputbox required', 'readonly' => 'readonly', 'style' => 'text-align:center;'))));
         }
         $data['entry']['_data']['fields'] = array('_complex' => 1, '_data' => $f, '_attributes' => array('lang' => Sobi::Lang(false)));
         if (Sobi::Cfg('legacy.sigsiutree', false)) {
             $data['tree'] = array('_complex' => 1, '_xml' => 1, '_data' => SPLang::entities($tree->display(true), true));
         }
         $this->_attr = $data;
         Sobi::Trigger($this->_type, ucfirst(__FUNCTION__), array(&$this->_attr));
     }
 }
Beispiel #2
0
 public function onFieldEdit(&$view)
 {
     $this->loadType();
     $this->editLimit = $this->editLimit > 0 ? $this->editLimit : 0;
     $this->fee = SPLang::currency($this->fee, false);
     if (is_array($this->allowedAttributes) && !is_string($this->allowedAttributes)) {
         $this->allowedAttributes = implode(', ', $this->allowedAttributes);
     }
     if (is_array($this->allowedTags) && !is_string($this->allowedTags)) {
         $this->allowedTags = implode(', ', $this->allowedTags);
     }
     if ($this->_type && method_exists($this->_type, 'onFieldEdit')) {
         $this->_type->onFieldEdit($view);
     }
 }
Beispiel #3
0
 public static function currency($value)
 {
     return SPLang::currency($value);
 }