Exemplo n.º 1
0
 public function show()
 {
     // sitemap
     $this->controller->setView('SitemapView');
     $sitemap = $this->controller->display();
     // legal notice
     $left = array_key_exists('legal_notice', $this->config) ? $this->config['legal_notice'] : '';
     $left = '<div class="col-md-6 col-md-offset-2"><p>' . $left . '</p></div>';
     $right = '<div class="col-md-2"><p class="pull-right"><a href="#">Back to top</a></p></div>';
     // social
     $social = '';
     $general = Config::getInstance()->getGeneralArray('general');
     if (array_key_exists('social', $general) && $general['social']) {
         $buttons = Social::getInstance()->socialButtons('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], Head::getInstance()->getTitle());
         $span = floor(6 / count($buttons));
         foreach ($buttons as $b) {
             $social .= '<div class="col-xs-2 col-md-' . $span . ' text-center">' . $b . '</div>';
         }
         $x = floor((8 - count($buttons)) / 2);
         $social = '<div class="row"><div class="col-md-offset-2 col-md-' . $x . '"></div>' . $social . '</div>';
     }
     // powered by
     $poweredby = '';
     if (isset($this->config['poweredby'])) {
         $poweredby = '<p class="poweredby text-center">' . $this->config['poweredby'] . '</p>';
         $poweredby = '<div class="row"><div class="col-md-8 col-md-offset-2">' . $poweredby . '</div></div>';
     }
     // put it together
     return $sitemap . '<div class="footer-inner row">' . $left . $right . '</div>' . $social . $poweredby;
 }
Exemplo n.º 2
0
 /**
  * @param AbstractModel $model
  * @param null $arg unused
  * @param boolean $bool indicates whether to use section tag or not
  * @return mixed
  */
 public function visit(AbstractModel $model, $arg, $bool)
 {
     if (array_key_exists('style', $model->config)) {
         Head::getInstance()->link($model->config['style']);
     }
     return $model->accept($this, $arg, $bool);
 }
Exemplo n.º 3
0
 public function loginAction()
 {
     if ($this->__isAdmin()) {
         $this->_redirectToIndex();
     }
     $this->view->headTitle('Adminka works | Login');
     Head::getInstance()->getJS()->add('login');
     $this->_helper->layout()->setLayout('login');
     $this->_helper->viewRenderer->setNoRender(true);
 }
Exemplo n.º 4
0
 public function __construct(AbstractModel $model, array $config)
 {
     parent::__construct($model, $config);
     if (array_key_exists('description', $this->config)) {
         Head::getInstance()->addOg('description', $this->config['description']);
     }
     if (!array_key_exists('subtitle', $this->config) || $this->config['subtitle']) {
         $title = Config::getInstance()->title . ' - ' . $this->config['name'];
         Head::getInstance()->addOg('title', $title);
         Head::getInstance()->setTitle($title);
     }
 }
Exemplo n.º 5
0
 /**
  * TODO maybe at the wrong place
  *
  * @param AbstractModel $model to view
  * @param array $config
  */
 public function __construct(AbstractModel $model, array $config)
 {
     $this->model = $model;
     $this->config = $config;
     Head::getInstance()->link(CSS_DIR . 'content.css');
     if (isset($this->config['style'])) {
         Head::getInstance()->link($this->config['style']);
     }
     Head::getInstance()->addOg('title', Config::getInstance()->title . ' - ' . $this->config['name']);
     Head::getInstance()->setTitle(Config::getInstance()->title . ' - ' . $this->config['name']);
     if (array_key_exists('description', $this->config)) {
         Head::getInstance()->addOg('description', $this->config['description']);
     }
 }
Exemplo n.º 6
0
 /**
  * This function loads all images contained in the folder stored in $this->path,
  * generate the bootstrap modal carousel and returns it.
  *
  * @param int $index
  * @return string generated carousel
  */
 public function parse($index)
 {
     $files = ScanDir::getFilesOfType($this->config['path'], self::MIME, $index);
     try {
         Head::getInstance()->link('lib/owl-carousel/css/owl.carousel.css');
         Head::getInstance()->link('lib/owl-carousel/css/owl.theme.css');
         Script::getInstance()->link('lib/owl-carousel/js/owl.carousel.js');
         Head::getInstance()->link('lib/owl-carousel/css/lazy_load.css');
         Script::getInstance()->link('lib/owl-carousel/js/lazy_load.js');
         $items = '';
         foreach ($files as $f) {
             $items .= '<div class="item"><img class="lazyOwl" data-src="' . Config::getInstance()->app_root . $this->config['path'] . $f . '" /></div>';
         }
         return '<div id="carousel" class="owl-carousel owl-theme">' . $items . '</div>';
     } catch (Exception $e) {
         Logger::getInstance()->add(new Error('An unexpected error has occurred.', 'OwlCarousel::parse("' . $this->config['path'] . '")', $e->getMessage()));
         return '';
     }
 }
Exemplo n.º 7
0
 public function markup(Markup $model, $arg)
 {
     $body = '<div class="preview"><div class="text">' . $model->parse($arg) . '</div></div>';
     $body = '<div class="row content-item"><div class="col-md-12">' . $body . '</div></div>';
     if (array_key_exists('static', $model->config) && $model->config['static']) {
         $href = Config::getInstance()->app_root . $model->config['static'] . '/' . preg_replace('/\\.[^.\\s]{2,4}$/', '', basename($model->config['path']));
         // social
         $social = '';
         $general = Config::getInstance()->getGeneralArray('general');
         // TODO description
         if (array_key_exists('social', $general) && $general['social']) {
             $buttons = Social::getInstance()->socialButtons('https://' . $_SERVER['HTTP_HOST'] . $href, Head::getInstance()->getTitle());
             $span = floor(6 / count($buttons));
             foreach ($buttons as $b) {
                 $social .= '<div class="col-xs-2 col-md-' . $span . ' text-center">' . $b . '</div>';
             }
         }
         $static = '<a class="btn" href="' . $href . '">More <i class="fa fa-angle-double-right"></i></a>';
         $body .= '<div class="row socials"><div class="col-md-5"><div class="row">' . $social . '</div></div><div class="col-md-7 text-right">' . $static . '</div></div>';
     }
     return self::head($model->parseTags($model->config['path'])) . $body;
 }
Exemplo n.º 8
0
 /**
  * This function loads all images contained in the folder stored in $this->path,
  * generate the bootstrap modal carousel and returns it.
  *
  * @param int $index
  * @return string generated carousel
  */
 public function parse($index)
 {
     $files = ScanDir::getFilesOfType($this->config['path'], self::MIME, $index);
     try {
         Head::getInstance()->link(PUBLIC_LIB_DIR . 'photoswipe/photoswipe.css');
         Head::getInstance()->link(PUBLIC_LIB_DIR . 'photoswipe/default-skin/default-skin.css');
         Script::getInstance()->link(PUBLIC_LIB_DIR . 'photoswipe/photoswipe.min.js');
         Script::getInstance()->link(PUBLIC_LIB_DIR . 'photoswipe/photoswipe-ui-default.min.js');
         Script::getInstance()->link(PUBLIC_LIB_DIR . 'photoswipe/init.js');
         $html = file_get_contents(PUBLIC_LIB_DIR . 'photoswipe/photoswipe.html');
         $items = '';
         foreach ($files as $f) {
             list($width, $height) = getimagesize($this->config['path'] . $f);
             $src = 'data-src="' . Config::getInstance()->app_root . $this->config['path'] . $f . '"';
             $width = 'data-width="' . $width . '"';
             $height = 'data-height="' . $height . '"';
             $items .= '<span ' . $src . $width . $height . '" class="img-swipe">';
         }
         return '<div class="hidden">' . $items . '</div>' . $html;
     } catch (Exception $e) {
         Logger::getInstance()->add(new Error('An unexpected error has occurred.', 'PhotoSwipe::parse("' . $this->config['path'] . '")', $e->getMessage()));
         return '';
     }
 }
 public function __construct()
 {
     parent::__construct();
     Head::getInstance()->link(CSS_DIR . 'sitemap.css');
 }
Exemplo n.º 10
0
} else {
    $layout = Config::getInstance()->getGeneral('general', 'page_layout');
}
switch ($layout) {
    case "floating":
        $container = new FloatingController();
        $navigation = new NavigationController("FloatingNavigationView");
        break;
    case "stacked":
    default:
        $container = new StackedController();
        $navigation = new NavigationController("StackedNavigationView");
}
$footer = new Footer($navigation);
if ($css = Config::getInstance()->getGeneral('general', 'template_css')) {
    Head::getInstance()->link(TEMPLATES_DIR . 'css/' . $css);
}
if ($template = Config::getInstance()->getGeneral('general', 'template')) {
    include_once TEMPLATES_DIR . $template;
}
/**
 * Function to autoload classes
 *
 * @param $class Class to load
 */
