protected function setUp()
 {
     $this->f3 = \Base::instance();
     $this->f3->set('CACHE', FALSE);
     $this->f3->config('test/app/config.ini');
     $this->service = new \Services\Contents();
     $this->pageContentsMock = $this->getMockBuilder('\\Models\\PageContent')->getMock();
     $this->service->setPageContentModel($this->pageContentMock);
 }
Beispiel #2
0
 function controller()
 {
     $f3 = \Base::instance();
     $contents = \Services\Contents::instance()->getContentsForPage($this->page['id'], $this->lang, true);
     $this->title = $contents['title']['texte'];
     $this->background = $contents['background'];
     $this->latestNews = \Services\BlogRss::instance()->getLatestNews();
     $this->blogUrl = $f3->get('BASE') . $f3->get('blog_path');
 }
Beispiel #3
0
 /**
  * @return mixed
  */
 function controller()
 {
     $contents = \Services\Contents::instance()->getContentsForPage($this->page["id"], $this->lang, true);
     $this->title = $contents['title']['texte'];
     $this->subtitle = $contents['subtitle']['texte'];
     $bios = array();
     foreach ($contents['bios']['data'] as $bio) {
         $bios[] = array("portrait" => $bio['data']["portrait"], "name" => $bio['data']['name']['texte'], "title" => $bio['data']['title']['texte'], "bio" => $bio['data']['bio']['texte']);
     }
     $this->bios = $bios;
     $parentContents = \Services\Contents::instance()->getContentsForPage($this->page["id"], $this->lang, true);
     $this->parentLink = $parentContents['title']['texte'];
     $this->parentUrl = \Services\PageTree::instance($this->lang)->getUrl($this->parent['id']);
 }
Beispiel #4
0
 /**
  * @return mixed
  */
 function controller()
 {
     $ptService = \Services\PageTree::instance($this->lang);
     $contents = \Services\Contents::instance()->getContentsForPage($this->page["id"], $this->lang, true);
     $this->visus = $contents['carousel']['data'];
     $this->logo = $contents['logo'];
     $this->tagline = $contents['tagline']['texte'];
     $tree = $ptService->getTree();
     $firstPage = array_shift($tree);
     while ($firstPage['id'] == $this->page['id']) {
         $firstPage = array_shift($tree);
     }
     $this->firstUrl = $ptService->getUrl($firstPage['id']);
 }
 function controller()
 {
     $f3 = \Base::instance();
     $contents = \Services\Contents::instance()->getContentsForPage($this->page["id"], $this->lang, true);
     $this->title = $contents['title']['texte'];
     $this->realisations = array();
     $ptService = \Services\PageTree::instance($this->lang);
     foreach ($this->page['children'] as $child) {
         $childContents = \Services\Contents::instance()->getContentsForPage($child['id'], $this->lang, true);
         $realisation = array('client' => $childContents['client']['texte'], 'thumbnail' => $childContents['thumbnail']);
         $realisation['url'] = $ptService->getUrl($child['id']);
         $this->realisations[] = $realisation;
     }
 }
 function controller()
 {
     $this->f3 = \Base::instance();
     if ($this->f3->get('VERB') == 'POST') {
         $contact = json_decode(file_get_contents('php://input'));
         $this->contact = \Services\ContactService::instance()->saveContact($contact);
         \Services\MailService::instance()->sendMail($this->contact['email'], $this->f3->get('INFOMAIL'), "New message from website", $this->contact['message']);
     } else {
         $contents = \Services\Contents::instance()->getContentsForPage($this->page['id'], $this->lang, true);
         $this->title = $contents['title']['texte'];
         $this->address = $contents['address']['texte'];
         $this->lat = $contents['lat']['texte'];
         $this->long = $contents['long']['texte'];
     }
 }
Beispiel #7
0
 public function post($f3)
 {
     $params = $f3->get('PARAMS');
     if (array_key_exists('id', $params) && array_key_exists('lang', $params)) {
         $id = $params['id'];
         $lang = $params['lang'];
         $contents = json_decode(file_get_contents('php://input'));
         \Services\Contents::instance()->saveContents($contents, $id, $lang);
         $this->get($f3);
     } else {
         http_response_code(400);
         echo '{ "message" : "Id and lang are required}';
         exit;
     }
 }
