[svn r14807] More improvements to user fields - added date and datetime pickers

skala
Yannick Warnier 17 years ago
parent bc20e4a349
commit 76906e1eb0
  1. 4
      main/admin/user_fields_add.php
  2. 41
      main/auth/profile.php

@ -63,10 +63,12 @@ $form->addRule('fieldlabel', get_lang('FieldTaken'), 'fieldlabel_available');
// Field type
$types = array();
$types[USER_FIELD_TYPE_TEXT] = get_lang('FieldTypeText');
//$types[USER_FIELD_TYPE_TEXTAREA] = get_lang('FieldTypeTextarea');
$types[USER_FIELD_TYPE_TEXTAREA] = get_lang('FieldTypeTextarea');
//$types[USER_FIELD_TYPE_RADIO] = get_lang('FieldTypeRadio');
//$types[USER_FIELD_TYPE_SELECT] = get_lang('FieldTypeSelect');
//$types[USER_FIELD_TYPE_SELECT_MULTIPLE] = get_lang('FieldTypeSelectMultiple');
$types[USER_FIELD_TYPE_DATE] = get_lang('FieldTypeDate');
$types[USER_FIELD_TYPE_DATETIME] = get_lang('FieldTypeDatetime');
$form->addElement('select','fieldtype',get_lang('FieldType'),$types);
$form->addRule('fieltype', get_lang('ThisFieldIsRequired'), 'required');
// Field display name

@ -1,4 +1,4 @@
<?php // $Id: profile.php 14798 2008-04-09 05:26:13Z yannoo $
<?php // $Id: profile.php 14807 2008-04-09 15:29:12Z yannoo $
/*
==============================================================================
Dokeos - elearning and course management software
@ -272,18 +272,45 @@ if (is_profile_editable() && api_get_setting('profile', 'password') == 'true')
// EXTRA FIELDS
$extra = UserManager::get_extra_fields();
$ftypeco = array(); //make a correspondance array for the form types
foreach($extra as $id => $field_details)
{
if($field_details[6] == 0)
{
continue;
}
//todo add field type management (rather than just "text")
$form->addElement('text', 'extra_'.$field_details[1], $field_details[3], array('size' => 40));
$form->applyFilter('extra_'.$field_details[1], 'stripslashes');
$form->applyFilter('extra_'.$field_details[1], 'trim');
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
switch($field_details[2])
{
case USER_FIELD_TYPE_TEXT:
$form->addElement('text', 'extra_'.$field_details[1], $field_details[3], array('size' => 40));
$form->applyFilter('extra_'.$field_details[1], 'stripslashes');
$form->applyFilter('extra_'.$field_details[1], 'trim');
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
break;
case USER_FIELD_TYPE_TEXTAREA:
$form->add_html_editor('extra_'.$field_details[1], $field_details[3], false);
//$form->addElement('textarea', 'extra_'.$field_details[1], $field_details[3], array('size' => 80));
$form->applyFilter('extra_'.$field_details[1], 'stripslashes');
$form->applyFilter('extra_'.$field_details[1], 'trim');
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
break;
case USER_FIELD_TYPE_RADIO:
break;
case USER_FIELD_TYPE_SELECT:
break;
case USER_FIELD_TYPE_SELECT_MULTIPLE:
break;
case USER_FIELD_TYPE_DATE:
$form->addElement('datepickerdate', 'extra_'.$field_details[1], $field_details[3]);
$form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear',1900);
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
$form->applyFilter('theme', 'trim');
break;
case USER_FIELD_TYPE_DATETIME:
$form->addElement('datepicker', 'extra_'.$field_details[1], $field_details[3]);
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
$form->applyFilter('theme', 'trim');
break;
}
}
// SUBMIT

Loading…
Cancel
Save