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'), '&nbsp;');
     $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);
 }
Beispiel #2
0
 function getForm()
 {
     if ($this->form) {
         return $this->form;
     }
     $options = array('format' => 'd m Y H i', 'optionIncrement' => array('i' => 15), 'minYear' => date('Y') - 2, 'maxYear' => date('Y') + 2);
     $form = new HTML_QuickForm('protokol', 'POST', $this->url());
     $form->addElement('hidden', 'elev_id');
     $form->addElement('hidden', 'id');
     $form->addElement('date', 'date_start', 'Startdato:', $options);
     $form->addElement('date', 'date_end', 'Slutdato:', $options);
     $radio[0] =& HTML_QuickForm::createElement('radio', null, null, 'fri', '1');
     $radio[1] =& HTML_QuickForm::createElement('radio', null, null, 'syg', '2');
     $radio[2] =& HTML_QuickForm::createElement('radio', null, null, 'fraværende', '3');
     $radio[5] =& HTML_QuickForm::createElement('radio', null, null, 'henstilling', '6');
     $radio[3] =& HTML_QuickForm::createElement('radio', null, null, 'mundtlig advarsel', '4');
     $radio[4] =& HTML_QuickForm::createElement('radio', null, null, 'skriftlig advarsel', '5');
     $radio[6] =& HTML_QuickForm::createElement('radio', null, null, 'hjemsendt', '7');
     $radio[7] =& HTML_QuickForm::createElement('radio', null, null, 'andet', '8');
     $form->addGroup($radio, 'type', 'Type:', ' ');
     $form->addElement('textarea', 'text', '');
     $form->addElement('submit', null, 'Send');
     $form->addRule('date_start', 'Husk dato', 'required', null, 'client');
     $form->addRule('date_end', 'Husk dato', 'required', null, 'client');
     $form->addRule('type', 'Husk type', 'required', null, 'client');
     $form->addRule('text', 'Tekst', 'required', null, 'client');
     return $this->form = $form;
 }
Beispiel #3
0
 /**
  * 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);
     }
 }
Beispiel #4
0
 /**
  * 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();
 }
Beispiel #5
0
 public function __construct()
 {
     parent::__construct('delete_interest', 'Delete Interest', 'Admin/delete_interest.php');
     if ($this->loginError) {
         return;
     }
     $form = new HTML_QuickForm('deleter');
     $interest_list = new pdAuthInterests($this->db);
     $form->addElement('select', 'interests', 'Select interest(s) to delete:', $interest_list->list, array('multiple' => 'multiple', 'size' => 15));
     $form->addGroup(array(HTML_QuickForm::createElement('button', 'cancel', 'Cancel', array('onclick' => 'history.back()')), HTML_QuickForm::createElement('submit', 'submit', 'Delete')), null, null, '&nbsp;', false);
     if ($form->validate()) {
         $values = $form->exportValues();
         foreach ($values['interests'] as $interest_id) {
             $names[] = $interest_list->list[$interest_id];
         }
         $interest_list->dbDelete($this->db, $values['interests']);
         echo 'You have successfully removed the following interest from the ', 'database: <br/><b>', implode(', ', $names), '</b></p>', '<br><a href="', $_SERVER['PHP_SELF'], '">Delete another interest</a>';
     } else {
         $renderer =& $form->defaultRenderer();
         $form->accept($renderer);
         $this->form =& $form;
         $this->renderer =& $renderer;
         echo '<h3>Delete Interest </h3>';
     }
 }
 /**
  * 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', '', '');
 }
Beispiel #7
0
 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', '&nbsp;', 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', '', '&nbsp;', 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');
 }
Beispiel #8
0
 function getForm()
 {
     if ($this->form) {
         return $this->form;
     }
     $faggruppe = VIH_Model_Fag_Gruppe::getList();
     foreach ($faggruppe as $grp) {
         $faggruppelist[$grp->get('id')] = $grp->get('navn');
     }
     $undervisere = VIH_Model_Ansat::getList('lærere');
     $form = new HTML_QuickForm('f*g', 'POST', $this->url());
     $form->addElement('hidden', 'id');
     $form->addElement('text', 'navn', 'Navn');
     $form->addElement('select', 'faggruppe_id', 'Faggruppe', $faggruppelist);
     $form->addElement('text', 'identifier', 'Identifier');
     $form->addElement('textarea', 'kort_beskrivelse', 'Kort beskrivelse', array('cols' => 80, 'rows' => 5));
     $form->addElement('textarea', 'beskrivelse', 'Beskrivelse', array('cols' => 80, 'rows' => 20));
     $form->addElement('textarea', 'udvidet_beskrivelse', 'Udvidet beskrivelse', array('cols' => 80, 'rows' => 20));
     $form->addElement('header', null, 'Til søgemaskinerne');
     $form->addElement('text', 'title', 'Titel');
     $form->addElement('textarea', 'description', 'Beskrivelse');
     $form->addElement('textarea', 'keywords', 'Nøgleord');
     $underviserlist = array();
     foreach ($undervisere as $underviser) {
         $underviserlist[] = HTML_QuickForm::createElement('checkbox', $underviser->get('id'), null, $underviser->get('navn'));
     }
     $form->addGroup($underviserlist, 'underviser', 'Underviser', '<br />');
     $form->addElement('checkbox', 'published', 'Udgivet');
     $form->addElement('submit', null, 'Gem');
     return $this->form = $form;
 }
 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'), '&nbsp;');
     $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'), '&nbsp;');
     $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);
 }
Beispiel #10
0
 /**
  * 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;
 }
 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();
     }
 }
 /**
  * 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' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }
Beispiel #13
0
 /**
  * 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);
 }
Beispiel #14
0
 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;
 }
Beispiel #15
0
 /**
  *
  */
 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, '&nbsp;');
     return $form;
 }