function __autoload($class)
{
    global $classes;
    include_once $classes[$class];
}
// TODO maybe not how it should be done ...
Exemplo n.º 11
0
 public function __construct($view)
 {
     $this->view = $view;
     Head::getInstance()->link(CSS_DIR . 'sitemap.css');
     $this->actionListener();
 }
Exemplo n.º 12
0
 * setup page and load provided business-casual.php
 */
$config = Config::getInstance()->getGeneralArray('general');
if (isset($config['highlight']) && $config['highlight']) {
    $style = isset($config['scheme']) ? $config['scheme'] : 'default.css';
    Head::getInstance()->link(PUBLIC_LIB_DIR . 'prismjs/css/' . $style);
    Script::getInstance()->link(PUBLIC_LIB_DIR . 'prismjs/js/prism.js');
}
if (array_key_exists('img_resize', $config) && $config['img_resize']) {
    Script::getInstance()->link('image.js');
}
Head::getInstance()->link(PUBLIC_LIB_DIR . 'bootstrap/css/bootstrap.min.css');
Head::getInstance()->link(PUBLIC_LIB_DIR . 'font-awesome/css/font-awesome.min.css');
// Add jquery and bootstrap into header so included HTML pages can use the libs
Head::getInstance()->linkScript(PUBLIC_LIB_DIR . 'jquery/js/jquery.min.js');
Head::getInstance()->linkScript(PUBLIC_LIB_DIR . 'bootstrap/js/bootstrap.js');
$container = new Controller();
$navigation = new NavigationController();
$footer = new Footer($navigation);
if ($template = Config::getInstance()->getGeneral('general', 'template')) {
    include_once TEMPLATES_DIR . $template;
}
/**
 * Function to autoload classes
 *
 * @param $class Class to load
 */
