Ignore:
Timestamp:
May 18, 2014, 12:04:36 AM (10 years ago)
Author:
mistic100
Message:

feature 3080 : simpler date inputs (one input + fontello + picker selects)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/picture_modify.php

    r28496 r28497  
    109109
    110110//--------------------------------------------------------- update informations
    111 
    112 // first, we verify whether there is a mistake on the given creation date
    113 if (isset($_POST['date_creation_action'])
    114     and 'set' == $_POST['date_creation_action'])
    115 {
    116   if (!is_numeric($_POST['date_creation_year'])
    117     or !checkdate(
    118           $_POST['date_creation_month'],
    119           $_POST['date_creation_day'],
    120           $_POST['date_creation_year'])
    121     )
    122   {
    123     $page['errors'][] = l10n('wrong date');
    124   }
    125 }
    126 
    127 if (isset($_POST['submit']) and count($page['errors']) == 0)
     111if (isset($_POST['submit']))
    128112{
    129113  $data = array();
     
    142126  }
    143127
    144   if (!empty($_POST['date_creation_year']))
    145   {
    146     $data['date_creation'] =
    147       $_POST['date_creation_year']
    148       .'-'.$_POST['date_creation_month']
    149       .'-'.$_POST['date_creation_day']
    150       .' '.$_POST['date_creation_time'];
     128  if (!empty($_POST['date_creation']))
     129  {
     130    $data['date_creation'] = $_POST['date_creation'].' '.$_POST['date_creation_time'];
    151131  }
    152132  else
     
    340320unset($day, $month, $year);
    341321
    342 if (isset($_POST['date_creation_action'])
    343     and 'set' == $_POST['date_creation_action'])
    344 {
    345   foreach (array('day', 'month', 'year', 'time') as $varname)
    346   {
    347     $$varname = $_POST['date_creation_'.$varname];
    348   }
    349 }
    350 else if (isset($row['date_creation']) and !empty($row['date_creation']))
    351 {
    352   list($year, $month, $day) = explode('-', substr($row['date_creation'],0,10));
    353   $time = substr($row['date_creation'],11);
     322if (!empty($row['date_creation']))
     323{
     324  list($date, $time) = explode(' ', $row['date_creation']);
    354325}
    355326else
    356327{
    357   list($year, $month, $day) = array('', 0, 0);
     328  $date = '';
    358329  $time = '00:00:00';
    359330}
    360 
    361 
    362 $month_list = $lang['month'];
    363 $month_list[0]='------------';
    364 ksort($month_list);
    365331
    366332$template->assign(
    367333    array(
    368       'DATE_CREATION_DAY_VALUE' => (int)$day,
    369       'DATE_CREATION_MONTH_VALUE' => (int)$month,
    370       'DATE_CREATION_YEAR_VALUE' => $year,
    371       'DATE_CREATION_TIME_VALUE' => $time,
    372       'month_list' => $month_list,
     334      'DATE_CREATION' => $date,
     335      'DATE_CREATION_TIME' => $time,
    373336      )
    374337    );
Note: See TracChangeset for help on using the changeset viewer.