Location: PHPKode > projects > LDAPted > ldapted/includes/controls/Date.php
<?php
/***************************************************************************
 *
 *                                  Date.php
 *                              -------------------
 *
 *   begin                : Monday, Juni 16, 2003
 *   copyright            : (C) 2002 The Kabramps Team
 *   email                : hide@address.com,
 *                          hide@address.com
 *
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 *   See the GNU General Public License for more details.
 *   (http://www.gnu.org/licenses/gpl.html)
 *
 ***************************************************************************/

class Date extends Control {

  function Date ($attribute, $value, $xmlDoc, $tmpl, $lang) {
    $this->Control($attribute, $value, $xmlDoc, $tmpl, $lang);
  }

  function get_edit_panel () {
    global $options;

    $this->tmpl->assign(array("DESCRIPTION"  => $this->description,
                              "ATTRIBLABEL"  => $this->xmlDoc->get_label($this->attribute, $this->lang),
                              "ATTRIBNAME"   => $this->attribute,
                              "ATTRIBVALUE"  => $this->value[0], // 0 - because it is a single text field
                              "SIZE"         => $this->attributeoptions["size"],
                              "MAXLENGTH"    => $this->attributeoptions["maxlength"],
                              "ERRORPIC"     => $exclamationpic,
                              "ERRORMESSAGE" => $this->get_error_message()
                        ));
                        
    return $this->tmpl->fetch($this->get_template('edit'));
  }
  
  function get_view_panel () {
    global $options;
 
    $this->tmpl->assign(array("DESCRIPTION" => $this->description,
			                  "ATTRIBLABEL" => $this->xmlDoc->get_label($this->attribute, $this->lang),
                  	          "ATTRIBNAME"  => $this->attribute,
                  		      "YEAR"        => substr($this->value[0],0 ,4),
			                  "MONTH"       => substr($this->value[0],4 ,2),
			                  "DAY"         => substr($this->value[0],6 ,2),
			                  "HOUR"        => substr($this->value[0],8 ,2),
			                  "MINUTE"      => substr($this->value[0],10,2),
			                  "SECOND"      => substr($this->value[0],12,2)
			           ));
    return $this->tmpl->fetch($this->get_template('view'));
  }
  
}
?>
Return current item: LDAPted