function validate_data($data) {
if ($data >= count($this->options)) {
- return get_string('invaliddata');
+ return get_string('profileinvaliddata', 'admin');
} else {
return '';
}
function edit_field_specific(&$form) {
/// Param 1 for menu type contains the options
- $form->addElement('textarea', 'param1', get_string('profilemenuoptions'));
+ $form->addElement('textarea', 'param1', get_string('profilemenuoptions', 'admin'));
$form->setType('param1', PARAM_MULTILANG);
/// Default data
- $form->addElement('text', 'defaultdata', get_string('profiledefaultdata'), 'size="30"');
+ $form->addElement('text', 'defaultdata', get_string('profiledefaultdata', 'admin'), 'size="30"');
$form->setType('defaultdata', PARAM_MULTILANG);
}
/// Check that we have at least 2 options
if (($options = explode("\n", $data->param1)) === false) {
- $err['param1'] = get_string('profilemenunooptions');
+ $err['param1'] = get_string('profilemenunooptions', 'admin');
} elseif (count($options) < 2) {
- $err['param1'] = get_string('profilemenuoptions');
+ $err['param1'] = get_string('profilemenutoofewoptions', 'admin');
/// Check the default data exists in the options
} elseif (!empty($data->defaultdata) and !in_array($data->defaultdata, $options)) {
- $err['defaultdata'] = get_string('profilemenudefaultnotinoptions');
+ $err['defaultdata'] = get_string('profilemenudefaultnotinoptions', 'admin');
}
return $err;
}
function edit_field_specific(&$form) {
/// Default data
- $form->addElement('text', 'defaultdata', get_string('profiledefaultdata'), 'size="30"');
+ $form->addElement('text', 'defaultdata', get_string('profiledefaultdata', 'admin'), 'size="30"');
$form->setType('defaultdata', PARAM_MULTILANG);
/// Param 1 for text type is the size of the field
- $form->addElement('text', 'param1', get_string('profilefieldsize'), 'size="6"');
+ $form->addElement('text', 'param1', get_string('profilefieldsize', 'admin'), 'size="6"');
$form->setType('param1', PARAM_INT);
/// Param 2 for text type is the maxlength of the field
- $form->addElement('text', 'param2', get_string('profilefieldmaxlength'), 'size="6"');
+ $form->addElement('text', 'param2', get_string('profilefieldmaxlength', 'admin'), 'size="6"');
$form->setType('param2', PARAM_INT);
}
*/
function display_field_lock (&$form) {
if ($this->_is_locked()) {
- $form->freeze($this->fieldname);
+ $form->freeze($this->fieldname, false);
}
}
* @param object instance of the moodleform class
*/
function edit_field (&$form) {
- $form->addElement('header', '_commonsettings', get_string('profilecommonsettings'));
+ $form->addElement('header', '_commonsettings', get_string('profilecommonsettings', 'admin'));
$this->edit_field_common($form);
- $form->addElement('header', '_specificsettings', get_string('profilespecificsettings'));
+ $form->addElement('header', '_specificsettings', get_string('profilespecificsettings', 'admin'));
$this->edit_field_specific($form);
}
$strrequired = get_string('required');
- $form->addElement('text', 'shortname', get_string('profileshortname'), 'maxlength="100" size="30"');
+ $form->addElement('text', 'shortname', get_string('profileshortname', 'admin'), 'maxlength="100" size="30"');
$form->setType('shortname', PARAM_ALPHANUM);
$form->addRule('shortname', $strrequired, 'required', null, 'client');
- $form->addElement('text', 'name', get_string('profilename'), 'size="30"');
+ $form->addElement('text', 'name', get_string('profilename', 'admin'), 'size="30"');
$form->setType('name', PARAM_MULTILANG);
$form->addRule('name', $strrequired, 'required', null, 'client');
- $form->addElement('htmleditor', 'description', get_string('profiledescription'));
+ $form->addElement('htmleditor', 'description', get_string('profiledescription', 'admin'));
$form->setType('description', PARAM_MULTILANG);
$form->setHelpButton('description', array('text', get_string('helptext')));
- $form->addElement('selectyesno', 'required', get_string('profilerequired'));
+ $form->addElement('selectyesno', 'required', get_string('profilerequired', 'admin'));
$form->setType('required', PARAM_BOOL);
- $form->addElement('selectyesno', 'locked', get_string('profilelocked'));
+ $form->addElement('selectyesno', 'locked', get_string('profilelocked', 'admin'));
$form->setType('locked', PARAM_BOOL);
unset($choices);
- $choices[0] = get_string('profilevisiblenone');
- $choices[1] = get_string('profilevisibleprivate');
- $choices[2] = get_string('profilevisibleall');
- $form->addElement('select', 'visible', get_string('profilevisible'), $choices);
+ $choices[0] = get_string('profilevisiblenone', 'admin');
+ $choices[1] = get_string('profilevisibleprivate', 'admin');
+ $choices[2] = get_string('profilevisibleall', 'admin');
+ $form->addElement('select', 'visible', get_string('profilevisible', 'admin'), $choices);
$form->setType('visible', PARAM_INT);
unset($choices);
$choices = profile_list_categories();
- $form->addElement('select', 'categoryid', get_string('profilecategory'), $choices);
+ $form->addElement('select', 'categoryid', get_string('profilecategory', 'admin'), $choices);
$form->setType('categoryid', PARAM_INT);
}
/// Check the shortname is unique
if (($field = get_record('user_info_field', 'shortname', $data->shortname)) and ($field->id <> $data->id)) {
//if (record_exists_select('user_info_field', 'shortname='.$data->shortname.' AND id<>'.$data->id)) {
- $err['shortname'] = get_string('profileshortnamenotunique');
+ $err['shortname'] = get_string('profileshortnamenotunique', 'admin');
}
/// No further checks necessary as the form class will take care of it