/**
  * Prints out the form snippet for the part of creating or
  * editing a profile field common to all data types
  * @param   object   instance of the moodleform class
  */
 public function define_form_common(&$form, $companyid = null)
 {
     global $DB;
     $strrequired = get_string('required');
     $form->addElement('text', 'shortname', get_string('companyprofileshortname', 'block_iomad_company_admin'), 'maxlength="100" size="25"');
     $form->addRule('shortname', $strrequired, 'required', null, 'client');
     $form->setType('shortname', PARAM_ALPHANUM);
     $form->addElement('text', 'name', get_string('profilename', 'admin'), 'size="50"');
     $form->addRule('name', $strrequired, 'required', null, 'client');
     $form->setType('name', PARAM_MULTILANG);
     $form->addElement('editor', 'description', get_string('profiledescription', 'admin'), null, null);
     $form->addElement('selectyesno', 'required', get_string('profilerequired', 'admin'));
     $form->addElement('selectyesno', 'locked', get_string('profilelocked', 'admin'));
     $form->addElement('selectyesno', 'forceunique', get_string('profileforceunique', 'admin'));
     $form->addElement('selectyesno', 'signup', get_string('profilesignup', 'admin'));
     $choices = array();
     $choices[PROFILE_VISIBLE_NONE] = get_string('profilevisiblenone', 'admin');
     $choices[PROFILE_VISIBLE_PRIVATE] = get_string('profilevisibleprivate', 'admin');
     $choices[PROFILE_VISIBLE_ALL] = get_string('profilevisibleall', 'admin');
     $form->addElement('select', 'visible', get_string('profilevisible', 'admin'), $choices);
     $form->addHelpButton('visible', 'profilevisible', 'admin');
     $form->setDefault('visible', PROFILE_VISIBLE_ALL);
     if (!empty($companyid)) {
         // Being passed a company dont need to have the select.
         // Get to company details.
         $company = $DB->get_record('company', array('id' => $companyid), '*', MUST_EXIST);
         $category = $DB->get_record('user_info_category', array('id' => $company->profileid));
         $form->addElement('hidden', 'categoryid', $category->id);
     } else {
         $choices = profile_list_categories();
         $form->addElement('select', 'categoryid', get_string('company', 'block_iomad_company_admin'), $choices);
     }
 }
示例#2
0
 /**
  * Prints out the form snippet for the part of creating or
  * editing a profile field common to all data types
  * @param   object   instance of the moodleform class
  */
 function define_form_common(&$form)
 {
     $strrequired = get_string('required');
     $form->addElement('text', 'shortname', get_string('profileshortname', 'admin'), 'maxlength="100" size="25"');
     $form->addRule('shortname', $strrequired, 'required', null, 'client');
     $form->setType('shortname', PARAM_ALPHANUM);
     $form->addElement('text', 'name', get_string('profilename', 'admin'), 'size="50"');
     $form->addRule('name', $strrequired, 'required', null, 'client');
     $form->setType('name', PARAM_MULTILANG);
     $form->addElement('htmleditor', 'description', get_string('profiledescription', 'admin'));
     $form->setHelpButton('description', array('text', get_string('helptext')));
     $form->addElement('selectyesno', 'required', get_string('profilerequired', 'admin'));
     $form->addElement('selectyesno', 'locked', get_string('profilelocked', 'admin'));
     $form->addElement('selectyesno', 'forceunique', get_string('profileforceunique', 'admin'));
     $form->addElement('selectyesno', 'signup', get_string('profilesignup', 'admin'));
     $choices = array();
     $choices[PROFILE_VISIBLE_NONE] = get_string('profilevisiblenone', 'admin');
     $choices[PROFILE_VISIBLE_PRIVATE] = get_string('profilevisibleprivate', 'admin');
     $choices[PROFILE_VISIBLE_ALL] = get_string('profilevisibleall', 'admin');
     $form->addElement('select', 'visible', get_string('profilevisible', 'admin'), $choices);
     $form->setHelpButton('visible', array('profilevisible', get_string('profilevisible', 'admin')));
     $form->setDefault('visible', PROFILE_VISIBLE_ALL);
     $choices = profile_list_categories();
     $form->addElement('select', 'categoryid', get_string('profilecategory', 'admin'), $choices);
 }
 /**
  * Prints out the form snippet for the part of creating or
  * editing a profile field common to all data types
  * @param   object   instance of the moodleform class
  */
 function define_form_common(&$form)
 {
     $strrequired = get_string('required');
     $form->addElement('text', 'shortname', get_string('profileshortname', 'admin'), 'maxlength="100" size="25"');
     $form->addRule('shortname', $strrequired, 'required', null, 'client');
     $form->setType('shortname', PARAM_ALPHANUM);
     $form->addElement('text', 'name', get_string('profilename', 'admin'), 'size="50"');
     $form->addRule('name', $strrequired, 'required', null, 'client');
     $form->setType('name', PARAM_MULTILANG);
     $form->addElement('editor', 'description', get_string('profiledescription', 'admin'), null, null);
     $choices = profile_list_categories();
     $form->addElement('select', 'categoryid', get_string('profilecategory', 'admin'), $choices);
 }