Changeset 2942

Show
Ignore:
Timestamp:
07/23/08 17:00:42 (3 months ago)
Author:
gcroes
Message:

En cours, pour les tests

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/project/modules/devel/cms3/heading/classes/headingelementinformationservices.class.php

    r2936 r2942  
    2626     */ 
    2727    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; 
    3242    } 
    3343     
     
    5666    public function fillMissing ($pHEI){ 
    5767        //Dates de mises à jour 
    58         $date = date (CopixI18N::getDateTimeFormat ()); 
     68        $date = date ('YmdHis'); 
    5969        if (!isset ($pHEI->date_create_hei)){ 
    6070            $pHEI->date_create_hei = $date; 
     
    106116            $pHEI->version_hei = 0; 
    107117        } 
    108         if (!isset ($pHEI->fromversion_hei)){ 
    109             $pHEI->fromversion_hei = 0; 
     118        if (!isset ($pHEI->from_version_hei)){ 
     119            $pHEI->from_version_hei = 0; 
    110120        } 
    111121         
     
    114124            $pHEI->show_in_menu_hei = 0;             
    115125        } 
    116          
    117126    } 
    118127     
     
    124133        if (!isset ($pHEI->public_id_hei)){ 
    125134            $pHEI->public_id_hei = $pHEI->id_hei; 
    126             _dao ('heading|headingelementinformation')->update ($pHEI); 
     135            _dao ('headingelementinformation')->update ($pHEI); 
    127136            return true; 
    128137        } 
     
    138147    public function getNextVersion ($pPublicId) { 
    139148        $parameters = _daoSp ()->addCondition ('public_id_hei', '=', $pPublicId) 
    140                                ->orderby(array('version_hei', 'DESC')) 
     149                               ->orderby (array('version_hei', 'DESC')) 
    141150                               ->setLimit (0, 1); 
    142151        $results = _dao('headingelementinformation')->findBy ($parameters); 
     
    147156     
    148157    /** 
    149      *  
    150      * 
    151158     * @param unknown_type $pId 
    152159     */ 
     
    155162        $parameters = _daoSp ()->addCondition ('id_helt', '=', $pId); 
    156163        if (_dao('headingelementinformation')->findBy ($parameters) !== false) { 
    157             return HeadingServices::getPathFromId($pId);  
     164            return HeadingServices::getPathFromId ($pId);  
    158165        } 
    159166    }    
    160167 
    161168    /** 
    162      *  
    163      * 
    164169     * @param unknown_type $pId 
    165170     */ 
  • trunk/project/modules/devel/cms3/heading/classes/headingelementtype.class.php

    r2940 r2942  
    2424     * Retourne le libellé du type de contenu d'identifiant $id 
    2525     * 
    26      * @param String $id : identifiant du type 
    27      * @return String : libellé 
     26     * @param string $id identifiant du type 
     27     * @return string libellé 
    2828     */ 
    2929    static public function getCaption ($id) { 
  • trunk/project/modules/devel/cms3/heading/classes/headingparameterservices.class.php

    r2939 r2942  
    99 */ 
    1010 
    11 _classInclude('heading|HeadingException'); 
    12 _classInclude('heading|HeadingParameter'); 
     11_classInclude ('heading|HeadingException'); 
     12_classInclude ('heading|HeadingParameter'); 
    1313 
    1414// Service de gestion des paramètres 
  • trunk/project/modules/devel/cms3/heading/classes/headingservices.class.php

    r2937 r2942  
    2020        CopixDB::begin (); 
    2121        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); 
    2329            $record->id_helt = $record->id_head; 
    2430            $record->type_hei = 'heading'; 
     31            $record->parent_heading_public_id_hei = $parentPublicId; 
     32            $record->caption_hei = $pHeadingDescription->caption_hei; 
    2533 
    2634            //dans $record->id_hei on a le nouvel identifiant 
    2735            _class ('heading|headingelementinformationservices')->insert ($record); 
    28              
     36 
    2937            //on met maintenant a jour l'élément $record avec les informations publiques mises à jour 
    3038            _dao ('heading')->update ($record); 
    3139 
     40            //Application des changements 
     41            _ppo ($record)->saveIn ($pHeadingDescription); 
    3242        }catch (CopixException $e){ 
    3343            CopixDB::rollback (); 
     
    3545        } 
    3646        CopixDB::commit (); 
    37     } 
    38  
    39     public function createRecordFromObject ($pInformations){ 
    40         return _record ('heading')->initFromDbObject (_rPPO ($pInformations)); 
    4147    } 
    4248 
  • trunk/project/modules/devel/cms3/heading/install/scripts/install.pdo_mysql.sql

    r2938 r2942  
    22  `id_head` int(11) NOT NULL auto_increment, 
    33  `public_id_hei` int(11) default NULL, 
    4   `parent_id_head` int(11) default NULL, 
    54  `description_head` text, 
    65  PRIMARY KEY  (`id_head`) 
    7 ) AUTO_INCREMENT=1
     6) AUTO_INCREMENT=0
    87 
    98CREATE TABLE IF NOT EXISTS `headingelementinformation` ( 
     
    1312  `public_id_hei` int(11) default NULL, 
    1413  `site_id_hei` varchar(255) NOT NULL, 
    15   `public_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)
    1918  `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)
    2322  `date_update_hei` datetime NOT NULL, 
    2423  `comment_hei` text, 
     
    3635  `theme_id_hei` int(11) default NULL, 
    3736  PRIMARY KEY  (`id_hei`) 
    38 ) AUTO_INCREMENT=1 ; 
     37) AUTO_INCREMENT=0 ; 
     38 
     39INSERT 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  
    1515    public function testGetPathFromId () { 
    1616        CopixClassesFactory::fileInclude('heading|headingservices'); 
    17         $this->assertTrue(HeadingServices::getPathFromId(8) !== null); 
     17        $this->assertTrue(HeadingServices::getPathFromId (8) !== null); 
    1818    } 
    1919     
     
    2424    public function testGetPathFromPublicId () { 
    2525        CopixClassesFactory::fileInclude('heading|headingservices'); 
    26         $this->assertTrue(HeadingServices::getPathFromPublicId(85) !== null); 
     26        $this->assertTrue(HeadingServices::getPathFromPublicId (85) !== null); 
    2727    } 
    2828} 
  • trunk/project/modules/devel/cms3/heading/tests/heading_headingtest.class.php

    r2915 r2942  
    1515    public function testCreationRubrique (){ 
    1616        //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'; 
    2021        _class ('heading|headingservices')->insert ($ppo); 
     22 
    2123        $this->assertFalse ($ppo->public_id_hei === null); 
    2224        $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))); 
    2626    } 
    2727     
     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 
    2850    public function testModificationRubrique (){ 
    2951    }