Beispiel #16
0
 /**
  * This function is to build the date-format form
  *
  * @param Object  $form   the form object that we are operating on
  * 
  * @static
  * @access public
  */
 function buildAllowedDateFormats(&$form)
 {
     $dateOptions = array();
     $dateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('yyyy-mm-dd OR yyyymmdd (1998-12-25 OR 19981225)'), CRM_CORE_FORM_DATE_DATE_yyyy_mm_dd);
     $dateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('mm/dd/yy OR mm-dd-yy (12/25/98 OR 12-25-98)'), CRM_CORE_FORM_DATE_DATE_mm_dd_yy);
     $dateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('mm/dd/yyyy OR mm-dd-yyyy (12/25/1998 OR 12-25-1998)'), CRM_CORE_FORM_DATE_DATE_mm_dd_yyyy);
     $dateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('Month dd, yyyy (December 12, 1998)'), CRM_CORE_FORM_DATE_DATE_Month_dd_yyyy);
     $dateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('dd-mon-yy (25-Dec-98)'), CRM_CORE_FORM_DATE_DATE_dd_mon_yy);
     $form->addGroup($dateOptions, 'dateFormats', ts('Date Format'), '<br/>');
     $form->setDefaults(array('dateFormats' => CRM_CORE_FORM_DATE_DATE_yyyy_mm_dd));
 }
 /**
  * function_description
  *
  * @author	John.meng
  * @since    version - Jan 16, 2006
  * @param	datatype paramname description
  * @return   datatype description
  */
 function opUpdate()
 {
     global $__Lang__, $UrlParameter, $SiteDB, $AddIPObj, $__SITE_VAR__, $form, $FlushPHPObj, $thisDAO, $smarty;
     parent::opAdd();
     $form->addElement('header', null, $__Lang__['langGeneralUpdate'] . " " . $__Lang__['langBaseInfo']);
     $form->addElement('text', 'SiteName', $__Lang__['langSite'] . $__Lang__['langGeneralName'] . ' : ', array('size' => 40));
     $form->addElement('text', 'SiteKeyword', $__Lang__['langSite'] . $__Lang__['langKeyword'] . ' : ', array('size' => 40));
     $form->addElement('textarea', 'SiteCopyright', $__Lang__['langSite'] . $__Lang__['langSiteCopyRight'] . ' : ', array('rows' => 8, 'cols' => 40));
     $site_logo_group[] =& HTML_QuickForm::createElement('file', 'Pic', $__Lang__['langSite'] . $__Lang__['langSiteLogo'] . ' : ');
     if ($site_logo = $this->_DAO->getSiteVarValue($__SITE_VAR__['SITE_LOGO'])) {
         $swf_image_obj = $FlushPHPObj->loadUtility("ViewImgSwf");
         $site_logo_group[] =& HTML_QuickForm::createElement('static', '_SiteLogo', NULL, $swf_image_obj->displayIt($site_logo, NULL, NULL, NULL, HTML_IMAGES_DIR));
         $site_logo_group[] =& HTML_QuickForm::createElement('checkbox', 'del_site_logo', NULL, $__Lang__['langGeneralCancel'] . $__Lang__['langSiteLogo']);
         $site_logo_group[] =& HTML_QuickForm::createElement('hidden', 'old_site_logo', $site_logo);
     }
     $form->addGroup($site_logo_group, NULL, $__Lang__['langSite'] . $__Lang__['langSiteLogo'] . ' : ', "    ");
     $form->addElement('submit', null, $__Lang__['langGeneralSubmit']);
     $form->setDefaults(array('SiteName' => $this->_DAO->getSiteVarValue($__SITE_VAR__['SITE_NAME']), 'SiteKeyword' => $this->_DAO->getSiteVarValue($__SITE_VAR__['SITE_KEYWORD']), 'SiteCopyright' => $this->_DAO->getSiteVarValue($__SITE_VAR__['SITE_COPYRIGHT'])));
     $form->addElement('hidden', 'Module', $_REQUEST['Module']);
     $form->addElement('hidden', 'Page', $_REQUEST['Page']);
     $form->addElement('hidden', 'Action', $_REQUEST['Action']);
     $form->addElement('hidden', 'Step', 'Step3');
     $form->addRule('SiteName', $__Lang__['langGeneralPleaseEnter'] . " " . $__Lang__['langSite'] . $__Lang__['langGeneralName'], 'required');
     $form->addRule('SiteKeyword', $__Lang__['langGeneralPleaseEnter'] . " " . $__Lang__['langSite'] . $__Lang__['langKeyword'], 'required');
     if ($form->validate()) {
         $record["VarName"] = $__SITE_VAR__['SITE_NAME'];
         $record["VarValue"] = $form->exportValue('SiteName');
         $record = $record + $this->_DAO->baseField();
         $this->_DAO->autoInsertOrUpdate(SITE_CONFIG_TABLE, $record, array('VersionCode', 'VarName'));
         $record["VarName"] = $__SITE_VAR__['SITE_KEYWORD'];
         $record["VarValue"] = $form->exportValue('SiteKeyword');
         $this->_DAO->autoInsertOrUpdate(SITE_CONFIG_TABLE, $record, array('VersionCode', 'VarName'));
         $record["VarName"] = $__SITE_VAR__['SITE_COPYRIGHT'];
         $record["VarValue"] = $form->exportValue('SiteCopyright');
         $this->_DAO->autoInsertOrUpdate(SITE_CONFIG_TABLE, $record, array('VersionCode', 'VarName'));
         if ($_FILES['Pic']['name'] != "") {
             $file_upload_obj = $FlushPHPObj->loadApp("FileUploadHandle");
             $StrPic = $file_upload_obj->uploadMedia(HTML_IMAGES_DIR);
             $record["VarName"] = $__SITE_VAR__['SITE_LOGO'];
             $record["VarValue"] = $StrPic;
             $this->_DAO->autoInsertOrUpdate(SITE_CONFIG_TABLE, $record, array('VersionCode', 'VarName'));
         }
         if ($_POST['del_site_logo'] == 1 && ($old_site_logo = $_POST['old_site_logo'])) {
             unlink(HTML_IMAGES_DIR . $old_site_logo);
             $record["VarName"] = $__SITE_VAR__['SITE_LOGO'];
             $record["VarValue"] = '';
             $this->_DAO->autoInsertOrUpdate(SITE_CONFIG_TABLE, $record, array('VersionCode', 'VarName'));
         }
         echo "<SCRIPT LANGUAGE='JavaScript'>opener.window.location.reload();window.close();</SCRIPT>";
     }
     $smarty->assign("Main", $form->toHTML());
 }
