function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
    {
        $this->label = $this->elements[1];
        $multiple = FALSE;
        if (isset($this->elements[6]) && $this->elements[6] == 1) {
            $multiple = TRUE;
        }
        $SEL = new rex_select();
        $SEL->setId("el_" . $this->id);
        if ($multiple) {
            $SEL->setName("FORM[" . $this->params["form_name"] . "][el_" . $this->id . "][]");
            $SEL->setSize(5);
            $SEL->setMultiple(1);
            if (!is_array($this->value)) {
                $this->value = array();
            }
        } else {
            $SEL->setName("FORM[" . $this->params["form_name"] . "][el_" . $this->id . "]");
            $SEL->setSize(1);
            $this->value = stripslashes($this->value);
        }
        foreach ($this->getKeys() as $k => $v) {
            $SEL->addOption($v, $k);
        }
        if ($this->value == "" && !$send) {
            if (isset($this->elements[5])) {
                $SEL->setSelected($this->elements[5]);
            }
        } else {
            if (is_array($this->value)) {
                foreach ($this->value as $val) {
                    $SEL->setSelected($val);
                }
            } else {
                $SEL->setSelected($this->value);
            }
        }
        $wc = "";
        if (isset($warning["el_" . $this->getId()])) {
            $wc = $warning["el_" . $this->getId()];
        }
        $SEL->setStyle(' class="select ' . $wc . '"');
        $form_output[] = ' 
			<p class="formselect formlabel-' . $this->label . '">
			<label class="select ' . $wc . '" for="el_' . $this->id . '" >' . $this->elements[2] . '</label>' . $SEL->get() . '
			</p>';
        $email_elements[$this->elements[1]] = $this->value;
        if (!isset($this->elements[4]) || $this->elements[4] != "no_db") {
            $sql_elements[$this->elements[1]] = $this->value;
        }
    }
 function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
 {
     $multiple = FALSE;
     if (isset($this->elements[6]) && $this->elements[6] == 1) {
         $multiple = TRUE;
     }
     $size = (int) $this->getElement(7);
     if ($size < 1) {
         $size = 1;
     }
     $SEL = new rex_select();
     $SEL->setId("el_" . $this->getId());
     if ($multiple) {
         if ($size == 1) {
             $size = 2;
         }
         $SEL->setName($this->getFormFieldname() . "[]");
         $SEL->setSize($size);
         $SEL->setMultiple(1);
     } else {
         $SEL->setName($this->getFormFieldname());
         $SEL->setSize(1);
     }
     foreach (explode(',', $this->elements[3]) as $v) {
         $teile = explode('=', $v);
         $wert = $teile[0];
         if (isset($teile[1])) {
             $bezeichnung = $teile[1];
         } else {
             $bezeichnung = $teile[0];
         }
         $SEL->addOption(rex_translate($wert), $bezeichnung);
     }
     if (!$send && $this->value == "" && isset($this->elements[5]) && $this->elements[5] != "") {
         $this->value = $this->elements[5];
     }
     if (!is_array($this->getValue())) {
         $this->value = explode(",", $this->getValue());
     }
     foreach ($this->getValue() as $v) {
         $SEL->setSelected($v);
     }
     $this->value = implode(",", $this->getValue());
     $wc = "";
     if (isset($warning[$this->getId()])) {
         $wc = $warning[$this->getId()];
     }
     $SEL->setStyle(' class="select ' . $wc . '"');
     $form_output[$this->getId()] = '
   <p class="formselect formlabel-' . $this->getName() . '" id="' . $this->getHTMLId() . '">
   <label class="select ' . $wc . '" for="el_' . $this->getId() . '" >' . rex_translate($this->getElement(2)) . '</label>' . $SEL->get() . '</p>';
     $email_elements[$this->elements[1]] = $this->getValue();
     if (!isset($this->elements[4]) || $this->elements[4] != "no_db") {
         $sql_elements[$this->elements[1]] = $this->getValue();
     }
 }
    function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
    {
        $SEL = new rex_select();
        $SEL->setName('FORM[' . $this->params["form_name"] . '][el_' . $this->id . ']');
        $SEL->setId("el_" . $this->id);
        $SEL->setSize(1);
        $sql = $this->elements[4];
        $teams = rex_sql::factory();
        $teams->debugsql = $this->params["debug"];
        $teams->setQuery($sql);
        $sqlnames = array();
        // mit --- keine auswahl ---
        if ($this->elements[3] != 1) {
            $SEL->addOption($this->elements[3], "0");
        }
        foreach ($teams->getArray() as $t) {
            if (!isset($this->elements[6]) || $this->elements[6] == "") {
                $v = $t['name'];
            } else {
                $v = $t[$this->elements[6]];
            }
            if ($this->elements[5] == "") {
                $k = $t['id'];
            } else {
                $k = $t[$this->elements[5]];
            }
            $SEL->addOption($v, $k);
            if (isset($this->elements[7])) {
                $sqlnames[$k] = $t[$this->elements[7]];
            }
        }
        $wc = "";
        if (isset($warning["el_" . $this->getId()])) {
            $wc = $warning["el_" . $this->getId()];
        }
        $SEL->setStyle(' class="select ' . $wc . '"');
        if ($this->value == "" && isset($this->elements[7]) && $this->elements[7] != "") {
            $this->value = $this->elements[7];
        }
        $SEL->setSelected($this->value);
        $form_output[] = '
			<p class="formselect" id="' . $this->getHTMLId() . '">
				<label class="select ' . $wc . '" for="el_' . $this->id . '" >' . $this->elements[2] . '</label>
				' . $SEL->get() . '
			</p>';
        $email_elements[$this->elements[1]] = stripslashes($this->value);
        if (isset($sqlnames[$this->value])) {
            $email_elements[$this->elements[1] . '_SQLNAME'] = stripslashes($sqlnames[$this->value]);
        }
        if (!isset($this->elements[8]) || $this->elements[8] != "no_db") {
            $sql_elements[$this->elements[1]] = $this->value;
        }
    }
    function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
    {
        // ***** SELECT FESTLEGEN
        $SEL = new rex_select();
        $SEL->setName('FORM[' . $this->params["form_name"] . '][el_' . $this->id . '][]');
        $SEL->setId("el_" . $this->id);
        $SEL->setSize(5);
        $SEL->setMultiple(1);
        // ***** SQL - ROHDATEN ZIEHEN
        $sql = $this->elements[5];
        $teams = rex_sql::factory();
        $teams->debugsql = $this->params["debug"];
        $teams->setQuery($sql);
        for ($t = 0; $t < $teams->getRows(); $t++) {
            $SEL->addOption($teams->getValue($this->elements[7]), $teams->getValue($this->elements[6]));
            $teams->next();
        }
        $wc = "";
        // if (isset($warning["el_" . $this->getId()])) $wc = $warning["el_" . $this->getId()];
        $SEL->setStyle('class="multipleselect ' . $wc . '"');
        // ***** EINGELOGGT ODER NICHT SETZEN
        if ($send == 0) {
            // erster aufruf
            // Daten ziehen
            if ($this->params["main_id"] > 0) {
                $this->value = array();
                $g = rex_sql::factory();
                $g->debugsql = $this->params["debug"];
                $g->setQuery('select ' . $this->elements[3] . ' from ' . $this->elements[1] . ' where ' . $this->elements[2] . '=' . $this->params["main_id"]);
                $gg = $g->getArray();
                if (is_array($gg)) {
                    foreach ($gg as $g) {
                        $this->value[] = $g[$this->elements[3]];
                    }
                }
            }
        }
        // ***** AUSWAHL SETZEN
        if (is_array($this->value)) {
            foreach ($this->value as $val) {
                $SEL->setSelected($val);
            }
        }
        // ***** AUSGEBEN
        $form_output[] = '
			<p class="formmultipleselect" id="' . $this->getHTMLId() . '">
				<label class="multipleselect ' . $wc . '" for="el_' . $this->id . '" >' . $this->elements[4] . '</label>
				' . $SEL->get() . '
			</p>';
    }
    function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
    {
        $SEL = new rex_select();
        $SEL->setName('FORM[' . $this->params["form_name"] . '][el_' . $this->id . ']');
        $SEL->setId("el_" . $this->id);
        $SEL->setSize(1);
        $sql = $this->elements[4];
        $teams = new rex_sql();
        $teams->debugsql = $this->params["debug"];
        $teams->setQuery($sql);
        $sqlnames = array();
        if ($this->elements[3] != 1) {
            // mit --- keine auswahl ---
            $SEL->addOption($this->elements[3], "0");
        }
        for ($t = 0; $t < $teams->getRows(); $t++) {
            $SEL->addOption($teams->getValue($this->elements[6]), $teams->getValue($this->elements[5]));
            if (isset($this->elements[7])) {
                $sqlnames[$teams->getValue($this->elements[5])] = $teams->getValue($this->elements[7]);
            }
            $teams->next();
        }
        $wc = "";
        if (isset($warning["el_" . $this->getId()])) {
            $wc = $warning["el_" . $this->getId()];
        }
        $SEL->setStyle(' class="select ' . $wc . '"');
        if ($this->value == "" && isset($this->elements[7]) && $this->elements[7] != "") {
            $this->value = $this->elements[7];
        }
        $SEL->setSelected($this->value);
        $form_output[] = '
			<p class="formselect">
			<label class="select ' . $wc . '" for="el_' . $this->id . '" >' . $this->elements[2] . '</label>
			' . $SEL->get() . '
			</p>';
        $email_elements[$this->elements[1]] = stripslashes($this->value);
        if (isset($sqlnames[$this->value])) {
            $email_elements[$this->elements[1] . '_SQLNAME'] = stripslashes($sqlnames[$this->value]);
        }
        if (!isset($this->elements[8]) || $this->elements[8] != "no_db") {
            $sql_elements[$this->elements[1]] = $this->value;
        }
    }
