]> _ Git - ccgm.git/commitdiff
wip #1769 @1.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 27 Nov 2017 17:42:06 +0000 (17:42 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 27 Nov 2017 17:42:06 +0000 (17:42 +0000)
framework/application/forms/CMS/Element/News.php [new file with mode: 0644]
framework/application/forms/CMS/Home.php
framework/application/forms/CMS/Sub/News/News.php [new file with mode: 0644]
framework/application/models/News.php [new file with mode: 0644]

diff --git a/framework/application/forms/CMS/Element/News.php b/framework/application/forms/CMS/Element/News.php
new file mode 100644 (file)
index 0000000..c633aec
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+class CCGM_Form_CMS_Element_News extends CubeIT_Form_Element_List {
+
+       public function init() {
+               parent::init();
+
+               $this->setBaseForm(new CCGM_Form_CMS_Sub_News_News());
+               $this->clearDecorators();
+       }
+
+}
index bcec11e9317bc5551ebabb42d95d83481481ad70..f63b747b67537322606b6024c0b2d3e25d72bf3f 100644 (file)
@@ -12,10 +12,14 @@ class CCGM_Form_CMS_Home extends CCGM_Form_CMS {
                $actualites = new CCGM_Form_CMS_Sub_Home_Actualites();
                $actualites->setLegend('Actualités');
                $this->addSubForm($actualites, 'actualites');
-               
-               $blocs=new CCGM_Form_CMS_Sub_Home_Blocs();
+
+               $blocs = new CCGM_Form_CMS_Sub_Home_Blocs();
                $blocs->setLegend('Blocs de présentation');
                $this->addSubForm($blocs, 'blocs');
+
+               $news = new CCGM_Form_CMS_Element_News('news_items');
+               $news->setLabel('Actualités');
+               $this->addElement($news);
        }
 
 }
diff --git a/framework/application/forms/CMS/Sub/News/News.php b/framework/application/forms/CMS/Sub/News/News.php
new file mode 100644 (file)
index 0000000..2c1a8fb
--- /dev/null
@@ -0,0 +1,41 @@
+<?php\r
+\r
+class CCGM_Form_CMS_Sub_News_News extends CubeIT_Form_List_Model {\r
+\r
+       public function init() {\r
+               parent::init();\r
+\r
+               $isCompactTrad = false;\r
+\r
+               $id = new CubeIT_Form_Element_Id();\r
+               $this->addElement($id);\r
+\r
+               $title = new Zend_Form_Element_Text('title');\r
+               $title->setLabel('Titre');\r
+               $this->addElement($title);\r
+\r
+               $date = new CubeIT_Form_Element_Date('date');\r
+               $date->setPrecision(Zend_Date::DAY);\r
+               $date->setLabel(__('Date'));\r
+               $this->addElement($date);\r
+\r
+               $image = new CubeIT_Form_Element_File_Image('image');\r
+               $image->setLabel('Image');\r
+               $image->setMaxItems(1);\r
+               $this->addElement($image);\r
+\r
+               $content = new CubeIT_Form_Element_Markitup_Basic('content');\r
+               $content->setLabel(__('Contents'));\r
+               $this->addElement($content);\r
+\r
+\r
+               $this->setListTitle(__('Actualités'));\r
+               $this->setNewTitle(__('Nouvelle actualité'));\r
+               $this->setEditTitle(__('Edition de l\'actualité « $date »'));\r
+               $this->setModel('CCGM_Model_News');\r
+               $this->setTitleColumn('title');\r
+               $this->setAdditionnalColumns(['date']);\r
+\r
+       }\r
+\r
+}\r
diff --git a/framework/application/models/News.php b/framework/application/models/News.php
new file mode 100644 (file)
index 0000000..9bd0e63
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+class CCGM_Model_News extends CubeIT_Model_Data_Table {
+
+       protected static $_table = 'news';
+       protected $date;
+       protected $content;
+       protected $link;
+       protected $image;
+       protected $title;
+
+       public static function getSchema($schema) {
+               $table = parent::getSchema($schema);
+               $table->addColumn('title', 'string', array('length' => 128));
+               $table->addColumn('date', 'datetime');
+               $table->addColumn('content', 'text');
+               $table->addColumn('link', 'text');
+               $table->addColumn('image', 'text');
+       }
+
+}
\ No newline at end of file