contributions/usermanagement/model/classes/permanentlogins.model.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * Table Definition for permanentlogins 00004 * 00005 * @author Gerd Riesselmann 00006 * @ingroup Usermanagement 00007 */ 00008 class DAOPermanentlogins extends DataObjectBase { 00009 public $code; // string(50) not_null primary_key 00010 public $id_user; // int(10) not_null multiple_key unsigned 00011 public $expirationdate; // datetime(19) binary 00012 00013 00014 protected function create_table_object() { 00015 return new DBTable( 00016 'permanentlogins', 00017 array( 00018 new DBFieldText('code', 50, null, DBFieldText::NOT_NULL), 00019 new DBFieldInt('id_user', null, DBFieldInt::NOT_NULL), 00020 new DBFieldDateTime('expirationdate') 00021 ), 00022 'code' 00023 ); 00024 } 00025 00026 00027 /** 00028 * Loads item, and returns true, if a valid one was fond, false otherwise 00029 */ 00030 public function get_valid($code) { 00031 if ($this->get($code)) { 00032 return ($this->expirationdate > time()); 00033 } 00034 return false; 00035 } 00036 }