Beispiel #1
0
 public function functions()
 {
     $functions = $this->get('functions');
     $out = array();
     $section = SPRequest::int('section');
     $out[] = '<form action="index.php" method="post">';
     $out[] = SPHtml_Input::select('function', $functions, null, false, array('id' => 'SobiProFunctions'));
     $out[] = '<input type="hidden" name="option" value="com_sobipro">';
     $out[] = '<input type="hidden" name="task" value="menu">';
     $out[] = '<input type="hidden" name="tmpl" value="component">';
     $out[] = '<input type="hidden" name="format" value="html">';
     $out[] = '<input type="hidden" name="mid" value="' . SPRequest::int('mid') . '">';
     $out[] = '<input type="hidden" name="section" value="' . $section . '">';
     $out[] = '</form>';
     echo implode("\n", $out);
 }
Beispiel #2
0
 /**
  * Shows the field in the edit entry or add entry form
  * @param bool $return return or display directly
  * @return string
  */
 public function field($return = false)
 {
     if (!$this->enabled) {
         return false;
     }
     $field = null;
     $fdata = Sobi::Reg('editcache');
     if ($fdata && is_array($fdata)) {
         $raw = $this->fromCache($fdata);
     } else {
         $raw = SPConfig::unserialize($this->getRaw());
     }
     if ($this->ownLabel) {
         $fieldTitle = null;
         $params = array('id' => $this->nid, 'size' => $this->labelWidth, 'class' => $this->cssClass . 'Title');
         if ($this->labelMaxLength) {
             $params['maxlength'] = $this->labelMaxLength;
         }
         if ($this->labelWidth) {
             $params['style'] = "width: {$this->labelWidth}px;";
         }
         if (strlen($this->labelsLabel)) {
             $this->labelsLabel = SPLang::clean($this->labelsLabel);
             $fieldTitle .= "<label for=\"{$this->nid}\" class=\"{$this->cssClass}Title\">{$this->labelsLabel}</label>\n";
         }
         $fieldTitle .= SPHtml_Input::text($this->nid, is_array($raw) && isset($raw['label']) ? SPLang::clean($raw['label']) : null, $params);
     }
     $class = $this->required ? $this->cssClass . ' required' : $this->cssClass;
     $this->nid .= '_url';
     $params = array('id' => $this->nid, 'size' => $this->width, 'class' => $class);
     if ($this->maxLength) {
         $params['maxlength'] = $this->maxLength;
     }
     if ($this->width) {
         $params['style'] = "width: {$this->width}px;";
     }
     $field .= SPHtml_Input::text($this->nid, is_array($raw) && isset($raw['url']) ? $raw['url'] : null, $params);
     if ($this->ownLabel) {
         $label = Sobi::Txt('FD.MAIL_EMAIL_ADDRESS');
         $field = "\n<div class=\"spFieldEmailLabel\">{$fieldTitle}</div>\n<div class=\"spFieldEmail\"><label for=\"{$this->nid}_url\" class=\"{$this->cssClass}Title\">{$label}</label>\n{$field}</div>";
     }
     if (!$return) {
         echo $field;
     } else {
         return $field;
     }
 }
Beispiel #3
0
 /**
  * Shows the field in the edit entry or add entry form
  * @param bool $return return or display directly
  * @return string
  */
 public function field($return = false)
 {
     if (!$this->enabled) {
         return false;
     }
     $class = $this->required ? $this->cssClass . ' required' : $this->cssClass;
     $params = array('class' => $class . ' checkbox');
     $values = array();
     if (count($this->options)) {
         foreach ($this->options as $option) {
             $values[$option['id']] = $option['label'];
         }
     }
     $selected = $this->getRaw();
     if (is_array($selected) && !is_string($selected) && count($selected)) {
         $selected = array_merge($selected, array_keys($selected));
     }
     if ($selected == null && $this->defaultValue) {
         $selected = explode(',', $this->defaultValue);
         $selected = array_map('trim', $selected);
     }
     $list = SPHtml_Input::checkBoxGroup($this->nid, $values, $this->nid, $selected, $params, $this->labelSite, true);
     $field = null;
     if (count($list)) {
         $c = 0;
         foreach ($list as $box) {
             $field .= '<div class="spFieldCheckbox"';
             if ($this->optWidth) {
                 $field .= ' style="width:' . $this->optWidth . 'px;"';
             }
             $field = $field . '>' . $box . '</div>';
             $field .= "\n";
             if ($this->optInLine) {
                 if (!(++$c % $this->optInLine)) {
                     $field .= "\n<div class=\"clearfix\"></div>\n";
                 }
             }
         }
         $field = "<div id=\"{$this->nid}\" class=\"{$class}\">{$field}\n<div class=\"clearfix\"></div>\n</div>";
     }
     if (!$return) {
         echo $field;
     } else {
         return $field;
     }
 }
Beispiel #4
0
 /**
  * @param $path
  * @param $subParams
  * @return string
  */
 protected function travelDependencyPath($path, $subParams)
 {
     $subFields = null;
     if (count($path)) {
         $progress = array();
         foreach ($path as $index => $step) {
             $progress[] = $step;
             $subParams['data']['order'] = $index + 1;
             $subParams['id'] = $this->nid . '_' . $index;
             $lists = $this->loadDependencyDefinition($progress);
             if (count($lists)) {
                 $subFields .= SPHtml_Input::select($this->nid, $lists, $path[$index + 1], false, $subParams);
             }
         }
     }
     return $subFields;
 }