Beispiel #8
0
 /**
  * @return mixed
  */
 function controller()
 {
     $ptService = \Services\PageTree::instance($this->lang);
     $contents = \Services\Contents::instance()->getContentsForPage($this->page["id"], $this->lang, true);
     $this->brand = $contents['brand']['texte'];
     $this->address = $contents['address']['texte'];
     $this->facebook = $contents['facebook']['texte'];
     $this->twitter = $contents['twitter']['texte'];
     $this->linkedin = $contents['linkedin']['texte'];
     if ($this->page["children"]) {
         $this->creditsUrl = $ptService->getUrl($this->page['children'][0]["id"]);
         $this->credits = $this->page['children'][0]["title"];
     } else {
         $this->creditsUrl = false;
         $this->credits = false;
     }
 }
Beispiel #9
0
 /**
  * @return mixed
  */
 function controller()
 {
     $contents = \Services\Contents::instance()->getContentsForPage($this->page["id"], $this->lang, true);
     $this->title = $contents['title']['texte'];
     $this->subtitle = $contents['subtitle']['texte'];
     $this->description = $contents['description']['texte'];
     $this->image = $contents['image'];
     $this->left = $contents['left'];
     $this->right = $contents['right'];
     if ($this->page['children']) {
         $this->nextUrl = \Services\PageTree::instance($this->lang)->getUrl($this->page['children'][0]["id"]);
         $this->next = $this->page['children'][0]['title'];
     } else {
         $this->nextUrl = "";
         $this->next = "";
     }
 }
 function controller()
 {
     $f3 = \Base::instance();
     $contents = \Services\Contents::instance()->getContentsForPage($this->page["id"], $this->lang, true);
     $this->title = $contents['title']['texte'];
     $this->description = $contents['description']['texte'];
     $this->expertises = array();
     $this->groups = array_map(function ($group) {
         return $group['texte'];
     }, $contents['groups']['data']);
     $nbGroups = sizeof($this->groups);
     $nbLines = ceil(sizeof($this->page['children']) / $nbGroups);
     $ptService = \Services\PageTree::instance($this->lang);
     foreach ($this->page['children'] as $index => $child) {
         $childContents = \Services\Contents::instance()->getContentsForPage($child['id'], $this->lang, true);
         $expertise = array('title' => $childContents['title']['texte'], 'thumbnail' => $childContents['thumbnail']);
         $expertise['url'] = $ptService->getUrl($child['id']);
         $this->expertises[floor($index / $nbLines) + $index % $nbLines * $nbGroups] = $expertise;
     }
     ksort($this->expertises);
 }
 function controller()
 {
     $f3 = \Base::instance();
     $parentContents = \Services\Contents::instance()->getContentsForPage($this->parent["id"], $this->lang, true);
     $this->title = $parentContents['title']['texte'];
     $contents = \Services\Contents::instance()->getContentsForPage($this->page["id"], $this->lang, true);
     $this->expertise = $contents['title']['texte'];
     $this->description = $contents['description']['texte'];
     $this->background = $contents['background'];
     $ptService = \Services\PageTree::instance($this->lang);
     if ($this->number > 0) {
         $this->prevUrl = $ptService->getUrl($this->parent['children'][$this->number - 1]['id']);
     } else {
         $this->prevUrl = false;
     }
     if ($this->number < sizeof($this->parent['children'])) {
         $this->nextUrl = $ptService->getUrl($this->parent['children'][$this->number + 1]['id']);
     } else {
         $this->nextUrl = false;
     }
     $this->realisationsUrl = $ptService->getUrl($this->parent['id']);
 }
Beispiel #12
0
 /**
  * @return mixed
  */
 function controller()
 {
     $contents = \Services\Contents::instance()->getContentsForPage($this->page["id"], $this->lang, true);
     $this->title = $contents['title']['texte'];
     $this->description = $contents['description']['texte'];
 }