Пример #6
0
 function formatElement()
 {
     global $I18N;
     $name = $this->getAttribute('name') . '[]';
     $value = explode('|', htmlspecialchars($this->getValue()));
     if (count($value) != 4) {
         $value = array(null, 1, 'd');
     }
     $select = new rex_select();
     $select->setAttribute('class', 'rex-form-select rex-a630-interval');
     $select->setStyle('width:120px');
     $select->setName($name);
     $select->setSize(1);
     $select->addOption($I18N->msg('cronjob_interval_hour'), 'h');
     $select->addOption($I18N->msg('cronjob_interval_day'), 'd');
     $select->addOption($I18N->msg('cronjob_interval_week'), 'w');
     $select->addOption($I18N->msg('cronjob_interval_month'), 'm');
     $select->addOption($I18N->msg('cronjob_interval_year'), 'y');
     $select->setSelected($value[2]);
     return '
         <input type="text" class="rex-form-text rex-a630-interval" name="' . $name . '" style="width:20px; margin-right: 5px;" value="' . $value[1] . '" />
         ' . $select->get() . "\n";
 }
/**
 * 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;
}
Пример #8
0
 $select->addOption("nur News, die den Status \"online\" haben", 101);
 $select->addOption("nur News, die den Status \"auf Startseite\" haben", 102);
 $qry = 'SELECT id, name from ' . TBL_NEWS_CATS;
 $sql = new rex_sql();
 $data = $sql->getArray($qry);
 if (is_array($data) && sizeof($data) > 0) {
     foreach ($data as $row) {
         $select->addOption("nur aus " . $row['name'], $row['id']);
     }
 }
 if (sizeof($REX['CLANG']) > 1) {
     foreach ($REX['CLANG'] as $k => $v) {
         $select->addOption("nur folgende Sprache: " . $v, 'clang_' . $k);
     }
 }
 $select->setSelected(rex_request('filter'));
 echo $select->get();
 ?>
                 </fieldset>
             </form>
         </div>
         <div class="rex-clearer"></div>
     </div>
 </div>
 <div id="addon_news">
     <?php 
 $filter = rex_request('filter');
 if ($filter > 0 and $filter != 999) {
     switch ($filter) {
         case 101:
             $addSql = " AND status=1";
Пример #9
0
     }
 }
 $ctypes_out = '';
 $i = 1;
 $ctypes[] = '';
 // Extra, fŸr Neue Spalte
 if (is_array($ctypes)) {
     foreach ($ctypes as $id => $name) {
         $modul_select->setName('modules[' . $i . '][]');
         $modul_select->setId('modules_' . $i . '_select');
         $modul_select->resetSelected();
         if (isset($modules[$i]) && count($modules[$i]) > 0) {
             foreach ($modules[$i] as $j => $jj) {
                 // typsicherer vergleich, weil (0 != "all") => false
                 if ($j !== 'all') {
                     $modul_select->setSelected($jj);
                 }
             }
         }
         $ctypes_out .= '
         <div class="rex-form-row">
         <p class="rex-form-col-a rex-form-text">
             <label for="ctype' . $i . '">ID=' . $i . '</label>
             <input class="rex-form-text" id="ctype' . $i . '" type="text" name="ctype[' . $i . ']" value="' . htmlspecialchars($name) . '" />
         </p>
         <p class="rex-form-col-a rex-form-checkbox rex-form-label-right">
             <input class="rex-form-checkbox" id="allmodules' . $i . '" type="checkbox" name="modules[' . $i . '][all]" ';
         if (!isset($modules[$i]['all']) || $modules[$i]['all'] == 1) {
             $ctypes_out .= ' checked="checked" ';
         }
         $ctypes_out .= ' value="1" />
Пример #10
0
/**
 * 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, $REX;
    $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++, $sqlFields->next()) {
        // 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');
        $restrictions = $sqlFields->getValue('restrictions');
        $attr .= rex_tabindex();
        $attrArray = rex_split_string($attr);
        if (isset($attrArray['perm'])) {
            if (!$REX['USER']->hasPerm($attrArray['perm'])) {
                continue;
            }
            unset($attrArray['perm']);
        }
        $defaultValue = $sqlFields->getValue('default');
        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));
            }
        } else {
            $dbvalues = (array) $sqlFields->getValue('default');
        }
        if ($title != '') {
            $label = rex_translate($title);
        } else {
            $label = htmlspecialchars($name);
        }
        $id = preg_replace('/[^a-zA-Z\\-0-9_]/', '_', $label);
        $labelIt = true;
        $field = '';
        switch ($typeLabel) {
            case 'text':
                $tag_attr = ' class="rex-form-text"';
                $rexInput = rex_input::factory($typeLabel);
                $rexInput->addAttributes($attrArray);
                $rexInput->setAttribute('id', $id);
                $rexInput->setAttribute('name', $name);
                if ($dblength > 0) {
                    $rexInput->setAttribute('maxlength', $dblength);
                }
                if ($activeItem) {
                    $rexInput->setValue($activeItem->getValue($name));
                } else {
                    $rexInput->setValue($defaultValue);
                }
                $field = $rexInput->getHtml();
                break;
            case 'checkbox':
                // Beachte auch default values in multiple fields bei ADD.
                // Im EDIT wurde dies bereits vorher gehandelt
                if (!$activeItem) {
                    $defaultValue = explode('|', $defaultValue);
                }
                $name .= '[]';
            case 'radio':
                $values = array();
                if (rex_sql::getQueryType($params) == 'SELECT') {
                    $sql = rex_sql::factory();
                    $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) {
                        // check ob key:value paar
                        // und der wert beginnt nicht mit "translate:"
                        if (strpos($value_group, ':') !== false && strpos($value_group, 'translate:') !== 0) {
                            $temp = explode(':', $value_group, 2);
                            $values[$temp[0]] = rex_translate($temp[1]);
                        } else {
                            $values[$value_group] = rex_translate($value_group);
                        }
                    }
                }
                $class_s = $typeLabel;
                $class_p = $typeLabel == 'radio' ? 'radios' : 'checkboxes';
                $oneValue = count($values) == 1;
                if (!$oneValue) {
                    $labelIt = false;
                    $tag = 'div';
                    $tag_attr = ' class="rex-form-col-a rex-form-' . $class_p . '"';
                    $field .= '<p class="rex-form-label">' . $label . '</p><div class="rex-form-' . $class_p . '-wrapper">';
                }
                $attrStr = '';
                $classAdd = '';
                foreach ($attrArray as $key => $value) {
                    if ($key == 'class') {
                        $classAdd = ' ' . $value;
                    } else {
                        $attrStr = ' ' . $key . '="' . $value . '"';
                    }
                }
                if (!$activeItem) {
                    $dbvalues = (array) $defaultValue;
                }
                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="rex-form-col-a rex-form-' . $class_s . $classAdd . '"';
                        $field .= '<input class="rex-form-' . $class_s . '" type="' . $typeLabel . '" name="' . $name . '" value="' . htmlspecialchars($key) . '" id="' . $id . '" ' . $attrStr . $selected . ' />' . "\n";
                    } else {
                        $field .= '<p class="rex-form-' . $class_s . ' rex-form-label-right' . $classAdd . '">' . "\n";
                        $field .= '<input class="rex-form-' . $class_s . '" type="' . $typeLabel . '" name="' . $name . '" value="' . htmlspecialchars($key) . '" id="' . $id . '" ' . $attrStr . $selected . ' />' . "\n";
                        $field .= '<label for="' . $id . '">' . htmlspecialchars($value) . '</label>';
                        $field .= '</p>' . "\n";
                    }
                }
                if (!$oneValue) {
                    $field .= '</div>';
                }
                break;
            case 'select':
                $tag_attr = ' class="rex-form-select"';
                $select = new rex_select();
                $select->setStyle('class="rex-form-select"');
                $select->setName($name);
                $select->setId($id);
                $multiple = false;
                foreach ($attrArray as $attr_name => $attr_value) {
                    if (empty($attr_name)) {
                        continue;
                    }
                    $select->setAttribute($attr_name, $attr_value);
                    if ($attr_name == 'multiple') {
                        $multiple = true;
                        $select->setName($name . '[]');
                    }
                }
                // Beachte auch default values in multiple fields bei ADD.
                // Im EDIT wurde dies bereits vorher gehandelt
                if ($multiple && !$activeItem) {
                    $dbvalues = explode('|', $defaultValue);
                }
                // hier mit den "raw"-values arbeiten, da die rex_select klasse selbst escaped
                $select->setSelected($dbvalues);
                if (!$multiple) {
                    $select->setSize(1);
                }
                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) {
                        // check ob key:value paar
                        // und der wert beginnt nicht mit "translate:"
                        if (strpos($value_group, ':') !== false && strpos($value_group, 'translate:') !== 0) {
                            $temp = explode(':', $value_group, 2);
                            $values[$temp[0]] = rex_translate($temp[1]);
                        } else {
                            $values[$value_group] = rex_translate($value_group);
                        }
                    }
                    $select->addOptions($values);
                }
                $field .= $select->get();
                break;
            case 'date':
            case 'time':
            case 'datetime':
                $tag_attr = ' class="rex-form-select-date"';
                $active = $dbvalues[0] != 0;
                if ($dbvalues[0] == '') {
                    $dbvalues[0] = time();
                }
                $inputValue = array();
                $inputValue['year'] = date('Y', $dbvalues[0]);
                $inputValue['month'] = date('m', $dbvalues[0]);
                $inputValue['day'] = date('j', $dbvalues[0]);
                $inputValue['hour'] = date('G', $dbvalues[0]);
                $inputValue['minute'] = date('i', $dbvalues[0]);
                $rexInput = rex_input::factory($typeLabel);
                $rexInput->addAttributes($attrArray);
                $rexInput->setAttribute('id', $id);
                $rexInput->setAttribute('name', $name);
                $rexInput->setValue($inputValue);
                $field = $rexInput->getHtml();
                $checked = $active ? ' checked="checked"' : '';
                $field .= '<input class="rex-form-select-checkbox rex-metainfo-checkbox" type="checkbox" name="' . $name . '[active]" value="1"' . $checked . ' />';
                break;
            case 'textarea':
                $tag_attr = ' class="rex-form-textarea"';
                $rexInput = rex_input::factory($typeLabel);
                $rexInput->addAttributes($attrArray);
                $rexInput->setAttribute('id', $id);
                $rexInput->setAttribute('name', $name);
                if ($activeItem) {
                    $rexInput->setValue($activeItem->getValue($name));
                } else {
                    $rexInput->setValue($defaultValue);
                }
                $field = $rexInput->getHtml();
                break;
            case 'legend':
                $tag = '';
                $tag_attr = '';
                $labelIt = false;
                // tabindex entfernen, macht bei einer legend wenig sinn
                $attr = preg_replace('@tabindex="[^"]*"@', '', $attr);
                $field = '</div></fieldset><fieldset class="rex-form-col-1"><legend id="' . $id . '"' . $attr . '>' . $label . '</legend><div class="rex-form-wrapper">';
                break;
            case 'REX_MEDIA_BUTTON':
                $tag = 'div';
                $tag_attr = ' class="rex-form-widget"';
                $paramArray = rex_split_string($params);
                $rexInput = rex_input::factory('mediabutton');
                $rexInput->addAttributes($attrArray);
                $rexInput->setButtonId($media_id);
                $rexInput->setAttribute('name', $name);
                $rexInput->setValue($dbvalues[0]);
                if (isset($paramArray['category'])) {
                    $rexInput->setCategoryId($paramArray['category']);
                }
                if (isset($paramArray['types'])) {
                    $rexInput->setTypes($paramArray['types']);
                }
                if (isset($paramArray['preview'])) {
                    $rexInput->setPreview($paramArray['preview']);
                }
                $id = $rexInput->getAttribute('id');
                $field = $rexInput->getHtml();
                $media_id++;
                break;
            case 'REX_MEDIALIST_BUTTON':
                $tag = 'div';
                $tag_attr = ' class="rex-form-widget"';
                $paramArray = rex_split_string($params);
                $name .= '[]';
                $rexInput = rex_input::factory('medialistbutton');
                $rexInput->addAttributes($attrArray);
                $rexInput->setButtonId($mlist_id);
                $rexInput->setAttribute('name', $name);
                $rexInput->setValue($dbvalues[0]);
                if (isset($paramArray['category'])) {
                    $rexInput->setCategoryId($paramArray['category']);
                }
                if (isset($paramArray['types'])) {
                    $rexInput->setTypes($paramArray['types']);
                }
                if (isset($paramArray['preview'])) {
                    $rexInput->setPreview($paramArray['preview']);
                }
                $id = $rexInput->getAttribute('id');
                $field = $rexInput->getHtml();
                $mlist_id++;
                break;
            case 'REX_LINK_BUTTON':
                $tag = 'div';
                $tag_attr = ' class="rex-form-widget"';
                $paramArray = rex_split_string($params);
                $category = '';
                if (isset($paramArray['category'])) {
                    $category = $paramArray['category'];
                } elseif ($activeItem) {
                    $category = $activeItem->getValue('category_id');
                }
                $rexInput = rex_input::factory('linkbutton');
                $rexInput->addAttributes($attrArray);
                $rexInput->setButtonId($link_id);
                $rexInput->setCategoryId($category);
                $rexInput->setAttribute('name', $name);
                $rexInput->setValue($dbvalues[0]);
                $id = $rexInput->getAttribute('id');
                $field = $rexInput->getHtml();
                $link_id++;
                break;
            case 'REX_LINKLIST_BUTTON':
                $tag = 'div';
                $tag_attr = ' class="rex-form-widget"';
                $paramArray = rex_split_string($params);
                $category = '';
                if (isset($paramArray['category'])) {
                    $category = $paramArray['category'];
                } elseif ($activeItem) {
                    $category = $activeItem->getValue('category_id');
                }
                $name .= '[]';
                $rexInput = rex_input::factory('linklistbutton');
                $rexInput->addAttributes($attrArray);
                $rexInput->setButtonId($llist_id);
                $rexInput->setCategoryId($category);
                $rexInput->setAttribute('name', $name);
                $rexInput->setValue(implode(',', $dbvalues));
                $id = $rexInput->getAttribute('id');
                $field = $rexInput->getHtml();
                $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, 'values' => $dbvalues, 'rawvalues' => $dbvalues, 'type' => $typeLabel, 'sql' => $sqlFields));
        }
        $s .= rex_call_func($formatCallback, array($field, $tag, $tag_attr, $id, $label, $labelIt, $typeLabel), false);
    }
    return $s;
}
Пример #11
0
        $tableSelect->setSelected($table);
    }
}
$formElements = [];
$n = [];
$n['header'] = '<div id="rex-js-exporttype-sql-div">';
$n['label'] = '<label for="rex-form-exporttables">' . rex_i18n::msg('backup_export_select_tables') . '</label>';
$n['field'] = $tableSelect->get();
$n['footer'] = '</div>';
$formElements[] = $n;
// Vorhandene Exporte auslesen
$sel_dirs = new rex_select();
$sel_dirs->setId('rex-form-exportdir');
$sel_dirs->setName('EXPDIR[]');
$sel_dirs->setMultiple();
$sel_dirs->setSelected($EXPDIR);
$sel_dirs->setStyle('class="form-control"');
$dir = rex_path::frontend();
$folders = rex_finder::factory($dir)->dirsOnly()->ignoreDirs('.*')->ignoreDirs('redaxo');
$folders = iterator_to_array($folders);
$count_folders = count($folders);
if ($count_folders > 4) {
    $sel_dirs->setSize($count_folders);
}
foreach ($folders as $file) {
    $file = basename($file);
    $sel_dirs->addOption($file, $file);
}
$n = [];
$n['header'] = '<div id="rex-js-exporttype-files-div" style="display: none;">';
$n['label'] = '<label for="rex-form-exportdir">' . rex_i18n::msg('backup_export_select_dir') . '</label>';
Пример #12
0
    ?>

                <p class="rex-form-select">
                <label class="select " for="divider" ><?php 
    echo $I18N->msg('xform_manager_import_divider');
    ?>
</label>
                <?php 
    $a = new rex_select();
    $a->setName('divider');
    $a->setId('divider');
    $a->setSize(1);
    $a->addOption($I18N->msg('xform_manager_import_divider_semicolon') . ' (;)', ';');
    $a->addOption($I18N->msg('xform_manager_import_divider_comma') . ' (,)', ',');
    $a->addOption($I18N->msg('xform_manager_import_divider_tab') . '', 'tab');
    $a->setSelected($divider);
    echo $a->get();
    ?>
                    </p>

                <p class="rex-form-text">
                    <label for="rex-form-error-replacefield"><?php 
    echo $I18N->msg('xform_manager_import_unique_field');
    ?>
</label>
                    <input class="rex-form-text" type="text" id="rex-form-replacefield" name="replacefield" value="<?php 
    echo htmlspecialchars(stripslashes($replacefield));
    ?>
" />
                </p>
Пример #13
0
$sel_be_sprache = new rex_select();
$sel_be_sprache->setSize(1);
$sel_be_sprache->setStyle('class="form-control"');
$sel_be_sprache->setName('userperm_be_sprache');
$sel_be_sprache->setId('rex-id-userperm-mylang');
$sel_be_sprache->addOption('default', '');
$saveLocale = rex_i18n::getLocale();
$langs = [];
foreach (rex_i18n::getLocales() as $locale) {
    rex_i18n::setLocale($locale, false);
    // Locale nicht neu setzen
    $sel_be_sprache->addOption(rex_i18n::msg('lang'), $locale);
}
rex_i18n::setLocale($saveLocale, false);
$userperm_be_sprache = rex_request('userperm_be_sprache', 'string', $user->getLanguage());
$sel_be_sprache->setSelected($userperm_be_sprache);
// --------------------------------- FUNCTIONS
if (rex_post('upd_profile_button', 'bool')) {
    $updateuser = rex_sql::factory();
    $updateuser->setTable(rex::getTablePrefix() . 'user');
    $updateuser->setWhere(['id' => $user_id]);
    $updateuser->setValue('name', $username);
    $updateuser->setValue('description', $userdesc);
    $updateuser->setValue('language', $userperm_be_sprache);
    $updateuser->addGlobalUpdateFields();
    try {
        $updateuser->update();
        $success = rex_i18n::msg('user_data_updated');
    } catch (rex_sql_exception $e) {
        $error = $e->getMessage();
    }
    function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
    {
        global $REX, $I18N;
        // ---------- CONFIG & CHECK
        $this->be_em = array();
        $this->be_em["source_table"] = $this->params["main_table"];
        // "rex_em_data_" wegcutten
        $this->be_em["label"] = $this->elements[2];
        // HTML Bezeichnung
        $this->be_em["target_table"] = $this->elements[3];
        // Zieltabelle
        $this->be_em["target_field"] = $this->elements[4];
        // Zielfield welches angezeigt wird.
        $this->be_em["relation_type"] = (int) $this->elements[5];
        // select single = 0 / select multiple = 1 / popup single = 2 / popup multiple = 3
        if ($this->be_em["relation_type"] > 4) {
            $this->be_em["relation_type"] = 0;
        }
        $this->be_em["eoption"] = (int) $this->elements[6];
        // "Leer" Option
        $this->be_em["page"] = $this->elements[8];
        // page=editme
        if ($this->be_em["page"] == "") {
            $this->be_em["page"] = 'editme';
        }
        $this->be_em["subpage"] = $this->elements[9];
        // page=editme
        if ($this->be_em["subpage"] == "") {
            $this->be_em["subpage"] = $this->be_em["target_table"];
        }
        if ($this->be_em["eoption"] != 1) {
            $this->be_em["eoption"] = 0;
        }
        $disabled = FALSE;
        // ---------- Datensatz existiert bereits, Values aus verkn�pfungstabelle holen
        if ($this->params["main_id"] > 0 && $send == 0) {
            if (trim($this->getValue()) != "") {
                $values = explode(",", $this->getValue());
            } else {
                $vs = rex_sql::factory();
                $vs->debugsql = $this->params["debug"];
                $vs->setQuery('
					select 
						target_id as id 
					from 
						rex_xform_relation 
					where 
						source_table="' . $this->be_em["source_table"] . '" and 
						source_name="' . $this->getName() . '" and 
						source_id="' . $this->params["main_id"] . '"');
                $v = $vs->getArray();
                $values = array();
                if (count($v) > 0) {
                    foreach ($v as $w) {
                        $values[$w["id"]] = $w["id"];
                    }
                }
            }
            $this->setValue($values);
            // echo '<pre>++ ';var_dump($this->getValue());echo '</pre>';
        }
        // ---------- connected, fix values
        if (isset($this->params["rex_xform_set"][$this->getName()])) {
            $values = $this->getValue();
            $values[] = $this->params["rex_xform_set"][$this->getName()];
            $this->setValue($values);
            $disabled = TRUE;
        }
        // ---------- Value angleichen -> immer Array mit IDs daraus machen
        if (!is_array($this->getValue())) {
            if (trim($this->getValue()) == "") {
                $this->setValue(array());
            } else {
                $this->setValue(explode(",", $this->getValue()));
            }
        }
        // ---------- (array) $this->getValue()
        // ---------- check values
        $sql = 'select id,' . $this->be_em["target_field"] . ' from ' . $this->be_em["target_table"];
        $value_names = array();
        if (count($this->getValue()) > 0) {
            $add_sql = array();
            foreach ($this->getValue() as $v) {
                $add_sql[] = ' id=' . $v . '';
            }
            if (count($add_sql) > 0) {
                $sql .= ' where ' . implode(" OR ", $add_sql);
            }
            $values = array();
            $vs = rex_sql::factory();
            $sss->debugsql = $this->params["debug"];
            $vs->setQuery($sql);
            foreach ($vs->getArray() as $v) {
                $value_names[$v["id"]] = $v[$this->be_em["target_field"]] . ' [id=' . $v['id'] . ']';
                $values[] = $v["id"];
                $value_name = $v[$this->be_em["target_field"]];
            }
            $this->setValue($values);
        }
        // ------------------------------------ POPUP, single, multiple 1-1, n-m
        if ($this->be_em["relation_type"] == 2 || $this->be_em["relation_type"] == 3) {
            $multiple = "0";
            if ($this->be_em["relation_type"] == 3) {
                $multiple = "1";
            }
            $link = 'index.php?page=xform&subpage=manager&tripage=data_edit&table_name=' . $this->be_em["target_table"];
            if ($multiple) {
                $out = '
				<div class="rex-widget">
				    <div class="rex-widget-xform-manager-datalist">
				      <input type="hidden" name="FORM[' . $this->params["form_name"] . '][el_' . $this->getId() . ']" id="XFORM_MANAGER_DATALIST_' . $this->getId() . '" value="' . implode(",", $this->getValue()) . '" />
				      <p class="rex-widget-field">
				        <select name="XFORM_MANAGER_DATALIST_SELECT[' . $this->getId() . ']" id="XFORM_MANAGER_DATALIST_SELECT_' . $this->getId() . '" size="8">';
                foreach ($value_names as $k => $v) {
                    $out .= '<option value="' . $k . '">' . $v . '</option>';
                }
                $out .= '
				        </select>
				      </p>
				       <p class="rex-widget-icons rex-widget-2col">
				       	<span class="rex-widget-column rex-widget-column-first">
						<a href="#" class="rex-icon-file-top" 
							onclick="xform_manager_moveDatalist(' . $this->getId() . ',\'top\');return false;" 
							title="' . $I18N->msg("xform_relation_move_first_data") . '"></a>
						<a href="#" class="rex-icon-file-up" 
							onclick="xform_manager_moveDatalist(' . $this->getId() . ',\'up\');return false;" 
							title="' . $I18N->msg("xform_relation_move_up_data") . '"></a>
						<a href="#" class="rex-icon-file-down" 
							onclick="xform_manager_moveDatalist(' . $this->getId() . ',\'down\');return false;" 
							title="' . $I18N->msg("xform_relation_down_first_data") . '"></a>
						<a href="#" class="rex-icon-file-bottom" 
							onclick="xform_manager_moveDatalist(' . $this->getId() . ',\'bottom\');return false;" 
							title="' . $I18N->msg("xform_relation_move_last_data") . '"></a>
				       	</span>
				       	<span class="rex-widget-column">
							<a href="#" class="rex-icon-file-open" 
								onclick="xform_manager_openDatalist(' . $this->getId() . ', \'' . $this->be_em["target_field"] . '\', \'' . $link . '\',\'' . $multiple . '\');return false;" 
								title="' . $I18N->msg("xform_relation_choose_entry") . '"></a>
							<a href="#" class="rex-icon-file-delete" 
								onclick="xform_manager_deleteDatalist(' . $this->getId() . ',\'' . $multiple . '\');return false;" 
								title="' . $I18N->msg("xform_relation_delete_entry") . '"></a>
				        </span>
				 	    </p>
				    </div>
				  </div>
			 	<div class="rex-clearer"></div>';
            } else {
                $out = '
				
				<div class="rex-widget">
					<div class="rex-widget-data">
					
					<p class="rex-widget-field">
					<input type="hidden" name="FORM[' . $this->params["form_name"] . '][el_' . $this->getId() . ']" id="XFORM_MANAGER_DATA_' . $this->getId() . '" value="' . implode(",", $this->getValue()) . '" />
					<input type="text" size="30" name="XFORM_MANAGER_DATANAME[' . $this->getId() . ']" value="' . htmlspecialchars($value_name) . '" id="XFORM_MANAGER_DATANAME_' . $this->getId() . '" readonly="readonly" class="text" />
					</p>
					<p class="rex-widget-icons rex-widget-1col">
					<span class="rex-widget-column rex-widget-column-first">
						<a href="#" class="rex-icon-file-open" 
							onclick="xform_manager_openDatalist(' . $this->getId() . ', \'' . $this->be_em["target_field"] . '\', \'' . $link . '\',\'' . $multiple . '\');return false;" 
							title="' . $I18N->msg("xform_relation_choose_entry") . '"></a>
						<a href="#" class="rex-icon-file-delete" 
							onclick="xform_manager_deleteDatalist(' . $this->getId() . ',\'' . $multiple . '\');return false;" 
							title="' . $I18N->msg("xform_relation_delete_entry") . '"></a>
					</span>
					</p>
					</div>
				</div>
				<div class="rex-clearer"></div>
				';
            }
            $form_output[] = '
				<p class="formpopup" id="' . $this->getHTMLId() . '">
					<label class="select ' . $wc . '" for="el_' . $this->id . '" >' . $this->be_em["label"] . '</label>
					' . $out . '
				</p>';
        }
        // --------------------------------------- POPUP, 1-n
        if ($this->be_em["relation_type"] == 4) {
            $text = 'not yet implemented';
            // TODO
            /*
            if($this->params["main_id"] < 1)
            {
            	$text = 'Diesen Bereich k&ouml;nnen Sie erst bearbeiten, wenn der Datensatz angelegt wurde.';
            }else
            {
            		
            	$link = 'javascript:rex_xform_openRelation('.$this->getId().',\''.$this->be_em["target_table"].'\',\'id'.
            		'&rex_em_filter['.$this->be_em["target_field"].']='.$this->params["main_id"].
            		'&rex_em_set['.$this->be_em["target_field"].']='.$this->params["main_id"].
            		'&page='.$this->be_em["page"].
            		'&subpage='.$this->be_em["subpage"].
            	'\');';
            		
            	$text = '<a href="'.$link.'">'.
            	'Link'.
            	'</a>';
            }
            */
            $form_output[] = '
			<p class="formhtml" id="' . $this->getHTMLId() . '">
			<label class="select " for="el_' . $this->getId() . '" >' . $this->be_em["label"] . '</label>
			<input type="hidden" name="FORM[' . $this->params["form_name"] . '][el_' . $this->getId() . '][]" id="REX_RELATION_' . $this->getId() . '" />
			<span>' . $text . '</span>
			</p>';
            return;
        }
        // --------------------------------------- Selectbox, single or multiple
        if ($this->be_em["relation_type"] < 2) {
            if ($send == 1 && $this->be_em["eoption"] == 0 && count($this->getValue()) == 0) {
                // Error. Fehlermeldung ausgeben
                $this->params["warning"][] = $this->elements[7];
                $this->params["warning_messages"][] = $this->elements[7];
                $wc = $this->params["error_class"];
            }
            $wc = "";
            if (isset($warning[$this->getId()])) {
                $wc = $warning[$this->getId()];
            }
            // ----- SELECT BOX
            $sss = rex_sql::factory();
            $sss->debugsql = $this->params["debug"];
            $sss->setQuery('select * from ' . $this->be_em["target_table"] . ' order by ' . $this->be_em["target_field"]);
            $SEL = new rex_select();
            $SEL->setName('FORM[' . $this->params["form_name"] . '][el_' . $this->id . '][]');
            $SEL->setId("el_" . $this->id);
            $SEL->setStyle('class="select"');
            $SEL->setDisabled($disabled);
            $SEL->setSize(1);
            // mit --- keine auswahl ---
            if ($this->be_em["relation_type"] == 1) {
                $SEL->setMultiple(TRUE);
                $SEL->setSize(5);
            } elseif ($this->be_em["eoption"] == 1) {
                $SEL->addOption("-", "");
            }
            foreach ($sss->getArray() as $v) {
                $s = $v[$this->be_em["target_field"]];
                if (strlen($s) > 50) {
                    $s = substr($s, 0, 45) . ' ... ';
                }
                $s = $s . ' [id=' . $v["id"] . ']';
                $SEL->addOption($s, $v["id"]);
            }
            // var_dump($this->getValue());
            $SEL->setSelected($this->getValue());
            $form_output[] = '
	        <p class="formselect" id="' . $this->getHTMLId() . '">
	          <label class="select ' . $wc . '" for="el_' . $this->id . '" >' . $this->be_em["label"] . '</label>
	          ' . $SEL->get() . '
	        </p>';
        }
        // --------------------------------------- save
        $email_elements[$this->getName()] = stripslashes(implode(",", $this->getValue()));
        $sql_elements[$this->getName()] = implode(",", $this->getValue());
    }