Beispiel #18
0
 /**
  * Adds a PEAR Date widget to the form
  */
 function add_elements_to_form($attributes)
 {
     for ($i = 0; $i < strlen($this->format); $i++) {
         $key = $this->format[$i];
         $this->_elements[] = HTML_QuickForm::createElement('select', $key, '', $this->_items[$key], array('class' => 'dropdown', 'id' => "{$this->_namespace}{$this->name}_{$key}"));
     }
     $this->_form->addGroup($this->_elements, $this->name, $this->_translate($this->_field['title']), '');
     if ($this->_field['required']) {
         $errmsg = sprintf($this->_l10n->get('field %s is required'), $this->_field['title']);
         $this->_form->addGroupRule($this->name, $errmsg, 'nonzero', null, 3);
     }
     $this->_form->addRule($this->name, $this->_translate('validation failed: date'), 'checksimpledate');
 }
Beispiel #19
0
 /**
  * Adds the radiobox triplet to the form if and only if we have the permissions.
  */
 function add_elements_to_form($attributes)
 {
     if ($this->_type->storage->object && !$this->_type->storage->object->can_do('midgard:privileges')) {
         return;
     }
     $elements = array();
     $elements[] = HTML_QuickForm::createElement('radio', null, MIDCOM_PRIVILEGE_ALLOW, $this->_l10n->get('widget privilege: allow'), MIDCOM_PRIVILEGE_ALLOW, array('class' => 'radiobutton'));
     $elements[] = HTML_QuickForm::createElement('radio', null, MIDCOM_PRIVILEGE_DENY, $this->_l10n->get('widget privilege: deny'), MIDCOM_PRIVILEGE_DENY, array('class' => 'radiobutton'));
     $elements[] = HTML_QuickForm::createElement('radio', null, MIDCOM_PRIVILEGE_INHERIT, $this->_l10n->get('widget privilege: inherit'), MIDCOM_PRIVILEGE_INHERIT, array('class' => 'radiobutton'));
     $this->_elements = $elements;
     $group = $this->_form->addGroup($this->_elements, $this->name, $this->_translate($this->_field['title']), "&nbsp;");
     $group->setAttributes(array('class' => 'radiobox'));
 }
 /**
  * build the form elements for Demographics object
  *
  * @param CRM_Core_Form $form       reference to the form object
  *
  * @return void
  * @access public
  * @static
  */
 static function buildQuickForm(&$form)
 {
     // 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->addDate('birth_date', ts('Date of birth'), false, array('formatType' => 'birth'));
     $form->addElement('checkbox', 'is_deceased', null, ts('Contact is deceased'), array('onclick' => "showDeceasedDate()"));
     $form->addDate('deceased_date', ts('Deceased date'), false, array('formatType' => 'birth'));
 }
