Exemplo n.º 1
0
 public function renderRoute($vars)
 {
     $config = Config::getInstance();
     $queries = CMS7_Queries::getInstance();
     $config->queries = $queries;
     $config->theme_path = join_path($config->base_path, 'themes');
     $config->module_path = join_path($config->base_path, 'modules');
     $config->plugin_path = join_path($config->base_path, 'plugin');
     $config->request_vars = $vars;
     $config->site = $config->queries->site->get_site_details();
     $this->site = $config->site;
     if (isset($vars->page)) {
         if (ctype_digit($vars->page)) {
             $page_id = $vars->page;
         } else {
             $page_id = $config->queries->site->find_page_id_by_name(strtolower($vars->page));
         }
     }
     if (!isset($page_id) || !$page_id) {
         $page_id = $this->site->site_home_page_id;
     }
     $this->page_id = $page_id;
     $layout = new Layout($page_id);
     $this->layout = $layout;
     $layout->vars = $vars;
     $content = $layout->render();
     return $content;
 }
Exemplo n.º 2
0
 /**
  * Renders and displays the multiview.
  */
 public function render($data = null, $subview = false)
 {
     if ($data != null) {
         $this->data = $data;
     } else {
         $this->data = array();
     }
     $this->data['layout'] = $this;
     $result = get_view($this->base_path . $this->view_name);
     Collector::View($this->base_path . $this->view_name, $result);
     $this->parse_nestedcontrols_cdata($result);
     $this->data['_extracted_content'] = $this->_extracted_content;
     $this->parse_helpers($result);
     $result = render_fragment($result, $this->data);
     $this->parse_layout($result, $subview);
     $this->parse_includes($result);
     $this->parse_subviews($result);
     $this->parse_other_tags($result);
     $this->parse_targets($result);
     $this->parse_uses($result);
     $this->parse_ports($result);
     $this->parse_controls($result);
     $this->parse_nestedcontrols($result);
     if ($this->layout != null) {
         $this->layout->add_content($this->target, $result);
         $result = $this->layout->render($data);
     }
     return $result;
 }
Exemplo n.º 3
0
 /**
  * Render a layout
  *
  * @return string
  *
  * @since 1.0.0
  */
 public function display($layout = null)
 {
     $layout = !empty($layout) ? $layout : $this->layout;
     if (!$this->layout instanceof Layout) {
         $this->setLayout($layout);
     }
     if (!$this->layout->hasContainer('view')) {
         $this->layout->setContainer('view', $this);
     }
     if (!$this->layout->hasContainer('application') && $this->hasContainer('application')) {
         $this->layout->setContainer('application', $this->getContainer('application'));
     }
     $Cyan = \Cyan::initialize();
     $this->buffer_content = $this->layout->render();
     $this->trigger('Render', $this);
     return $this->buffer_content;
 }
Exemplo n.º 4
0
 public static function render($view, $data, $finalCut)
 {
     Layout::set("leftNav", Config::get("display:leftnav"));
     // localize all the view variables.
     extract($data);
     // Start capturing a new output buffer, load the view
     // and apply all the display logic to the localized data
     // and save the results in $parsed.
     ob_start();
     require $view;
     $parsed = ob_get_clean();
     if (!$finalCut) {
         return $parsed;
     }
     Layout::set("content", $parsed);
     ob_start();
     echo Layout::render();
     $full = ob_get_clean();
     return $full;
 }
