<?php
namespace carabi_cms;

/**
 * Description of class
 *
 * @author sasha
 */
class pagehandler_desktop extends \SimplePagehandler {
	public function process() {
		if (\lib_cms::hasPermission($this->user(), \lib_cms::PERMISSION_ANY)) {
			$this->executeAction();
		} else {
			header("Location: " . \lib_cms::loginPage());
		}
	}
	
	public function index() {
		$tpl = $this->renderer()->createTemplate("carabi_cms/content.desktop.tpl");
		$lastPages = ora_cursor("APPL_WEB_TABLE.GET_WEB_PAGE_TABLE_LAST(" . \lib_cms::WEBSITE_ID . ", 8)");
		$lastNews = ora_cursor("APPL_WEB_TABLE.GET_NEWS_TABLE_LAST(6)");
		$internalUrl = "http://" . $_SERVER['HTTP_HOST'] . \lib_cms::CMS_ROOT();
		$tpl->assign("internalUrl", $internalUrl);
		$tpl->assign("externalUrl", \lib_cms::WEBSITE_URL);
		$tpl->assign("lastPages", $lastPages);
		$tpl->assign("lastNews", $lastNews);
		$tpl->assign("pagehandler", $this);
		$tpl->display();
	}
}
?>