Beispiel #21
0
 function &_addElementGroup($name, $field_def)
 {
     $group_set = array();
     $default = $this->_getDefault($name);
     foreach ($field_def['elements'] as $el_name => $el_def) {
         $fRef =& HTML_QuickForm::createElement($el_def['type'], $el_name, $el_def['label'], $default);
         if (isset($el_def['attr']) && $el_def['attr']) {
             $fRef->updateAttributes($el_def['attr']);
         }
         $group_set[] =& $fRef;
     }
     return $this->form->addGroup($group_set, $name, $field_def['label'], '&nbsp;&nbsp;');
 }
 function formUserData($name, $login)
 {
     $lang = services::getService('lang');
     $countries = services::getService('countries');
     $this->form($name);
     // Add some elements to the form
     $this->addElement('hidden', 'function', "data");
     $this->addElement('text', 'email', $lang->getMsg('userdata_email'), array('size' => 30, 'maxlength' => 50));
     $this->addElement('text', 'email2', $lang->getMsg('userdata_email2'), array('size' => 30, 'maxlength' => 50));
     $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'));
     $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'), '&nbsp;');
     $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'), '&nbsp;');
     $this->addElement('select', 'country', $lang->getMsg('userdata_country'), $countries->getAsArray());
     $this->addElement('checkbox', 'adresspublic', $lang->getMsg('userdata_adresspublic'));
     $this->addElement('textarea', 'description', $lang->getMsg('userdata_description'), array('rows' => 5, 'cols' => 50));
     // Define filters and validation rules
     $this->addRule('login', $lang->getMsg('userdata_name_required'), 'required');
     $this->addRule('password', $lang->getMsg('userdata_password_required'), 'required');
     $this->addElement('submit', 'submit', $lang->getMsg('userdata_submit'));
     // Define filters and validation rules
     if (!$login) {
         $this->registerRule('userunique', 'callback', 'usernameUnique');
         $this->registerRule('emailunique', 'callback', 'emailUnique');
         $this->addRule('name', $lang->getMsg('userdata_nameuniqueness'), 'userunique', false);
         $this->addRule('email', $lang->getMsg('userdata_emailuniqueness'), 'emailunique', false);
         $this->addRule('name', $lang->getMsg('userdata_name_required'), 'required');
         $this->registerRule('passcommon', 'callback', 'passwordCommon');
         $this->addRule('password', $lang->getMsg('userdata_password_inlist'), 'passcommon', false);
         $this->addRule('password', $lang->getMsg('userdata_password_tooshort'), 'minlength', 6);
         $this->addRule('password', $lang->getMsg('userdata_password_required'), 'required');
         $this->addRule(array('password', 'password2'), $lang->getMsg('userdata_passwords_differ'), 'compare');
     }
     $this->addRule('email', $lang->getMsg('userdata_email_necessary'), 'required');
     $this->addRule(array('email', 'email2'), $lang->getMsg('userdata_emails_differ'), 'compare');
     $this->addRule('email', $lang->getMsg('userdata_not_an_email'), 'email');
     $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 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();
     }
 }