Exemplo n.º 5
0
// Popup content
$lang =& DoceboLanguage::createInstance('popup_' . POPUP_MOD_NAME, 'framework');
$GLOBALS["page"]->setWorkingZone("content");
$GLOBALS["page"]->add(getTitleArea($lang->def("_AREA_" . strtoupper(POPUP_MOD_NAME)), strtolower(POPUP_MOD_NAME)) . '<div class="std_block">');
if (!defined('POPUP_MOD_NAME')) {
    die;
}
require_once "../" . POPUP_MOD_NAME . "/body.php";
$GLOBALS["page"]->add('</div>');
// finalize
Boot::finalize();
/* output all */
$GLOBALS['page']->add(ob_get_contents(), 'debug');
ob_clean();
// layout
Layout::render('popup');
// flush buffer
ob_end_flush();
// Page functions:
function drawMenu($menu_label, $menu_url, $sel = "")
{
    if (is_array($menu_label)) {
        $GLOBALS['page']->add("<div class=\"popup_menu\"><ul>\n", "content");
        foreach ($menu_label as $key => $val) {
            if ($sel == $key) {
                $class = "class=\"selected\" ";
            } else {
                $class = "";
            }
            $GLOBALS['page']->add("<li><a " . $class . "href=\"" . $menu_url[$key] . "\">" . $val . "</a></li>\n", "content");
        }
Exemplo n.º 6
0
 public function actionRenderBuilder($class, $layout)
 {
     $postdata = file_get_contents("php://input");
     $post = CJSON::decode($postdata);
     if (isset($post['form'])) {
         $form = $post['form'];
     } else {
         $fb = FormBuilder::load($class);
         $form = $fb->form;
     }
     $builder = $this->renderPartial('form_builder', array(), true);
     $mainFormSection = Layout::getMainFormSection($form['layout']['data']);
     $data = $form['layout']['data'];
     if ($layout != $form['layout']['name']) {
         unset($data[$mainFormSection]);
         $mainFormSection = Layout::defaultSection($layout);
     }
     $data['editor'] = true;
     $data[$mainFormSection]['content'] = $builder;
     Layout::render($layout, $data);
 }
Exemplo n.º 7
0
 public function renderForm($class, $model = null, $params = [], $options = [])
 {
     if (is_array($model)) {
         $options = $params;
         $params = $model;
         $model = null;
     }
     $fb = FormBuilder::load($class);
     ## check if layout property is declared by rendering controller
     $reflection = new ReflectionObject($this);
     $layoutClass = $reflection->getProperty('layout')->getDeclaringClass()->getName();
     ## if layout property is not declared, then set it to default form layout '//layouts/form'
     if ($layoutClass != get_class($this)) {
         $this->layout = '//layouts/form';
     }
     ## set page title & layout to options
     $this->pageTitle = isset($options['pageTitle']) ? $options['pageTitle'] : @$fb->form['title'];
     $this->layout = isset($options['layout']) ? $options['layout'] : $this->layout;
     $renderOptions = ['wrapForm' => true, 'action' => $this->action->id];
     if (is_object($model)) {
         if (get_class($model) != Helper::explodeLast(".", $class)) {
             throw new Exception("Invalid model name, please instantiate model from {$class} class");
         }
         $fb->model = $model;
     }
     $options['params'] = $params;
     $renderOptions = array_merge($renderOptions, $options);
     $mainform = $fb->render($model, $renderOptions);
     $data = $fb->form['layout']['data'];
     $renderSection = @$_GET['render_section'];
     foreach ($data as $k => $d) {
         if ($d['type'] == "mainform") {
             $data[$k]['content'] = $mainform;
         }
         if (isset($data[$renderSection]) && $k != $renderSection) {
             unset($data[$k]);
         }
     }
     $layout = Layout::render($fb->form['layout']['name'], $data, $model, true);
     $this->renderText($layout, false);
 }
Exemplo n.º 8
0
 public function testAlternateName()
 {
     $this->object->content = 'hello-world';
     $this->object->setScriptName("alternate.phtml");
     $this->assertEquals("<h1>hello-world</h1>", $this->object->render($this->object->getScriptName()));
 }
Exemplo n.º 9
0
    function render()
    {
        $CI =& get_instance();
        /***************************************
         *  saving the page edit mode condition in a 
         * variable so open it in the body after that
         * **************************************/
        $editMode = $CI->vunsy->edit_mode() ? TRUE : FALSE;
        if ($CI->vunsy->section->can_view()) {
            /***************************************
             *  rendering the BEFORE page
             * i must close the edit mode before that 
             * then render it so that the container box don't 
             * display ...
             * **************************************/
            $CI->vunsy->mode = 'view';
            $before_page = new Layout();
            $before_page->get_by_info('BEFORE_PAGE_LOCKED');
            $before_page_text = $before_page->render();
            /***************************************
             *  rendering the page Head
             * without the CSS and JS
             * i have to render them after all the
             * widgets rendered to add all the widgets needed
             * js and css files
             ***************************************/
            $page_head = new Layout();
            $page_head->get_by_info('PAGE_HEAD_LOCKED');
            $page_head_text = $page_head->render();
            /*********************************************
             *  redering the page BODY content
             * here i open the edit mode so the widgets got the
             * container box and the controller buttons
             * and the admin toolbar 
             * ********************************************/
            if ($editMode) {
                $CI->vunsy->mode = 'edit';
            }
            $page_body = new Layout();
            $page_body->get_by_info('PAGE_BODY_LOCKED');
            $page_body_text = $page_body->render();
            if ($CI->vunsy->user->is_root()) {
                $page_body_text .= $CI->load->view('edit_mode/toolbar', '', TRUE);
            }
            /*********************************************
             *  redering the AFTER page content
             * i must close the edit mode variable 
             * before rendering so that the container
             * of editing doesn't rendered
             * ********************************************/
            $CI->vunsy->mode = 'view';
            $after_page = new Layout();
            $after_page->get_by_info('AFTER_PAGE_LOCKED');
            $after_page_text = $after_page->render();
            $doctype_text = doctype($CI->config->item('doctype'));
            /*********************************************************
             * display the page content
             * i sum all the page content text
             * before page + CSS + JS + head + body + after page
             * *******************************************************/
            // Rendering the page
            echo <<<EOT
{$before_page_text}
{$doctype_text}
<html xmlns="http://www.w3.org/1999/xhtml" >
\t<head>
\t<title>{$CI->config->item('site_name')} {$this->name}</title>
\t<meta http-equiv="content-type" content="text/html;charset={$CI->config->item('charset')}" />
\t<meta name="generator" content="VUNSY system" />
{$CI->vunsy->css_text()}
{$CI->vunsy->js_text()}
{$CI->vunsy->dojo_text()}
{$page_head_text}
\t</head>
\t<body class="{$CI->vunsy->dojoStyle}">
\t\t{$page_body_text}
\t</body>
</html>
{$after_page_text}
EOT;
            $CI->vunsy->js = array();
            $CI->vunsy->css = array();
            $CI->vunsy->dojo = array();
        }
        //Very long IF block for view permission
    }
Exemplo n.º 10
0
<?php

require_once '../app/init.php';
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);
$app = new App();
$renderOutput = $app->getController();
$layout = new Layout();
$layout->render($renderOutput);
Exemplo n.º 11
0
        $mvc_name = $r[1];
        $task = $r[2];
    } else {
        // Only class and method defined in the path requested
        $mvc_class = '' . ucfirst(strtolower($r[0])) . 'LmsController';
        $mvc_name = $r[0];
        $task = $r[1];
    }
    ob_clean();
    $controller = new $mvc_class($mvc_name);
    $controller->request($task);
    $GLOBALS['page']->add(ob_get_contents(), 'content');
    ob_clean();
} else {
    // load module body
    if (!empty($GLOBALS['modname'])) {
        $module_cfg->loadBody();
    }
}
// -----------------------------------------------------------------------------
#// finalize TEST_COMPATIBILITA_PHP54
//Boot::finalize();
// remove all the echo and put them in the debug zone
$GLOBALS['page']->add(ob_get_contents(), 'debug');
ob_clean();
// layout
Layout::render(isset($_SESSION['idCourse']) ? 'lms' : 'lms_user');
#// finalize TEST_COMPATIBILITA_PHP54
Boot::finalize();
// flush buffer
ob_end_flush();
Exemplo n.º 12
0
} else {
    // layout selection
    if ($op == '') {
        $op = 'login';
    }
    switch ($op) {
        case 'login':
            $layout = 'home_login';
            break;
        default:
            if ($module_cfg) {
                $layout = 'home';
                $module_cfg->loadBody();
            } else {
                die;
            }
            break;
    }
}
// -----------------------------------------------------------------------------
#// finalize TEST_COMPATIBILITA_PHP54
// Boot::finalize();
// remove all the echo and put them in the debug zone
$GLOBALS['page']->add(ob_get_contents(), 'debug');
ob_clean();
// layout
Layout::render($layout);
#// finalize TEST_COMPATIBILITA_PHP54
Boot::finalize();
// flush buffer
ob_end_flush();
Exemplo n.º 13
0
    $r = explode('/', $request);
    $action = $r[1];
    if (count($r) == 3) {
        // Position, class and method defined in the path requested
        $mvc = ucfirst(strtolower($r[1])) . ucfirst(strtolower($r[0])) . 'Controller';
        $action = $r[2];
    } else {
        // Only class and method defined in the path requested
        $mvc = '' . ucfirst(strtolower($r[0])) . 'AdmController';
        $action = $r[1];
    }
    ob_clean();
    $controller = new $mvc(strtolower($r[1]));
    $controller->request($action);
    $GLOBALS['page']->add(ob_get_contents(), 'content');
    ob_clean();
} elseif ($GLOBALS['modname'] != '') {
    $module_cfg->loadBody();
}
// -----------------------------------------------------------------------------
#// finalize TEST_COMPATIBILITA_PHP54
//Boot::finalize();
// remove all the echo and put them in the debug zone
$GLOBALS['page']->add(ob_get_contents(), 'debug');
ob_clean();
// layout
Layout::render('adm');
#// finalize TEST_COMPATIBILITA_PHP54
Boot::finalize();
// flush buffer
ob_end_flush();
Exemplo n.º 14
0
 public static function handler($data = null)
 {
     Layout::set("leftNav", Config::get("display:leftnav"));
     echo Layout::render();
 }