Пример #15
0
     $allcatschecked = ' checked="checked"';
 }
 if ($allmcats == 1) {
     $allmcatschecked = ' checked="checked"';
 }
 // userperm_all
 foreach ($userperm_all as $_perm) {
     $sel_all->setSelected($_perm);
 }
 // userperm_ext
 foreach ($userperm_ext as $_perm) {
     $sel_ext->setSelected($_perm);
 }
 // userperm_extra
 foreach ($userperm_extra as $_perm) {
     $sel_extra->setSelected($_perm);
 }
 // userperm_sprachen
 foreach ($userperm_sprachen as $_perm) {
     $sel_sprachen->setSelected($_perm);
 }
 if ($userperm_mylang == '') {
     $userperm_mylang = 'be_lang[default]';
 }
 $sel_mylang->setSelected($userperm_mylang);
 // userperm_cat
 foreach ($userperm_cat as $_perm) {
     $sel_cat->setSelected($_perm);
 }
 // userperm_media
 foreach ($userperm_media as $_perm) {
Пример #16
0
foreach (array('mail', 'sendmail', 'smtp') as $type) {
    $sel_mailer->addOption($type, $type);
}
$sel_encoding = new rex_select();
$sel_encoding->setId('encoding');
$sel_encoding->setName('encoding');
$sel_encoding->setSize(1);
$sel_encoding->setSelected($encoding);
foreach (array('7bit', '8bit', 'binary', 'base64', 'quoted-printable') as $enc) {
    $sel_encoding->addOption($enc, $enc);
}
$sel_priority = new rex_select();
$sel_priority->setid('priority');
$sel_priority->setName('priority');
$sel_priority->setSize(1);
$sel_priority->setSelected($priority);
foreach (array(1 => $I18N_A93->msg('high'), 3 => $I18N_A93->msg('normal'), 5 => $I18N_A93->msg('low')) as $no => $name) {
    $sel_priority->addOption($name, $no);
}
if ($message != '') {
    echo rex_warning($message);
}
?>

<div class="rex-addon-editmode">
	<form action="" method="post">
	  <fieldset>
		<legend class="rex-lgnd"><?php 
echo $I18N_A93->msg('config_settings');
?>
</legend>
Пример #17
0
$redaxo_nl_from_email = rex_request("redaxo_nl_from_email", "string");
$redaxo_nl_from_name = rex_request("redaxo_nl_from_name", "string");
$redaxo_nl_subject = rex_request("redaxo_nl_subject", "string");
// -------- xform email template
$xform_nl_tpl = "";
$xform_nl_tpl_tmp = rex_request("xform_nl_tpl", "string");
$xform_nl_sql = new rex_sql();
$xform_nl_sql->setQuery("select * from rex_xform_email_template");
$xform_nl_tpls = $xform_nl_sql->getArray();
$xform_nl_select = new rex_select();
$xform_nl_select->setName("xform_nl_tpl");
foreach ($xform_nl_tpls as $tpl) {
    $xform_nl_select->addOption($tpl["name"], $tpl["name"]);
    if ($xform_nl_tpl_tmp == $tpl["name"]) {
        $xform_nl_tpl = $tpl;
        $xform_nl_select->setSelected($tpl["name"]);
    }
}
// -------- Testuser ID
$test_user_id = rex_request("test_user_id", "int", 0);
$test_user = array();
$gu = new rex_sql();
$gu->setQuery('select * from rex_com_user where id=' . $test_user_id);
$test_users = $gu->getArray();
if (count($test_users) != 1) {
    $test_user_id = 0;
} else {
    $test_user = $test_users[0];
}
$info = array();
$error = array();
Пример #18
0
       </tr>
     </thead>
     ';
 // tbody nur anzeigen, wenn später auch inhalt drinnen stehen wird
 if ($sql->getRows() > 0 || $function == 'add_art') {
     echo '<tbody>
       ';
 }
 // --------------------- ARTIKEL ADD FORM
 if ($function == 'add_art' && $KATPERM && !$REX_USER->hasPerm('editContentOnly[]')) {
     if (empty($template_id)) {
         $sql2 = new rex_sql();
         // $sql2->debugsql = true;
         $sql2->setQuery('SELECT template_id FROM ' . $REX['TABLE_PREFIX'] . 'article WHERE id=' . $category_id . ' AND clang=' . $clang . ' AND startpage=1');
         if ($sql2->getRows() == 1) {
             $TMPL_SEL->setSelected($sql2->getValue('template_id'));
         }
     }
     $add_td = '';
     if ($REX_USER->hasPerm('advancedMode[]')) {
         $add_td = '<td class="rex-icon">-</td>';
     }
     echo '<tr class="rex-trow-actv">
         <td class="rex-icon"><img src="media/document.gif" alt="' . $I18N->msg('article_add') . '" title="' . $I18N->msg('article_add') . '" /></td>
         ' . $add_td . '
         <td><input type="text" id="article_name" name="article_name" /></td>
         <td><input type="text" id="Position_New_Article" name="Position_New_Article" value="100" /></td>
         <td>' . $TMPL_SEL->get() . '</td>
         <td>' . rex_formatter::format(time(), 'strftime', 'date') . '</td>
         <td>' . $I18N->msg("article") . '</td>
         <td colspan="3"><input type="submit" class="rex-fsubmit" name="artadd_function" value="' . $I18N->msg('article_add') . '"' . rex_accesskey($I18N->msg('article_add'), $REX['ACKEY']['SAVE']) . ' /></td>
Пример #19
0
 /**
  * Erstellt den nötigen HTML Code um ein Formular zu erweitern.
  *
  * @param rex_sql $sqlFields rex_sql-objekt, dass die zu verarbeitenden Felder enthält
  * @param array   $epParams  Array of all EP parameters
  *
  * @return string
  */
 public function renderMetaFields(rex_sql $sqlFields, array $epParams)
 {
     $s = '';
     // Startwert für MEDIABUTTON, MEDIALIST, LINKLIST zähler
     $media_id = 1;
     $mlist_id = 1;
     $link_id = 1;
     $llist_id = 1;
     $activeItem = isset($epParams['activeItem']) ? $epParams['activeItem'] : null;
     $sqlFields->reset();
     for ($i = 0; $i < $sqlFields->getRows(); $i++, $sqlFields->next()) {
         // 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');
         $attrArray = rex_string::split($attr);
         if (isset($attrArray['perm'])) {
             if (!rex::getUser()->hasPerm($attrArray['perm'])) {
                 continue;
             }
             unset($attrArray['perm']);
         }
         $defaultValue = $sqlFields->getValue('default');
         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));
             }
         } else {
             $dbvalues = (array) $sqlFields->getValue('default');
         }
         if ($title != '') {
             $label = rex_i18n::translate($title);
         } else {
             $label = htmlspecialchars($name);
         }
         $id = preg_replace('/[^a-zA-Z\\-0-9_]/', '_', $label);
         $labelIt = true;
         $label = '<label for="' . $id . '">' . $label . '</label>';
         $field = '';
         switch ($typeLabel) {
             case 'text':
                 $tag_attr = ' class="form-control"';
                 $rexInput = rex_input::factory($typeLabel);
                 $rexInput->addAttributes($attrArray);
                 $rexInput->setAttribute('id', $id);
                 $rexInput->setAttribute('name', $name);
                 if ($dblength > 0) {
                     $rexInput->setAttribute('maxlength', $dblength);
                 }
                 if ($activeItem) {
                     $rexInput->setValue($activeItem->getValue($name));
                 } else {
                     $rexInput->setValue($defaultValue);
                 }
                 $field = $rexInput->getHtml();
                 $e = [];
                 $e['label'] = $label;
                 $e['field'] = $field;
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', [$e], false);
                 $field = $fragment->parse('core/form/form.php');
                 break;
             case 'checkbox':
                 // Beachte auch default values in multiple fields bei ADD.
                 // Im EDIT wurde dies bereits vorher gehandelt
                 if (!$activeItem) {
                     $defaultValue = explode('|', $defaultValue);
                 }
                 $name .= '[]';
             case 'radio':
                 $formElements = [];
                 $values = [];
                 if (rex_sql::getQueryType($params) == 'SELECT') {
                     $sql = rex_sql::factory();
                     $value_groups = $sql->getDBArray($params, [], PDO::FETCH_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) {
                         // check ob key:value paar
                         // und der wert beginnt nicht mit "translate:"
                         if (strpos($value_group, ':') !== false && strpos($value_group, 'translate:') !== 0) {
                             $temp = explode(':', $value_group, 2);
                             $values[$temp[0]] = rex_i18n::translate($temp[1]);
                         } else {
                             $values[$value_group] = rex_i18n::translate($value_group);
                         }
                     }
                 }
                 $oneValue = count($values) == 1;
                 $attrStr = '';
                 $classAdd = '';
                 $inline = false;
                 if (false !== ($key = array_search('inline', $attrArray))) {
                     $inline = true;
                     unset($attrArray[$key]);
                 }
                 foreach ($attrArray as $key => $value) {
                     if ($key == 'class') {
                         $classAdd = ' ' . $value;
                     } else {
                         $attrStr = ' ' . $key . '="' . $value . '"';
                     }
                 }
                 if (!$activeItem) {
                     $dbvalues = (array) $defaultValue;
                 }
                 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"';
                     }
                     $e = [];
                     if ($oneValue) {
                         $e['label'] = $label;
                     } else {
                         $e['label'] = '<label for="' . $id . '">' . htmlspecialchars($value) . '</label>';
                     }
                     $e['field'] = '<input type="' . $typeLabel . '" name="' . $name . '" value="' . htmlspecialchars($key) . '" id="' . $id . '" ' . $attrStr . $selected . ' />';
                     $formElements[] = $e;
                 }
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', $formElements, false);
                 $fragment->setVar('inline', $inline);
                 if ($typeLabel == 'radio') {
                     $field = $fragment->parse('core/form/radio.php');
                 } else {
                     if (!$oneValue) {
                         $fragment->setVar('grouped', true);
                     }
                     $field = $fragment->parse('core/form/checkbox.php');
                 }
                 if (!$oneValue) {
                     $e = [];
                     $e['label'] = $label;
                     $e['field'] = $field;
                     $fragment = new rex_fragment();
                     $fragment->setVar('elements', [$e], false);
                     $field = $fragment->parse('core/form/form.php');
                 }
                 break;
             case 'select':
                 $tag_attr = ' class="form-control"';
                 $select = new rex_select();
                 $select->setStyle('class="form-control"');
                 $select->setName($name);
                 $select->setId($id);
                 $multiple = false;
                 foreach ($attrArray as $attr_name => $attr_value) {
                     if (empty($attr_name)) {
                         continue;
                     }
                     $select->setAttribute($attr_name, $attr_value);
                     if ($attr_name == 'multiple') {
                         $multiple = true;
                         $select->setName($name . '[]');
                         $select->setMultiple();
                     }
                 }
                 // Beachte auch default values in multiple fields bei ADD.
                 // Im EDIT wurde dies bereits vorher gehandelt
                 if ($multiple && !$activeItem) {
                     $dbvalues = explode('|', $defaultValue);
                 }
                 // hier mit den "raw"-values arbeiten, da die rex_select klasse selbst escaped
                 $select->setSelected($dbvalues);
                 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 = [];
                     $value_groups = explode('|', $params);
                     foreach ($value_groups as $value_group) {
                         // check ob key:value paar
                         // und der wert beginnt nicht mit "translate:"
                         if (strpos($value_group, ':') !== false && strpos($value_group, 'translate:') !== 0) {
                             $temp = explode(':', $value_group, 2);
                             $values[$temp[0]] = rex_i18n::translate($temp[1]);
                         } else {
                             $values[$value_group] = rex_i18n::translate($value_group);
                         }
                     }
                     $select->addOptions($values);
                 }
                 $field .= $select->get();
                 $e = [];
                 $e['label'] = $label;
                 $e['field'] = $field;
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', [$e], false);
                 $field = $fragment->parse('core/form/form.php');
                 break;
             case 'date':
             case 'time':
             case 'datetime':
                 $tag_attr = ' class="form-control-date"';
                 $active = $dbvalues[0] != 0;
                 if ($dbvalues[0] == '') {
                     $dbvalues[0] = time();
                 }
                 $inputValue = [];
                 $inputValue['year'] = date('Y', $dbvalues[0]);
                 $inputValue['month'] = date('n', $dbvalues[0]);
                 $inputValue['day'] = date('j', $dbvalues[0]);
                 $inputValue['hour'] = date('G', $dbvalues[0]);
                 $inputValue['minute'] = date('i', $dbvalues[0]);
                 $rexInput = rex_input::factory($typeLabel);
                 $rexInput->addAttributes($attrArray);
                 $rexInput->setAttribute('id', $id);
                 $rexInput->setAttribute('name', $name);
                 $rexInput->setValue($inputValue);
                 $field = $rexInput->getHtml();
                 $checked = $active ? ' checked="checked"' : '';
                 $field .= '<input class="rex-metainfo-checkbox" type="checkbox" name="' . $name . '[active]" value="1"' . $checked . ' />';
                 $e = [];
                 $e['label'] = $label;
                 $e['field'] = $field;
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', [$e], false);
                 $field = $fragment->parse('core/form/form.php');
                 break;
             case 'textarea':
                 $tag_attr = ' class="form-control"';
                 $rexInput = rex_input::factory($typeLabel);
                 $rexInput->addAttributes($attrArray);
                 $rexInput->setAttribute('id', $id);
                 $rexInput->setAttribute('name', $name);
                 if ($activeItem) {
                     $rexInput->setValue($activeItem->getValue($name));
                 } else {
                     $rexInput->setValue($defaultValue);
                 }
                 $field = $rexInput->getHtml();
                 $e = [];
                 $e['label'] = $label;
                 $e['field'] = $field;
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', [$e], false);
                 $field = $fragment->parse('core/form/form.php');
                 break;
             case 'legend':
                 $tag = '';
                 $tag_attr = '';
                 $labelIt = false;
                 // tabindex entfernen, macht bei einer legend wenig sinn
                 $attr = preg_replace('@tabindex="[^"]*"@', '', $attr);
                 $field = '</fieldset><fieldset><legend id="' . $id . '"' . $attr . '>' . $label . '</legend>';
                 break;
             case 'REX_MEDIA_WIDGET':
                 $tag = 'div';
                 $tag_attr = ' class="rex-form-widget"';
                 $paramArray = rex_string::split($params);
                 $rexInput = rex_input::factory('mediabutton');
                 $rexInput->addAttributes($attrArray);
                 $rexInput->setButtonId($media_id);
                 $rexInput->setAttribute('name', $name);
                 $rexInput->setValue($dbvalues[0]);
                 if (isset($paramArray['category'])) {
                     $rexInput->setCategoryId($paramArray['category']);
                 }
                 if (isset($paramArray['types'])) {
                     $rexInput->setTypes($paramArray['types']);
                 }
                 if (isset($paramArray['preview'])) {
                     $rexInput->setPreview($paramArray['preview']);
                 }
                 $id = $rexInput->getAttribute('id');
                 $field = $rexInput->getHtml();
                 $e = [];
                 $e['label'] = $label;
                 $e['field'] = $field;
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', [$e], false);
                 $field = $fragment->parse('core/form/form.php');
                 ++$media_id;
                 break;
             case 'REX_MEDIALIST_WIDGET':
                 $tag = 'div';
                 $tag_attr = ' class="rex-form-widget"';
                 $paramArray = rex_string::split($params);
                 $name .= '[]';
                 $rexInput = rex_input::factory('medialistbutton');
                 $rexInput->addAttributes($attrArray);
                 $rexInput->setButtonId($mlist_id);
                 $rexInput->setAttribute('name', $name);
                 $rexInput->setValue($dbvalues[0]);
                 if (isset($paramArray['category'])) {
                     $rexInput->setCategoryId($paramArray['category']);
                 }
                 if (isset($paramArray['types'])) {
                     $rexInput->setTypes($paramArray['types']);
                 }
                 if (isset($paramArray['preview'])) {
                     $rexInput->setPreview($paramArray['preview']);
                 }
                 $id = $rexInput->getAttribute('id');
                 $field = $rexInput->getHtml();
                 $e = [];
                 $e['label'] = $label;
                 $e['field'] = $field;
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', [$e], false);
                 $field = $fragment->parse('core/form/form.php');
                 ++$mlist_id;
                 break;
             case 'REX_LINK_WIDGET':
                 $tag = 'div';
                 $tag_attr = ' class="rex-form-widget"';
                 $paramArray = rex_string::split($params);
                 $category = '';
                 if (isset($paramArray['category'])) {
                     $category = $paramArray['category'];
                 } elseif ($activeItem) {
                     $category = $activeItem->getValue('category_id');
                 }
                 $rexInput = rex_input::factory('linkbutton');
                 $rexInput->addAttributes($attrArray);
                 $rexInput->setButtonId($link_id);
                 $rexInput->setCategoryId($category);
                 $rexInput->setAttribute('name', $name);
                 $rexInput->setValue($dbvalues[0]);
                 $id = $rexInput->getAttribute('id');
                 $field = $rexInput->getHtml();
                 $e = [];
                 $e['label'] = $label;
                 $e['field'] = $field;
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', [$e], false);
                 $field = $fragment->parse('core/form/form.php');
                 ++$link_id;
                 break;
             case 'REX_LINKLIST_WIDGET':
                 $tag = 'div';
                 $tag_attr = ' class="rex-form-widget"';
                 $paramArray = rex_string::split($params);
                 $category = '';
                 if (isset($paramArray['category'])) {
                     $category = $paramArray['category'];
                 } elseif ($activeItem) {
                     $category = $activeItem->getValue('category_id');
                 }
                 $name .= '[]';
                 $rexInput = rex_input::factory('linklistbutton');
                 $rexInput->addAttributes($attrArray);
                 $rexInput->setButtonId($llist_id);
                 $rexInput->setCategoryId($category);
                 $rexInput->setAttribute('name', $name);
                 $rexInput->setValue(implode(',', $dbvalues));
                 $id = $rexInput->getAttribute('id');
                 $field = $rexInput->getHtml();
                 $e = [];
                 $e['label'] = $label;
                 $e['field'] = $field;
                 $fragment = new rex_fragment();
                 $fragment->setVar('elements', [$e], false);
                 $field = $fragment->parse('core/form/form.php');
                 ++$llist_id;
                 break;
             default:
                 // ----- EXTENSION POINT
                 list($field, $tag, $tag_attr, $id, $label, $labelIt) = rex_extension::registerPoint(new rex_extension_point('METAINFO_CUSTOM_FIELD', [$field, $tag, $tag_attr, $id, $label, $labelIt, 'values' => $dbvalues, 'rawvalues' => $dbvalues, 'type' => $typeLabel, 'sql' => $sqlFields]));
         }
         $s .= $this->renderFormItem($field, $tag, $tag_attr, $id, $label, $labelIt, $typeLabel);
     }
     return $s;
 }
