}
}
+ // URL template used for research study pages
+ public static function getResearchCategoriesURLTemplate() {
+ return '/Recherche-clinique/%name%'; // Important: must have leading slash or pages will show as not found!
+ }
/**
*
//$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!
+ $URL_template = self::getResearchCategoriesURLTemplate();
$db = Zend_Db_Table::getDefaultAdapter();
$s = $db->select()->from('research_categories')
public function indexAction() {
+ $this->view->headScript()->addScriptAndStyle('research');
+
$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();
+ $select = $db->select()->from(['s' => 'research_studies'])
+ ->joinInner(['c' => 'research_categories'], 'c.id = s.category', ['c.name AS category_name'])
+ ->order('s.id DESC')
+ ->where('s.category = ?', $this->getRequest()->getParam('research_category_id'));
+ $query = $select->query();
+
+ //echo 'QUERY: '. (string) $select;
// if (!$q->rowCount()) {
// $this->_404();
// $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();
+ $this->view->studies = $query->fetchAll();
+
+ // Get specialities data
+ $specialities = [];
+ $query_specialities = $db->select()->from('research_specialities')->query();
+ while ($speciality = $query_specialities->fetch()) {
+ $specialities[$speciality->id] = CubeIT_Util_Object::toArray($speciality);
+ }
+
+ $this->view->specialities = $specialities;
}
}
public function init() {\r
parent::init();\r
\r
+ $intro = new CCGM_Form_Element_Markitup('studies_intro');\r
+ $intro->setLabel("Texte d'introduction pour les études");\r
+ $intro->setAttrib('rows', 10);\r
+ $this->addElement($intro);\r
+\r
$studies = new CCGM_Form_CMS_Element_ResearchStudies('studies');\r
$studies->setLabel('Gestion des études cliniques');\r
$this->addElement($studies);\r
--- /dev/null
+<?php
+
+class CCGM_View_Helper_ResearchCategories extends CubeIT_View_Helper_Abstract {
+
+ public function ResearchCategories() {
+
+ $this->headScript()->addScriptAndStyle('research');
+
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $table = 'research_categories';
+
+ //SELECT c.*, COUNT(s.id) as study_count FROM research_categories c INNER JOIN research_studies s ON c.id = s.category GROUP BY c.id
+ // Get distinct list of categories present in the table
+ $select = $db->select()
+ ->from($table, [$table.'.*'])
+ ->joinInner('research_studies', $table.'.id = research_studies.category', ['COUNT(research_studies.id) AS study_count'])
+ ->group($table.'.id')
+ ->order($table.'.sort_order ASC');
+
+ //echo 'QUERY: '. (string) $select;
+
+ $query = $select->query();
+
+ $res = '<div class="research-categories">';
+
+ while ($row = $query->fetch()) {
+
+ $URL = CubeIT_Navigation_Page::generateAutoUri($row, Bootstrap::getResearchCategoriesURLTemplate());
+
+ $res .= '<a href="'. $URL .'" class="research-categories-link">';
+ $res .= '<div class="research-categories-icon">';
+ $res .= '<img src="'. CubeIT_View_Helper_ImageCms::getPath($row->icon) .'">';
+ $res .= '</div>'; // .research-categories-icon
+ $res .= '<span class="research-categories-name">'. $row->name .'</span>';
+ $res .= '</a>';
+
+ }
+
+ $res .= '</div>';
+
+ echo $res;
+ }
+
+
+}
<h1><?= $this->parent_title ?></h1>
<h2><?= $this->currentPage->label ?></h2>
- <pre>
- <?php print_r($this->studies); ?>
- </pre>
+ <?php if (count($this->studies) == 0) echo __('Aucun résultat trouvé.'); ?>
+
+ <?php foreach($this->studies as $study): ?>
+
+ <div class="research-study">
+ <div class="study-main">
+ <div class="study-title"><?= $study->title ?></div>
+ <div class="study-description"><?= nl2br($study->description) ?></div>
+
+ <a href="mailto:camille.laurent@oncoclem.org?subject=<?= urlencode("Essai clinique : {$study->title}") ?>" class="study-contact">Nous contacter</a>
+ </div>
+ <div class="study-details">
+ <p><strong>Pathologie :</strong> <?= $study->pathology ?></p>
+ <p><strong>Investigateur :</strong> <?= $study->investigator ?></p>
+ <p>
+ <strong style="vertical-align: bottom">Spécialité(s) :</strong>
+ <?php foreach(CubeIT_Util_Cms::unserialize($study->specialities) as $specialityID): ?>
+ <img src="<?= CubeIT_View_Helper_ImageCms::getPath($this->specialities[$specialityID]['icon']) ?>" data-tooltip="<?= $this->specialities[$specialityID]['name'] ?>" style="margin-right:0.5em; height: 30px">
+ <?php endforeach; ?>
+ </p>
+ </div>
+ </div>
+
+ <?php endforeach; ?>
</div>
<?php echo $this->rightbar() ?>
<section id="content">\r
<div id="c">\r
<?php\r
+ echo $this->markupDotclear($this->studies_intro);\r
+ echo $this->ResearchCategories();\r
echo $this->markupDotclear($this->text);\r
?>\r
</div>\r
--- /dev/null
+TO_LOAD_ONCE[TO_LOAD_ONCE.length] = 'load_research();';
+
+function load_research() {
+
+ var maxHeight = 100, // 20px line height so 100 is 5 lines
+ more = 'En savoir plus',
+ less = 'Réduire';
+
+ $('.study-description').each(function() {
+ var originalHeight = $(this).height();
+
+ $(this).data('height', originalHeight); // Keep full height so we can animate to this when revealing
+
+ if (originalHeight > maxHeight) {
+
+ $(this).css({
+ 'maxHeight': maxHeight,
+ 'overflow': 'hidden',
+ 'transition': 'max-height 0.4s' // animate when max-height changes
+ });
+ $(this).after('<a href="#" class="toggle-description" data-less="'+ less +'" data-more="'+ more +'">'+ more +'</a>')
+ }
+ });
+
+ $(document).on('click', '.toggle-description', function(event) {
+ event.preventDefault();
+
+ var $link = $(this),
+ $description = $link.parent().find('.study-description');
+
+ $link.toggleClass('open');
+
+ if ($link.hasClass('open')) {
+ $link.text($link.data('less'));
+ $description.css('maxHeight', $description.data('height'));
+ } else {
+ $link.text($link.data('more'));
+ $description.css('maxHeight', maxHeight);
+ }
+ });
+
+}
--- /dev/null
+@import "constants.less";
+
+.research-categories {
+ display: flex;
+ flex-wrap: wrap;
+ margin: 2em 0;
+
+
+ &-link {
+ flex-basis: 33%;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ margin-bottom: 2em;
+ color: #AFBC19;
+ &:hover {
+ color: #0EA6DB;
+ text-decoration: none;
+ }
+ }
+
+ &-icon {
+ display: block;
+ background-color: currentColor;
+ width: 140px;
+ height: 140px;
+ border-radius: 50%;
+ padding: 15px;
+ box-sizing: border-box;
+ margin: 0 1em 1em;
+
+ img {
+ width: 100%;
+ height: auto;
+ }
+ }
+
+ &-name {
+ display: inline-block;
+ }
+}
+
+.research-study {
+ display: flex;
+ padding-bottom: 1.5em;
+ border-bottom: 1px solid #0EA6DB;
+ margin-bottom: 2em;
+}
+
+.study {
+ &-main {
+ flex: 1 0 64%;
+ padding-right: 10px;
+ }
+
+ &-details {
+ flex: 1 1 36%;
+
+ p {
+ margin-top: 0 !important;
+ }
+
+ strong {
+ color: #0EA6DB;
+ font-weight: 500;
+ }
+ }
+
+ &-title {
+ color: #0EA6DB;
+ font-size: 20px;
+ font-weight: 500;
+ text-transform: uppercase;
+ margin-bottom: 0.75em;
+ }
+
+ &-contact {
+ display: inline-block;
+ background-color: #0EA6DB;
+ color: #fff;
+ font-style: italic;
+ margin-top: 1.5em;
+ padding: 0.5em 1em;
+ border-radius: 6px;
+ }
+}
+
+.toggle-description {
+ display: block;
+ color: #0EA6DB;
+ margin-top: 1em;
+}