Beispiel #24
0
 function getForm()
 {
     if ($this->form) {
         return $this->form;
     }
     $form = new HTML_QuickForm('', 'post', $this->url());
     $form->addElement('text', 'email', 'E-mail');
     $radio[0] =& HTML_QuickForm::createElement('radio', null, null, 'tilmeld', '1');
     $radio[1] =& HTML_QuickForm::createElement('radio', null, null, 'frameld', '2');
     $form->addGroup($radio, 'mode', null, null);
     $form->addElement('submit', null, 'Gem');
     $form->setDefaults(array('mode' => 1));
     $form->addRule('email', 'Du skal skrive en e-mail-adresse', 'required', null);
     return $this->form = $form;
 }
Beispiel #25
0
 /**
  * Adds the input elements to the form.
  */
 public function add_elements_to_form($attributes)
 {
     $elements = array();
     $attributes = array_merge($attributes, array('class' => 'shorttext', 'id' => $this->name . '_input'));
     $menu = '<label><input type="radio" name="org_openpsa_user_person_account_password_switch" value="0" checked="checked"/> ' . $this->_l10n->get("generate_password") . '
         </label>
         <label>
             <input type="radio" name="org_openpsa_user_person_account_password_switch" value="1"/> ' . $this->_l10n->get("own_password") . '
         </label>';
     $jsinit = $this->_prepare_jsinit();
     $elements[] = HTML_QuickForm::createElement('static', $this->name . '_menu', '', $menu);
     $title = $this->_translate($this->_field['title']);
     $elements[] = HTML_QuickForm::createElement('password', $this->name . '_input', $title, $attributes);
     $elements[] = HTML_QuickForm::createElement('static', $this->name . '_jsinit', '', $jsinit);
     $this->_form->addGroup($elements, $this->name, $title);
 }
Beispiel #26
0
    public function __construct()
    {
        parent::__construct();
        if ($this->loginError) {
            return;
        }
        $this->use_mootools = true;
        $this->pub =& $_SESSION['pub'];
        if (isset($this->pub->pub_id)) {
            $this->page_title = 'Edit Publication';
        }
        $this->authors = pdAuthorList::create($this->db, null, null, true);
        $form = new HTML_QuickForm('add_pub2', 'post', '', '', array('onsubmit' => 'return check_authors("add_pub2");'));
        $form->addElement('header', null, 'Select from Authors in Database');
        $tooltip = 'Authors::The authors of the publication. Listed in the
same order as in the publication
&lt;p/&gt;
If an author is not already in the database press the &lt;b&gt;Add Author not
in DB&lt;/b&gt; button.';
        $form->addElement('textarea', 'authors', "<div id=\"MYCUSTOMFLOATER\"  class=\"myCustomFloater\" style=\"position:absolute;top:200px;left:600px;background-color:#cecece;display:none;visibility:hidden\"><div class=\"myCustomFloaterContent\"></div></div>" . "<span class=\"Tips1\" title=\"{$tooltip}\">Authors</span>:", array('cols' => 60, 'rows' => 5, 'class' => 'wickEnabled:MYCUSTOMFLOATER', 'wrap' => 'virtual'));
        $form->addElement('static', null, null, '<span class="small">' . 'There are ' . count($this->authors) . ' authors in the database. Type a partial name to ' . 'see a list of matching authors. Separate names ' . 'using commas.</span>');
        $form->addElement('submit', 'add_new_author', 'Add Author not in DB');
        // collaborations radio selections
        $tooltip = 'Collaborations::If the publication is a collaboration,
select the options that apply to this paper.';
        $form->addElement('header', null, "<span class=\"Tips1\" title=\"{$tooltip}\">Collaborations</span>");
        $collaborations = pdPublication::collaborationsGet($this->db);
        foreach ($collaborations as $col_id => $description) {
            $radio_cols[] = HTML_QuickForm::createElement('checkbox', 'paper_col[' . $col_id . ']', null, $description, 1);
        }
        $form->addGroup($radio_cols, 'group_collaboration', null, '<br/>', false);
        $pos = strpos($_SERVER['PHP_SELF'], 'papersdb');
        $url = substr($_SERVER['PHP_SELF'], 0, $pos) . 'papersdb';
        $buttons[] = HTML_QuickForm::createElement('submit', 'prev_step', '<< Previous Step');
        $buttons[] = HTML_QuickForm::createElement('button', 'cancel', 'Cancel', array('onclick' => "cancelConfirm();"));
        $buttons[] = HTML_QuickForm::createElement('submit', 'next_step', 'Next Step >>');
        if ($this->pub->pub_id != '') {
            $buttons[] = HTML_QuickForm::createElement('submit', 'finish', 'Finish');
        }
        $form->addGroup($buttons, 'buttons', '', '&nbsp;', false);
        $this->form =& $form;
        if ($form->validate()) {
            $this->processForm();
        } else {
            $this->renderForm();
        }
    }
