[svn r18078] Logic changes - Assigned date by default for date and date time fields when you add those ones into manager user field and added the possibility to select the year from 1900 - see FS#3452

skala
Cristian Fasanando 16 years ago
parent bf1720a636
commit 3a55b1bc7a
  1. 7
      main/admin/user_add.php
  2. 7
      main/admin/user_edit.php
  3. 7
      main/auth/inscription.php
  4. 9
      main/auth/profile.php
  5. 9
      main/inc/lib/formvalidator/Element/datepicker.php
  6. 4
      main/inc/lib/formvalidator/Element/tbl_change.js.php
  7. 5
      main/mySpace/user_add.php
  8. 7
      main/survey/fillsurvey.php

@ -1,4 +1,4 @@
<?php // $Id: user_add.php 17754 2009-01-15 22:58:39Z cfasanando $
<?php // $Id: user_add.php 18078 2009-01-29 17:21:11Z cfasanando $
/*
==============================================================================
Dokeos - elearning and course management software
@ -236,10 +236,15 @@ foreach($extra as $id => $field_details)
case USER_FIELD_TYPE_DATE:
$form->addElement('datepickerdate', 'extra_'.$field_details[1], $field_details[3],array('form_name'=>'user_add'));
$form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear',1900);
$defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
$form -> setDefaults($defaults);
$form->applyFilter('theme', 'trim');
break;
case USER_FIELD_TYPE_DATETIME:
$form->addElement('datepicker', 'extra_'.$field_details[1], $field_details[3],array('form_name'=>'user_add'));
$form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear',1900);
$defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
$form -> setDefaults($defaults);
$form->applyFilter('theme', 'trim');
break;
case USER_FIELD_TYPE_DOUBLE_SELECT:

@ -1,4 +1,4 @@
<?php // $Id: user_edit.php 17754 2009-01-15 22:58:39Z cfasanando $
<?php // $Id: user_edit.php 18078 2009-01-29 17:21:11Z cfasanando $
/*
==============================================================================
Dokeos - elearning and course management software
@ -263,10 +263,15 @@ foreach($extra as $id => $field_details)
case USER_FIELD_TYPE_DATE:
$form->addElement('datepickerdate', 'extra_'.$field_details[1], $field_details[3],array('form_name'=>'user_add'));
$form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear',1900);
$defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
$form -> setDefaults($defaults);
$form->applyFilter('theme', 'trim');
break;
case USER_FIELD_TYPE_DATETIME:
$form->addElement('datepicker', 'extra_'.$field_details[1], $field_details[3],array('form_name'=>'user_add'));
$form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear',1900);
$defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
$form -> setDefaults($defaults);
$form->applyFilter('theme', 'trim');
break;
}

@ -1,5 +1,5 @@
<?php
// $Id: inscription.php 17789 2009-01-17 12:24:36Z iflorespaz $
// $Id: inscription.php 18078 2009-01-29 17:21:11Z cfasanando $
/*
==============================================================================
Dokeos - elearning and course management software
@ -207,11 +207,16 @@ foreach ($extra as $id => $field_details) {
case USER_FIELD_TYPE_DATE:
$form->addElement('datepickerdate', 'extra_'.$field_details[1], $field_details[3],array('form_name'=>'registration'));
$form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear',1900);
$defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
$form -> setDefaults($defaults);
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],array('form_name'=>'registration'));
$form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear',1900);
$defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
$form -> setDefaults($defaults);
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
$form->applyFilter('theme', 'trim');
break;

@ -1,4 +1,4 @@
<?php // $Id: profile.php 17990 2009-01-25 06:06:00Z yannoo $
<?php // $Id: profile.php 18078 2009-01-29 17:21:11Z cfasanando $
/* For licensing terms, see /dokeos_license.txt */
/**
==============================================================================
@ -324,14 +324,19 @@ foreach($extra as $id => $field_details)
break;
case USER_FIELD_TYPE_DATE:
$form->addElement('datepickerdate', 'extra_'.$field_details[1],$field_details[3], array('form_name'=>'profile'));
$form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear',1900);
$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');
$defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
$form -> setDefaults($defaults);
break;
case USER_FIELD_TYPE_DATETIME:
$form->addElement('datepicker', 'extra_'.$field_details[1],$field_details[3], array('form_name'=>'profile'));
$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');
$defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
$form -> setDefaults($defaults);
break;
case USER_FIELD_TYPE_DOUBLE_SELECT:
foreach ($field_details[8] as $key=>$element)

@ -1,5 +1,5 @@
<?php
// $Id: datepicker.php 16033 2008-08-20 21:21:44Z yannoo $
// $Id: datepicker.php 18078 2009-01-29 17:21:11Z cfasanando $
/*
==============================================================================
Dokeos - elearning and course management software
@ -111,5 +111,12 @@ class HTML_QuickForm_datepicker extends HTML_QuickForm_date
$result[$this->getName()]= $datetime;
return $result;
}
/**
* Sets an option to a value
*/
function setLocalOption($name,$value)
{
$this->_options[$name] = $value;
}
}
?>

@ -1,5 +1,5 @@
<?php
// $Id: tbl_change.js.php 18057 2009-01-28 21:07:19Z cfasanando $
// $Id: tbl_change.js.php 18078 2009-01-29 17:21:11Z cfasanando $
require ('../../../global.inc.php');
?>
var day;
@ -177,7 +177,7 @@ function returnDate(d,m,y) {
datevalues[0].selectedIndex = (d-1) ;
datevalues[1].selectedIndex = m;
date = new Date();
year = date.getFullYear()-1;
year = 1900;
datevalues[2].selectedIndex = (y-year);
for(i = 0; i<= 3; i++)

@ -222,10 +222,15 @@ foreach($extra as $id => $field_details)
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);
$defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
$form -> setDefaults($defaults);
$form->applyFilter('theme', 'trim');
break;
case USER_FIELD_TYPE_DATETIME:
$form->addElement('datepicker', 'extra_'.$field_details[1], $field_details[3]);
$form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear',1900);
$defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
$form -> setDefaults($defaults);
$form->applyFilter('theme', 'trim');
break;
}

@ -461,13 +461,18 @@ if ($survey_data['form_fields']!='' && $survey_data['anonymous'] == 0 && is_arra
break;
case USER_FIELD_TYPE_DATE :
$form->addElement('datepickerdate', 'extra_' . $field_details[1], $field_details[3],array('form_name'=>'profile'));
$form->_elements[$form->_elementIndex['extra_' . $field_details[1]]]->setLocalOption('minYear', 1900);
$form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear',1900);
$defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
$form -> setDefaults($defaults);
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],array('form_name'=>'profile'));
$form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear',1900);
$defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
$form -> setDefaults($defaults);
if ($field_details[7] == 0)
$form->freeze('extra_' . $field_details[1]);
$form->applyFilter('theme', 'trim');

Loading…
Cancel
Save