Source for file class.project.php
Documentation is available at class.project.php
* @package linea21.modules
* @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, 'project.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();
* @param int $m chiffre des mois
* @param int $d chiffre des jours
* @param int $y chiffre des années
* @return string $format_date
function _getDate($m = 0, $d = 0, $y = 0)
$format_date = strftime('%Y-%m-%d %H:%M:%S', $format_date);
* project::CheckDataIntegrity()
* Vérification intégrité des données
* @param array $table : contient les composants Nécessaires d'un projet
* si verifié, sinon string 'message d'erreur'
if (strlen($table[0]) < 3) return _t('project','no_name');
if (strlen($table[1]) < 3) return _t('project','no_description');
if (strlen($table[2]) < 3) return _t('project','no_body');
if ($table[5] <= 0 || !is_numeric($table[5])) return _t('project','no_priority');
if ($table[4] <= 0 || !is_numeric($table[4])) return _t('project','no_scale');
if(!is_numeric($table[14]) || $table[14]> 100 || $table[14]< 0 ) return _t('project','progression_error');
* @param array $table_project : contient les composants d'un projet
* @param object $sql_object
* @return integer $last_id
$table_project= $sql_object->DBescape($table_project);
if ($table_project[0] != '') {
if ($table_project[1] != '') {
if ($table_project[2] != '') {
if (is_numeric($table_project[3]) && $table_project[3] != - 1) {
if ($table_project[6] != '') {
if ($table_project[7] != '') {
if ($table_project[8] != '') {
if ($table_project[10] != '') {
if (is_numeric($table_project[11]) && $table_project[11] != - 1) {
if (is_numeric($table_project[12]) && $table_project[12] != - 1) {
$this->SDI = $table_project[13];
$query = "INSERT INTO " . $this->TDB_PROJECT . " (project_name, project_description, project_body, ".
"project_parent_id, project_priority_id, project_scale_id, " .
"project_begin_date, project_estimated_date, project_end_date, ".
"project_completed, project_theme_id, project_workshop_id, ".
"project_posted_by, project_published_date, " .
"project_statut, project_date_crea) " .
$this->ID = $sql_object->DBInsert ($query, 1);
$this->_addSDI($sql_object);
* project::DeleteProject()
* suppression d'un projet
* @param int $ID : identifiant du projet
* @param object $sql_object
$query = "UPDATE " . $this->TDB_PROJECT . " set project_statut='E', project_last_modify=NOW() WHERE project_id='" . $this->ID . "';";
$result = $sql_object->DBQuery($query);
$query = "DELETE FROM " . J_PROJECT_SDI . " WHERE jps_project_id='". $this->ID. "';";
$res = $sql_object->DBQuery($query);
$query = "UPDATE " . $this->TDB_PROJECT . " set project_parent_id=0 WHERE project_parent_id='" . $this->ID . "';";
$result = $sql_object->DBQuery($query);
* project::ModifyProject()
* modification d'un projet
* @param integer $ID : identifiant du projet
* @param object $sql_object
* @param array $table_project : contient les composants d'un projet
* @return boolean $result
$table_project= $sql_object->DBescape($table_project);
if ($table_project[0] != '') {
if ($table_project[1] != '') {
if ($table_project[2] != '') {
if (is_numeric($table_project[3]) && $table_project[3] != - 1) {
if ($table_project[6] != '') {
if ($table_project[7] != '') {
if ($table_project[8] != '') {
if ($table_project[9] != '') {
if (is_numeric($table_project[11]) && $table_project[11] != - 1) {
if (is_numeric($table_project[12]) && $table_project[12] != - 1) {
$this->SDI = $table_project[13];
$mask = $this->_HavePublishedDate($table_project[10]);
$query = "UPDATE " . $this->TDB_PROJECT . " SET project_name='" . $this->NAME . "', project_description='" . $this->DESCRIPTION. "', project_body='" . $this->BODY . "' , project_parent_id='" . $this->PARENT_ID . "', project_scale_id='" . $this->SCALE_ID . "', project_theme_id='" . $this->THEME_ID . "', project_workshop_id='" . $this->WORKSHOP_ID . "', project_priority_id='" . $this->PRIORITY_ID . "', project_begin_date='" . $this->BEGIN_DATE . "', project_estimated_date='" . $this->ESTIMATED_DATE . "', project_end_date='". $this->END_DATE. "', project_completed=". $this->COMPLETED. ", project_statut='" . $this->STATUT . "', project_last_modify=NOW() " . $mask . " WHERE project_id='" . $this->ID . "';";
$result = $sql_object->DBQuery($query);
$result = $this->_modifySDI($sql_object);
* project::changeRanges()
* @param array : Id (key) and ranges (value)
* @param object $sql_object
foreach ($array as $key => $value) {
$query = "UPDATE " . $this->TDB_PROJECT . " set project_range='". $value. "' WHERE project_id='" . $key . "';";
$result = $sql_object->DBQuery($query);
* associate indicators to project
function _addSDI($sql_object) {
foreach ($this->SDI as &$value) {
$query = "INSERT INTO ". J_PROJECT_SDI . " VALUES(". $this->ID. ", ". $value. ");";
$result = $sql_object->DBQuery($query);
* associate indicators to project
function _modifySDI($sql_object) {
$query = "DELETE FROM " . J_PROJECT_SDI . " WHERE jps_project_id='". $this->ID. "';";
$result = $sql_object->DBQuery($query);
$result = $this->_addSDI($sql_object);
* project::_HavePublishedDate()
* Détermine la date de publication a inserer dans la bdd
* @param string $current_status : statut actuel de l'actualité
* @return string $sql_mask
function _HavePublishedDate($current_status)
if ($current_status == 'D') $sql_mask = ", project_published_date= NOW()";
$sql_mask = ", project_published_date= '0001-01-01'";
|