Beispiel #27
0
 /**
  * Adds the elements to the form if we have the permissions.
  */
 function add_elements_to_form($attributes)
 {
     if ($this->_type->storage->object && !$this->_type->storage->object->can_do('midgard:privileges')) {
         return;
     }
     $elements = array();
     $select_attributes = array('class' => 'dropdown privilegeselection', 'id' => "{$this->_namespace}{$this->name}");
     $this->_element = HTML_QuickForm::createElement('select', $this->name, '', $this->_privilege_options, $select_attributes);
     $this->_jscript = '<script type="text/javascript">';
     $this->_jscript .= 'jQuery("#' . $this->_namespace . $this->name . '_holder").render_privilege();';
     $this->_jscript .= '</script>';
     $elements[] = HTML_QuickForm::createElement('static', "{$this->_namespace}{$this->name}_holder_start", '', "<div id=\"{$this->_namespace}{$this->name}_holder\">");
     $elements[] = $this->_element;
     $elements[] = HTML_QuickForm::createElement('static', "{$this->_namespace}{$this->name}_holder_end", '', "</div>");
     $elements[] = HTML_QuickForm::createElement('static', "{$this->_namespace}{$this->name}_initscripts", '', $this->_jscript);
     $this->_form->addGroup($elements, $this->name, '', '', array('class' => 'privilegeselection'));
 }