Beispiel #5
0
 /**
  * @deprecated
  */
 public function display($return = false)
 {
     $pn = null;
     $pages = $this->limit > 0 ? ceil($this->count / $this->limit) : 0;
     $sid = SPRequest::sid() ? SPRequest::sid() : Sobi::Section();
     $pn .= '<div style="text-align:center;"><div class="pagination">';
     $pn .= '<div class="limit">';
     $pn .= Sobi::Txt('PN.DISPLAY');
     $box = array();
     foreach ($this->limits as $v) {
         if ($v) {
             $box[$v] = $v;
         } else {
             $box[-1] = Sobi::Txt('PN.ALL');
         }
     }
     $pn .= SPHtml_Input::select($this->box, $box, $this->limit, false, array('onchange' => "{$this->boxFunc}( {$sid} )"));
     $pn .= '</div>';
     if ($pages > 1) {
         if ($this->current == 1) {
             $pn .= '<div class="button2-right off"><div class="start"><span>';
             $pn .= Sobi::Txt('PN.START');
             $pn .= '</span></div></div>';
             $pn .= '<div class="button2-right off"><div class="prev"><span>';
             $pn .= Sobi::Txt('PN.PREVIOUS');
             $pn .= '</span></div></div>';
         } else {
             $link = " onclick=\"{$this->func}( 1, {$sid} )\" ";
             $txt = Sobi::Txt('PN.START');
             $pn .= "<div class=\"button2-right\"><div class=\"start\"><a href=\"#\"{$link} title=\"{$txt}\">{$txt}</a></div></div>";
             $prevpage = $this->current - 1;
             $txt = Sobi::Txt('PN.PREVIOUS');
             $link = " onclick=\"{$this->func}( {$prevpage}, {$sid} )\" ";
             $pn .= "<div class=\"button2-right\"><div class=\"start\"><a href=\"#\"{$link} title=\"{$txt}\">{$txt}</a></div></div>";
         }
         $pn .= '<div class="button2-left"><div class="page">';
         for ($page = 1; $page <= $pages; $page++) {
             if ($pages > 1000 && $page % 1000 != 0) {
                 continue;
             } elseif ($pages > 100 && $page % 100 != 0) {
                 continue;
             } elseif ($pages > 20 && $page % 5 != 0) {
                 continue;
             }
             $link = " onclick=\"{$this->func}( {$page}, {$sid} )\" ";
             if ($page == $this->current) {
                 $pn .= '<span>' . $page . '</span>';
             } else {
                 $pn .= "<a href=\"#\"{$link}\" title=\"{$page}\">{$page}</a>";
             }
         }
         $pn .= '</div></div>';
         if ($this->current == $pages) {
             $pn .= '<div class="button2-left off"><div class="next"><span>';
             $pn .= Sobi::Txt('PN.NEXT');
             $pn .= '</span></div></div>';
             $pn .= '<div class="button2-left off"><div class="end"><span>';
             $pn .= Sobi::Txt('PN.END');
             $pn .= '</span></div></div>';
         } else {
             $nextpage = $this->current + 1;
             $link = " onclick=\"{$this->func}( {$nextpage}, {$sid} )\" ";
             $txt = Sobi::Txt('PN.NEXT');
             $pn .= "<div class=\"button2-left\"><div class=\"next\"><a href=\"#\"{$link}title=\"{$txt}\">{$txt}</a></div></div>";
             $link = " onclick=\"{$this->func}( {$pages}, {$sid} )\" ";
             $txt = Sobi::Txt('PN.END');
             $pn .= "<div class=\"button2-left\"><div class=\"end\"><a href=\"#\"{$link}title=\"{$txt}\">{$txt}</a></div></div>";
         }
         $pn .= "<div class=\"limit\">";
         $pn .= Sobi::Txt('PN.CURRENT_SITE', array('current' => $this->current, 'pages' => $pages));
         $pn .= '</div></div>';
     }
     $pn .= '</div><br/>';
     if ($return) {
         return $pn;
     } else {
         echo $pn;
     }
 }
Beispiel #6
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 #7
0
 /**
  * Creates a select list
  *
  *
  * example: list with multiple select options
  *
  * SPHtml_Input::select(
  *             'fieldname',
  *             array( 'translate:[perms.can_delete]' => 'can_delete', 'translate:[perms.can_edit]' => 'can_edit', 'translate:[perms.can_see]' => 'can_see' ),
  *             array( 'can_see', 'can_delete' ),
  *          true,
  *           array( 'class' => 'inputbox', 'size' => 5 )
  * );
  *
  *
  * example: list with multiple select options and optgroups
  *
  * SPHtml_Input::select(
  *             'fieldname',
  *             array(
  *                     'categories' => array( 'translate:[perms.can_delete_categories]' => 'can_delete_categories', 'translate:[perms.can_edit_categories]' => 'can_edit_categories', 'translate:[perms.can_see_categories]' => 'can_see_categories' ),
  *                     'entries' => array( 'translate:[perms.can_delete_entries]' => 'can_delete_entries', 'translate:[perms.can_edit_entries]' => 'can_edit_entries', 'translate:[perms.can_see_entries]' => 'can_see_entries' ),
  *             )
  *             array( 'can_see_categories', 'can_delete_entries', 'can_edit_entries' ),
  *          true,
  *           array( 'class' => 'inputbox', 'size' => 5 )
  * )
  *
  * @param string $name - name of the html field
  * @param array $values - two-dimensional array with values and their labels. array( 'enabled' => 1, 'disabled' => 0 )
  * @param array $selected - one-dimensional array with selected values
  * @param bool $multi - multiple select is allowed or not
  * @param array $params - two-dimensional array with additional html parameters. Can be also string defined, comma separated array with equal sign as key to index separator.
  * @return string
  * @internal param string $title - language section for the title tags. If given, the options/optgroup will get a title tag. The title will be search in the language file under the given section
  */
 public static function _select($name, $values, $selected = null, $multi = false, $params = null)
 {
     if (Sobi::Cfg('template.bootstrap3-styles')) {
         SPHtml_Input::checkArray($params);
         if (isset($params['class'])) {
             $params['class'] .= ' form-control';
         } else {
             $params['class'] = ' form-control';
         }
     }
     if (is_array($params) && (isset($params['size']) && $params['size'] == 1)) {
         unset($params['size']);
     }
     $data = self::createDataTag($params);
     $params = self::params($params);
     if (strstr($name, '_array')) {
         self::checkArray($selected);
     }
     self::checkArray($values);
     if ($selected !== null && !is_array($selected)) {
         $selected = array((string) $selected);
     } elseif (!is_array($selected)) {
         $selected = array();
     }
     $cells = self::createOptions($values, $selected);
     if ($multi) {
         $multi = ' multiple="multiple" ';
         $name .= '[]';
     }
     $cells = implode("\n\t", $cells);
     $f = "<select name=\"{$name}\"{$multi}{$params}{$data}>\n\t{$cells}\n</select>";
     Sobi::Trigger('Field', ucfirst(__FUNCTION__), array(&$f));
     //		return "\n<!-- SelectList '{$name}' Output -->{$f}<!-- SelectList '{$name}' End -->\n\n";
     return "\n{$f}\n\n";
 }
