public function get_events() { $pages = PageManager::get(); foreach ($pages as $page) { if ($page['is_event'] == TRUE) { $this->add(new Page($page["title"], $page["content"], $page["date"], $page["id"], $page["author"], $page['is_event'])); } } }
public function get($param) { if (is_int($param) or is_string($param)) { $page = PageManager::get($param); if (is_null($page)) { return null; } return new Page($page["title"], $page["content"], $page["date"], $page["id"], $page["author"], $page["is_event"]); } else { throw new InvalidArgumentException("Param must be string or integer"); } }
$content = ob_get_contents(); ob_end_clean(); require_once 'view/layout/layout.php'; } } else { ob_start(); echo 'dls too low'; require_once 'view/wooapi/productnext.php'; $content = ob_get_contents(); ob_end_clean(); require_once 'view/layout/layout.php'; } } else { echo 'fail'; } break; case 'productnext': if (!empty($_GET['id']) && !empty($_GET['nbdls'])) { $pageManager = new PageManager($bdd); $nextid = $_GET['id'] + 1; while (!$pageManager->get($nextid)) { $nextid++; } header('Location: ?controler=wooapi&action=productadd&id=' . $nextid . '&nbdls=' . $_GET['nbdls']); } else { echo 'fail'; } break; default: break; }