Пример #20
0
 $submit_message = rex_i18n::msg('setup_410');
 if (count($error_array) > 0) {
     $submit_message = rex_i18n::msg('setup_414');
 }
 $content .= '
         <fieldset>
             <input type="hidden" name="page" value="setup" />
             <input type="hidden" name="step" value="5" />
             <input type="hidden" name="lang" value="' . $lang . '" />';
 $timezone_sel = new rex_select();
 $timezone_sel->setId('rex-form-timezone');
 $timezone_sel->setStyle('class="form-control"');
 $timezone_sel->setName('timezone');
 $timezone_sel->setSize(1);
 $timezone_sel->addOptions(DateTimeZone::listIdentifiers(), true);
 $timezone_sel->setSelected($config['timezone']);
 $db_create_checked = rex_post('redaxo_db_create', 'boolean') ? ' checked="checked"' : '';
 $content .= '<legend>' . rex_i18n::msg('setup_402') . '</legend>';
 $formElements = [];
 $n = [];
 $n['label'] = '<label for="rex-form-serveraddress">' . rex_i18n::msg('server') . '</label>';
 $n['field'] = '<input class="form-control" type="text" id="rex-form-serveraddress" name="serveraddress" value="' . $config['server'] . '" autofocus />';
 $formElements[] = $n;
 $n = [];
 $n['label'] = '<label for="rex-form-servername">' . rex_i18n::msg('servername') . '</label>';
 $n['field'] = '<input class="form-control" type="text" id="rex-form-servername" name="servername" value="' . $config['servername'] . '" />';
 $formElements[] = $n;
 $n = [];
 $n['label'] = '<label for="rex-form-error-email">' . rex_i18n::msg('error_email') . '</label>';
 $n['field'] = '<input class="form-control" type="text" id="rex-form-error-email" name="error_email" value="' . $config['error_email'] . '" />';
 $formElements[] = $n;