Beispiel #8
0
 protected function rangeSearch($values, $freeInput = false)
 {
     $request['from'] = isset($this->_selected['from']) ? (int) $this->_selected['from'] : '';
     $request['to'] = isset($this->_selected['to']) ? (int) $this->_selected['to'] : '';
     if (!$freeInput) {
         $values = str_replace(array("\n", "\r", "\t"), null, $values);
         $values = explode(',', $values);
         $data = array();
         $data2 = array();
         if (count($values)) {
             foreach ($values as $k => $v) {
                 $data[''] = Sobi::Txt('SH.SEARCH_SELECT_RANGE_FROM', array('name' => $this->name));
                 $data2[''] = Sobi::Txt('SH.SEARCH_SELECT_RANGE_TO', array('name' => $this->name));
                 $data[preg_replace('/[^\\d\\.\\-]/', null, trim($v))] = $v;
                 $data2[preg_replace('/[^\\d\\.\\-]/', null, trim($v))] = $v;
             }
         }
         $from = SPHtml_Input::select($this->nid . '[from]', $data, $request['from'], false, array('class' => $this->cssClass . ' ' . Sobi::Cfg('search.form_list_def_css', 'SPSearchSelect'), 'size' => '1'));
         $to = SPHtml_Input::select($this->nid . '[to]', $data2, $request['to'], false, array('class' => $this->cssClass . ' ' . Sobi::Cfg('search.form_list_def_css', 'SPSearchSelect'), 'size' => '1'));
         //			return '<div class="SPSearchSelectRangeFrom"><span>' . Sobi::Txt( 'SH.RANGE_FROM' ) . '</span> ' . $from . ' ' . $this->suffix . '</div><div class="SPSearchSelectRangeTo"><span>' . Sobi::Txt( 'SH.RANGE_TO' ) . '</span> ' . $to . ' ' . $this->suffix . '</div>';
         return '<div class="spSelectRangeFrom">' . $from . ' ' . $this->suffix . '</div><div class="spSelectRangeTo">' . $to . ' ' . $this->suffix . '</div>';
     } else {
         $from = SPHtml_Input::text($this->nid . '[from]', $request['from'], array('size' => '1', 'placeholder' => Sobi::Txt('SH.RANGE_FROM')));
         $to = SPHtml_Input::text($this->nid . '[to]', $request['to'], array('size' => '1', 'placeholder' => Sobi::Txt('SH.RANGE_TO')));
         //			return '<div class="SPSearchInputRangeFrom"><span>' . Sobi::Txt( 'SH.RANGE_FROM' ) . '</span> ' . $from . ' ' . $this->suffix . '</div><div class="SPSearchInputRangeTo"><span>' . Sobi::Txt( 'SH.RANGE_TO' ) . '</span> ' . $to . ' ' . $this->suffix . '</div>';
         return '<div class="spInputRangeFrom">' . $from . ' ' . $this->suffix . '</div><div class="spInputRangeTo">' . $to . ' ' . $this->suffix . '</div>';
     }
 }
