Changeset 2942
- Timestamp:
- 07/23/08 17:00:42 (3 months ago)
- Files:
-
- trunk/project/modules/devel/cms3/heading/classes/headingelementinformationservices.class.php (modified) (8 diffs)
- trunk/project/modules/devel/cms3/heading/classes/headingelementtype.class.php (modified) (1 diff)
- trunk/project/modules/devel/cms3/heading/classes/headingparameterservices.class.php (modified) (1 diff)
- trunk/project/modules/devel/cms3/heading/classes/headingservices.class.php (modified) (2 diffs)
- trunk/project/modules/devel/cms3/heading/install/scripts/install.pdo_mysql.sql (modified) (3 diffs)
- trunk/project/modules/devel/cms3/heading/tests/heading_headingservicestest.class.php (modified) (2 diffs)
- trunk/project/modules/devel/cms3/heading/tests/heading_headingtest.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/project/modules/devel/cms3/heading/classes/headingelementinformationservices.class.php
r2936 r2942 26 26 */ 27 27 public function insert ($pHeadingElementInformation){ 28 $this->fillMissing ($pHeadingElementInformation); 29 _dao ('headingelementinformation')->insert ($pHeadingElementInformation); 30 $this->_updatePublicIdIfMissing ($pHeadingElementInformation); 31 return $pHeadingElementInformation->public_id_hei; 28 //création d'un record pour les opération de sauvegarde 29 $record = _record ('headingelementinformation')->initFromDbObject ($pHeadingElementInformation); 30 31 //insertion de l'objet 32 $this->fillMissing ($record); 33 _dao ('headingelementinformation')->insert ($record); 34 $this->_updatePublicIdIfMissing ($record); 35 36 //afin que toutes les données ajoutées / maj durant le processus soient disponibles 37 //a la sortie de la méthode, applique les changements survenus 38 _ppo ($record)->saveIn ($pHeadingElementInformation); 39 40 //retour de l'identifiant public 41 return $record->public_id_hei; 32 42 } 33 43 … … 56 66 public function fillMissing ($pHEI){ 57 67 //Dates de mises à jour 58 $date = date ( CopixI18N::getDateTimeFormat ());68 $date = date ('YmdHis'); 59 69 if (!isset ($pHEI->date_create_hei)){ 60 70 $pHEI->date_create_hei = $date; … … 106 116 $pHEI->version_hei = 0; 107 117 } 108 if (!isset ($pHEI->from version_hei)){109 $pHEI->from version_hei = 0;118 if (!isset ($pHEI->from_version_hei)){ 119 $pHEI->from_version_hei = 0; 110 120 } 111 121 … … 114 124 $pHEI->show_in_menu_hei = 0; 115 125 } 116 117 126 } 118 127 … … 124 133 if (!isset ($pHEI->public_id_hei)){ 125 134 $pHEI->public_id_hei = $pHEI->id_hei; 126 _dao ('heading |headingelementinformation')->update ($pHEI);135 _dao ('headingelementinformation')->update ($pHEI); 127 136 return true; 128 137 } … … 138 147 public function getNextVersion ($pPublicId) { 139 148 $parameters = _daoSp ()->addCondition ('public_id_hei', '=', $pPublicId) 140 ->orderby (array('version_hei', 'DESC'))149 ->orderby (array('version_hei', 'DESC')) 141 150 ->setLimit (0, 1); 142 151 $results = _dao('headingelementinformation')->findBy ($parameters); … … 147 156 148 157 /** 149 *150 *151 158 * @param unknown_type $pId 152 159 */ … … 155 162 $parameters = _daoSp ()->addCondition ('id_helt', '=', $pId); 156 163 if (_dao('headingelementinformation')->findBy ($parameters) !== false) { 157 return HeadingServices::getPathFromId ($pId);164 return HeadingServices::getPathFromId ($pId); 158 165 } 159 166 } 160 167 161 168 /** 162 *163 *164 169 * @param unknown_type $pId 165 170 */ trunk/project/modules/devel/cms3/heading/classes/headingelementtype.class.php
r2940 r2942 24 24 * Retourne le libellé du type de contenu d'identifiant $id 25 25 * 26 * @param String $id :identifiant du type27 * @return String :libellé26 * @param string $id identifiant du type 27 * @return string libellé 28 28 */ 29 29 static public function getCaption ($id) { trunk/project/modules/devel/cms3/heading/classes/headingparameterservices.class.php
r2939 r2942 9 9 */ 10 10 11 _classInclude ('heading|HeadingException');12 _classInclude ('heading|HeadingParameter');11 _classInclude ('heading|HeadingException'); 12 _classInclude ('heading|HeadingParameter'); 13 13 14 14 // Service de gestion des paramètres trunk/project/modules/devel/cms3/heading/classes/headingservices.class.php
r2937 r2942 20 20 CopixDB::begin (); 21 21 try { 22 _dao ('heading')->insert ($record = $this->createRecordFromObject ($pHeadingDescription)); 22 //récupération de la rubrique parente 23 $parentPublicId = 0; 24 25 //création de l'enregistrement 26 $record = _record ('heading')->initFromDbObject (_ppo ($pHeadingDescription)); 27 28 _dao ('heading')->insert ($record); 23 29 $record->id_helt = $record->id_head; 24 30 $record->type_hei = 'heading'; 31 $record->parent_heading_public_id_hei = $parentPublicId; 32 $record->caption_hei = $pHeadingDescription->caption_hei; 25 33 26 34 //dans $record->id_hei on a le nouvel identifiant 27 35 _class ('heading|headingelementinformationservices')->insert ($record); 28 36 29 37 //on met maintenant a jour l'élément $record avec les informations publiques mises à jour 30 38 _dao ('heading')->update ($record); 31 39 40 //Application des changements 41 _ppo ($record)->saveIn ($pHeadingDescription); 32 42 }catch (CopixException $e){ 33 43 CopixDB::rollback (); … … 35 45 } 36 46 CopixDB::commit (); 37 }38 39 public function createRecordFromObject ($pInformations){40 return _record ('heading')->initFromDbObject (_rPPO ($pInformations));41 47 } 42 48 trunk/project/modules/devel/cms3/heading/install/scripts/install.pdo_mysql.sql
r2938 r2942 2 2 `id_head` int(11) NOT NULL auto_increment, 3 3 `public_id_hei` int(11) default NULL, 4 `parent_id_head` int(11) default NULL,5 4 `description_head` text, 6 5 PRIMARY KEY (`id_head`) 7 ) AUTO_INCREMENT= 1;6 ) AUTO_INCREMENT=0 ; 8 7 9 8 CREATE TABLE IF NOT EXISTS `headingelementinformation` ( … … 13 12 `public_id_hei` int(11) default NULL, 14 13 `site_id_hei` varchar(255) NOT NULL, 15 `p ublic_id_heading_hei` int(11) NOT NULL,16 `author_id_create_hei` varchar(255) NOT NULL,17 `author_handler_create_hei` varchar(255) NOT NULL,18 `author_caption_create_hei` varchar(255) NOT NULL,14 `parent_heading_public_id_hei` int(11) NOT NULL, 15 `author_id_create_hei` varchar(255), 16 `author_handler_create_hei` varchar(255), 17 `author_caption_create_hei` varchar(255), 19 18 `date_create_hei` datetime NOT NULL, 20 `author_id_update_hei` varchar(255) NOT NULL,21 `author_handler_udpate_hei` varchar(255) NOT NULL,22 `author_caption_update_hei` varchar(255) NOT NULL,19 `author_id_update_hei` varchar(255), 20 `author_handler_udpate_hei` varchar(255), 21 `author_caption_update_hei` varchar(255), 23 22 `date_update_hei` datetime NOT NULL, 24 23 `comment_hei` text, … … 36 35 `theme_id_hei` int(11) default NULL, 37 36 PRIMARY KEY (`id_hei`) 38 ) AUTO_INCREMENT=1 ; 37 ) AUTO_INCREMENT=0 ; 38 39 INSERT INTO `heading` (`id_head`, `public_id_hei`, `parent_id_head`, `description_head`) VALUES 40 (0, 0, NULL, NULL); trunk/project/modules/devel/cms3/heading/tests/heading_headingservicestest.class.php
r2936 r2942 15 15 public function testGetPathFromId () { 16 16 CopixClassesFactory::fileInclude('heading|headingservices'); 17 $this->assertTrue(HeadingServices::getPathFromId (8) !== null);17 $this->assertTrue(HeadingServices::getPathFromId (8) !== null); 18 18 } 19 19 … … 24 24 public function testGetPathFromPublicId () { 25 25 CopixClassesFactory::fileInclude('heading|headingservices'); 26 $this->assertTrue(HeadingServices::getPathFromPublicId (85) !== null);26 $this->assertTrue(HeadingServices::getPathFromPublicId (85) !== null); 27 27 } 28 28 } trunk/project/modules/devel/cms3/heading/tests/heading_headingtest.class.php
r2915 r2942 15 15 public function testCreationRubrique (){ 16 16 //création d'une rubrique test 17 $ppo = _rPPO (); 18 $ppo->parent_id_head = 0;//rubrique parente = rubrique racine 19 $ppo->description_head = 'Rubrique testée unitairement'; 17 $ppo = _ppo (); 18 $ppo->parent_heading_public_id_hei = 0;//rubrique parente = rubrique racine 19 $ppo->caption_hei = 'Rubrique testée '.date ('YmdHis'); 20 $ppo->description_head = 'Ceci est une rubrique testée unitairement, et ceci constitue la description longue de mon élément'; 20 21 _class ('heading|headingservices')->insert ($ppo); 22 21 23 $this->assertFalse ($ppo->public_id_hei === null); 22 24 $this->assertFalse ($ppo->id_head === null); 23 24 25 $this->assertTrue (is_object ($heading = _dao ('heading')->get ($ppo->id_head))); 25 $this->assertTrue (is_object (_dao ('heading')->get ($ppo->id_head))); 26 26 } 27 27 28 public function creationArbo (){ 29 $r1 = _ppo (array ('parent_heading_public_id_hei'=>0, 30 'caption_hei'=>'R2' 31 )); 32 _class ('heading|headingservices')->insert ($r1); 33 34 $r2 = _ppo (array ('parent_heading_public_id_hei'=>0, 35 'caption_hei'=>'R2' 36 )); 37 _class ('heading|headingservices')->insert ($r2); 38 39 $r3 = _ppo (array ('parent_heading_public_id_hei'=>0, 40 'caption_hei'=>'R3' 41 )); 42 _class ('heading|headingservices')->insert ($r3); 43 44 $r11 = _ppo (array ('parent_heading_public_id_hei'=>$r1->public_id_hei, 45 'caption_hei'=>'R11' 46 )); 47 _class ('heading|headingservices')->insert ($r11); 48 } 49 28 50 public function testModificationRubrique (){ 29 51 }
