]> _ Git - ccgm.git/commitdiff
WIP #2340 @6.75
authorstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 30 Jan 2019 17:01:38 +0000 (17:01 +0000)
committerstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 30 Jan 2019 17:01:38 +0000 (17:01 +0000)
framework/application/Bootstrap.php
framework/application/controllers/ResearchCategoriesController.php [new file with mode: 0644]
framework/application/forms/CMS/Element/ResearchStudies.php [new file with mode: 0644]
framework/application/forms/CMS/Research.php
framework/application/forms/CMS/ResearchStudies.php [new file with mode: 0644]
framework/application/forms/CMS/Sub/Research/Studies.php [deleted file]
framework/application/forms/CMS/Sub/Research/Study.php [deleted file]
framework/application/views/scripts/research-categories/index.phtml [new file with mode: 0644]
framework/application/views/scripts/templates/research.phtml

index 591388b4a8107f003c404d4a2b16483b1613889c..2f9008c8d8bdaddb56acd11ec96cf0aeb85db332 100644 (file)
@@ -68,7 +68,6 @@ class Bootstrap extends CubeIT_Bootstrap {
                $templates['Recherche clinique'] = array(
                    //'listing' => 'Listing',
                    'research' => 'Recherche clinique',
-                   'researchStudies' => 'Études cliniques',
         );
                $templates['Parcours patient'] = array('parcours' => 'Parcours', 'soins' => 'Soins support');
                $templates['Traitements'] = array('traitement' => 'Traitement (Texte avec accordéon)');
@@ -87,6 +86,62 @@ class Bootstrap extends CubeIT_Bootstrap {
                return $templates;
        }
 
+
+    protected function _makeNavigationOnePage(&$navigation, $r, $t, $isAdmin, $locale = false) {
+        $page = parent::_makeNavigationOnePage($navigation, $r, $t, $isAdmin, $locale);
+
+        if (!$page) {
+            return;
+        }
+
+        if ($page->getTemplate() == 'research') {
+            $this->addResearchCategoriesPages($page, $locale, $isAdmin);
+        }
+    }
+
+
+    /**
+     *
+     * @param CubeIT_Navigation_Page_Locale $page
+     */
+    protected function addResearchCategoriesPages($page, $locale, $isAdmin) {
+        //$datas = $this->getCMSDatasOfNavigationPage($page);
+
+        // How the URLs should be formed for the research category pages
+        $URL_template = '/Recherche-clinique/%name%'; // Important: must have leading slash or pages will show as not found!
+
+        $db = Zend_Db_Table::getDefaultAdapter();
+        $s = $db->select()->from('research_categories')
+            ->order('id ASC');
+        $q = $s->query();
+
+        while ($r = $q->fetch()) {
+
+            //$r = CubeIT_Util_Cms::unserialize($r, $locale);
+            if ($r->name == '') {
+                continue;
+            }
+
+            $online = true;
+
+            $pageTitle = sprintf(__('Essais sur les cancers en %s'), strtolower($r->name));
+
+            $p = new CubeIT_Navigation_Page_Locale();
+            $p->setController('ResearchCategories');
+            $p->setId($page->getId() . '/' . $r->id);
+            //$p->setAutoUri($r, $datas['seourl_stu'], $page->getLocale());
+            $p->setAutoUri($r, $URL_template);
+            $p->setSitemap($online);
+            $p->setTitle($pageTitle);
+            $p->setEditable(false);
+            $p->setParams(array('research_category_id' => $r->id));
+            $p->setOnline($online);
+            $p->setDomain($page->getDomain());
+            $p->setLabel($pageTitle); // Used in breadcrumbs + sidebar menu
+            $page->addPage($p);
+        }
+    }
+
        protected function _makeURL($r, $seoUrl, $locale, $title, $parent, $isAdmin) {
                if ($locale) {
                        $navLocales = $this->getNavigationLocales($isAdmin);
diff --git a/framework/application/controllers/ResearchCategoriesController.php b/framework/application/controllers/ResearchCategoriesController.php
new file mode 100644 (file)
index 0000000..7bac7c2
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+
+class ResearchCategoriesController extends CubeIT_Controller_PageController {
+
+    public function indexAction() {
+
+        $parent = $this->view->currentPage->getParent();
+        $parent_data = $this->getBootstrap()->getCMSDatasOfNavigationPage($parent);
+        $this->view->datas = $parent_data;
+
+        // Todo: inner join for category name etc?
+
+        $db = Zend_Db_Table::getDefaultAdapter();
+        $s = $db->select()->from('research_studies')
+            ->order('id DESC')
+            ->where('category = ?', $this->getRequest()->getParam('research_category_id'));
+        $q = $s->query();
+
+//        if (!$q->rowCount()) {
+//            $this->_404();
+//            return;
+//        }
+
+//        $r = CubeIT_Util_Cms::unserialize($q->fetch());
+        $this->view->parent_title = $parent_data['shortTitle'];
+        $this->view->sidebar = $parent_data['sidebar'];
+//        $this->view->titre = $r->titre;
+        $this->view->studies = $q->fetchAll();
+    }
+
+}
diff --git a/framework/application/forms/CMS/Element/ResearchStudies.php b/framework/application/forms/CMS/Element/ResearchStudies.php
new file mode 100644 (file)
index 0000000..c7a3508
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+class CCGM_Form_CMS_Element_ResearchStudies extends CubeIT_Form_Element_List {
+
+    public function init() {
+        parent::init();
+
+        $this->setBaseForm(new CCGM_Form_CMS_ResearchStudies());
+        $this->clearDecorators();
+    }
+
+}
index 1e9e315262d9b252685c611c9c91ecc42f7d676b..540ce159dab4372bbcac81fba18b2ce624f416ea 100644 (file)
@@ -4,8 +4,8 @@ class CCGM_Form_CMS_Research extends CCGM_Form_CMS_Text {
        public function init() {\r
                parent::init();\r
 \r
-               $studies = new CCGM_Form_CMS_Sub_Research_Studies();\r
-               $studies->setLegend('Études Cliniques');\r
-               $this->addSubForm($studies, 'studies');\r
+               $studies = new CCGM_Form_CMS_Element_ResearchStudies('studies');\r
+               $studies->setLabel('Gestion des études cliniques');\r
+               $this->addElement($studies);\r
        }\r
 }\r
diff --git a/framework/application/forms/CMS/ResearchStudies.php b/framework/application/forms/CMS/ResearchStudies.php
new file mode 100644 (file)
index 0000000..622a53c
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+
+class CCGM_Form_CMS_ResearchStudies extends CubeIT_Form_List_Model {
+
+    public function init() {
+        parent::init();
+
+        $id = new CubeIT_Form_Element_Id();
+        $this->addElement($id);
+
+        $title = new Zend_Form_Element_Text('title');
+        $title->setLabel('Titre');
+        $this->addElement($title);
+
+        $code = new CubeIT_Form_Element_Markitup('description');
+        $code->setLabel('Description');
+        $this->addElement($code);
+
+        $localisation = new CCGM_Form_CMS_Element_ResearchCategories('category');
+        $localisation->setLabel('Localisation');
+        $this->addElement($localisation);
+
+        $pathology = new Zend_Form_Element_Textarea('pathology');
+        $pathology->setLabel('Pathologie');
+        $this->addElement($pathology);
+
+        $investigator = new Zend_Form_Element_Text('investigator');
+        $investigator->setLabel('Investigateur');
+        $this->addElement($investigator);
+
+        $specialities = new CCGM_Form_CMS_Element_ResearchSpecialities('specialities');
+        $specialities->setLabel('Spécialités');
+        $this->addElement($specialities);
+
+        $this->setListTitle(__('Études Cliniques'))
+             ->setNewTitle(__('Créer une étude'))
+             ->setEditTitle(sprintf(__("Edition de l'étude « %s »"), '$name'))
+             ->setTitleColumn('title')
+             ->setModel('CCGM_Model_ResearchStudy');
+    }
+
+}
diff --git a/framework/application/forms/CMS/Sub/Research/Studies.php b/framework/application/forms/CMS/Sub/Research/Studies.php
deleted file mode 100644 (file)
index 8b17600..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-class CCGM_Form_CMS_Sub_Research_Studies extends CubeIT_Form_Multi_SubForm {
-
-    public function init() {
-        parent::init();
-
-        $study = new CCGM_Form_CMS_Sub_Research_Study();
-        $this->setBaseSubForm($study);
-        $this->setBaseLegend('Edition de l\'étude « $title »');
-        $this->setNewLegend('Nouvelle étude');
-    }
-
-}
diff --git a/framework/application/forms/CMS/Sub/Research/Study.php b/framework/application/forms/CMS/Sub/Research/Study.php
deleted file mode 100644 (file)
index 91c9a45..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-class CCGM_Form_CMS_Sub_Research_Study extends CubeIT_Form_SubForm {
-
-    public function init() {
-        parent::init();
-
-        $title = new Zend_Form_Element_Text('title');
-        $title->setLabel('Titre');
-        $this->addElement($title);
-
-        $code = new CubeIT_Form_Element_Markitup('description');
-        $code->setLabel('Description');
-        $this->addElement($code);
-
-        $localisation = new CCGM_Form_CMS_Element_ResearchCategories('category');
-        $localisation->setLabel('Localisation');
-        $this->addElement($localisation);
-
-        $pathology = new Zend_Form_Element_Textarea('pathology');
-        $pathology->setLabel('Pathologie');
-        $this->addElement($pathology);
-
-        $investigator = new Zend_Form_Element_Text('investigator');
-        $investigator->setLabel('Investigateur');
-        $this->addElement($investigator);
-
-        $specialities = new CCGM_Form_CMS_Element_ResearchSpecialities('specialities');
-        $specialities->setLabel('Spécialités');
-        $this->addElement($specialities);
-    }
-
-}
diff --git a/framework/application/views/scripts/research-categories/index.phtml b/framework/application/views/scripts/research-categories/index.phtml
new file mode 100644 (file)
index 0000000..d9686f4
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+
+$this->headTitle($this->currentPage->title . ' / ' . $this->currentPage->getParent()->getTitle(), 'SET');
+$this->showsidebar = false;
+
+?>
+
+<section id="content">
+    <div id="c">
+        <h1><?= $this->parent_title ?></h1>
+        <h2><?= $this->currentPage->label ?></h2>
+
+        <pre>
+        <?php print_r($this->studies); ?>
+        </pre>
+
+    </div>
+    <?php echo $this->rightbar() ?>
+</section>
index c161a14a4d51255abf556336c0e4a5c84e0c0ae2..bdd0ec1bdf8d0b7d226ae69725661bee7f329fba 100644 (file)
@@ -1,4 +1,5 @@
 <?php\r
+$this->showsidebar = false;\r
 $this->contentWidth = 662;\r
 ?>\r
 \r
@@ -9,4 +10,4 @@ $this->contentWidth = 662;
                ?>\r
        </div>\r
        <?php echo $this->rightbar() ?>\r
-</section>
\ No newline at end of file
+</section>\r