Beispiel #9
0
 /**
  * Shows the field in the edit entry or add entry form
  * @param bool $return return or display directly
  * @return string
  */
 public function field($return = false)
 {
     if (!$this->enabled) {
         return false;
     }
     $field = null;
     $fdata = Sobi::Reg('editcache');
     if ($fdata && is_array($fdata)) {
         $raw = $this->fromCache($fdata);
     } else {
         $raw = $this->getRaw();
         if (!is_array($raw)) {
             try {
                 $raw = SPConfig::unserialize($raw);
             } catch (SPException $x) {
                 $raw = null;
             }
         }
     }
     if ($this->ownLabel) {
         $fieldTitle = null;
         $params = array('id' => $this->nid, 'class' => $this->cssClass . 'Title');
         if ($this->labelMaxLength) {
             $params['maxlength'] = $this->labelMaxLength;
         }
         if ($this->labelWidth) {
             $params['style'] = "width: {$this->labelWidth}px;";
         }
         if (strlen($this->labelsLabel)) {
             $this->labelsLabel = SPLang::clean($this->labelsLabel);
             //$fieldTitle .= "<label for=\"{$this->nid}\" class=\"{$this->cssClass}Title\">{$this->labelsLabel}</label>\n";
             $params['placeholder'] = $this->labelsLabel;
         }
         $fieldTitle .= SPHtml_Input::text($this->nid, is_array($raw) && isset($raw['label']) ? SPLang::clean($raw['label']) : null, $params);
     }
     $protocols = array();
     if (count($this->allowedProtocols)) {
         foreach ($this->allowedProtocols as $protocol) {
             $protocols[$protocol] = $protocol . '://';
         }
     } else {
         $protocols = array('http' => 'http://', 'https' => 'https://');
     }
     $params = array('id' => $this->nid . '_protocol', 'size' => 1, 'class' => $this->cssClass . 'Protocol');
     if (Sobi::Cfg('template.bootstrap3-styles')) {
         $protofield = '<div class="input-group"><div class="input-group-btn">';
     } else {
         $protofield = '<div class="input-prepend"><div class="btn-group">';
     }
     $protofield .= SPHtml_Input::select($this->nid . '_protocol', $protocols, is_array($raw) && isset($raw['protocol']) ? $raw['protocol'] : 'http', false, $params);
     $protofield .= '</div>';
     //$field .= '<span class="spFieldUrlProtocol">://</span>';
     $class = $this->required ? $this->cssClass . ' required' : $this->cssClass;
     $params = array('id' => $this->nid . '_url', 'class' => $class);
     if ($this->maxLength) {
         $params['maxlength'] = $this->maxLength;
     }
     //for compatibility reason still there
     if ($this->width) {
         $params['style'] = "width: {$this->width}px;";
     }
     $label = Sobi::Txt('FD.URL_ADDRESS');
     if (!$this->ownLabel && $this->labelAsPlaceholder) {
         // the field label will be shown only if labelAsPlaceholder is true and no own label for the URL is selected
         $label = $this->__get('name');
     }
     $params['placeholder'] = $label;
     $value = is_array($raw) && isset($raw['url']) ? $raw['url'] : null;
     if ($value == null) {
         if ($this->defaultValue) {
             $value = $this->defaultValue;
         }
     }
     $field .= $protofield;
     $field .= SPHtml_Input::text($this->nid . '_url', $value, $params);
     $field .= '</div>';
     if ($this->ownLabel) {
         $field = "\n<div class=\"spFieldUrlLabel\">{$fieldTitle}</div>\n<div class=\"spFieldUrl\">{$field}</div>";
     } else {
         $field = "\n<div class=\"spFieldUrl\">{$field}</div>";
     }
     if ($this->countClicks && $this->sid) {
         $counter = $this->getCounter();
         if ($counter) {
             SPFactory::header()->addJsFile('opt.field_url_edit');
         }
         $classes = 'btn spCountableReset';
         $attr = array();
         if (!$counter) {
             $attr['disabled'] = 'disabled';
         }
         $field .= SPHtml_Input::button($this->nid . '_reset', Sobi::Txt('FM.URL.EDIT_CLICKS', $counter), null, $classes);
     }
     if (!$return) {
         echo $field;
     } else {
         return $field;
     }
 }
Beispiel #10
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));
 }