Пример #21
0
						<p class="rex-form-text">
							<label for="multinewsletter_group"><?php 
    echo $I18N_KURSE->msg('multinewsletter_gruppe');
    ?>
</label>
							<?php 
    require_once $REX['INCLUDE_PATH'] . '/addons/multinewsletter/classes/class.multinewsletter_group.inc.php';
    $groups = new rex_select();
    $groups->setSize(1);
    $groups->setAttribute('class', 'myrex_select');
    $groups->addOption($I18N_KURSE->msg('multinewsletter_nicht_anmelden'), '0');
    $newsletter_groups = MultinewsletterGroupList::getAll($REX['TABLE_PREFIX']);
    foreach ($newsletter_groups as $group) {
        $groups->addOption($group->name, $group->group_id);
    }
    $groups->setSelected($REX['ADDON']['d2u_kurse']['settings']['multinewsletter_group']);
    $groups->setAttribute('id', 'multinewsletter_group');
    $groups->setName('settings[multinewsletter_group]');
    print $groups->get();
    ?>
						</p>
					</div>
					<?php 
}
?>
				</div>
			</fieldset>

			<fieldset class="rex-form-col-1">
				<legend><?php 
echo $I18N_KURSE->msg('einstellungen_startseite_zielgruppe');
<?php

