From c0fa227c1b4b3291907c2bc8446ae1683aa9f5b3 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 27 Nov 2017 17:42:06 +0000 Subject: [PATCH] wip #1769 @1.5 --- .../application/forms/CMS/Element/News.php | 12 ++++++ framework/application/forms/CMS/Home.php | 8 +++- .../application/forms/CMS/Sub/News/News.php | 41 +++++++++++++++++++ framework/application/models/News.php | 21 ++++++++++ 4 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 framework/application/forms/CMS/Element/News.php create mode 100644 framework/application/forms/CMS/Sub/News/News.php create mode 100644 framework/application/models/News.php diff --git a/framework/application/forms/CMS/Element/News.php b/framework/application/forms/CMS/Element/News.php new file mode 100644 index 0000000..c633aec --- /dev/null +++ b/framework/application/forms/CMS/Element/News.php @@ -0,0 +1,12 @@ +setBaseForm(new CCGM_Form_CMS_Sub_News_News()); + $this->clearDecorators(); + } + +} diff --git a/framework/application/forms/CMS/Home.php b/framework/application/forms/CMS/Home.php index bcec11e..f63b747 100644 --- a/framework/application/forms/CMS/Home.php +++ b/framework/application/forms/CMS/Home.php @@ -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 index 0000000..2c1a8fb --- /dev/null +++ b/framework/application/forms/CMS/Sub/News/News.php @@ -0,0 +1,41 @@ +addElement($id); + + $title = new Zend_Form_Element_Text('title'); + $title->setLabel('Titre'); + $this->addElement($title); + + $date = new CubeIT_Form_Element_Date('date'); + $date->setPrecision(Zend_Date::DAY); + $date->setLabel(__('Date')); + $this->addElement($date); + + $image = new CubeIT_Form_Element_File_Image('image'); + $image->setLabel('Image'); + $image->setMaxItems(1); + $this->addElement($image); + + $content = new CubeIT_Form_Element_Markitup_Basic('content'); + $content->setLabel(__('Contents')); + $this->addElement($content); + + + $this->setListTitle(__('Actualités')); + $this->setNewTitle(__('Nouvelle actualité')); + $this->setEditTitle(__('Edition de l\'actualité « $date »')); + $this->setModel('CCGM_Model_News'); + $this->setTitleColumn('title'); + $this->setAdditionnalColumns(['date']); + + } + +} diff --git a/framework/application/models/News.php b/framework/application/models/News.php new file mode 100644 index 0000000..9bd0e63 --- /dev/null +++ b/framework/application/models/News.php @@ -0,0 +1,21 @@ +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 -- 2.39.5