Beispiel #11
0
 /**
  * Shows the field in the search form
  * @param bool $return return or display directly
  * @return string
  */
 public function searchForm($return = false)
 {
     if ($this->searchMethod == 'general') {
         return false;
     }
     if ($this->searchMethod == 'range') {
         return $this->rangeSearch($this->searchRangeValues, $this->freeRange);
     }
     $fdata = array();
     try {
         $data = SPFactory::db()->dselect(array('baseData', 'sid', 'lang'), 'spdb_field_data', array('fid' => $this->fid, 'copy' => '0', 'enabled' => 1), 'field( lang, \'' . Sobi::Lang() . '\'), baseData', 0, 0, 'baseData')->loadAssocList();
         $languages = array();
         $output = array();
         $lang = Sobi::Lang(false);
         $defLang = Sobi::DefLang();
         if (count($data)) {
             foreach ($data as $row) {
                 $languages[$row['lang']][$row['sid']] = $row['baseData'];
             }
         }
         if (isset($languages[$lang])) {
             foreach ($languages[$lang] as $sid => $fieldData) {
                 $output[$sid] = $fieldData;
             }
             unset($languages[$lang]);
         }
         if (isset($languages[$defLang])) {
             foreach ($languages[$defLang] as $sid => $fieldData) {
                 if (!isset($output[$sid])) {
                     $output[$sid] = $fieldData;
                 }
             }
             unset($languages[$defLang]);
         }
         if (count($languages)) {
             foreach ($languages as $language => $langData) {
                 foreach ($langData as $sid => $fieldData) {
                     if (!isset($output[$sid])) {
                         $output[$sid] = $fieldData;
                     }
                 }
                 unset($languages[$language]);
             }
         }
     } catch (SPException $x) {
         Sobi::Error($this->name(), SPLang::e('CANNOT_GET_FIELDS_DATA_DB_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
     }
     $data = (array) $output;
     if (count($data)) {
         $fdata[''] = Sobi::Txt('FD.INBOX_SEARCH_SELECT', array('name' => $this->name));
         foreach ($data as $i => $d) {
             if (strlen($d)) {
                 $fdata[strip_tags($d)] = strip_tags($d);
             }
         }
     }
     return SPHtml_Input::select($this->nid, $fdata, $this->_selected, false, array('class' => $this->cssClass . ' ' . Sobi::Cfg('search.form_list_def_css', 'SPSearchSelect'), 'size' => '1', 'id' => $this->nid));
 }
Beispiel #12
0
 /**
  * Shows the field in the search form
  * @param bool $return return or display directly
  * @return string
  */
 public function searchForm($return = false)
 {
     $data = $this->getValues();
     $field = null;
     switch ($this->searchMethod) {
         default:
         case 'general':
             $field = false;
             break;
         case 'chbx':
             $list = SPHtml_Input::checkBoxGroup($this->nid, $data, $this->nid, $this->_selected, array('class' => $this->cssClass . ' ' . Sobi::Cfg('search.form_checkbox_def_css', 'SPSearchChbx')), $this->labelSite, true);
             if (count($list)) {
                 $c = 0;
                 foreach ($list as $box) {
                     $box = '<div class="spFieldCheckbox" style="width:' . $this->optWidth . 'px;">' . $box . '</div>';
                     $field .= "\n" . $box;
                     if (!(++$c % $this->optInLine)) {
                         $field .= "\n<div class=\"clearfix\"></div>\n";
                     }
                 }
                 $field = "<div id=\"{$this->nid}\" >{$field}</div>";
                 $field .= "\n<div class=\"clearfix\"></div>\n";
             }
             break;
         case 'radio':
             $field = $this->getField($this->cssClass . ' ' . Sobi::Cfg('search.form_radio_def_css', 'SPSearchRadio'), $this->_selected);
             $field .= "\n<div class=\"clearfix\"></div>\n";
             break;
         case 'select':
         case 'mselect':
             $params = array('id' => $this->nid, 'size' => $this->searchMethod == 'mselect' ? $this->optInLine : 1, 'class' => $this->cssClass . ' ' . Sobi::Cfg('search.form_list_def_css', 'SPSearchSelect'));
             $data = array_merge(array('' => Sobi::Txt('FD.SEARCH_SELECT_LIST', array('name' => $this->name))), $data);
             $field = SPHtml_Input::select($this->nid, $data, $this->_selected, $this->searchMethod == 'mselect', $params);
             break;
     }
     return $field;
 }
Beispiel #13
0
 /**
  * Shows the field in the search form
  * @param bool $return return or display directly
  * @return string
  */
 public function searchForm($return = true)
 {
     $this->loadCategories();
     if (count($this->_cats)) {
         if ($this->searchMethod == 'select') {
             $values = array('' => Sobi::Txt('FMN.CC_SEARCH_SELECT_CAT'));
         } else {
             $values = array();
         }
         $this->createValues($this->_cats, $values, Sobi::Cfg('category_chooser.margin_sign', '-'), false);
         $selected = $this->_selected;
         if ($selected) {
             if (is_numeric($selected)) {
                 $selected = array($selected);
             }
             foreach ($selected as $i => $v) {
                 $selected[$i] = (string) $v;
             }
         }
     }
     if ($this->searchMethod == 'select') {
         $params = array('id' => $this->nid, 'class' => $this->cssClass);
         if ($this->searchWidth) {
             $params['style'] = "width: {$this->searchWidth}px;";
         }
         $field = SPHtml_Input::select($this->nid, $values, $selected, false, $params);
     } elseif ($this->searchMethod == 'mselect') {
         $params = array('id' => $this->nid, 'class' => $this->cssClass);
         if ($this->searchWidth && $this->searchHeight) {
             $params['style'] = "width: {$this->searchWidth}px; height: {$this->searchHeight}px";
         }
         $field = SPHtml_Input::select($this->nid, $values, $selected, true, $params);
     }
     return $field;
 }
Beispiel #14
0
 /**
  * Shows the field in the edit entry or add entry form
  * @param bool $return return or display directly
  * @return string
  */
 public function field($return = false)
 {
     if (!$this->enabled) {
         return false;
     }
     $field = null;
     $fdata = Sobi::Reg('editcache');
     if ($fdata && is_array($fdata)) {
         $raw = $this->fromCache($fdata);
     } else {
         $raw = $this->getRaw();
         if (!is_array($raw)) {
             try {
                 $raw = SPConfig::unserialize($raw);
             } catch (SPException $x) {
                 $raw = null;
             }
         }
     }
     if ($this->ownLabel) {
         $fieldTitle = null;
         $params = array('id' => $this->nid, 'class' => $this->cssClass . 'Title');
         if ($this->labelMaxLength) {
             $params['maxlength'] = $this->labelMaxLength;
         }
         if ($this->labelWidth) {
             $params['style'] = "width: {$this->labelWidth}px;";
         }
         if (strlen($this->labelsLabel)) {
             $this->labelsLabel = SPLang::clean($this->labelsLabel);
             $fieldTitle .= "<label for=\"{$this->nid}\" class=\"{$this->cssClass}Title\">{$this->labelsLabel}</label>\n";
         }
         $fieldTitle .= SPHtml_Input::text($this->nid, is_array($raw) && isset($raw['label']) ? SPLang::clean($raw['label']) : null, $params);
     }
     $protocols = array();
     if (count($this->allowedProtocols)) {
         foreach ($this->allowedProtocols as $protocol) {
             $protocols[$protocol] = $protocol . '://';
         }
     } else {
         $protocols = array('http' => 'http://', 'https' => 'https://');
     }
     $params = array('id' => $this->nid . '_protocol', 'size' => 1, 'class' => $this->cssClass . 'Protocol');
     $field .= SPHtml_Input::select($this->nid . '_protocol', $protocols, is_array($raw) && isset($raw['protocol']) ? $raw['protocol'] : 'http', false, $params);
     //$field .= '<span class="spFieldUrlProtocol">://</span>';
     $class = $this->required ? $this->cssClass . ' required' : $this->cssClass;
     $params = array('id' => $this->nid . '_url', 'class' => $class);
     if ($this->maxLength) {
         $params['maxlength'] = $this->maxLength;
     }
     if ($this->width) {
         $params['style'] = "width: {$this->width}px;";
     }
     $field .= SPHtml_Input::text($this->nid . '_url', is_array($raw) && isset($raw['url']) ? $raw['url'] : null, $params);
     if ($this->ownLabel) {
         $field = "\n<div class=\"spFieldUrlLabel\">{$fieldTitle}</div>\n<div class=\"spFieldUrl\">{$field}</div>";
     } else {
         $field = "\n<div class=\"spFieldUrl\">{$field}</div>";
     }
     if ($this->countClicks && $this->sid) {
         $counter = $this->getCounter();
         if ($counter) {
             SPFactory::header()->addJsFile('opt.field_url_edit');
         }
         $classes = 'btn spCountableReset';
         $attr = array();
         if (!$counter) {
             $attr['disabled'] = 'disabled';
         }
         $field .= SPHtml_Input::button($this->nid . '_reset', Sobi::Txt('FM.URL.EDIT_CLICKS', $counter), null, $classes);
     }
     if (!$return) {
         echo $field;
     } else {
         return $field;
     }
 }
Beispiel #15
0
 protected function getTemplates()
 {
     $selected = $this->tpl;
     $templates = array();
     $name = $this->tpl ? 'urlparams[sptpl]' : 'urlparams[-sptpl-]';
     $templates[''] = Sobi::Txt('SELECT_TEMPLATE_OVERRIDE');
     $template = SPFactory::db()->select('sValue', 'spdb_config', array('section' => $this->section, 'sKey' => 'template', 'cSection' => 'section'))->loadResult();
     $templateDir = $this->templatePath($template);
     $this->listTemplates($templates, $templateDir, $this->oType);
     $params = array('id' => 'sptpl');
     $field = SPHtml_Input::select($name, $templates, $selected, false, $params);
     return "<div class=\"SobiPro\" style=\"margin-top: 2px;\">{$field}</div>";
 }
Beispiel #16
0
 /**
  * Shows the field in the edit entry or add entry form
  * @param bool $return return or display directly
  * @return string
  */
 public function field($return = false)
 {
     if (!$this->enabled) {
         return false;
     }
     $class = $this->required ? $this->cssClass . ' required' : $this->cssClass;
     $show = null;
     $field = null;
     static $js = false;
     $params = array('id' => $this->nid, 'class' => $class);
     if ($this->width) {
         $params['style'] = "width: {$this->width}px;";
     }
     $files = $this->getExistingFiles();
     if (is_array($files) && count($files)) {
         if (isset($files['ico'])) {
             $show = $files['ico'];
         } elseif (isset($files['thumb'])) {
             $show = $files['thumb'];
         }
     }
     $noncropsize = "";
     $icoSize = explode(':', Sobi::Cfg('image.ico_size', '80:80'));
     if ($show) {
         $img = Sobi::Cfg('live_site') . $show;
         if (!$this->crop) {
             $noncropsize = "style=\"width: {$icoSize[0]}px; height: {$icoSize[1]}px;\"";
         }
     }
     $field .= "\n<div class=\"spImageField\">";
     $field .= "\n<div>";
     $field .= "\n<div id=\"{$this->nid}_img_preview\" class=\"spEditImage\">";
     $field .= "\n<div class=\"spEditImagePreview\" >";
     if ($show) {
         $field .= "\n\t<img src=\"{$img}\" alt=\"{$this->name}\" {$noncropsize} />";
     }
     $field .= "\n</div>";
     $field .= "\n</div>";
     $field .= "\n</div>";
     $field .= "\n<div class=\"spImageUpDelete\">";
     if ($show) {
         $field .= SPHtml_Input::checkbox($this->nid . '_delete', 1, Sobi::Txt('FD.IMG_DELETE_CURRENT_IMAGE'), $this->nid . '_delete', false, array('class' => $this->cssClass));
     }
     $field .= SPHtml_Input::fileUpload($this->nid, 'image/*', null, 'spImageUpload', str_replace('field_', 'field.', $this->nid) . '.upload');
     $field .= "\n</div>";
     $field .= "\n</div>";
     if (!$js) {
         SPFactory::header()->addJsFile('opt.field_image_edit')->addJsCode('SobiPro.jQuery( document ).ready( function () { SobiPro.jQuery( ".spImageUpload" ).SPFileUploader(); } );');
         $js = true;
     }
     if ($this->crop) {
         $modalclass = 'modal hide';
         if (Sobi::Cfg('template.bootstrap3-styles') && !defined('SOBIPRO_ADM')) {
             $modalclass = 'modal fade';
         }
         SPFactory::header()->addJsFile('cropper')->addCssFile('cropper');
         $field .= SPHtml_Input::modalWindow(Sobi::Txt('IMAGE_CROP_HEADER'), $this->nid . '_modal', null, $modalclass, 'CLOSE', 'SAVE');
     }
     if (!$return) {
         echo $field;
     } else {
         return $field;
     }
 }
Beispiel #17
0
 /**
  * Shows the field in the edit entry or add entry form
  * @param bool $return return or display directly
  * @return string
  */
 public function field($return = false)
 {
     if (!$this->enabled) {
         return false;
     }
     $field = null;
     $fdata = Sobi::Reg('editcache');
     if ($fdata && is_array($fdata)) {
         $raw = $this->fromCache($fdata);
     } else {
         $raw = SPConfig::unserialize($this->getRaw());
     }
     if ($this->ownLabel) {
         $fieldTitle = null;
         $params = array('id' => $this->nid, 'size' => $this->labelWidth, 'class' => $this->cssClass . 'Title');
         if ($this->labelMaxLength) {
             $params['maxlength'] = $this->labelMaxLength;
         }
         if ($this->labelWidth) {
             $params['style'] = "width: {$this->labelWidth}px;";
         }
         if (strlen($this->labelsLabel)) {
             $this->labelsLabel = SPLang::clean($this->labelsLabel);
             //$fieldTitle .= "<label for=\"{$this->nid}\" class=\"{$this->cssClass}Title\">{$this->labelsLabel}</label>\n";
             $params['placeholder'] = $this->labelsLabel;
         }
         $fieldTitle .= SPHtml_Input::text($this->nid, is_array($raw) && isset($raw['label']) ? SPLang::clean($raw['label']) : null, $params);
     }
     $class = $this->required ? $this->cssClass . ' required' : $this->cssClass;
     $this->nid .= '_url';
     $params = array('id' => $this->nid, 'size' => $this->width, 'class' => $class);
     if ($this->maxLength) {
         $params['maxlength'] = $this->maxLength;
     }
     if ($this->width) {
         $params['style'] = "width: {$this->width}px;";
     }
     $label = Sobi::Txt('FD.MAIL_EMAIL_ADDRESS');
     if (!$this->ownLabel && $this->labelAsPlaceholder) {
         // the field label will be shown only if labelAsPlaceholder is true and no own label for the email is selected
         $label = $this->__get('name');
         //get the field's label from the model
     }
     $params['placeholder'] = $label;
     $value = is_array($raw) && isset($raw['url']) ? $raw['url'] : null;
     if ($value == null) {
         if ($this->defaultValue) {
             $value = $this->defaultValue;
         }
     }
     $field .= SPHtml_Input::text($this->nid, $value, $params);
     if ($this->ownLabel) {
         $field = "\n<div class=\"spFieldEmailLabel\">{$fieldTitle}</div><div class=\"spFieldEmail\">{$field}</div>";
     }
     if (!$return) {
         echo $field;
     } else {
         return $field;
     }
 }
Beispiel #18
0
 /**
  * Shows the field in the edit entry or add entry form
  * @param bool $return return or display directly
  * @return string
  */
 public function field($return = false)
 {
     if (!$this->enabled) {
         return false;
     }
     $class = $this->cssClass . (strlen($this->cssClassEdit) ? ' ' . $this->cssClassEdit : '');
     $class = $this->required ? $class . ' required' : $class;
     // Switched to Ajax validation
     //		if( $this->maxLength ) {
     //			if( !( $this->editor ) ) {
     //				SPFactory::header()->addJsCode( "SobiPro.onReady( function ()
     //				{
     //					function SPtxtLimit()
     //					{
     //						if( SP_id( '{$this->nid}' ).value.length > {$this->maxLength} ) {
     //							alert( SobiPro.Txt( 'FD_TEXTAREA_LIMIT' ).replace( 'var:[max_length]', '{$this->maxLength}' ) );
     //							SP_id( '{$this->nid}' ).value = SP_id( '{$this->nid}' ).value.substr( 0, $this->maxLength );
     //						}
     //					}
     //					try {
     //						SP_id( '{$this->nid}' ).addEventListener( 'keypress', SPtxtLimit, false ); }
     //					catch ( e ) {
     //						SP_id( '{$this->nid}' ).attachEvent( 'keypress', SPtxtLimit );
     //					}
     //				});" );
     //			}
     //		}
     $params = array('id' => $this->nid, 'class' => $class);
     if ($this->maxLength) {
         $params['maxlength'] = $this->maxLength;
     }
     if ($this->labelAsPlaceholder) {
         $params['placeholder'] = $this->__get('name');
     }
     $value = $this->getRaw();
     $value = strlen($value) ? $value : $this->defaultValue;
     $field = SPHtml_Input::textarea($this->nid, $value, $this->editor, $this->width, $this->height, $params);
     if (!$return) {
         echo $field;
     } else {
         return $field;
     }
 }
Beispiel #19
0
 /**
  * Creates the "position" table row with order up/order down and position inputbox
  *
  * @param $row - SPDataModel
  * @param $count - number of entries/cats
  * @param $id - id ident for the box
  * @param $type - object type
  * @param $parent - id ident of parent object
  * @param $lsid - id of the object for the link
  * @return unknown_type
  */
 public static function position($row, $count, $id = 'sid', $type = null, $parent = 'pid', $lsid = 'sid')
 {
     SPLoader::loadClass('html.tooltip');
     $position = $row->get('position');
     /** @todo check what the hell the $up should be */
     $up = null;
     if (!$type) {
         $type = $row->type();
     }
     if ($position > 1) {
         $up = Sobi::Cfg('list_icons.position_up');
         $url = Sobi::Url(array('task' => $type . '.up', $parent => SPRequest::sid(), $lsid => $row->get('id')));
         /* translate alternative text */
         $s = Sobi::Txt($type . '.order_up');
         $a = Sobi::Txt($type . '.order_up_expl');
         $img = SPTooltip::toolTip($a, $s, $up);
         $up = "<a href=\"{$url}\">{$img}</a>";
     }
     $down = Sobi::Cfg('list_icons.position_down');
     $url = Sobi::Url(array('task' => $type . '.down', $parent => SPRequest::sid(), $lsid => $row->get('id')));
     /* translate alternative text */
     $s = Sobi::Txt($type . '.order_down');
     if ($position != $count) {
         $a = Sobi::Txt($type . '.order_down_expl');
         $img = SPTooltip::toolTip($a, $s, $down);
         $down = "<a href=\"{$url}\">{$img}</a>";
     } else {
         $down = null;
     }
     $sid = $row->get('id');
     $box = SPHtml_Input::text("{$id}[{$sid}]", $position, array('style' => 'text-align:center; width: 40px;'));
     return "<div style=\"width:30%;float:left;\">{$up}&nbsp;{$down}</div>&nbsp;{$box}";
 }
Beispiel #20
0
 public function fetchElement($name, &$label)
 {
     $sid = $this->settings()->get('sid');
     $this->oType = 'section';
     switch ($name) {
         case 'sid':
             $params = array('id' => 'sid', 'size' => 5, 'class' => 'text_area', 'style' => 'text-align: center;', 'readonly' => 'readonly');
             return SPHtml_Input::text('jform[params][sid]', $sid, $params);
             break;
         case 'tplFile':
         case 'modalTemplate':
             return $this->tplFile($this->settings()->get('tplFile'), $name == 'modalTemplate');
             break;
         case 'spOrder':
             return $this->ordering($this->settings()->get('spOrder'));
             break;
         case 'spLimit':
             return $this->limits($this->settings()->get('spLimit'));
             break;
         case 'cid':
             if (!in_array($sid, array_keys($this->sections))) {
                 $catName = SPLang::translateObject($sid, array('name'));
                 if (isset($catName[$sid]['value'])) {
                     $this->oName = $catName[$sid]['value'];
                     $this->oType = 'category';
                 }
             }
             return $this->getCat();
             break;
         default:
             $sections = array();
             if (count($this->sections)) {
                 $sections[] = Sobi::Txt('SELECT_SECTION');
                 foreach ($this->sections as $section) {
                     if (Sobi::Can('section', 'access', 'valid', $section->id)) {
                         $s = SPFactory::Model('section');
                         $s->extend($section);
                         $sections[$s->get('id')] = $s->get('name');
                     }
                 }
             }
             $params = array('id' => 'spsection', 'class' => 'text_area required');
             return SPHtml_Input::select('jform[params][section]', $sections, $this->settings()->get('section'), false, $params);
             break;
     }
 }
Beispiel #21
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);
 }
