return;
}
+ if ($page->getTemplate() == 'news') {
+ $this->addNewsPages($page, $locale, $isAdmin);
+ }
+
if ($page->getTemplate() == 'research') {
$this->addResearchCategoriesPages($page, $locale, $isAdmin);
}
}
+
+ // URL template used for news pages
+ public static function getNewsArticleURLTemplate() {
+ return '/actualites/%title%'; // Important: must have leading slash or pages will show as not found!
+ }
+
+ /**
+ *
+ * @param CubeIT_Navigation_Page_Locale $page
+ */
+ protected function addNewsPages($page, $locale, $isAdmin) {
+ //$datas = $this->getCMSDatasOfNavigationPage($page);
+
+ // How the URLs should be formed for the news articles
+ $URL_template = self::getNewsArticleURLTemplate();
+
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $s = $db->select()->from('news')
+ ->order('id ASC');
+ $q = $s->query();
+
+ while ($r = $q->fetch()) {
+
+ $online = true;
+ $pageTitle = $r->title;
+
+ $p = new CubeIT_Navigation_Page_Locale();
+ $p->setController('News');
+ $p->setId($page->getId() . '/' . $r->id);
+ $p->setAutoUri($r, $URL_template);
+ $p->setSitemap($online);
+ $p->setTitle($pageTitle);
+ $p->setEditable(false);
+ $p->setParams(array('news_id' => $r->id));
+ $p->setOnline($online);
+ $p->setDomain($page->getDomain());
+ $p->setLabel($pageTitle); // Used in breadcrumbs + sidebar menu
+ $page->addPage($p);
+ }
+ }
+
// 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!
session.domain = .ccgm.test
minify.js = true
-minify.css = false
+minify.css = true
database.params.host = localhost
database.params.username = root
--- /dev/null
+<?php
+
+class NewsController extends CubeIT_Controller_PageController {
+
+ public function indexAction() {
+
+ $this->view->headScript()->addScriptAndStyle('news-article');
+
+ $parent = $this->view->currentPage->getParent();
+ $parent_data = $this->getBootstrap()->getCMSDatasOfNavigationPage($parent);
+ $this->view->datas = $parent_data;
+
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $db->select()->from(['n' => 'news'])
+ ->where('n.id = ?', $this->getRequest()->getParam('news_id'));
+ $query = $select->query();
+
+ //echo 'QUERY: '. (string) $select;
+
+ if (!$query->rowCount()) {
+ $this->_404();
+ return;
+ }
+
+ $this->view->news = $query->fetch();
+ }
+
+}
}\r
\r
protected function _news($n) {\r
- $img = $this->imageProcess($n->getImage(), '', 200, 200);\r
+\r
+ $URL = CubeIT_Navigation_Page::generateAutoUri($n, Bootstrap::getNewsArticleURLTemplate());\r
+\r
+ $img = $this->imageProcess($n->getImage(), '', 247, 247);\r
$res = $img;\r
- $c = $this->dateTime($n->getDate(), CubeIT_Date::DAY . '/' . CubeIT_Date::MONTH . '/' . CubeIT_Date::YEAR);\r
- $c .= $this->htmlElement($n->getTitle(), 'h2');\r
+ //$c = $this->dateTime($n->getDate(), CubeIT_Date::DAY . '/' . CubeIT_Date::MONTH . '/' . CubeIT_Date::YEAR);\r
+ $c = $this->htmlElement($n->getTitle(), 'h2');\r
$c .= '<div class="acc">';\r
$c .= $this->markupDotclear($n->getContent());\r
$c .= $this->linkCMS($n->getLink());\r
$c .= '</div>';\r
- $c .= $this->link('Lire la suite', '#', ['class' => 'more']);\r
- $c .= $this->link('Réduire', '#', ['class' => 'less']);\r
+ $c .= $this->link('Lire la suite', $URL, ['class' => 'read-more']);\r
$res .= $this->htmlElement($c, 'div', ['class' => 'c']);\r
$aargs = [];\r
if (!$img) {\r
}\r
return $this->htmlElement($res, 'article', $aargs);\r
}\r
-}
\ No newline at end of file
+}\r
--- /dev/null
+<?php
+
+$this->showsidebar = false;
+
+?>
+
+<pre>
+<?php
+ print_r($this->news);
+?>
+</pre>
<?php\r
$this->contentWidth = 980;\r
+$this->showsidebar = false;\r
$this->headScript()->addScriptAndStyle('news');\r
?>\r
\r
<section id="content">\r
<div id="c">\r
<?php\r
- echo $this->markupDotclear($this->text);\r
+ echo $this->markupDotclear($this->text, [], ['class' => 'news-header']);\r
echo $this->news();\r
?>\r
</div>\r
-</section>
\ No newline at end of file
+</section>\r
-(function ($) {\r
- function JQnews(element) {\r
- this.element = element;\r
- this.init();\r
- }\r
-\r
- JQnews.prototype = {\r
- init: function () {\r
- var $this = this;\r
-\r
-\r
- $(this.element).on('click', '.more', function () {\r
- var c = $(this).closest('.c');\r
- var d = $(c).find('.acc');\r
- d.css({maxHeight: 999});\r
- $(this).hide();\r
- $(c).find('.less').show();\r
- setTimeout(function () {\r
- d.css({maxHeight: d.outerHeight()});\r
- }, 600);\r
- return false;\r
- });\r
-\r
- $(this.element).on('click', '.less', function () {\r
- var c = $(this).closest('.c');\r
- var d = $(c).find('.acc');\r
- d.css({maxHeight: 72});\r
- $(this).hide();\r
- $(c).find('.more').show();\r
- return false;\r
- });\r
- }\r
- };\r
-\r
- jQuery.fn.news = function () {\r
- return this.each(function () {\r
- var $this = $(this);\r
- if ($(this).data('news') === undefined) {\r
- $(this).data('news', new JQnews($this));\r
- }\r
- })\r
- };\r
-})(jQuery);\r
-\r
-$(function () {\r
- $("#news").news();\r
-});
\ No newline at end of file
+// (function ($) {\r
+// function JQnews(element) {\r
+// this.element = element;\r
+// this.init();\r
+// }\r
+//\r
+// JQnews.prototype = {\r
+// init: function () {\r
+// var $this = this;\r
+//\r
+//\r
+// $(this.element).on('click', '.more', function () {\r
+// var c = $(this).closest('.c');\r
+// var d = $(c).find('.acc');\r
+// d.css({maxHeight: 999});\r
+// $(this).hide();\r
+// $(c).find('.less').show();\r
+// setTimeout(function () {\r
+// d.css({maxHeight: d.outerHeight()});\r
+// }, 600);\r
+// return false;\r
+// });\r
+//\r
+// $(this.element).on('click', '.less', function () {\r
+// var c = $(this).closest('.c');\r
+// var d = $(c).find('.acc');\r
+// d.css({maxHeight: 72});\r
+// $(this).hide();\r
+// $(c).find('.more').show();\r
+// return false;\r
+// });\r
+// }\r
+// };\r
+//\r
+// jQuery.fn.news = function () {\r
+// return this.each(function () {\r
+// var $this = $(this);\r
+// if ($(this).data('news') === undefined) {\r
+// $(this).data('news', new JQnews($this));\r
+// }\r
+// })\r
+// };\r
+// })(jQuery);\r
+//\r
+// $(function () {\r
+// $("#news").news();\r
+// });\r
+.news-header {\r
+ margin: 1em 0 2em;\r
+}\r
+\r
#news {\r
font-weight: 300;\r
\r
article {\r
+ display: flex;\r
border-bottom: 1px solid #dad9d9;\r
padding-bottom: 48px;\r
margin-bottom: 48px;\r
margin-bottom: 0;\r
}\r
\r
- &.noimg {\r
- .c {\r
- margin-left: 0;\r
- width: 980px;\r
- }\r
- }\r
-\r
img {\r
vertical-align: top;\r
display: inline-block;\r
- width: 200px;\r
- height: 200px;\r
- border-radius: 100px;\r
+ width: 247px;\r
+ height: 247px;\r
+ margin-right: 50px;\r
+ flex: 0 0 auto;\r
+ background-color: #eee;\r
}\r
\r
.c {\r
- margin-left: 80px;\r
- vertical-align: top;\r
- display: inline-block;\r
- width: 686px;\r
- time {\r
- font-size: 13px;\r
- }\r
\r
h2 {\r
- color: #5e5e5e;\r
- margin: 30px 0 0;\r
- font-size: 26px;\r
- }\r
-\r
- .acc {\r
- max-height: 72px;\r
- overflow: hidden;\r
- transition: max-height 450ms;\r
- margin-bottom: 30px;\r
- > a {\r
- display: inline-block;\r
- text-align: center;\r
- box-sizing: border-box;\r
- white-space: nowrap;\r
- background-color: #0ea6db;\r
- font-weight: 300;\r
- font-style: italic;\r
- line-height: 29px;\r
- border-radius: 3px;\r
- color: #fff;\r
- padding: 0 13px 1px 10px;\r
- margin: 20px 0 20px 1px;\r
- }\r
+ color: #f5810f;\r
+ margin: 20px 0 0;\r
+ font-size: 30px;\r
}\r
\r
- .dotclear {\r
- line-height: 24px;\r
- min-height: 72px;\r
- p:last-child {\r
- margin-bottom: 0;\r
- }\r
- }\r
-\r
- .more, .less {\r
+ .read-more {\r
color: #25a1da;\r
font-weight: 500;\r
font-size: 16px;\r
display: block;\r
- &:after {\r
- content: "";\r
- display: inline-block;\r
- margin-left: 10px;\r
- width: 15px;\r
- height: 15px;\r
- position: relative;\r
- top: 3px;\r
- background-image: url("../images/arrow-li.svg");\r
- background-size: 100% 100%;\r
- transform: rotate(90deg);\r
- }\r
- }\r
-\r
- .less {\r
- display: none;\r
- &:after {\r
- transform: rotate(270deg);\r
- }\r
+ margin-top: 1em;\r
}\r
}\r
}\r