Source for file class.level.php
Documentation is available at class.level.php
* @package linea21.modules
* @author linea21 <info@linea21.com>
* @license http://opensource.org/licenses/gpl-3.0.html
var $URI_INPUT = "level/visual/"; // dossier racine de stockage des photos
var $UPLOAD_MAX_MO = UPLOAD_MAX_MO; // taille maximale d'upload des photos en octets
public function __call($method, $arguments)
$event = $this->dispatcher->notifyUntil(new sfEvent($this, 'level.extensible_function', array(
'arguments' => $arguments
if (!$event->isProcessed())
throw new Exception(sprintf('Call to undefined method %s::%s.', get_class($this), $method));
return $event->getReturnValue();
* level::CheckDataIntegrity()
* vérifie l'integrité des données d'un niveau
* @param array $table_level : contient les composants d'un niveau
* @param object $sql_object
* si verifié, sinon string 'message d'erreur'
if (strlen($table_level[0]) < 2) return _t('level','object_notdenomination');
* @param array $table_level contient les composants d'un niveau
* @param object $sql_object
* @return integer $last_id
function AddLevel($table_level, $sql_object)
$table_level= $sql_object->DBescape($table_level);
if ($table_level[0] != '') {
if ($table_level[1] != '') {
$this->RANGE = $table_level[4];
if ($table_level[5] != '') {
switch ($table_level[5]) {
$this->STATUT = $table_level[5];
$this->STATUT = $table_level[5];
$requete = "INSERT INTO " . $this->TDB_LEVEL . " (level_name, level_description, level_comment, level_visual_identity, " . "level_range, level_statut, level_date_crea) " . "VALUES('" . $this->NAME . "', '" . $this->DESCRIPTION . "', '" . $this->COMMENT . "', '" . $this->VISUAL_URI . "', " . $this->RANGE . ", '" . $this->STATUT . "', NOW());";
$last_id = $sql_object->DBInsert ($requete, 1);
* modification d'un niveau
* @param int $id identifiant niveau a modifier
* @param array $table_level contient les composants d'un niveau
* @param object $sql_object
$table_level= $sql_object->DBescape($table_level);
if ($table_level[0] != '') {
if ($table_level[1] != '') {
$this->RANGE = $table_level[4];
if ($table_level[5] != '') {
switch ($table_level[5]) {
$this->STATUT = $table_level[5];
$this->STATUT = $table_level[5];
$requete = "UPDATE " . $this->TDB_LEVEL . " set level_name='" . $this->NAME . "', level_description='" . $this->DESCRIPTION . "' , level_comment='" . $this->COMMENT . "', level_visual_identity='" . $this->VISUAL_URI . "',level_range=" . $this->RANGE . ", level_statut='" . $this->STATUT . "', level_last_modify=NOW() WHERE level_id=" . $this->ID . ";";
$result = $sql_object->DBQuery($requete);
* modification du statut d'un niveau
* -- NE PREND PAS EN CHARGE l'EFFACEMENT --
* @param int $ID identifiant du niveau
* @param string $state 'P' Public | 'D' Draft/
* @param object $sql_object
$requete = "UPDATE " . $this->TDB_LEVEL . " set level_statut='" . $this->STATUT . "' WHERE level_id=" . $this->ID . ";";
$result = $sql_object->DBQuery($requete);
* suppression d'un niveau
* -- NON IMPLEMENTEE/NON TESTEE DANS L'APPLICATION --
* @param int $ID identifiant du niveau
* @param object $sql_object
* @param string $type type : 'MASS_DELETE' toutes les ressources associées à l'échelle sont rendues inactives
* 'MASS_MODIFY' remplacement de l'ancienne échelle par $ID_new
* @param int $ID_new identifiant du nouveau niveau a rattacher
* @return object $affected
function DeleteLevel($ID, $sql_object, $type, $ID_new = - 1)
if ($type == 'MASS_MODIFY') {
$requete = "UPDATE " . $this->TDB_LEVEL . " set level_statut='E', level_last_modify=NOW() WHERE level_id=" . $this->ID . ";";
$result = $sql_object->DBQuery($requete);
$requete_news = "UPDATE " . T_NEWS . " set news_level=" . $ID_new . " WHERE news_level=" . $this->ID . ";";
$result = $sql_object->DBQuery($requete_news);
$affected += $sql_object->DBaffectedRow();
$requete_publication = "UPDATE " . T_PUBLI . " set publi_level=" . $ID_new . " WHERE publi_level=" . $this->ID . ";";
$result = $sql_object->DBQuery($requete_publication);
$affected += $sql_object->DBaffectedRow();
if ($type == 'MASS_DELETE') {
$requete = "UPDATE " . $this->TDB_LEVEL . " set level_statut='E', level_last_modify=NOW() WHERE level_id=" . $this->ID . ";";
$result = $sql_object->DBQuery($requete);
$requete_news = "UPDATE " . T_NEWS . " set news_statut='E' WHERE news_level=" . $this->ID . ";";
$result = $sql_object->DBQuery($requete_news);
$affected += $sql_object->DBaffectedRow();
$requete_publication = "UPDATE " . T_PUBLI . " set publi_statut='E' WHERE publi_level=" . $this->ID . ";";
$result = $sql_object->DBQuery($requete_publication);
$affected += $sql_object->DBaffectedRow();
|