Beispiel #22
0
 public function proceedCell($cell, $span = null)
 {
     $span = $this->istSet($cell['attributes'], 'element') ? $cell['attributes']['element'] : $span;
     if ($cell['type'] == 'text') {
         return $this->parseElement($cell);
     }
     if ($cell['type'] == 'tooltip' || $cell['type'] == 'popover') {
         return $this->tooltip($cell);
     }
     $data = null;
     if (isset($cell['attributes']) && count($cell['attributes'])) {
         foreach ($cell['attributes'] as $att => $value) {
             if (!strstr($att, 'data-')) {
                 continue;
             }
             $data .= ' ' . $att . '="' . $value . '" ';
         }
     }
     if (isset($cell['attributes']['class'])) {
         $c = $cell['attributes']['class'];
         $this->_out[] = "\n<{$span} {$data} class=\"{$c}\">\n";
     } else {
         $this->_out[] = "\n<{$span} {$data}>\n";
     }
     $type = isset($cell['attributes']['type']) ? $cell['attributes']['type'] : 'text';
     switch ($type) {
         /** no break here - continue */
         case 'text':
         case 'link':
             if ($type == 'link') {
                 $class = null;
                 $target = null;
                 if ($this->istSet($cell['attributes'], 'link-class')) {
                     $class = "class=\"{$cell['attributes']['link-class']}\" ";
                 }
                 if ($this->istSet($cell['attributes'], 'target')) {
                     $target = "target=\"{$cell['attributes']['target']}\" ";
                 }
                 $this->_out[] = "<a href=\"{$cell['link']}\"{$class}{$target} >";
             }
             if ($this->istSet($cell['attributes'], 'icon')) {
                 $this->_out[] = '<i class="icon-' . $cell['attributes']['icon'] . '"></i>&nbsp;';
             }
             if ($this->istSet($cell['attributes'], 'label')) {
                 $this->_out[] = $cell['attributes']['label'];
             }
             if ($this->istSet($cell, 'label')) {
                 $class = null;
                 //if label in cell directly (with optional class) add a span as it could be a label/value pair
                 if ($this->istSet($cell['attributes'], 'class')) {
                     $class = "class=\"{$cell['attributes']['class']}Label\"";
                 }
                 $this->_out[] = "<span {$class}>{$cell['label']}</span>";
             }
             if ($this->istSet($cell['content'], 'element', 'button')) {
                 $this->renderButton($cell['content']);
             } else {
                 $this->_out[] = $cell['content'];
             }
             /** no break here - continue */
             if ($type == 'link') {
                 $this->_out[] = "</a>";
             }
             break;
         case 'image':
             $this->_out[] = "<img src=\"{$cell['link']}\" />";
             break;
         case 'ordering':
             if (isset($cell['attributes']['label'])) {
                 $this->_out[] = $cell['attributes']['label'];
                 $this->_out[] = '<button class="btn sp-mini-bt" name="spReorder" rel="' . $cell['attributes']['rel'] . '">';
                 $this->_out[] = '<i class="icon-reorder"></i>';
                 $this->_out[] = '</button>';
             } else {
                 $this->_out[] = SPHtml_Input::text($cell['attributes']['name'], $cell['content'], array('class' => 'input-mini sp-input-micro spSubmit'));
             }
             break;
         case 'checkbox':
             $cell = $this->checkbox($cell);
             break;
         case 'ticker':
             $cell = $this->ticker($cell);
             break;
     }
     if (isset($cell['childs']) && count($cell['childs'])) {
         foreach ($cell['childs'] as $child) {
             $this->proceedCell($child, 'div');
         }
     }
     $this->_out[] = "\n</{$span}>\n";
 }
Beispiel #23
-2
 protected function loadSection()
 {
     $sections = array();
     $sectionsOutput = array();
     try {
         $sections = SPFactory::db()->select('*', 'spdb_object', array('oType' => 'section'), 'id')->loadObjectList();
     } catch (SPException $x) {
         Sobi::Error($this->name(), $x->getMessage(), SPC::ERROR, 500, __LINE__, __FILE__);
     }
     if (count($sections)) {
         $sectionsOutput[] = Sobi::Txt('SOBI_SELECT_SECTION');
         foreach ($sections as $section) {
             if (Sobi::Can('section', 'access', 'valid', $section->id)) {
                 $s = new SPSection();
                 $s->extend($section);
                 $sectionsOutput[$s->get('id')] = $s->get('name');
             }
         }
     }
     $params = array('id' => 'SobiSection', 'class' => 'required');
     return SPHtml_Input::select('section', $sectionsOutput, self::$section, false, $params);
 }