Example #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));
     }
 }
Example #2
0
 public function display()
 {
     $this->_type = 'search';
     $type = $this->key('template_type', 'xslt');
     if ($type != 'php' && Sobi::Cfg('global.disable_xslt', false)) {
         $type = 'php';
     }
     if ($type == 'xslt') {
         $searchData = array();
         $fields = $this->get('fields');
         $visitor = $this->get('visitor');
         $p = $this->get('priorities');
         $priorities = array();
         if (is_array($p) && count($p)) {
             foreach ($p as $priority => $eids) {
                 if (is_array($eids) && count($eids)) {
                     foreach ($eids as $sid) {
                         $priorities[$sid] = $priority;
                     }
                 }
             }
         }
         $entries = $this->get('entries');
         $searchData['section'] = array('_complex' => 1, '_data' => Sobi::Section(true), '_attributes' => array('id' => Sobi::Section(), 'lang' => Sobi::Lang(false)));
         $searchPhrase = $this->get('search_for');
         $phrase = $this->get('search_phrase');
         $searchPhrase = strlen($searchPhrase) ? $searchPhrase : Sobi::Txt('SH.SEARCH_FOR_BOX');
         SPFactory::header()->addJsCode('var spSearchDefStr = "' . Sobi::Txt('SH.SEARCH_FOR_BOX') . '"');
         if ($this->get('$eInLine')) {
             $searchData['entries_in_line'] = $this->get('$eInLine');
         }
         if ($this->get('$eCount') >= 0) {
             $searchData['message'] = Sobi::Txt('SH.SEARCH_FOUND_RESULTS', array('count' => $this->get('$eCount')));
         }
         $this->menu($searchData);
         $this->alphaMenu($searchData);
         $fData = array();
         if (Sobi::Cfg('search.show_searchbox', true)) {
             $fData['searchbox'] = array('_complex' => 1, '_data' => array('label' => array('_complex' => 1, '_data' => Sobi::Txt('SH.SEARCH_FOR'), '_attributes' => array('lang' => Sobi::Lang(false))), 'data' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::text('sp_search_for', $searchPhrase, array('class' => Sobi::Cfg('search.form_box_def_css', 'SPSearchBox'), 'id' => 'SPSearchBox')))), '_attributes' => array('position' => 1, 'css_class' => 'SPSearchBox'));
         }
         if (Sobi::Cfg('search.top_button', true)) {
             $fData['top_button'] = array('_complex' => 1, '_data' => array('label' => array('_complex' => 1, '_data' => Sobi::Txt('SH.SEARCH_START'), '_attributes' => array('lang' => Sobi::Lang())), 'data' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::submit('search', Sobi::Txt('SH.START'), array('id' => 'top_button')))), '_attributes' => array('position' => 1, 'css_class' => 'SPSearchButton'));
         }
         if (Sobi::Cfg('search.show_phrase', true)) {
             $fData['phrase'] = array('_complex' => 1, '_data' => array('label' => array('_complex' => 1, '_data' => Sobi::Txt('SH.FIND_ENTRIES_THAT_HAVE'), '_attributes' => array('lang' => Sobi::Lang(false))), 'data' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::radioList('spsearchphrase', array('all' => Sobi::Txt('SH.FIND_ENTRIES_THAT_HAVE_ALL_WORDS'), 'any' => Sobi::Txt('SH.FIND_ENTRIES_THAT_HAVE_ANY_WORDS'), 'exact' => Sobi::Txt('SH.FIND_ENTRIES_THAT_HAVE_EXACT_PHRASE')), 'spsearchphrase', strlen($phrase) ? $phrase : Sobi::Cfg('search.form_searchphrase_def', 'all'), null, 'right'))), '_attributes' => array('position' => 1, 'css_class' => 'SPSearchPhrase'));
         }
         if (count($fields)) {
             foreach ($fields as $field) {
                 $data = $field->searchForm();
                 $suffix = $field->get('searchMethod') != 'range' ? $field->get('suffix') : null;
                 if (strlen($data)) {
                     $fData[$field->get('nid')] = array('_complex' => 1, '_data' => array('label' => array('_complex' => 1, '_data' => $field->get('name'), '_attributes' => array('lang' => Sobi::Lang())), 'data' => array('_complex' => 1, '_xml' => 1, '_data' => $data)), '_attributes' => array('id' => $field->get('id'), 'type' => $field->get('type'), 'suffix' => $suffix, 'position' => $field->get('position'), 'css_class' => strlen($field->get('cssClass')) ? $field->get('cssClass') : 'spField'));
                 }
             }
         }
         if (Sobi::Cfg('search.bottom_button', false)) {
             $fData['bottom_button'] = array('_complex' => 1, '_data' => array('label' => array('_complex' => 1, '_data' => Sobi::Txt('SH.SEARCH_START'), '_attributes' => array('lang' => Sobi::Lang(false))), 'data' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::submit('search', Sobi::Txt('SH.START')))), '_attributes' => array('position' => 1, 'css_class' => 'SPSearchButton'));
         }
         $searchData['fields'] = $fData;
         if (count($entries)) {
             $this->loadNonStaticData($entries);
             $manager = Sobi::Can('entry', 'edit', '*', Sobi::Section()) ? true : false;
             foreach ($entries as $entry) {
                 $en = $this->entry($entry, $manager);
                 $searchData['entries'][] = array('_complex' => 1, '_attributes' => array('id' => $en['id'], 'search-priority' => isset($priorities[$en['id']]) ? $priorities[$en['id']] : 'undefined'), '_data' => $en);
             }
             $this->navigation($searchData);
         }
         $searchData['visitor'] = $this->visitorArray($visitor);
         $this->_attr = $searchData;
     }
     Sobi::Trigger($this->_type, ucfirst(__FUNCTION__), array(&$this->_attr));
     parent::display($this->_type);
 }