function __autoload($class)
{
    global $classes;
    include_once $classes[$class];
Exemplo n.º 13
0
 public function markup(Markup $model, $arg, $bool)
 {
     // parse head
     $head = '';
     $tags = $model->parseTags();
     if (!empty($tags)) {
         $left = '';
         if (isset($tags['published'])) {
             $left .= $tags['published'];
         }
         if (isset($tags['author'])) {
             $left = $left ? $left . ' | ' . $tags['author'] : $tags['author'];
         }
         $left = $left ? '<div class="col-md-7"><p>' . $left . '</p></div>' : '';
         $right = '';
         if (isset($tags['category'])) {
             $href = Config::getInstance()->app_root . URLs::getInstance()->getURI() . '?' . QueryString::removeAll(['tag', 'page'], $_SERVER['QUERY_STRING']);
             foreach ($tags['category'] as $c) {
                 $right .= ' | <a href="' . $href . '&tag=' . $c . '">#' . trim($c) . '</a>';
                 // $right .= ' | #' . trim($c);
             }
             $right = '<div class="col-md-5 pull-right text-right">' . substr($right, 3) . '</div>';
         }
         $head = $left . $right ? '<div class="row content-head">' . $left . $right . '</div>' : '';
     }
     // parse body
     $body = '<div class="row content-body"><div class="col-md-12">' . $model->parse($arg) . '</div></div>';
     if (array_key_exists('static', $model->config) && $model->config['static']) {
         $href = Config::getInstance()->app_root . URLs::getInstance()->getURI() . '/' . preg_replace('/\\.[^.\\s]{2,4}$/', '', basename($model->config['path']));
         // social
         $social = '';
         $general = Config::getInstance()->getGeneralArray('general');
         // TODO description
         if (array_key_exists('social', $general) && $general['social']) {
             $buttons = Social::getInstance()->socialButtons('https://' . $_SERVER['HTTP_HOST'] . $href, Head::getInstance()->getTitle());
             $span = floor(6 / count($buttons));
             foreach ($buttons as $b) {
                 $social .= '<div class="col-xs-2 col-md-' . $span . ' text-center">' . $b . '</div>';
             }
         }
         $static = '<a class="btn btn-default" href="' . $href . '" role="button">Static <i class="fa fa-share-alt"></i></a>';
         $body .= '<div class="row content-foot"><div class="col-md-5"><div class="row">' . $social . '</div></div><div class="col-md-7 text-right">' . $static . '</div></div>';
     }
     return '<div class="row content-item"><div class="col-md-12">' . $head . $body . '</div></div>';
 }