Maintenant, tout dans le executor.php. Fin de tempPreMega.
Ajout d'un super simulateur de tours de Monoï dans la page 404.
This commit is contained in:
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
class Article {
|
||||
|
||||
protected $ID;
|
||||
protected $title;
|
||||
protected $short;
|
||||
protected $text;
|
||||
protected $postDate;
|
||||
protected $lastNoticeableChangeDate;
|
||||
protected $lastChange;
|
||||
protected $picPath;
|
||||
|
||||
protected $valid;
|
||||
|
||||
public function __construct($ID) {
|
||||
$this->ID = $ID;
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM articles WHERE ID=?');
|
||||
$req->execute(array($ID));
|
||||
if($rep = $req->fetch()){
|
||||
$this->valid = TRUE;
|
||||
$this->title = $rep['title'];
|
||||
$this->short = $rep['short'];
|
||||
$this->text = $rep['text'];
|
||||
$this->postDate = $rep['postDate'];
|
||||
$this->lastNoticeableChangeDate = $rep['lastNoticeableChangeDate'];
|
||||
$this->lastChange = $rep['lastChange'];
|
||||
$this->picPath = $rep['picPath'];
|
||||
}else{
|
||||
$this->valid = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString(){
|
||||
$out = 'MegaStockage\n';
|
||||
$out .= '\tID:' . $this->ID . '\n';
|
||||
$out .= '\tTitle:' . $this->title . '\n';
|
||||
$out .= '\tShort description' . $this->short . '\n';
|
||||
$out .= '\tText:' . $this->text . '\n';
|
||||
$out .= '\tPost article date:' . $this->postDate . '\n';
|
||||
$out .= '\tLast noticeable change date:' . $this->lastNoticeableChangeDate . '\n';
|
||||
$out .= '\tLast change date:' . $this->lastChangeDate . '\n';
|
||||
$out .= '\tPic(ture) path:' . $this->picPath . '\n';
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function exists(){
|
||||
return $this->valid;
|
||||
}
|
||||
|
||||
//Getters
|
||||
|
||||
public function getID(){
|
||||
return $this->ID;
|
||||
}
|
||||
|
||||
public function setID($ID){
|
||||
$this->ID = $ID;
|
||||
}
|
||||
|
||||
public function getTitle(){
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function setTitle($title){
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
public function getShort(){
|
||||
return $this->short;
|
||||
}
|
||||
|
||||
public function setShort($short){
|
||||
$this->short = $short;
|
||||
}
|
||||
|
||||
public function getText(){
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
public function setText($text){
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
public function getPostDate(){
|
||||
return $this->postDate;
|
||||
}
|
||||
|
||||
public function setPostDate($postDate){
|
||||
$this->postDate = $postDate;
|
||||
}
|
||||
|
||||
public function getLastNoticeableChangeDate(){
|
||||
return $this->lastNoticeableChangeDate;
|
||||
}
|
||||
|
||||
public function setLastNoticeableChangeDate($lastNoticeableChangeDate){
|
||||
$this->lastNoticeableChangeDate = $lastNoticeableChangeDate;
|
||||
}
|
||||
|
||||
public function getLastChange(){
|
||||
return $this->lastChange;
|
||||
}
|
||||
|
||||
public function setLastChange($lastChange){
|
||||
$this->lastChange = $lastChange;
|
||||
}
|
||||
|
||||
public function getPicPath(){
|
||||
return $this->picPath;
|
||||
}
|
||||
|
||||
public function setPicPath($picPath){
|
||||
$this->picPath = $picPath;
|
||||
}
|
||||
//Useful getters
|
||||
|
||||
//Gross getters
|
||||
public static function getNewest($count){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM articles ORDER BY lastNoticeableChangeDate DESC LIMIT '.intval($count));
|
||||
$req->execute();
|
||||
$reps = array();
|
||||
$GLOBALS['bdd']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
while($rep = $req->fetch()){
|
||||
$reps[] = new Article($rep['ID']);
|
||||
}
|
||||
return $reps;
|
||||
|
||||
}
|
||||
|
||||
//Setters
|
||||
|
||||
//
|
||||
|
||||
//Operateurs
|
||||
|
||||
|
||||
|
||||
//Outputs texts
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user