public function formatElement() { static $widget_counter = 1; $html = rex_var_link::getWidget($widget_counter, $this->getAttribute('name'), $this->getValue(), ['category' => $this->category_id]); ++$widget_counter; return $html; }
function getHtml() { $buttonId = $this->buttonId; $categoryId = $this->categoryId; $value = htmlspecialchars($this->value); $name = $this->attributes['name']; $field = rex_var_link::_getLinkButton($name, $buttonId, $value, $categoryId); return $field; }
public function getHtml() { $buttonId = $this->buttonId; $categoryId = $this->categoryId; $value = htmlspecialchars($this->value); $name = $this->attributes['name']; $field = rex_var_link::getWidget($buttonId, $name, $value, ['category' => $categoryId]); return $field; }
function getHtml() { $buttonId = $this->buttonId; $category = $this->categoryId; $value = htmlspecialchars($this->value); $name = $this->attributes['name']; $field = rex_var_link::getLinklistButton($buttonId, $value, $category); $field = str_replace('LINKLIST[' . $buttonId . ']', $name, $field); return $field; }
/** * Erstellt den nötigen HTML Code um ein Formular zu erweitern * * @param $sqlFields rex_sql-objekt, dass die zu verarbeitenden Felder enthält * @param $activeItem objekt, dass mit getValue() die Werte des akuellen Eintrags zurückgibt * @param $formatCallback callback, dem die infos als Array übergeben werden und den formatierten HTML Text zurückgibt */ function rex_a62_metaFields($sqlFields, $activeItem, $formatCallback, $epParams) { global $I18N; $s = ''; // Startwert für MEDIABUTTON, MEDIALIST, LINKLIST zähler $media_id = 1; $mlist_id = 1; $link_id = 1; $llist_id = 1; $sqlFields->reset(); for ($i = 0; $i < $sqlFields->getRows(); $i++) { // Umschliessendes Tag von Label und Formularelement $tag = 'p'; $tag_attr = ''; $name = $sqlFields->getValue('name'); $title = $sqlFields->getValue('title'); $params = $sqlFields->getValue('params'); $typeLabel = $sqlFields->getValue('label'); $attr = $sqlFields->getValue('attributes'); $dblength = $sqlFields->getValue('dblength'); $dbvalues = array(htmlspecialchars($sqlFields->getValue('default'))); $dbvalues_esc = $dbvalues; if ($activeItem) { $itemValue = $activeItem->getValue($name); if (strpos($itemValue, '|+|') !== false) { // Alte notation mit |+| als Trenner $dbvalues = explode('|+|', $activeItem->getValue($name)); } else { // Neue Notation mit | als Trenner $dbvalues = explode('|', $activeItem->getValue($name)); } $dbvalues_esc = array_map('htmlspecialchars', $dbvalues); } if ($title != '') { $label = htmlspecialchars(rex_translate($title)); } else { $label = htmlspecialchars($name); } $id = preg_replace('/[^a-zA-Z\\-0-9_]/', '_', $label); $attr .= rex_tabindex(); $labelIt = true; $field = ''; switch ($typeLabel) { case 'text': $field = '<input type="' . $typeLabel . '" name="' . $name . '" value="' . $dbvalues_esc[0] . '" id="' . $id . ' "maxlength="' . $dblength . '" ' . $attr . ' />'; break; case 'checkbox': $name .= '[]'; case 'radio': $values = array(); if (rex_sql::getQueryType($params) == 'SELECT') { $sql = new rex_sql(); $value_groups = $sql->getDBArray($params, MYSQL_NUM); foreach ($value_groups as $value_group) { if (isset($value_group[1])) { $values[$value_group[1]] = $value_group[0]; } else { $values[$value_group[0]] = $value_group[0]; } } } else { $value_groups = explode('|', $params); foreach ($value_groups as $value_group) { if (strpos($value_group, ':') !== false) { $temp = explode(':', $value_group); $values[$temp[0]] = $temp[1]; } else { $values[$value_group] = $value_group; } } } $class = $typeLabel == 'radio' ? 'rex-rdo' : 'rex-chckbx'; $oneValue = count($values) == 1; if (!$oneValue) { $tag = ''; $labelIt = false; $tag = 'div'; $tag_attr = ' class="rex-chckbxs rex-ptag"'; $field .= '<p>' . $label . '</p>'; } foreach ($values as $key => $value) { $id = preg_replace('/[^a-zA-Z\\-0-9_]/', '_', $id . $key); $key = htmlspecialchars($key); // wenn man keine Werte angibt (Boolean Chkbox/Radio) // Dummy Wert annehmen, damit an/aus unterscheidung funktioniert if ($oneValue && $key == '') { $key = 'true'; } $selected = ''; if (in_array($key, $dbvalues_esc)) { $selected = ' checked="checked"'; } if ($oneValue) { $tag_attr = ' class="' . $class . '"'; $field .= '<input type="' . $typeLabel . '" name="' . $name . '" value="' . $key . '" id="' . $id . '" ' . $attr . $selected . ' />' . "\n"; } else { $field .= '<p class="' . $class . '">' . "\n"; $field .= '<label for="' . $id . '"><span>' . htmlspecialchars($value) . '</span></label>'; $field .= '<input type="' . $typeLabel . '" name="' . $name . '" value="' . $key . '" id="' . $id . '" ' . $attr . $selected . ' />' . "\n"; $field .= '</p>' . "\n"; } } break; case 'select': $select = new rex_select(); $select->setName($name); $select->setId($id); // hier mit den "raw"-values arbeiten, da die rex_select klasse selbst escaped $select->setSelected($dbvalues); foreach (rex_split_string($attr) as $attr_name => $attr_value) { if (empty($attr_name)) { continue; } $select->setAttribute($attr_name, $attr_value); if ($attr_name == 'multiple') { $select->setName($name . '[]'); } } if (rex_sql::getQueryType($params) == 'SELECT') { // Werte via SQL Laden $select->addDBSqlOptions($params); } else { // Optionen mit | separiert // eine einzelne Option kann mit key:value separiert werden $values = array(); $value_groups = explode('|', $params); foreach ($value_groups as $value_group) { if (strpos($value_group, ':') !== false) { $temp = explode(':', $value_group); $values[$temp[0]] = $temp[1]; } else { $values[$value_group] = $value_group; } } $select->addOptions($values); } $field .= $select->get(); break; case 'datetime': case 'date': if ($dbvalues_esc[0] == '') { $dbvalues_esc[0] = time(); } $style = 'class="rex-fdate"'; $yearStyle = 'class="rex-fdatey"'; $yearSelect = new rex_select(); $yearSelect->addOptions(range(2005, date('Y') + 10), true); $yearSelect->setName($name . '[year]'); $yearSelect->setSize(1); $yearSelect->setId($id); $yearSelect->setStyle($yearStyle); $yearSelect->setSelected(date('Y', $dbvalues_esc[0])); $monthSelect = new rex_select(); $monthSelect->addOptions(range(1, 12), true); $monthSelect->setName($name . '[month]'); $monthSelect->setSize(1); $monthSelect->setStyle($style); $monthSelect->setSelected(date('m', $dbvalues_esc[0])); $daySelect = new rex_select(); $daySelect->addOptions(range(1, 31), true); $daySelect->setName($name . '[day]'); $daySelect->setSize(1); $daySelect->setStyle($style); $daySelect->setSelected(date('j', $dbvalues_esc[0])); if ($typeLabel == 'datetime') { $hourSelect = new rex_select(); $hourSelect->addOptions(range(1, 23), true); $hourSelect->setName($name . '[hour]'); $hourSelect->setSize(1); $hourSelect->setStyle($style); $hourSelect->setSelected(date('G', $dbvalues_esc[0])); $minuteSelect = new rex_select(); $minuteSelect->addOptions(range(0, 59), true); $minuteSelect->setName($name . '[minute]'); $minuteSelect->setSize(1); $minuteSelect->setStyle($style); $minuteSelect->setSelected(date('i', $dbvalues_esc[0])); $field = $daySelect->get() . $monthSelect->get() . $yearSelect->get() . '-' . $hourSelect->get() . $minuteSelect->get(); } else { $field = $daySelect->get() . $monthSelect->get() . $yearSelect->get(); } break; case 'textarea': $field = '<textarea name="' . $name . '" id="' . $id . '" cols="50" rows="6" ' . $attr . '>' . $dbvalues_esc[0] . '</textarea>'; break; case 'REX_MEDIA_BUTTON': $tag = 'div'; $tag_attr = ' class="rex-ptag"'; $field = rex_var_media::getMediaButton($media_id); $field = str_replace('REX_MEDIA[' . $media_id . ']', $dbvalues_esc[0], $field); $field = str_replace('MEDIA[' . $media_id . ']', $name, $field); $id = 'REX_MEDIA_' . $media_id; $media_id++; break; case 'REX_MEDIALIST_BUTTON': $tag = 'div'; $tag_attr = ' class="rex-ptag"'; $name .= '[]'; $field = rex_var_media::getMediaListButton($mlist_id, implode(',', $dbvalues_esc)); $field = str_replace('MEDIALIST[' . $mlist_id . ']', $name, $field); $id = 'REX_MEDIALIST_' . $mlist_id; $mlist_id++; break; case 'REX_LINK_BUTTON': $tag = 'div'; $tag_attr = ' class="rex-ptag"'; $category = ''; if ($activeItem) { $category = $activeItem->getValue('category_id'); } $field = rex_var_link::getLinkButton($link_id, $dbvalues_esc[0], $category); $field = str_replace('LINK[' . $link_id . ']', $name, $field); $id = 'LINK_' . $link_id; $link_id++; break; case 'REX_LINKLIST_BUTTON': $tag = 'div'; $tag_attr = ' class="rex-ptag"'; $category = ''; if ($activeItem) { $category = $activeItem->getValue('category_id'); } $name .= '[]'; $field = rex_var_link::getLinklistButton($llist_id, implode(',', $dbvalues), $category); $field = str_replace('LINKLIST[' . $llist_id . ']', $name, $field); $id = 'REX_LINKLIST_' . $llist_id; $llist_id++; break; default: // ----- EXTENSION POINT list($field, $tag, $tag_attr, $id, $label, $labelIt) = rex_register_extension_point('A62_CUSTOM_FIELD', array($field, $tag, $tag_attr, $id, $label, $labelIt, 'type' => $typeLabel, 'sql' => $sqlFields)); } $s .= rex_call_func($formatCallback, array($field, $tag, $tag_attr, $id, $label, $labelIt), false); $sqlFields->next(); } return $s; }
function formatElement() { static $widget_counter = 1; $html = rex_var_link::getLinkButton($widget_counter, $this->getValue()); $html = str_replace('LINK[' . $widget_counter . ']', $this->getAttribute('name'), $html); $widget_counter++; return $html; }
<?php $buttonId = $counter; $categoryId = 0; $name = $this->getFieldName(); $value = htmlspecialchars($this->getValue()); $widget = rex_var_link::getWidget($buttonId, $name, $value, ['category' => $categoryId]); $class_group = trim('form-group yform-element ' . $this->getHTMLClass() . ' ' . $this->getWarningClass()); ?> <div class="<?php echo $class_group; ?> " id="<?php echo $this->getHTMLId(); ?> "> <label class="control-label" for="<?php echo $this->getFieldId(); ?> "><?php echo $this->getLabel(); ?> </label> <?php echo $widget; ?> </div>
<span class="rex-form-notice">$REX[\'ERROR_EMAIL\']</span> </p> </div> <div class="rex-form-row"> <div class="rex-form-col-a rex-form-widget"> <label for="rex-form-startarticle-id" title="$REX[\'START_ARTICLE_ID\']">' . $I18N->msg('specials_settings_startarticle') . '</label> ' . rex_var_link::_getLinkButton('neu_startartikel', 1, $REX['START_ARTICLE_ID']) . ' <p><span class="rex-form-notice">$REX[\'START_ARTICLE_ID\']</span></p> </div> </div> <div class="rex-form-row"> <div class="rex-form-col-a rex-form-widget"> <label for="rex-form-notfound-article-id" title="$REX[\'NOTFOUND_ARTICLE_ID\']">' . $I18N->msg('specials_settings_notfound_article') . '</label> ' . rex_var_link::_getLinkButton('neu_notfoundartikel', 2, $REX['NOTFOUND_ARTICLE_ID']) . ' <p><span class="rex-form-notice">$REX[\'NOTFOUND_ARTICLE_ID\']</span></p> </div> </div> <div class="rex-form-row"> <p class="rex-form-col-a rex-form-select"> <label for="rex-form-default-template-id" title="$REX[\'DEFAULT_TEMPLATE_ID\']">' . $I18N->msg('specials_settings_default_template') . '</label> ' . $sel_template->get() . ' <span class="rex-form-notice">$REX[\'DEFAULT_TEMPLATE_ID\']</span> </p> </div> <div class="rex-form-row"> <p class="rex-form-col-a rex-form-select"> <label for="rex-form-lang" title="$REX[\'LANG\']">' . $I18N->msg('specials_settings_backend_lang') . '</label>
/** * Erstellt den nötigen HTML Code um ein Formular zu erweitern * * @param $sqlFields rex_sql-objekt, dass die zu verarbeitenden Felder enthält * @param $activeItem objekt, dass mit getValue() die Werte des akuellen Eintrags zurückgibt * @param $formatCallback callback, dem die infos als Array übergeben werden und den formatierten HTML Text zurückgibt */ function rex_a62_metaFields($sqlFields, $activeItem, $formatCallback, $epParams) { global $I18N; $s = ''; // Startwert für MEDIABUTTON, MEDIALIST, LINKLIST $media_id = 1; $mlist_id = 1; $link_id = 1; $sqlFields->reset(); for ($i = 0; $i < $sqlFields->getRows(); $i++) { // Umschliessendes Tag von Label und Formularelement $tag = 'p'; $tag_attr = ''; $name = $sqlFields->getValue('name'); $title = $sqlFields->getValue('title'); $params = $sqlFields->getValue('params'); $typeLabel = $sqlFields->getValue('label'); $attr = $sqlFields->getValue('attributes'); $dbvalues = array(''); if ($activeItem) { $dbvalues = explode('|+|', $activeItem->getValue($name)); } if ($title != '') { $label = rex_translate($title); } else { $label = htmlspecialchars($name); } $id = preg_replace('/[^a-zA-Z\\-0-9_]/', '_', $label); $attr .= rex_tabindex(); $labelIt = true; $field = ''; switch ($typeLabel) { case 'text': $field = '<input type="' . $sqlFields->getValue('label') . '" name="' . $name . '" value="' . $dbvalues[0] . '" id="' . $id . '" ' . $attr . ' />'; break; case 'checkbox': $name .= '[]'; case 'radio': $values = array(); if (rex_sql::getQueryType($params) == 'SELECT') { $sql = new rex_sql(); $value_groups = $sql->getDBArray($params, MYSQL_NUM); foreach ($value_groups as $value_group) { if (isset($value_group[1])) { $values[$value_group[1]] = $value_group[0]; } else { $values[$value_group[0]] = $value_group[0]; } } } else { $value_groups = explode('|', $params); foreach ($value_groups as $value_group) { if (strpos($value_group, ':') !== false) { $temp = explode(':', $value_group); $values[$temp[0]] = $temp[1]; } else { $values[$value_group] = $value_group; } } } // if($epParams['extension_point'] != 'CAT_META_FORM_EDIT') // $field .= '<span>'. $label .'</span>'; $class = $typeLabel == 'radio' ? 'rex-rdo' : 'rex-chckbx'; $oneValue = count($values) == 1; if (!$oneValue) { $tag = ''; $labelIt = false; $tag = 'div'; $tag_attr = ' class="rex-chckbxs rex-ptag"'; $field .= '<p>' . $label . '</p>'; } foreach ($values as $key => $value) { $id = preg_replace('/[^a-zA-Z\\-0-9_]/', '_', $id . $key); // wenn man keine Werte angibt (Boolean Chkbox/Radio) // Dummy Wert annehmen, damit an/aus unterscheidung funktioniert if ($oneValue && $key == '') { $key = 'true'; } $selected = ''; if (in_array($key, $dbvalues)) { $selected = ' checked="checked"'; } if ($oneValue) { $tag_attr = ' class="' . $class . '"'; $field .= '<input type="' . $typeLabel . '" name="' . $name . '" value="' . $key . '" id="' . $id . '" ' . $attr . $selected . ' />' . "\n"; } else { $field .= '<p class="' . $class . '">' . "\n"; $field .= '<label for="' . $id . '"><span>' . htmlspecialchars($value) . '</span></label>'; $field .= '<input type="' . $typeLabel . '" name="' . $name . '" value="' . $key . '" id="' . $id . '" ' . $attr . $selected . ' />' . "\n"; $field .= '</p>' . "\n"; } } break; case 'select': $select = new rex_select(); $select->setName($name); $select->setId($id); $select->setSelected($dbvalues); foreach (explode(' ', $attr) as $pair) { if (strpos($pair, '=') === false) { continue; } $temp = explode('=', $pair); $select->setAttribute($temp[0], str_replace(array('"', "'"), '', $temp[1])); if ($temp[0] == 'multiple') { $select->setName($name . '[]'); } } if (rex_sql::getQueryType($params) == 'SELECT') { $select->addDBSqlOptions($params); } else { $values = array(); $value_groups = explode('|', $params); foreach ($value_groups as $value_group) { if (strpos($value_group, ':') !== false) { $temp = explode(':', $value_group); $values[$temp[0]] = $temp[1]; } else { $values[$value_group] = $value_group; } } $select->addOptions($values); } $field .= $select->get(); break; case 'datetime': case 'date': if ($dbvalues[0] == '') { $dbvalues[0] = time(); } $style = 'class="rex-fdate"'; $yearStyle = 'class="rex-fdatey"'; $yearSelect = new rex_select(); $yearSelect->addOptions(range(2005, date('Y') + 2), true); $yearSelect->setName($name . '[year]'); $yearSelect->setSize(1); $yearSelect->setId($id); $yearSelect->setStyle($yearStyle); $yearSelect->setSelected(date('Y', $dbvalues[0])); $monthSelect = new rex_select(); $monthSelect->addOptions(range(1, 12), true); $monthSelect->setName($name . '[month]'); $monthSelect->setSize(1); $monthSelect->setStyle($style); $monthSelect->setSelected(date('m', $dbvalues[0])); $daySelect = new rex_select(); $daySelect->addOptions(range(1, 31), true); $daySelect->setName($name . '[day]'); $daySelect->setSize(1); $daySelect->setStyle($style); $daySelect->setSelected(date('j', $dbvalues[0])); if ($typeLabel == 'datetime') { $hourSelect = new rex_select(); $hourSelect->addOptions(range(1, 23), true); $hourSelect->setName($name . '[hour]'); $hourSelect->setSize(1); $hourSelect->setStyle($style); $hourSelect->setSelected(date('G', $dbvalues[0])); $minuteSelect = new rex_select(); $minuteSelect->addOptions(range(0, 59), true); $minuteSelect->setName($name . '[minute]'); $minuteSelect->setSize(1); $minuteSelect->setStyle($style); $minuteSelect->setSelected(date('i', $dbvalues[0])); $field = $daySelect->get() . $monthSelect->get() . $yearSelect->get() . '-' . $hourSelect->get() . $minuteSelect->get(); } else { $field = $daySelect->get() . $monthSelect->get() . $yearSelect->get(); } break; case 'textarea': $field = '<textarea name="' . $name . '" id="' . $id . '" ' . $attr . ' cols="50" rows="6">' . $dbvalues[0] . '</textarea>'; break; case 'REX_MEDIA_BUTTON': $tag = 'div'; $tag_attr = ' class="rex-ptag"'; $field = rex_var_media::getMediaButton($media_id); $field = str_replace('REX_MEDIA[' . $media_id . ']', $dbvalues[0], $field); $field = str_replace('MEDIA[' . $media_id . ']', $name, $field); $id = 'REX_MEDIA_' . $media_id; $media_id++; break; case 'REX_MEDIALIST_BUTTON': $tag = 'div'; $tag_attr = ' class="rex-ptag"'; $name .= '[]'; $field = rex_var_media::getMediaListButton($mlist_id, implode(',', $dbvalues)); $field = str_replace('MEDIALIST[' . $mlist_id . ']', $name, $field); $id = 'REX_MEDIALIST_' . $mlist_id; $mlist_id++; break; case 'REX_LINK_BUTTON': $tag = 'div'; $tag_attr = ' class="rex-ptag"'; $category = ''; if ($activeItem) { $category = $activeItem->getValue('category_id'); } $field = rex_var_link::getLinkButton($link_id, $dbvalues[0], $category); $field = str_replace('LINK[' . $link_id . ']', $name, $field); $id = 'LINK_' . $link_id; $link_id++; break; } $s .= rex_call_func($formatCallback, array($field, $tag, $tag_attr, $id, $label, $labelIt), false); $sqlFields->next(); } return $s; }
function _getLinkButton($name, $linkId, $article_id, $category = '') { $field = rex_var_link::getLinkButton($linkId, $article_id, $category); return str_replace('LINK[' . $linkId . ']', $name, $field); }
<select name="pagination"> <?php foreach (array('site-number' => $I18N->msg('asd_news_site_numbers'), 'pager' => $I18N->msg('asd_news_prev_next_buttons')) as $value => $desc) { $selected = $value == rex_asd_news_config::getConfig('pagination') ? ' selected="selected"' : ''; echo '<option value="' . $value . '"' . $selected . '>' . $desc . '</option>'; } ?> </select> </p> </div> <div class="rex-form-row"> <div class="rex-form-widget"> <label>News Artikel</label> <?php echo rex_var_link::_getLinkButton('article', 1, rex_asd_news_config::getConfig('article')); ?> </div> </div> </div> <fieldset class="rex-form-col-1"> <legend><?php echo $I18N->msg('asd_news_settings_published_by'); ?> </legend> <div class="rex-form-wrapper"> <?php foreach (array('single' => $I18N->msg('asd_news_current_lang'), 'all' => $I18N->msg('asd_news_all_lang')) as $value => $description) { $checked = $value == rex_asd_news_config::getConfig('published-lang') ? ' checked="checked"' : ''; ?> <div class="rex-form-row">
<label for="rex-form-article_login_failed">Sprung zu diesem Artikel wenn nicht erfolgreich eingeloggt</label> ' . rex_var_link::_getLinkButton('article_login_failed', 2, stripslashes($REX['ADDON']['community']['plugin_auth']['article_login_failed'])) . ' </p> </div> <div class="rex-form-row"> <p class="rex-form-col-a rex-form-widget"> <label for="rex-form-article_logout">Sprung zu diesem Artikel nach dem Ausloggen</label> ' . rex_var_link::_getLinkButton('article_logout', 3, stripslashes($REX['ADDON']['community']['plugin_auth']['article_logout'])) . ' </p> </div> <div class="rex-form-row"> <p class="rex-form-col-a rex-form-widget"> <label for="rex-form-article_logout">Sprung zu diesem Artikel wenn auf gesperrtem Artikel zugriffen wird</label> ' . rex_var_link::_getLinkButton('article_withoutperm', 4, stripslashes($REX['ADDON']['community']['plugin_auth']['article_withoutperm'])) . ' </p> </div> <div class="rex-form-row"> <p class="rex-form-col-a rex-form-submit"> <input type="submit" class="rex-form-submit" name="sendit" value="' . $I18N->msg("specials_update") . '"' . rex_accesskey($I18N->msg('specials_update'), $REX['ACKEY']['SAVE']) . ' /> </p> </div> </fieldset> </div> <!-- Ende rex-area-content //--> </div> <!-- Ende rex-area-col-b //--> </div> <!-- Ende rex-area-col-2 //-->