public function __construct() { parent::__construct('authorize_new_users'); if ($this->loginError) { return; } $this->loadHttpVars(true, true); $this->users = pdUserList::getNotVerified($this->db); echo '<h2>Users Requiring Authentication</h2>'; if ($this->users == null || count($this->users) == 0) { echo 'All users authorized.'; return; } $form = new HTML_QuickForm('authorizeUsers', 'post'); foreach ($this->users as $user) { $form->addGroup(array(HTML_QuickForm::createElement('advcheckbox', "submit[auth][{$user->login}]", null, null, null, array('no', 'yes')), HTML_QuickForm::createElement('select', "submit[access][{$user->login}]", null, AccessLevel::getAccessLevels()), HTML_QuickForm::createElement('static', null, null, $user->login), HTML_QuickForm::createElement('static', null, null, $user->name), HTML_QuickForm::createElement('static', null, null, $user->email)), 'all', null, '</td><td class="stats_odd">', false); } $form->addElement('submit', null, 'Submit'); $this->form =& $form; if ($form->validate()) { $this->processForm(); } else { $this->renderForm(); } }
public function __construct() { parent::__construct('aicml_stats'); if ($this->loginError) { return; } $this->loadHttpVars(true, false); if (isset($this->csv_output)) { assert('isset($_SESSION["aicml_stats"])'); $this->stats =& $_SESSION['aicml_stats']; return; } $pubs =& $this->getMachineLearningPapers(); // populate $this->aicml_pi_authors $this->getPiAuthors(); // populate $this->aicml_pdf_students_staff_authors $this->getPdfStudentsAndStaffAuthors(); $this->collectStats($pubs); $_SESSION['aicml_stats'] =& $this->stats; $form = new HTML_QuickForm('aicml_stats', 'get', 'aicml_stats.php'); $form->addElement('submit', 'csv_output', 'Export to CSV'); // create a new renderer because $form->defaultRenderer() creates // a single copy $renderer = new HTML_QuickForm_Renderer_Default(); $form->accept($renderer); echo $renderer->toHtml(); echo $this->allPiPublicationTable(); echo $this->fiscalYearTotalsTable('pi', 'PI Fiscal Year Totals'); foreach ($this->aicml_pi_authors as $pi_author) { echo $this->piPublicationsTable($pi_author); } echo $this->staffPublicationsTable(); echo $this->fiscalYearTotalsTable('staff', 'Staff Fiscal Year Totals'); echo $this->studentTotalsTable(); }
/** * Defines how a radio button widget should be built. * * @param Dataface_Record $record The Dataface_Record that is being edited. * @param array &$field The field configuration data structure that the widget is being generated for. * @param HTML_QuickForm The form to which the field is to be added. * @param string $formFieldName The name of the field in the form. * @param boolean $new Whether this widget is being built for a new record form. * @return HTML_QuickForm_element The element that can be added to a form. * */ function &buildWidget(&$record, &$field, &$form, $formFieldName, $new = false) { $widget =& $field['widget']; if (!@$widget['separator']) { $widget['separator'] = '<br />'; } if (isset($field['vocabulary']) and $field['vocabulary']) { $radios = array(); $dummyForm = new HTML_QuickForm(); $options =& Dataface_FormTool::getVocabulary($record, $field); $options__classes = Dataface_FormTool::getVocabularyClasses($record, $field); // CSS classes foreach ($options as $opt_val => $opt_text) { if ($opt_val === '') { continue; } $radios[] =& $dummyForm->createElement('radio', null, null, $opt_text, $opt_val, array('class' => 'radio-of-' . $field['name'] . ' ' . @$options__classes[$opt_val])); } $factory =& Dataface_FormTool::factory(); $el =& $factory->addGroup($radios, $field['name'], $widget['label']); } else { error_log("Your field {$formFieldName} is missing the vocabulary directive."); throw new Exception("Your field {$formFieldName} is missing the vocabulary directive."); } return $el; }
/** * factory * * Factory method * * @param mixed $name name of the form * @param mixed $url action url * * @static * @access public * @return Object HTML_QuickForm Object */ static function factory($name, $url) { $form = new HTML_QuickForm($name, 'post', $url); $star = '<span style="color: #ff0000">*</span> '; $form->setRequiredNote($star . _('denotes required field')); return $form; }
function renderHtml() { $kursus = new VIH_Model_LangtKursus($this->context->name()); if ($this->query("addrate")) { if (!$kursus->addRate($this->query("addrate"))) { throw new Exception('Kunne ikke tilføje rate.', E_USER_ERROR); } } $this->document->setTitle('Opdater rater'); $pris = array('kursus' => $kursus); if ($kursus->antalRater() == 0) { $form = new HTML_QuickForm('rater', 'POST', $this->url()); $form->addElement('text', 'antal', 'Antal rater'); $form->addElement('text', 'foerste_rate_dato', 'Første rate dato', 'dd-mm-YYYY'); $form->addElement('submit', 'opret_rater', 'Opret rater'); $form_html = $form->toHTML(); } else { $data = array('kursus' => $kursus); $tpl = $this->template->create('langekurser/rater_form'); $form_html = $tpl->render($this, $data); } $this->document->setTitle('Rater for betaling ' . $kursus->get('kursusnavn')); $this->document->addOption('Til kurset', $this->context->url()); $tpl = $this->template->create('langekurser/pris'); return '<p><strong>Periode</strong>: ' . $kursus->getDateStart()->format('%d-%m-%Y') . ' — ' . $kursus->getDateEnd()->format('%d-%m-%Y') . '</p> ' . $tpl->render($this, $pris) . $form_html; }
function getForm() { if ($this->form) { return $this->form; } $form = new HTML_QuickForm('search', 'GET', $this->url()); $form->addElement('text', 'search'); $form->addElement('submit', null, 'Søg efter bundtnummer'); return $this->form = $form; }
/** * */ public function otherFormatForm($result_pubs) { if ($result_pubs == null) { return; } $form = new HTML_QuickForm('otherFormatForm'); $form->addElement('hidden', 'pub_ids', implode(",", $result_pubs)); $form->addGroup(array(HTML_QuickForm::createElement('submit', 'cv_format', 'Show results in CV format'), HTML_QuickForm::createElement('submit', 'bibtex_format', 'Show results in BibTex format')), null, null, ' '); return $form; }
function getForm() { if ($this->form) { return $this->form; } $form = new HTML_QuickForm('korte', 'GET', $this->url()); $form->addElement('select', 'filter', 'Filter', array('alle' => 'alle', 'golf' => 'golf', 'old' => 'gamle')); $form->addElement('submit', 'submit', 'Afsted'); return $this->form = $form; }
function getForm() { if ($this->form) { return $this->form; } $form = new HTML_QuickForm('holdliste', 'GET', $this->url()); $form->addElement('date', 'date', 'date'); $form->addElement('submit', null, 'Hent'); return $this->form = $form; }
function getForm() { if ($this->form) { return $this->form; } $form = new HTML_QuickForm('faciliteter', 'POST', $this->url()); $form->addElement('file', 'userfile', 'Fil'); $form->addElement('submit', null, 'Upload'); return $this->form = $form; }
function execute(ActionMapping $map, ActionForm $form, Request $req) { global $papyrine; $papyrine->entries =& $papyrine->getEntries(); // Instantiate the HTML_QuickForm object require_once 'HTML/QuickForm.php'; require_once 'HTML/QuickForm/group.php'; $form = new HTML_QuickForm('create_entry'); $form->addElement('text', 'title', 'Title:'); $form->addElement('text', 'date', 'Date:'); $form->addElement('text', 'status', 'Status:'); // Get the default handler $form->addElement('text', 'body', 'Body:'); $form->addElement('submit', null, 'Create'); // Define filters and validation rules $form->applyFilter('name', 'trim'); $form->addRule('name', 'Please enter your name', 'required', null, 'client'); //get classes registered for entry //call method $plugin = new PapyrinePlugin(BASE . 'plugins/categories/'); $object = $plugin->getInstance(); $object->recieveNewEntryForm($form); $plugin = new PapyrinePlugin(BASE . 'plugins/comments/'); $object = $plugin->getInstance(); $object->recieveNewEntryForm($form); // Output the form $papyrine->form = $form->toHTML(); header("Content-Type: application/xhtml+xml;charset=UTF-8"); $papyrine->display('admin/header.html'); $papyrine->display($map->getParameter()); $papyrine->display('admin/footer.html'); }
/** * Renvoit l'instance d'un formulaire * * Un formulaire est instancié, configuré puis renvoyé * * @param string $url URL pour l'attribut "action" du formulaire * @param string $nom Nom du formulaire * @return object */ function &instancierFormulaire($url = null, $nom = 'formulaire') { if (is_null($url)) { $url = $_SERVER['REQUEST_URI']; } require_once dirname(__FILE__) . '/../../dependencies/PEAR/HTML/QuickForm.php'; require_once dirname(__FILE__) . '/../../dependencies/PEAR/HTML/QuickForm/altselect.php'; $formulaire = new HTML_QuickForm($nom, 'post', $url); $formulaire->removeAttribute('name'); return $formulaire; }
function getForm() { if ($this->form) { return $this->form; } $date_options = array('minYear' => date('Y') - 10, 'maxYear' => date('Y') + 5); $form = new HTML_QuickForm('holdliste', 'GET', $this->url() . '.txt'); $form->addElement('date', 'date', 'date', $date_options); $form->addElement('submit', null, 'Hent'); return $this->form = $form; }
function display($self_link) { $form = new HTML_QuickForm('adminConfigInfoForm', 'get', $self_link); $consts = get_defined_constants(); $form->addElement('header', '', 'Configuration Settings (from conf/general)'); foreach ($consts as $const => $value) { if (preg_match("/^OPTION_/", $const)) { $form->addElement('static', "static{$const}", null, "{$const} = {$value}"); } } admin_render_form($form); }
function getForm() { if ($this->form) { return $this->form; } $form = new HTML_QuickForm('confirm', 'POST', $this->url()); $form->addElement('header', null, 'Accepterer du betingelserne?'); $form->addElement('checkbox', 'confirm', null, 'Ja, jeg accepterer betingelserne', 'id="confirm"'); $form->addElement('submit', null, 'Send'); $form->addRule('confirm', 'Du skal acceptere betingelserne', 'required'); return $this->form = $form; }
function getForm() { if ($this->form) { return $this->form; } $form = new HTML_QuickForm('fotogalleri', 'POST', $this->url()); $form->addElement('hidden', 'id'); $form->addElement('text', 'description', 'Beskrivelse'); $form->addElement('checkbox', 'active', '', 'Aktiv'); $form->addElement('submit', null, 'Gem og tilføj billeder'); return $this->form = $form; }
function handle(&$params) { $app =& Dataface_Application::getInstance(); $query =& $app->getQuery(); $this->table =& Dataface_Table::loadTable($query['-table']); $translations =& $this->table->getTranslations(); foreach (array_keys($translations) as $trans) { $this->table->getTranslation($trans); } //print_r($translations); if (!isset($translations) || count($translations) < 2) { // there are no translations to be made trigger_error('Attempt to translate a record in a table "' . $this->table->tablename . '" that contains no translations.', E_USER_ERROR); } $this->translatableLanguages = array_keys($translations); $translatableLanguages =& $this->translatableLanguages; $this->languageCodes = new I18Nv2_Language($app->_conf['lang']); $languageCodes =& $this->languageCodes; $currentLanguage = $languageCodes->getName($app->_conf['lang']); if (count($translatableLanguages) < 2) { return PEAR::raiseError(df_translate('Not enough languages to translate', 'There aren\'t enough languages available to translate.'), DATAFACE_E_ERROR); } //$defaultSource = $translatableLanguages[0]; //$defaultDest = $translatableLanguages[1]; $options = array(); foreach ($translatableLanguages as $lang) { $options[$lang] = $languageCodes->getName($lang); } unset($options[$app->_conf['default_language']]); $tt = new Dataface_TranslationTool(); $form = new HTML_QuickForm('StatusForm', 'POST'); $form->addElement('select', '--language', 'Translation', $options); $form->addElement('select', '--status', 'Status', $tt->translation_status_codes); //$form->setDefaults( array('-sourceLanguage'=>$defaultSource, '-destinationLanguage'=>$defaultDest)); $form->addElement('submit', '--set_status', 'Set Status'); foreach ($query as $key => $value) { $form->addElement('hidden', $key); $form->setDefaults(array($key => $value)); } if ($form->validate()) { $res = $form->process(array(&$this, 'processForm')); if (PEAR::isError($res)) { return $res; } else { header('Location: ' . $app->url('-action=list&-sourceLanguage=&-destinationLanguage=&-translate=') . '&--msg=' . urlencode('Translation status successfully set.')); exit; } } ob_start(); $form->display(); $out = ob_get_contents(); ob_end_clean(); $records =& $this->getRecords(); df_display(array('form' => $out, 'translationTool' => &$tt, 'records' => &$records, 'translations' => &$options, 'context' => &$this), 'Dataface_set_translation_status.html'); }
function build() { if ($this->_isBuilt) { return; } $this->isBuilt = true; $options = $this->relationship->getAddableValues($this->record); $boxes = array(); foreach ($options as $opt_val => $opt_text) { if (!$opt_val) { continue; } $boxes[] =& HTML_QuickForm::createElement('advcheckbox', $opt_val, null, $opt_text, array('class' => 'relationship-checkbox-of-' . $opt_val . ' ' . @$options__classes[$opt_val])); } $el =& $this->addGroup($boxes, '--related-checkboxes', df_translate('scripts.Dataface_RelationshipCheckboxForm.LABEL_' . $this->relationship->_name . '_CHECKBOXES', 'Related ' . $this->relationship->_name . ' Records')); $defaults = $this->getCheckedRecordsDefaults(); $this->setDefaults(array('--related-checkboxes' => $defaults)); // Now let's add hidden fields for the keys of the current record // to the form. $factory = new HTML_QuickForm('factory'); // a dummy quickform object to be used tgo create elements. $keyEls = array(); // $keyDefaults = array(); foreach (array_keys($this->record->_table->keys()) as $key) { $keyEls[] = $factory->addElement('hidden', $key); $keyDefaults[$key] = $this->record->strval($key); } $this->addGroup($keyEls, '--__keys__'); $this->setConstants(array('--__keys__' => $keyDefaults)); // Now let's add a trail that will allow us to get back to here $app =& Dataface_Application::getInstance(); $q =& $app->getQuery(); $this->addElement('hidden', '--query'); if (isset($_POST['--query'])) { $this->setDefaults(array('--query' => $_POST['--query'])); } else { $this->setDefaults(array('--query' => $app->url(''))); } $this->addElement('hidden', '-table'); $this->addElement('hidden', '-action'); $this->addElement('hidden', '-relationship'); $this->setDefaults(array('-table' => $q['-table'], '-action' => $q['-action'], '-relationship' => $q['-relationship'])); $this->addElement('submit', 'save', df_translate('scripts.Dataface_RelationshipCheckboxForm.LABEL_SUBMIT', 'Save')); $perms = $this->record->getPermissions(array('relationship' => $q['-relationship'])); if (!@$perms['add existing related record'] and !@$perms['remove related record']) { $this->freeze(); } }
/** * Function to actually build the form * * @return void * @access public */ public function buildQuickForm() { require_once 'CRM/Utils/Money.php'; $this->_first = true; $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage'); // name $this->add('text', 'title', ts('Title'), $attributes['title'], true); $this->add('select', 'contribution_type_id', ts('Contribution Type'), CRM_Contribute_PseudoConstant::contributionType(), true); $this->addWysiwyg('intro_text', ts('Introductory Message'), $attributes['intro_text']); $this->addWysiwyg('footer_text', ts('Footer Message'), $attributes['footer_text']); // is on behalf of an organization ? $this->addElement('checkbox', 'is_organization', ts('Allow individuals to contribute and / or signup for membership on behalf of an organization?'), null, array('onclick' => "showHideByValue('is_organization',true,'for_org_text','table-row','radio',false);showHideByValue('is_organization',true,'for_org_option','table-row','radio',false);")); $options = array(); $options[] = HTML_QuickForm::createElement('radio', null, null, ts('Optional'), 1); $options[] = HTML_QuickForm::createElement('radio', null, null, ts('Required'), 2); $this->addGroup($options, 'is_for_organization', ts('')); $this->add('textarea', 'for_organization', ts('On behalf of Label'), $attributes['for_organization']); // collect goal amount $this->add('text', 'goal_amount', ts('Goal Amount'), array('size' => 8, 'maxlength' => 12)); $this->addRule('goal_amount', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money'); // is this page active ? $this->addElement('checkbox', 'is_active', ts('Is this Online Contribution Page Active?')); // should the honor be enabled $this->addElement('checkbox', 'honor_block_is_active', ts('Honoree Section Enabled'), null, array('onclick' => "showHonor()")); $this->add('text', 'honor_block_title', ts('Honoree Section Title'), $attributes['honor_block_title']); $this->add('textarea', 'honor_block_text', ts('Honoree Introductory Message'), $attributes['honor_block_text']); // add optional start and end dates $this->addDateTime('start_date', ts('Start Date')); $this->addDateTime('end_date', ts('End Date')); $this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Settings', 'formRule')); parent::buildQuickForm(); }
/** * Function to actually build the form * * @return None * @access public */ function buildQuickForm() { //Setting Upload File Size $config =& new CRM_Core_Config(); if ($config->maxImportFileSize >= 8388608) { $uploadFileSize = 8388608; } else { $uploadFileSize = $config->maxImportFileSize; } $uploadSize = round($uploadFileSize / (1024 * 1024), 2); $this->assign('uploadSize', $uploadSize); $this->add('file', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=60', true); $this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile'); $this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize); $this->setMaxFileSize($uploadFileSize); $this->addRule('uploadFile', ts('Input file must be in CSV format'), 'asciiFile'); $this->addElement('checkbox', 'skipColumnHeader', ts('First row contains column headers')); $duplicateOptions = array(); $duplicateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('Skip'), CRM_CONTRIBUTE_IMPORT_PARSER_DUPLICATE_SKIP); $duplicateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('Update'), CRM_CONTRIBUTE_IMPORT_PARSER_DUPLICATE_UPDATE); $duplicateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('Fill'), CRM_CONTRIBUTE_IMPORT_PARSER_DUPLICATE_FILL); // for contributions NOCHECK == SKIP // $duplicateOptions[] = HTML_QuickForm::createElement('radio', // null, null, ts('No Duplicate Checking'), CRM_Contribute_Import_Parser::DUPLICATE_NOCHECK); $this->addGroup($duplicateOptions, 'onDuplicate', ts('On duplicate entries')); $this->setDefaults(array('onDuplicate' => CRM_CONTRIBUTE_IMPORT_PARSER_DUPLICATE_SKIP)); //build date formats require_once 'CRM/Core/Form/Date.php'; CRM_Core_Form_Date::buildAllowedDateFormats($this); $this->addButtons(array(array('type' => 'upload', 'name' => ts('Continue >>'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel')))); }
/** * Adds a (multi)select widget to the form, depending on the base type config. */ function add_elements_to_form($attributes) { // Let us try to be a bit smarter here, avoiding an all-out load for read-only // fields. // TODO: This doesn't support Access control yet. if ($this->_field['readonly']) { $this->_all_elements = array(); foreach ($this->_type->selection as $key) { $this->_all_elements[$key] = $this->_type->get_name_for_key($key); } } else { $this->_all_elements = $this->_type->list_all(); } $select_attributes = array_merge($attributes, array('class' => $this->_type->allow_multiple ? 'list' : 'dropdown', 'id' => "{$this->_namespace}{$this->name}")); $select_attributes['class'] .= ' selectcomponent'; $select_element = HTML_QuickForm::createElement('select', $this->name, $this->_translate($this->_field['title']), array(), $select_attributes); // Translate and add foreach ($this->_all_elements as $key => $value) { $option_attributes = array(); $icon = midcom::get('componentloader')->get_component_icon($key, false); if ($icon) { $option_attributes['style'] = 'background-image: url("' . MIDCOM_STATIC_URL . '/' . midcom::get('componentloader')->get_component_icon($key) . '")'; } $select_element->addOption($this->_translate($value), $key, $option_attributes); } $select_element->setMultiple($this->_type->allow_multiple); if ($this->_type->allow_multiple) { $select_element->setSize($this->height); } $this->_select_element = $this->_form->addElement($select_element); }
function formPoolData($name) { $lang = services::getService('lang'); $params = services::getService('pageParams'); $cats = services::getService('cats'); $this->form($name); // Add some elements to the form $this->addElement('text', 'poolname', $lang->getMsg('pooldata_form_name'), array('size' => 30, 'maxlength' => 50)); $this->addElement('textarea', 'pooldesc', $lang->getMsg('pooldata_form_description'), array('rows' => 8, 'cols' => 50)); $this->addElement('text', 'poolarea', $lang->getMsg('pooldata_form_area'), array('size' => 30, 'maxlength' => 50)); /*$is_located = array(); $is_located[] = HTML_QuickForm::createElement('radio', null, null, $lang->getMsg('pooldata_form_is_located_no'), 0); $is_located[] = HTML_QuickForm::createElement('radio', null, null, $lang->getMsg('pooldata_form_is_located_yes'), 1); $this->addGroup($is_located, 'is_located', $lang->getMsg('pooldata_form_is_located'), '<br>');*/ $countries = services::getService('countries'); $this->addElement('select', 'poolcountry', $lang->getMsg('pooldata_form_country'), $countries->getAsArray()); $adress[] =& HTML_QuickForm::createElement('text', 'plz1', null, array('size' => 2, 'maxlength' => 2)); $adress[] =& HTML_QuickForm::createElement('text', 'plz2', null, array('size' => 3, 'maxlength' => 3)); $adress[] =& HTML_QuickForm::createElement('text', 'city', null, array('size' => 20, 'maxlength' => 30)); $this->addGroup($adress, 'pooladress', $lang->getMsg('userdata_adress2'), ' '); $this->addElement('select', 'is_public', $lang->getMsg('pooldata_form_is_public'), array("0" => $lang->getMsg('pooldata_form_is_located_no'), "1" => $lang->getMsg('pooldata_form_is_located_yes'))); if ($params->getParam('pool_id')) { $this->addElement('hidden', 'pool_id', $params->getParam('pool_id')); } $this->addElement('submit', 'submit', $lang->getMsg('pooldata_form_submit')); // Define filters and validation rules $this->registerRule('securehtml', 'callback', 'secureHtml'); $this->addRule('poolname', $lang->getMsg('pooldata_form_namenecessary'), 'required'); $this->addRule('pooldesc', $lang->getMsg('pooldata_form_descnecessary'), 'required'); $this->addRule('pooldesc', $lang->getMsg('pooldata_form_securehtml'), 'securehtml'); $this->addRule('poolarea', $lang->getMsg('pooldata_form_areanecessary'), 'required'); $adressrules['plz1'][] = array($lang->getMsg('userdata_plz_numeric'), 'numeric'); $adressrules['plz2'][] = array($lang->getMsg('userdata_plz_numeric'), 'numeric'); $this->addGroupRule('pooladress', $adressrules); }
function preGenerateForm(&$fb, &$obj) { $info = $obj->_getPluginsDef(); $info = $info['images']; HTML_QuickForm::registerElementType('imagefile', 'HTML/QuickForm/imagefile.php', 'HTML_QuickForm_imagefile'); foreach ($info as $k => $v) { $v = key_exists(0, $v) ? $v[0] : $v; switch (true) { case $v['x'] && $v['y']: $newSize = $v['x'] . ' X ' . $v['y'] . ' pixels'; break; case $v['x'] && !$v['y']: $newSize = $v['x'] . ' ' . __('pixels wide (proportions kept)'); break; case !$v['x'] && $v['y']: $newSize = $v['y'] . ' ' . __('pixels high (proportions kept)'); break; default: $newSize = ''; break; } $obj->fb_fieldLabels[$k] = array($obj->fb_fieldLabels[$k], 'note' => $newSize ? '. ' . __('Image will be resized to %s', array($newSize)) : ''); if (!empty($obj->{$k})) { //TODO move this to postGenerateForm (like in upload plugin) $obj->fb_fieldLabels[$k]['unit'] = '<input type="checkbox" name="__image_delete_' . $k . '" value="1" />' . __('Delete current'); } $obj->fb_preDefElements[$k] =& MyQuickForm::createElement('imagefile', $obj->fb_elementNamePrefix . $k . $obj->fb_elementNamePostfix, $obj->fb_fieldLabels[$k], array('showimage' => $v['showimage']), SITE_URL . WWW_IMAGES_FOLDER . $info[$k][0]['path'] . '/'); } }
public static function text_elem($name, $args, &$def_js) { $obj = HTML_QuickForm::createElement('ckeditor', $name, __('Text to display')); $obj->setFCKProps('400', '300', false); // $def_js .= '$(\''.$this->getAttribute('name').'\').'.$v['name'].'.value = \''.$v['default'].'\';'; return $obj; }
/** * Adds tag checkboxes to form passed as first parameter * 2nd parameter is the actual name of the fields used to add tags * @param HTML_QuickForm * @param string default _tags */ public function addTagsToForm(HTML_QuickForm $form, $fieldname, DB_DataObject $obj) { $tags = DB_DataObject::factory('tag'); $tags->archived = 0; // @todo add this field to tags table $tag_record = DB_DataObject::factory('tag_record'); $tags->joinAdd($tag_record); $tags->whereAdd("tag_record.tagged_table = '" . $obj->__table . "'"); $tags->selectAdd(); $tags->selectAdd('tag.*'); $tags->groupBy('tag.strip'); if ($tags->find()) { while ($tags->fetch()) { $taglist[$tags->id] = $tags->strip; } foreach ($taglist as $id => $strip) { $arr[] = MyQuickForm::createElement('checkbox', $fieldname . '[' . $id . ']', '', $strip); $arr2[] = MyQuickForm::createElement('checkbox', 'exc_' . $fieldname . '[' . $id . ']', '', $strip); } $grp = MyQuickForm::createElement('group', $fieldname, __('Including Tags'), $arr, null, false); $grp2 = MyQuickForm::createElement('group', 'exc_' . $fieldname, __('Excluding Tags'), $arr2, null, false); if ($form->elementExists('__submit__')) { $form->insertElementBefore($grp, '__submit__'); $form->insertElementBefore($grp2, '__submit__'); } else { $form->addElement($grp); $form->addElement($grp2); } } }
function formRegister2($name, $login, $pass, $email) { $lang = services::getService('lang'); $this->form($name); // Add some elements to the form $this->addElement('hidden', 'name', $login); $this->addElement('hidden', 'password', $pass); $this->addElement('hidden', 'email', $email); $adress1 = array(); $adress1[] =& HTML_QuickForm::createElement('text', 'street', null, array('size' => 20, 'maxlength' => 50)); $adress1[] =& HTML_QuickForm::createElement('text', 'house', null, array('size' => 3, 'maxlength' => 10)); $this->addGroup($adress1, 'adress1', $lang->getMsg('userdata_adress1'), ' '); $adress2 = array(); $adress2[] =& HTML_QuickForm::createElement('text', 'plz', null, array('size' => 5, 'maxlength' => 5)); $adress2[] =& HTML_QuickForm::createElement('text', 'city', null, array('size' => 20, 'maxlength' => 30)); $this->addGroup($adress2, 'adress2', $lang->getMsg('userdata_adress2'), ' '); $this->addElement('select', 'country', $lang->getMsg('userdata_country'), array("DE" => $lang->getMsg('country_DE'), "AT" => $lang->getMsg('country_AT'), "CH" => $lang->getMsg('country_CH'), "GR" => $lang->getMsg('country_GR'), "US" => $lang->getMsg('country_US'), "GB" => $lang->getMsg('country_GB'))); $this->addElement('checkbox', 'adresspublic', $lang->getMsg('userdata_adresspublic')); $this->addElement('checkbox', 'emailpublic', $lang->getMsg('userdata_emailpublic')); $this->addElement('text', 'phone', $lang->getMsg('userdata_phone'), array('size' => 20, 'maxlength' => 20)); $this->addElement('checkbox', 'phonepublic', $lang->getMsg('userdata_phonepublic')); $this->addElement('textarea', 'description', $lang->getMsg('userdata_description'), array('rows' => 5, 'cols' => 50)); // Define filters and validation rules $this->addElement('submit', 'submit2', $lang->getMsg('register_submit2')); // Define filters and validation rules $adress1rules['street'][] = array($lang->getMsg('userdata_street_necessary'), 'required'); $adress1rules['house'][] = array($lang->getMsg('userdata_house_necessary'), 'required'); $adress2rules['plz'][] = array($lang->getMsg('userdata_plz_necessary'), 'required'); $adress2rules['plz'][] = array($lang->getMsg('userdata_plz_numeric'), 'numeric'); $adress2rules['city'][] = array($lang->getMsg('userdata_city_necessary'), 'required'); $this->addGroupRule('adress1', $adress1rules); $this->addGroupRule('adress2', $adress2rules); }
function buildForm() { $this->_formBuilt = true; $this->addElement('header', 'data_header', 'Your personal data'); $name[] =& HTML_QuickForm::createElement('text', 'first', 'Firstname', array('size' => 16, 'maxlength' => 63)); $name[] =& HTML_QuickForm::createElement('text', 'last', 'Lastname', array('size' => 16, 'maxlength' => 63)); $this->addGroup($name, 'name', 'Your name :', null, false); $this->addElement('text', 'company', 'Your company :', array('size' => 30, 'maxlength' => 63)); $this->addElement('text', 'address1', 'Your address :', array('size' => 30, 'maxlength' => 63)); $this->addElement('text', 'address2', ' ', array('size' => 30, 'maxlength' => 63)); $this->addElement('text', 'zip', 'Zip code :', array('size' => 16, 'maxlength' => 16)); $this->addElement('text', 'city', 'City :', array('size' => 30, 'maxlength' => 63)); $countries = array('FR' => 'France', 'GE' => 'Germany', 'RU' => 'Russia', 'UK' => 'United Kingdom'); $this->addElement('select', 'country', 'Your country :', $countries); $this->addElement('text', 'phone', 'Phone number :', array('size' => 16, 'maxlength' => 16)); $this->addElement('text', 'fax', 'Fax number :', array('size' => 16, 'maxlength' => 16)); $prevnext[] =& $this->createElement('submit', $this->getButtonName('back'), '<< Previous step'); $prevnext[] =& $this->createElement('submit', $this->getButtonName('next'), 'Finish'); $this->addGroup($prevnext, 'buttons', '', ' ', false); $this->addGroupRule('name', 'First and last names are required', 'required'); $this->addRule('company', 'Company is required', 'required'); $this->addRule('address1', 'Address is required', 'required'); $this->addRule('city', 'City is required', 'required'); $this->setDefaultAction('next'); }
/** * This function provides the HTML form elements that are specific to the Individual Contact Type * * @access public * @return None */ function buildQuickForm(&$form) { $form->applyFilter('__ALL__', 'trim'); // prefix $form->addElement('select', 'prefix_id', ts('Prefix'), array('' => ts('- prefix -')) + CRM_Core_PseudoConstant::individualPrefix()); $attributes = CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Individual'); // first_name $form->addElement('text', 'first_name', ts('First Name'), $attributes['first_name']); //middle_name $form->addElement('text', 'middle_name', ts('Middle Name'), $attributes['middle_name']); // last_name $form->addElement('text', 'last_name', ts('Last Name'), $attributes['last_name']); // suffix $form->addElement('select', 'suffix_id', ts('Suffix'), array('' => ts('- suffix -')) + CRM_Core_PseudoConstant::individualSuffix()); // nick_name $form->addElement('text', 'nick_name', ts('Nick Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'nick_name')); // greeting type $form->addElement('select', 'greeting_type', ts('Greeting'), CRM_Core_SelectValues::greeting()); // job title $form->addElement('text', 'job_title', ts('Job title'), $attributes['job_title']); // radio button for gender $genderOptions = array(); $gender = CRM_Core_PseudoConstant::gender(); foreach ($gender as $key => $var) { $genderOptions[$key] = HTML_QuickForm::createElement('radio', null, ts('Gender'), $var, $key); } $form->addGroup($genderOptions, 'gender_id', ts('Gender')); $form->addElement('checkbox', 'is_deceased', null, ts('Contact is deceased')); $form->addElement('date', 'birth_date', ts('Date of birth'), CRM_Core_SelectValues::date('birth')); $form->addRule('birth_date', ts('Select a valid date.'), 'qfDate'); $form->addElement('text', 'home_URL', ts('Website'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'home_URL')); $form->addRule('home_URL', ts('Enter a valid Website.'), 'url'); $config =& CRM_Core_Config::singleton(); CRM_Core_ShowHideBlocks::links($this, 'demographics', '', ''); }
/** * Adds checkboxes / radioboxes to the form. */ function add_elements_to_form($attributes) { $elements = array(); $all_elements = $this->_type->list_all(); foreach ($all_elements as $key => $value) { if ($this->_type->allow_multiple) { $elements[] = HTML_QuickForm::createElement('checkbox', $key, $key, $this->_translate($value), array('class' => 'checkbox')); } else { $elements[] = HTML_QuickForm::createElement('radio', null, $key, $this->_translate($value), $key, array('class' => 'radiobutton')); } } if ($this->render_mode == 'auto') { if (sizeof($elements) > $this->list_threshold) { $this->render_mode = 'vertical'; } else { $this->render_mode = 'horizontal'; } } $separator = '<span class="separator separator-' . $this->render_mode . '"></span>'; $group = $this->_form->addGroup($elements, $this->name, $this->_translate($this->_field['title']), $separator); if ($this->_type->allow_multiple) { $attributes['class'] = 'checkbox checkbox-' . $this->render_mode; $group->setAttributes($attributes); } else { $attributes['class'] = 'radiobox radiobox-' . $this->render_mode; $group->setAttributes($attributes); } }
function getForm() { if ($this->form) { return $this->form; } $form = new HTML_QuickForm('venteliste', 'POST', $this->url()); $form->addElement('hidden', 'id'); $form->addElement('hidden', 'kursus_id'); $form->addElement('text', 'navn', 'Navn'); $form->addElement('text', 'antal', 'Antal'); $form->addElement('text', 'telefonnummer', 'Telefon'); $form->addElement('text', 'arbejdstelefon', 'Arbejdstelefon'); $form->addElement('text', 'email', 'E-mail'); $form->addElement('textarea', 'besked', 'Besked'); $form->addElement('submit', NULL, 'Gem'); return $this->form = $form; }