* */ /** * Class history : Contains all the function to manage history of the maarch tables * * @author Claire Figueras * @license GPL * @package Maarch LetterBox 2.3 * @version 1.1 */ class history extends dbquery { /** * Redefinition of the history object constructor */ function __construct() { // construct the object and setup the variables if(isset($_GET['start'])) { $start = $_GET['start']; $this->the_start = strip_tags($_GET['start']); } else { $this->the_start = 0; } if(isset($_GET['order'])) { $this->orderby = strip_tags($_GET['order']); } else { $this->orderby = "datedesc"; } $this->sqlorderby = ""; if($this->orderby == "dateasc") { $this->sqlorderby = "order by EVENT_DATE asc"; } if($this->orderby == "datedesc") { $this->sqlorderby = "order by EVENT_DATE desc"; } if($this->orderby == "userasc") { $this->sqlorderby = "order by USER_ID asc"; } if($this->orderby == "userdesc") { $this->sqlorderby = "order by USER_ID desc"; } if($this->orderby == "actionasc") { $this->sqlorderby = "order by EVENT_TYPE asc"; } if($this->orderby == "actiondesc") { $this->sqlorderby = "order by EVENT_TYPE desc"; } if($this->orderby == "idasc") { $this->sqlorderby = "order by INFO asc"; } if($this->orderby == "iddesc") { $this->sqlorderby = "order by INFO desc"; } } /** * Insert a record in the history table * * @param integer $id identifier of the event to add * @param string $how event type * @param string $what event description */ public function add($where,$id,$how,$what) { // insert a record in the history table // $conn = new dbquery(); $this->connect(); $this->query("INSERT INTO `".$_SESSION['tablename']['history']."` (`TABLE_NAME`, `RECORD_ID` , `EVENT_TYPE` , `USER_ID` , `EVENT_DATE` , `INFO` ) VALUES ('".$where."', '".$id."', '".$how."', '".$_SESSION['user']['UserId']."', '".date("Y")."-".date("m")."-".date("d")." ".date("H:i:s")."', '".addslashes($what)."')"); $this->close; } /** * List all the rows of the history table * */ public function listhistory() { // List all the rows of the history table /* Configuration */ /* Just edit this part if you need it*/ $title = _HISTORY_TITLE; $ref_page = "index"; $page_name = "hist"; $page_name_up = $page_name."_up"; $page_name_del = $page_name."_del"; $page_name_validate = $page_name."_validate"; $table_name = $_SESSION['tablename']['history']; $nb_show = $_SESSION['config']['nblinetoshow']; $this->connect(); $this->query("select count(*) as total from ".$table_name); $nb_total_1 = $this->fetch_object(); $nb_total = $nb_total_1->total; // define the defaults values $nb_pages = ceil($nb_total/$nb_show); $link = $ref_page.".php?page=".$page_name; if($nb_pages > 1) { $next_start = 0; $page_list1 = '

'; $lastpage = 0; for($i = 0;$i <> $nb_pages; $i++) { $the_line = $i + 1; if($this->the_start == $next_start) { $page_list1 .= ""; $page_list2 .= ""; } else { $page_list1 .= ""; $page_list2 .= ""; } $next_start = $next_start + $nb_show; $lastpage = $next_start; } $lastpage = $lastpage - $nb_show; $previous = ""; $next = ""; if($this->the_start > 0) { $start_prev = $this->the_start - $nb_show; $previous = ''; } if($this->the_start <> $lastpage) { $start_next = $this->the_start + $nb_show; $next = ''; } $page_list1 = $page_list1.""; $page_list2 = $page_list2.""; if($previous <> '' || $next <> '') { if(empty($previous)) { $previous = " "; } if(empty($next)) { $next = " "; } $page_list1 .= $previous." ".$next.'

'; $page_list2 .= $previous." ".$next.'

'; } } $this->query("select * from ".$table_name." ".$this->sqlorderby." limit ".$this->the_start.",".$nb_show); echo '

'.$title.'

'; echo $page_list1; ?> fetch_object()) { if($color == ' class="col"') { $color = ''; } else { $color = ' class="col"'; } $func = new functions(); ?> >
<? echo _DESC_SORT; ?> <? echo _ASC_SORT; ?> <? echo _DESC_SORT; ?> <? echo _ASC_SORT; ?> <? echo _DESC_SORT; ?> <? echo _ASC_SORT; ?>
dateformat($line->EVENT_DATE); ?> show($line->USER_ID); ?> EVENT_TYPE == "ADD") { echo _ADDITION; } elseif($line-> EVENT_TYPE == "DEL") { echo _DELETION; } elseif($line-> EVENT_TYPE == "UP") { echo _MODIFICATION; } elseif($line-> EVENT_TYPE == "BAN") { echo _SUSPENSION; } elseif($line-> EVENT_TYPE == "VAL") { echo _VALIDATION; } elseif($line-> EVENT_TYPE == "DIF") { echo _DIFFUSION; } elseif($line-> EVENT_TYPE == "RED") { echo _REDIRECTION; } elseif($line-> EVENT_TYPE == "ABS") { echo _ABSENCE; } elseif($line-> EVENT_TYPE == "RET") { echo _RETURN_FROM_VACATION; } ?> show($line->INFO); ?>
'; } } ?>