// Stellenkategorien
$query = 'SELECT interne_bezeichnung, kategorie_id ' . 'FROM ' . $REX['TABLE_PREFIX'] . 'd2u_stellenmarkt_kategorien ' . 'ORDER BY interne_bezeichnung';
$result = new rex_sql();
$result->setQuery($query);
$num_rows = $result->getRows();
$kategorien = array();
for ($i = 0; $i < $num_rows; $i++) {
    $kategorien[$result->getValue("kategorie_id")] = $result->getValue("interne_bezeichnung");
    $result->next();
}
print 'Anzuzeigende Stellenkategorie auswählen: ';
$select = new rex_select();
$select->setName('VALUE[1]');
$select->setSize(1);
// Daten
$select->addOption("Alle", 0);
foreach ($kategorien as $key => $val) {
    $select->addOption($val, $key);
}
// Vorselektierung
$select->setSelected("REX_VALUE[1]");
echo $select->show();
?>

<p><br />Alle weiteren Änderungen bitte im <a href="index.php?page=d2u_stellenmarkt">Stellenmarkt Addon</a> vornehmen.</p>
Пример #23
0
                $error[] = $msg;
            }
        }
    }
    if (empty($error)) {
        if (rex_file::putConfig($configFile, $config) > 0) {
            $success = rex_i18n::msg('info_updated');
        }
    }
}
$sel_lang = new rex_select();
$sel_lang->setStyle('class="form-control"');
$sel_lang->setName('settings[lang]');
$sel_lang->setId('rex-id-lang');
$sel_lang->setSize(1);
$sel_lang->setSelected(rex::getProperty('lang'));
foreach (rex_i18n::getLocales() as $l) {
    $sel_lang->addOption($l, $l);
}
if (!empty($error)) {
    echo rex_view::error(implode('<br />', $error));
}
if ($info != '') {
    echo rex_view::info($info);
}
if ($success != '') {
    echo rex_view::success($success);
}
$dbconfig = rex::getProperty('db');
$version = rex_path::src();
if (strlen($version) > 21) {
Пример #24
0
<td><?php 
$cat_select->setName('VALUE[3]');
$cat_select->setSelected('REX_VALUE[3]');
echo $cat_select->get();
?>
</td>

<td>Maximaler Zoom:</td>
<td><?php 
$max_zoom = (int) 'REX_VALUE[4]';
if ($max_zoom < 1 || $max_zoom > 16) {
    $max_zoom = 8;
}
$zoom_select = new rex_select();
$zoom_select->setName('VALUE[4]');
$zoom_select->setSelected($max_zoom);
for ($zoom = 1; $zoom <= 16; $zoom++) {
    $zoom_select->addOption($zoom, $zoom);
}
$zoom_select->setSize(1);
echo $zoom_select->get();
?>
</td>
</tr>

<tr>
<td>Marker:</td>
<td colspan="3"><textarea name="VALUE[6]" style="width:500px; height:200px">REX_VALUE[6]</textarea></td>
</tr>

<tr>
Пример #25
0
                    $lang_a->setAttribute('tabindex', rex_tabindex(false));
                    foreach ($REX['CLANG'] as $key => $val) {
                        $val = rex_translate($val);
                        $lang_a->addOption($val, $key);
                    }
                    $lang_b = new rex_select();
                    $lang_b->setId('clang_b');
                    $lang_b->setName('clang_b');
                    $lang_b->setSize('1');
                    $lang_b->setAttribute('tabindex', rex_tabindex(false));
                    foreach ($REX['CLANG'] as $key => $val) {
                        $val = rex_translate($val);
                        $lang_b->addOption($val, $key);
                    }
                    $lang_a->setSelected(rex_request('clang_a', 'int', null));
                    $lang_b->setSelected(rex_request('clang_b', 'int', null));
                    echo '
                <fieldset>
                  <legend class="rex-lgnd">' . $I18N->msg('content_submitcopycontent') . '</legend>
  							  <div class="rex-fldst-wrppr">
									  <p>
											<label for="clang_a">' . $I18N->msg('content_contentoflang') . '</label>
											' . $lang_a->get() . '
											<label for="clang_b">' . $I18N->msg('content_to') . '</label>
											' . $lang_b->get() . '
									  </p>
									  <p>
											<input class="rex-sbmt" type="submit" name="copycontent" value="' . $I18N->msg('content_submitcopycontent') . '"' . rex_tabindex() . ' onclick="return confirm(\'' . $I18N->msg('content_submitcopycontent') . '?\')" />
									  </p>
								  </div>
                </fieldset>';
    function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
    {
        $day = 0;
        $month = 0;
        $year = 0;
        if (@strlen($this->value) == 10) {
            $day = (int) substr($this->value, 8, 2);
            $month = (int) substr($this->value, 5, 2);
            $year = (int) substr($this->value, 0, 4);
        } else {
            if (isset($_REQUEST["FORM"][$this->params["form_name"]]['el_' . $this->id]["day"])) {
                $day = (int) $_REQUEST["FORM"][$this->params["form_name"]]['el_' . $this->id]["day"];
            }
            if (isset($_REQUEST["FORM"][$this->params["form_name"]]['el_' . $this->id]["month"])) {
                $month = (int) $_REQUEST["FORM"][$this->params["form_name"]]['el_' . $this->id]["month"];
            }
            if (isset($_REQUEST["FORM"][$this->params["form_name"]]['el_' . $this->id]["year"])) {
                $year = (int) $_REQUEST["FORM"][$this->params["form_name"]]['el_' . $this->id]["year"];
            }
        }
        $formname = 'FORM[' . $this->params["form_name"] . '][el_' . $this->id . ']';
        $isodatum = sprintf("%04d-%02d-%02d", $year, $month, $day);
        $datum = $isodatum;
        $twarning = "";
        if (isset($this->elements[4]) && $this->elements[4] == 1 && !checkdate($month, $day, $year) && $send == 1) {
            $twarning = 'border:1px solid #f99;background-color:#f9f3f3;';
            $warning[] = "Geburtsdatum ist falsch";
        } else {
            $email_elements[$this->elements[1]] = "{$day}.{$month}.{$year}";
            $sql_elements[$this->elements[1]] = $datum;
        }
        $out = "";
        $out .= '
		<p class="formbirthday">
					<label class="select" for="el_' . $this->id . '" >' . $this->elements[2] . '</label>';
        $dsel = new rex_select();
        $dsel->setName($formname . '[day]');
        $dsel->setStyle("width:50px;" . $twarning);
        $dsel->setId('el_' . $this->id . '_day');
        $dsel->setSize(1);
        $dsel->addOption("TT", "0");
        for ($i = 1; $i < 32; $i++) {
            $dsel->addOption($i, $i);
        }
        $dsel->setSelected($day);
        $out .= $dsel->get();
        $msel = new rex_select();
        $msel->setName($formname . '[month]');
        $msel->setStyle("width:50px;" . $twarning);
        $msel->setId('el_' . $this->id . '_month');
        $msel->setSize(1);
        $msel->addOption("MM", "0");
        for ($i = 1; $i < 13; $i++) {
            $msel->addOption($i, $i);
        }
        $msel->setSelected($month);
        $out .= $msel->get();
        $ysel = new rex_select();
        $ysel->setName($formname . '[year]');
        $ysel->setStyle("width:80px;" . $twarning);
        $ysel->setId('el_' . $this->id . '_year');
        $ysel->setSize(1);
        $ysel->addOption("YYYY", "0");
        for ($i = 1930; $i < 2000; $i++) {
            $ysel->addOption($i, $i);
        }
        $ysel->setSelected($year);
        $out .= $ysel->get();
        $out .= '</p>';
        $form_output[] = $out;
    }
Пример #27
0
                foreach ($clang_perm as $key) {
                    $val = rex_translate($REX['CLANG'][$key]);
                    $lang_a->addOption($val, $key);
                }
                $lang_b = new rex_select();
                $lang_b->setStyle('class="rex-form-select"');
                $lang_b->setId('clang_b');
                $lang_b->setName('clang_b');
                $lang_b->setSize('1');
                $lang_b->setAttribute('tabindex', rex_tabindex(false));
                foreach ($clang_perm as $key) {
                    $val = rex_translate($REX['CLANG'][$key]);
                    $lang_b->addOption($val, $key);
                }
                $lang_a->setSelected(rex_request('clang_a', 'rex-clang-id', null));
                $lang_b->setSelected(rex_request('clang_b', 'rex-clang-id', null));
                $out .= '
              <fieldset class="rex-form-col-2">
                <legend>' . $I18N->msg('content_submitcopycontent') . '</legend>
							  <div class="rex-form-wrapper">
							  
							  	<div class="rex-form-row">
									  <p class="rex-form-col-a rex-form-select">
											<label for="clang_a">' . $I18N->msg('content_contentoflang') . '</label>
											' . $lang_a->get() . '
										</p>
									  <p class="rex-form-col-b rex-form-select">
											<label for="clang_b">' . $I18N->msg('content_to') . '</label>
											' . $lang_b->get() . '
									  </p>
									 </div>
Пример #28
0
    function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
    {
        $day = date("d");
        $month = date("m");
        $year = date("Y");
        if (!is_array($this->getValue()) && strlen($this->getValue()) == 8) {
            $year = (int) substr($this->value, 0, 4);
            $month = (int) substr($this->value, 4, 2);
            $day = (int) substr($this->value, 6, 2);
        } else {
            if (isset($_REQUEST["FORM"][$this->params["form_name"]]['el_' . $this->id]["day"])) {
                $day = $_REQUEST["FORM"][$this->params["form_name"]]['el_' . $this->id]["day"];
            }
            if (isset($_REQUEST["FORM"][$this->params["form_name"]]['el_' . $this->id]["month"])) {
                $month = $_REQUEST["FORM"][$this->params["form_name"]]['el_' . $this->id]["month"];
            }
            if (isset($_REQUEST["FORM"][$this->params["form_name"]]['el_' . $this->id]["year"])) {
                $year = $_REQUEST["FORM"][$this->params["form_name"]]['el_' . $this->id]["year"];
            }
        }
        $formname = 'FORM[' . $this->params["form_name"] . '][el_' . $this->id . ']';
        $twarning = "";
        if (!checkdate($month, $day, $year) && $send == 1) {
            $twarning = 'border:1px solid #f99;background-color:#f9f3f3;';
            $warning[] = "Datum ist falsch";
        }
        $isodatum = sprintf("%04d%02d%02d", $year, $month, $day);
        $email_elements[$this->getName()] = $isodatum;
        $sql_elements[$this->getName()] = $isodatum;
        $out = "";
        $out .= '
		<p class="formdate formlabel-' . $this->getName() . '" id="' . $this->getHTMLId() . '">
					<label class="select" for="' . $this->getFieldId() . '" >' . $this->elements[2] . '</label>';
        $dsel = new rex_select();
        $dsel->setName($formname . '[day]');
        $dsel->setStyle("width:55px;" . $twarning);
        $dsel->setId('el_' . $this->id . '_day');
        $dsel->setSize(1);
        $dsel->addOption("TT", "0");
        for ($i = 1; $i < 32; $i++) {
            $dsel->addOption($i, $i);
        }
        $dsel->setSelected($day);
        $out .= $dsel->get();
        $msel = new rex_select();
        $msel->setName($formname . '[month]');
        $msel->setStyle("width:55px;" . $twarning);
        $msel->setId('el_' . $this->id . '_month');
        $msel->setSize(1);
        $msel->addOption("MM", "0");
        for ($i = 1; $i < 13; $i++) {
            $msel->addOption($i, $i);
        }
        $msel->setSelected($month);
        $out .= $msel->get();
        $year_start = (int) $this->elements[3];
        $year_end = (int) $this->elements[4];
        if ($year_start == 0) {
            $year_start = 1980;
        }
        if ($year_end == 0) {
            $year_end = 2010;
        }
        if ($year_end < $year_start) {
            $year_end = $year_start;
        }
        $ysel = new rex_select();
        $ysel->setName($formname . '[year]');
        $ysel->setStyle("width:88px;" . $twarning);
        $ysel->setId('el_' . $this->id . '_year');
        $ysel->setSize(1);
        $ysel->addOption("YYYY", "0");
        for ($i = $year_start; $i <= $year_end; $i++) {
            $ysel->addOption($i, $i);
        }
        $ysel->setSelected($year);
        $out .= $ysel->get();
        $out .= '</p>';
        $form_output[] = $out;
    }
Пример #29
0
$tbl_sel->setName('VALUE[1]');
$tbl_sel->setSize(1);
$tbl_sel->addOption('Keine Tabelle ausgewählt', '');
foreach ($tables as $key => $value) {
    $tbl_sel->addOption(current($value), current($value));
}
$tbl_sel->setSelected('REX_VALUE[1]');
$tbl_sel = $tbl_sel->get();
$plz_tbl_sel = new rex_select();
$plz_tbl_sel->setName('VALUE[8]');
$plz_tbl_sel->setSize(1);
$plz_tbl_sel->addOption('Keine Tabelle ausgewählt', '');
foreach ($tables as $key => $value) {
    $plz_tbl_sel->addOption(current($value), current($value));
}
$plz_tbl_sel->setSelected('REX_VALUE[8]');
$plz_tbl_sel = $plz_tbl_sel->get();
?>

<table class="rex-table">
    <tr>
        <th colspan="2">yform GeoModul</th>
    </tr>
    <tr>
        <th>Quell-Tabelle</th>
        <td><?php 
echo $tbl_sel;
?>
</td>
    </tr>
    <tr>
}
$sel_lang = new rex_select();
$sel_lang->setStyle('class="rex-form-select"');
$sel_lang->setName('neu_lang');
$sel_lang->setId('rex-form-lang');
$sel_lang->setSize(1);
$sel_lang->setSelected($REX['LANG']);
foreach ($REX['LOCALES'] as $l) {
    $sel_lang->addOption($l, $l);
}
$sel_mod_rewrite = new rex_select();
$sel_mod_rewrite->setSize(1);
$sel_mod_rewrite->setStyle('class="rex-form-select"');
$sel_mod_rewrite->setName('neu_modrewrite');
$sel_mod_rewrite->setId('rex-form-mod-rewrite');
$sel_mod_rewrite->setSelected($REX['MOD_REWRITE'] === false ? 'FALSE' : 'TRUE');
$sel_mod_rewrite->addOption('TRUE', 'TRUE');
$sel_mod_rewrite->addOption('FALSE', 'FALSE');
if ($warning != '') {
    echo rex_warning($warning);
}
if ($info != '') {
    echo rex_info($info);
}
echo '
	<div class="rex-form" id="rex-form-system-setup">
  	<form action="index.php" method="post">
    	<input type="hidden" name="page" value="specials" />
    	<input type="hidden" name="func" value="updateinfos" />
		
			<div class="rex-area-col-2">