Source for file class.contents.php
Documentation is available at class.contents.php
* @package linea21.modules
* @see workshop, publication
* @author linea21 <info@linea21.com>
* @license http://opensource.org/licenses/gpl-3.0.html
public function __call($method, $arguments)
$event = $this->dispatcher->notifyUntil(new sfEvent($this, 'contents.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();
* contents::CheckDataIntegrity()
* vérifie l'integrité d'un partie avant Insertion
* @param array $table contient les composants d'une partie
* @param string $type 'P', 'W'
* si verifié, sinon string 'message d'erreur'
if (strlen($table[0]) < 2) return _t('contents','no_title');
if (strlen($table[1]) < 10) return _t('contents','no_body');
* initialisation des tables SQL
* @param string $type : type du CONTENU 'WORKSHOP' ou 'PUBLICATION'
function _wichType($type)
* contents::AddContents()
* ajout d'une partie de contenu
* @param integer $ID identifiant du père (rattachement)
* @param array $contents_table tableau contenant les infos ressources
* @param string $type 'WORKSHOP' ou 'PUBLICATION'
* @return integer $last_id
function AddContents($ID, $contents_table, $type, $sql_object)
$contents_table= $sql_object->DBescape($contents_table);
if ($this->_wichType($type) == "error") exit;
if ($type == "WORKSHOP") {
$q.= " (workrepcon_title, workrepcon_body, workrepcon_date_crea, workrepcon_last_modify, workrepcon_validity)";
$q .= " VALUES('" . $this->WR_TITLE . "', '" . $this->WR_BODY . "', NOW(),NOW(), 'Y');";
if ($type == "PUBLICATION") {
$q.= " (publicon_title, publicon_body, publicon_date_crea, publicon_last_modify, publicon_validity)";
$q .= " VALUES('" . $this->P_TITLE . "', '" . $this->P_BODY . "', NOW(),NOW(), 'Y');";
$last_id = $sql_object->DBInsert ($q, 1);
$q = "INSERT INTO " . $this->TDB_LIAISON . " VALUES(" . $ID . "," . $last_id . ", '" . $this->ACTIVE_TYPE . "');";
$result = $sql_object->DBInsert ($q);
* contents::ModifyContents()
* modification d'une partie de contenu
* @param integer $ID : identifiant de la partie à modifier
* @param array $contents_table : tableau contenant les infos ressources
* @param string $type 'WORKSHOP' ou 'PUBLICATION'
* @param object $sql_object
* @return boolean $result
$contents_table= $sql_object->DBescape($contents_table);
if ($this->_wichType($type) == "error") exit;
if ($type == "WORKSHOP") $this->WR_ID = $ID;
if ($type == "PUBLICATION") $this->P_ID = $ID;
if ($type == "WORKSHOP") {
$q .= "workrepcon_title='" . $this->WR_TITLE . "', workrepcon_body='" . $this->WR_BODY . "', workrepcon_last_modify=NOW() WHERE workrepcon_id='" . $this->WR_ID . "';";
if ($type == "PUBLICATION") {
$q .= "publicon_title='" . $this->P_TITLE . "', publicon_body='" . $this->P_BODY . "', publicon_last_modify=NOW() WHERE publicon_id='" . $this->P_ID . "';";
$result = $sql_object->DBQuery($q);
* contents::changeRanges()
* @param array : Id (key) and ranges (value)
* @param object $sql_object
$field_id = 'publicon_id';
$field_range = 'publicon_range';
$field_id = 'workrepcon_id';
$field_range = 'workrepcon_range';
foreach ($array as $key => $value) {
$query = "UPDATE " . $table . " set ". $field_range. " ='". $value. "' WHERE ". $field_id. " ='" . $key . "';";
$result = $sql_object->DBQuery($query);
* contents::DeleteContents()
* suppression d'une partie
* @param integer $ID : identifiant du contents a supprimer
* @param string $type : 'WORKSHOP' ou 'PUBLICATION'
* @param object $sql_object
* @return boolean $result
if ($type == "WORKSHOP") {
$champ1 = "workrepcon_id";
$champ2 = "jwp_contents_id";
$champ3 = "workrepcon_validity";
$champ4 = "workrepcon_last_modify";
if ($type == "PUBLICATION") {
$champ2 = "jpp_contents_id";
$champ3 = "publicon_validity";
$champ4 = "publicon_last_modify";
if ($this->_wichType($type) == "error") return false;
$q = "UPDATE " . $this->ACTIVE_TABLE . " SET " . $champ3 . "='N', ". $champ4. "=NOW() WHERE " . $champ1 . "='" . $ID . "';";
$result = $sql_object->DBQuery($q);
|