Files
fdn2/private/lib/dao/models/CommentoModel.php
T
Riccardo Di Dato fa648c0850 Creato sistema accetazione commenti;
Create pagine per notizie in pending e rifiutate;
Creati componenti grafici per mostrare Notizia, Commento e lista
commenti;
Bugfix e limature su amministrazione
2016-02-29 18:44:22 +01:00

45 lines
1.1 KiB
PHP

<?php
class CommentoModel extends Model{
const STATUS_PENDING = 1;
const STATUS_ACCEPTED = 2;
const STATUS_REJECTED = 3;
public static $COMMENTO_STATUS = array(
self::STATUS_PENDING=>array("label"=>"Valutazione"),
self::STATUS_ACCEPTED=>array("label"=>"Accettata"),
self::STATUS_REJECTED=>array("label"=>"Respinta")
);
/**
* saveableObject deve avere alemeno il campo notizia = notiziaId;
* @param stdClass $saveableObject
* @throws CoreException
*/
public function __construct($saveableObject){
parent::__construct($saveableObject);
if (!$this->hasProperty("notizia") || strcmp($this->notizia,"")==0){
throw new CoreException("Impossible to build CommentoModel without field notizia");
}
if (!$this->hasProperty("user") || strcmp($this->user,"")==0){
throw new CoreException("Impossible to build CommentoModel without field user");
}
if (!$this->hasProperty("status") || strcmp($this->status,"")==0){
$this->status = self::STATUS_PENDING;
}
if (!$this->hasProperty("date")){
$this->date = new MongoDate();
}
}
public static function getCollectionName(){
return "commenti";
}
}
?>