Example #3
0
 private function submit()
 {
     $xml = $this->payment();
     $visitor = $this->get('visitor');
     $id = $this->get('entry')->get('id');
     SPLoader::loadClass('mlo.input');
     if ($id) {
         $saveUrl = Sobi::Url(array('task' => 'entry.save', 'pid' => Sobi::Reg('current_section'), 'sid' => $id), false, false);
         $backUrl = Sobi::Url(array('task' => 'entry.edit', 'pid' => Sobi::Reg('current_section'), 'sid' => $id));
     } else {
         $saveUrl = Sobi::Url(array('task' => 'entry.save', 'pid' => Sobi::Reg('current_section')), false, false);
         $backUrl = Sobi::Url(array('task' => 'entry.add', 'pid' => Sobi::Reg('current_section')));
     }
     $xml['buttons']['save_button'] = array('_complex' => 1, '_data' => array('data' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::button('save', Sobi::Txt('EN.PAYMENT_SAVE_ENTRY_BT'), array('href' => $saveUrl)))));
     $xml['buttons']['back_button'] = array('_complex' => 1, '_data' => array('data' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::button('back', Sobi::Txt('EN.PAYMENT_BACK_BT'), array('href' => $backUrl)))));
     $xml['buttons']['cancel_button'] = array('_complex' => 1, '_data' => array('data' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::submit('save', Sobi::Txt('EN.CANCEL_BT')), '_data' => SPHtml_Input::button('cancel', Sobi::Txt('EN.CANCEL_BT'), array('href' => Sobi::Url(array('task' => 'entry.cancel', 'pid' => Sobi::Reg('current_section'))))))));
     $xml['save_url'] = $saveUrl;
     $xml['visitor'] = $this->visitorArray($visitor);
     $this->_attr = $xml;
     Sobi::Trigger('PaymentView', ucfirst(__FUNCTION__), array(&$this->_attr));
 }