/**
 * Functions for component 'simple_contact_form'.
 *
 * @package   simple_contact_form
 * @copyright 2014 Rodrigo Saraiva  {@link http://moodle.com}, Carlos Eduardo Alves {@link http://github.com/kmiksi}
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
function mountSelect($name, $label, $no_option, $elements)
{
    $select = HTML_QuickForm::createElement('select', $name, $label);
    $select->addOption($no_option, null, array('disabled' => 'disabled'));
    $selected = '';
    foreach ($elements as $name) {
        if (!empty($name)) {
            if (strpos($name, '*') === 0) {
                $name = trim(trim($name, '*'));
                $selected = $name;
            }
            $select->addOption($name, $name);
        }
    }
    $select->setSelected($selected);
    return $select;
}
 /**
  * Append type-specific form elements to the base form
  *
  * @param object &$form
  * @param array &$row
  */
 function buildForm(&$form, &$row)
 {
     $form->setAttribute("onSubmit", "return max_formValidateHtml(this.banner)");
     $header = $form->createElement('header', 'header_html', $GLOBALS['strHTMLBanner'] . " -  banner code");
     $header->setAttribute('icon', 'icon-banner-html.gif');
     $form->addElement($header);
     $adPlugins = OX_Component::getComponents('3rdPartyServers');
     $adPluginsNames = OX_Component::callOnComponents($adPlugins, 'getName');
     $adPluginsList = array();
     $adPluginsList[''] = $GLOBALS['strAdserverTypeGeneric'];
     $adPluginsList['none'] = $GLOBALS['strDoNotAlterHtml'];
     foreach ($adPluginsNames as $adPluginKey => $adPluginName) {
         $adPluginsList[$adPluginKey] = $adPluginName;
     }
     $htmlG['textarea'] = $form->createElement('textarea', 'htmltemplate', null, array('class' => 'code', 'cols' => '45', 'rows' => '10', 'wrap' => 'off', 'dir' => 'ltr', 'style' => 'width:550px;'));
     $aSelectAttributes = array('id' => 'adserver', 'style' => 'margin-left: 15px;width:230px');
     $htmlG['select'] = HTML_QuickForm::createElement('select', 'adserver', $GLOBALS['strAlterHTML'], $adPluginsList, $aSelectAttributes);
     $form->addGroup($htmlG, 'html_banner_g', null, array("<br>", ""), false);
     $form->addElement('advcheckbox', 'iframe_friendly', $GLOBALS['strIframeFriendly']);
     if ($row['bannerid'] && ($row['url'] || $row['target'])) {
         // The "url" and "target" elements remain as part of the form definition
         // for HTML banners only for existing banners that have either
         // url or target already set.
         $form->addElement('header', 'header_b_links', "Banner link");
         $form->addElement('text', 'url', $GLOBALS['strURL']);
         $form->addElement('text', 'target', $GLOBALS['strTarget']);
     }
     $form->addElement('header', 'header_b_display', 'Banner display');
     $sizeG['width'] = $form->createElement('text', 'width', $GLOBALS['strWidth'] . ":");
     $sizeG['width']->setSize(5);
     $sizeG['height'] = $form->createElement('text', 'height', $GLOBALS['strHeight'] . ":");
     $sizeG['height']->setSize(5);
     if (!empty($row['bannerid'])) {
         $sizeG['height']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");');
         $sizeG['width']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");');
     }
     $form->addGroup($sizeG, 'size', $GLOBALS['strSize'], "&nbsp;", false);
     $form->addElement('hidden', 'ext_bannertype', $this->getComponentIdentifier());
     //validation rules
     $translation = new OX_Translation();
     $widthRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strWidth'])), 'required');
     $heightRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strHeight'])), 'required');
     $numericRule = array($GLOBALS['strNumericField'], 'numeric');
     $form->addGroupRule('size', array('width' => array($widthRequiredRule, $numericRule), 'height' => array($heightRequiredRule, $numericRule)));
 }
Beispiel #30
0
 /**
  * This function is to build the date-format form
  *
  * @param Object  $form   the form object that we are operating on
  * 
  * @static
  * @access public
  */
 static function buildAllowedDateFormats(&$form)
 {
     $dateOptions = array();
     require_once "CRM/Utils/System.php";
     if (CRM_Utils_System::getClassName($form) == 'CRM_Activity_Import_Form_UploadFile') {
         $dateText = ts('yyyy-mm-dd OR yyyy-mm-dd HH:mm OR yyyymmdd OR yyyymmdd HH:mm (1998-12-25 OR 1998-12-25 15:33 OR 19981225 OR 19981225 10:30 OR ( 2008-9-1 OR 2008-9-1 15:33 OR 20080901 15:33)');
     } else {
         $dateText = ts('yyyy-mm-dd OR yyyymmdd (1998-12-25 OR 19981225) OR (2008-9-1 OR 20080901)');
     }
     $dateOptions[] = HTML_QuickForm::createElement('radio', null, null, $dateText, self::DATE_yyyy_mm_dd);
     $dateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('mm/dd/yy OR mm-dd-yy (12/25/98 OR 12-25-98) OR (9/1/08 OR 9-1-08)'), self::DATE_mm_dd_yy);
     $dateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('mm/dd/yyyy OR mm-dd-yyyy (12/25/1998 OR 12-25-1998) OR (9/1/2008 OR 9-1-2008)'), self::DATE_mm_dd_yyyy);
     $dateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('Month dd, yyyy (December 12, 1998)'), self::DATE_Month_dd_yyyy);
     $dateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('dd-mon-yy OR dd/mm/yy (25-Dec-98 OR 25/12/98)'), self::DATE_dd_mon_yy);
     $dateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('dd/mm/yyyy (25/12/1998) OR (1/9/2008)'), self::DATE_dd_mm_yyyy);
     $form->addGroup($dateOptions, 'dateFormats', ts('Date Format'), '<br/>');
     $form->setDefaults(array('dateFormats' => self::DATE_yyyy_mm_dd));
 }