Zudem: geht sowas eigentlich in einem Modul:
Code: Alles auswählen
$xform->setValueField('text', array('name', $I18N->msg('donationcenter_thanxUpage_name')));
Mit Dank!
Code: Alles auswählen
$xform->setValueField('text', array('name', $I18N->msg('donationcenter_thanxUpage_name')));
Code: Alles auswählen
// get language of visitor as 'de', 'en' etc... and bring to I18N-Format. We want to use Backend lang file for module
$curlang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
if ($curlang == 'de')
{$currentlanguage = 'de_de';}
if ($curlang == 'en')
{$currentlanguage = 'en_gb';}
else {}
// include $I18N (Frontend has no I18N)
if (!is_object($I18N)) {
$includepath = $REX['INCLUDE_PATH'].'/addons/donationcenter/lang/';
$I18N = rex_create_lang($currentlanguage,$includepath,true);
}
Code: Alles auswählen
$xform->setValidateField('preg_match', array('name', '/[9]/i', $I18N->msg('donationcenter_validation_nosymbols')));
Code: Alles auswählen
$xform->setValidateField('preg_match', array('name', '/[^$+{}']/', $I18N->msg('donationcenter_validation_nosymbols')));
Code: Alles auswählen
$xform->setValidateField('preg_match', array('name', '/^[a-zA-ZäüöéàèÄÜÖÉÀÈß +.-]{5,30}$/', $I18N->msg('donationcenter_validation_nosymbols')));
Code: Alles auswählen
$xform = new rex_xform();
//$xform->setDebug (TRUE);
// Fields
$xform->setValueField('hidden', array('transaction_id', $_POST['txn_id']));
$xform->setValueField('text', array('name', $I18N->msg('donationcenter_thanxUpage_name')));
$xform->setValueField('text', array('url', $I18N->msg('donationcenter_thanxUpage_website')));
$xform->setValueField('textarea', array('message', $I18N->msg('donationcenter_thanxUpage_message')));
// Validations
$xform->setValidateField('preg_match', array('name', '/^[a-zA-ZäüöéàèÄÜÖÉÀÈß +-]{2,30}$/', $I18N->msg('donationcenter_validation_name')));
$xform->setValidateField('preg_match', array('url', '/\b(?:(?:https?):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/', $I18N->msg('donationcenter_validation_url')));
$xform->setValidateField('preg_match', array('message', '/^[0-9a-zA-ZäüöéàèÄÜÖÉÀÈß +,;?!-]{2,300}$/', $I18N->msg('donationcenter_validation_textarea')));
$thanxpage = rex_getUrl($REX['ADDON']['donationcenter']['settings']['thanxArticleID']);
// Form config
$xform->setObjectparams("form_action", $thanxpage);
$xform->setObjectparams('real_field_names',true);
$form = $xform->getForm();
Code: Alles auswählen
xform-> designForm($table);
Code: Alles auswählen
$xform->setValueField('select_sql', array("location","Locations","SELECT id,name AS name FROM rex_schoolcinemamanager_locations ORDER BY name","","","1","bitte wählen"),"0"));
Code: Alles auswählen
<select class="select " id="xform-formular-field-2" name="location" size="1">
<option value="0" selected="selected">bitte wählen</option>
<option value="3">Chur</option>
<option value="2">Horgen</option>
<option value="1">Winterthur</option>
<option value="4">Zürich</option>
</select>
Code: Alles auswählen
$locations = "Stadt1,Stadt2,Stadt3";
Code: Alles auswählen
$xform->setValueField('select', array('location', $I18N->msg('schoolcinemamanager_registerform_location'), $locations));
Code: Alles auswählen
// get cities list for form select
/*
$sql = "SELECT id,name FROM rex_schoolcinemamanager_locations ORDER BY name ASC";
$data = mysql_query($sql);
while ($row = mysql_fetch_array($data)) {
$locations = $row['name'].', ';
}
Code: Alles auswählen
// get cities list for form select
$sql = rex_sql::factory();
$sql->setQuery("SELECT name FROM rex_schoolcinemamanager_locations ORDER BY name ASC");
for($i=0; $i<$sql->getRows(); $i++) {
$locations = $sql->getValue('name');
echo $locations;
$sql->next();
}
Code: Alles auswählen
// get cities list for form select
$sql = rex_sql::factory();
$sql->setQuery("SELECT name FROM rex_schoolcinemamanager_locations ORDER BY name ASC");
for($i=0; $i<$sql->getRows(); $i++) {
$locations[] = $sql->getValue('name');
$sql->next();
}
$locationlist = implode(',', $locations);
$xform = new rex_xform();
$xform->setValueField('select', array('location', 'Locations'), $locationlist));
etc.
Code: Alles auswählen
$xform->setValueField('select_sql', array("location","Locations","SELECT name as id, name AS name FROM rex_schoolcinemamanager_locations ORDER BY name","","","1","bitte wählen"),"0"));
Code: Alles auswählen
<select class="select " id="xform-formular-field-2" name="location" size="1">
<option value="0" selected="selected">bitte wählen</option>
<option value="3">Chur</option>
<option value="2">Horgen</option>
<option value="1">Winterthur</option>
<option value="4">Zürich</option>
</select>