예제 #1
0
 public static function RenderList($template, $data = '')
 {
     $renderer = new ViewRenderer($template);
     if ($data != '') {
         return $renderer->tryRenderlist($data);
     }
 }
예제 #2
0
 public function test()
 {
     $renderer = new ViewRenderer(__DIR__ . '/testviews/', ["kGlob" => "vGlob"]);
     $obj = new \stdClass();
     $obj->foo2 = "bar2";
     $this->assertEquals('<div>bar_vGlob</div>', $renderer->render('testview.php', ['foo' => 'bar'], $obj));
     $this->assertEquals('<div>bar_vGlob</div>', $renderer('testview.php', ['foo' => 'bar'], $obj));
 }
예제 #3
0
 /**
  * Render the view script and output it to string. Less
  * effecient than ::render - use only when required
  * 
  * @param string $path Path for the script to render
  * @param array $params Array with parameters to pass
  * @return string String containing the result
  */
 public static function renderToString($path, $params = null)
 {
     debug(__METHOD__ . "({$path}, {$params})");
     $view = new ViewRenderer($path);
     if ($params) {
         $view->assign($params);
     }
     return $view->doRenderToString();
 }
예제 #4
0
 public static function render($script, $params = null, $contact = null)
 {
     $layout = new ViewRenderer(APP_PATH . '/layouts/mail.php');
     $body = new ViewRenderer($script);
     $body->assign($params);
     if ($contact !== null) {
         // Commented out to remove the opt-out link while it's broken
         // $layout->optoutUrl = self::buildAuthenticationUrl('optout', $contact);
         $body->contact = $contact;
     }
     $layout->body = $body;
     return $layout->doRenderToString();
 }
예제 #5
0
function uncaughtExceptionHandler($e)
{
    logException($e);
    ob_end_clean();
    header('HTTP/1.1 500 Internal Server Error');
    ViewRenderer::render('views/errorPage.php', array('exception' => $e));
    die;
}
예제 #6
0
 /**
  * Render view object
  *
  * @param EasyView $viewObj
  * @return string result of rendering process
  */
 public static function render($viewObj)
 {
     $tplEngine = $viewObj->m_TemplateEngine;
     $tplFile = BizSystem::getTplFileWithPath($viewObj->m_TemplateFile, $viewObj->m_Package);
     if ($tplEngine == "Smarty" || $tplEngine == null) {
         return ViewRenderer::renderSmarty($viewObj, $tplFile);
     } else {
         return ViewRenderer::renderPHP($viewObj, $tplFile);
     }
 }
예제 #7
0
 /**
  * Render view object
  *
  * @param EasyView $viewObj
  * @return string result of rendering process
  */
 public static function render($viewObj)
 {
     $tplEngine = $viewObj->m_TemplateEngine;
     $tplAttributes = ViewRenderer::buildTemplateAttributes($viewObj);
     if (defined("PAGE_MINIFY") && PAGE_MINIFY == 1) {
         //if(!ob_start("ob_gzhandler")) ob_start();
         ob_start();
     }
     if ($tplEngine == "Smarty" || $tplEngine == null) {
         $result = ViewRenderer::renderSmarty($viewObj, $tplAttributes);
     } else {
         $result = ViewRenderer::renderPHP($viewObj, $tplAttributes);
     }
     if (defined("PAGE_MINIFY") && PAGE_MINIFY == 1) {
         $html = ob_get_contents();
         ob_end_clean();
         $html = self::MinifyOutput($html);
         echo $html;
     }
     return $html;
 }
예제 #8
0
 static function buildNavbar()
 {
     $html = '';
     $role = AuthHandler::getRole();
     $acl = $GLOBALS['acl'];
     $logged = $role !== ROLE_GUEST;
     // Put branding bar if we want one
     if (getConfiguration('branding.enable')) {
         $html .= ViewRenderer::renderToString('views/branding.php');
     }
     $html .= '<div id="navbar">';
     if ($logged) {
         $pages =& self::$pagesMember;
         // Put the right ref on the logout link
         $pages[4]['params'] = array('ref' => Utils::getRunningScript());
         // If we have no ride yet, the name of join.php is still "Join"
         if (!AuthHandler::isRideRegistered()) {
             $pages[1]['name'] = 'Join';
         }
     } else {
         $pages =& self::$pagesGuest;
     }
     $str = '<ol>';
     foreach ($pages as $page) {
         if ($acl->isAllowed($role, $page['href'])) {
             $str .= '<li><a href="' . Utils::buildLocalUrl($page['href'], isset($page['params']) ? $page['params'] : null) . '" ';
             if ($page['href'] == Utils::getRunningScript()) {
                 $str .= 'class="selected"';
             }
             $str .= '>' . _($page['name']) . '</a></li>';
         }
     }
     $str .= '</ol>';
     $html .= $str;
     $html .= self::buildLanguageSelector();
     $html .= self::buildRegionSelector();
     $html .= '<div class="clearFloat"></div></div>';
     return $html;
 }
예제 #9
0
<body role="document">
	<!-- nav begins -->
	<?php 
$login_user_msg = "";
$login_status = "LOG OUT";
if (!empty($login_user_info) && $login_user_info->__is_login == $params->YES && !empty($login_user_info->__member_hashkey)) {
    // 로그인 되었을 경우.
    $login_user_msg = "Welcome! " . $login_user_info->__member_first_name . " " . $login_user_info->__member_last_name;
    $view_render_var_arr = array("[__ACTIVE_MEETING_AGENDA__]" => "active", "[__MEETING_MEMBERSHIP_ID__]" => $meeting_membership_id, "[__LOG_IN_USER__]" => $login_user_msg, "[__LOG_IN_URL__]" => "{$service_root_path}/view/log_out.php?redirect_url={$service_root_path}/view/meeting_agenda.php?MEETING_ID={$meeting_id}", "[__LOG_IN_STATUS__]" => $login_status, "[__ROOT_PATH__]" => $service_root_path);
    ViewRenderer::render("{$file_root_path}/template/nav.toast-master.admin.template", $view_render_var_arr);
} else {
    // 로그인되지 않았을 경우.
    $login_status = "LOG IN";
    $view_render_var_arr = array("[__ACTIVE_MEETING_AGENDA__]" => "active", "[__MEETING_MEMBERSHIP_ID__]" => $meeting_membership_id, "[__LOG_IN_URL__]" => "{$service_root_path}/view/log_in.php?redirect_url={$service_root_path}/view/meeting_agenda.php?MEETING_ID={$meeting_id}", "[__LOG_IN_STATUS__]" => $login_status, "[__ROOT_PATH__]" => $service_root_path);
    ViewRenderer::render("{$file_root_path}/template/nav.toast-master.template", $view_render_var_arr);
}
// check date is expired
$is_expired = $params->YES;
$editable_time = date("YmdHis", strtotime("-1 days"));
// YYYYMMDDHHmmss
// $is_edit_anyway = $params["is_edit_anyway"];
$is_edit_anyway = $params->isYes($params->IS_EDIT_ANYWAY);
if ($editable_time < $meeting_agenda_obj->__startdttm || $is_edit_anyway == $params->YES) {
    $is_expired = $params->NO;
}
$is_editable = $is_expired == $params->NO && $login_user_info->__member_id > 0 ? $params->YES : $params->NO;
?>
	<!-- nav ends -->

 function putLogonFormFields()
 {
     ViewRenderer::render('views/authFormLdap.php');
 }
 function putLogonFormFields()
 {
     ViewRenderer::render('views/authFormPassword.php');
 }
예제 #12
0
파일: DynaView.php 프로젝트: que273/siremis
 /**
  * Render this view. This function is called by Render() or ReRender()
  *
  * @return mixed either print html content or return html content if called by Render(), or void if called by ReRender()
  */
 protected function _render()
 {
     $this->setClientScripts();
     include_once OPENBIZ_BIN . "/easy/ViewRenderer.php";
     return ViewRenderer::render($this);
 }
예제 #13
0
        } else {
            return $defaultValue;
        }
    }
    public function GetShowPageList()
    {
        return true;
    }
    public function GetShortCaption()
    {
        return $this->GetCaption();
    }
    public function GetCaption()
    {
        return $this->GetLocalizerCaptions()->GetMessageString('AdminPage');
    }
    public function GetPageFileName()
    {
        return basename(__FILE__);
    }
}
$tableBasedGrants = CreateTableBasedGrantsManager();
$page = new AdminPage($tableBasedGrants);
$page->setHeader(GetPagesHeader());
$page->setFooter(GetPagesFooter());
$page->OnGetCustomTemplate->AddListener('Global_GetCustomTemplateHandler');
if (!GetApplication()->GetUserAuthorizationStrategy()->HasAdminGrant(GetApplication()->GetCurrentUser())) {
    RaiseSecurityError($page, 'You do not have permission to access this page.');
}
$renderer = new ViewRenderer($page->GetLocalizerCaptions());
echo $renderer->Render($page);
예제 #14
0
        </p>
    </form>
    <hr />
</div>
<?php 
if (isset($_POST['fileName'])) {
    $fileName = $_POST['fileName'];
    if (!in_array($fileName, $validFileList)) {
        die('File was not found in the views folder');
    }
    $params = null;
    // TODO: Why JSON doesn't work?
    if (isset($_POST['params'])) {
        $paramStr = explode("\n", $_POST['params']);
        foreach ($paramStr as $pair) {
            $pairArr = explode('=', $pair);
            $pairArr[0] = trim($pairArr[0]);
            $pairArr[1] = trim($pairArr[1]);
            if (substr($pairArr[1], 0, 1) == '[' && substr($pairArr[1], -1) == ']') {
                $params[trim($pairArr[0])] = explode(',', $pairArr[1]);
            } else {
                $params[trim($pairArr[0])] = $pairArr[1];
            }
        }
    }
    ViewRenderer::render(APP_PATH . '/views/' . $fileName, $params);
}
?>
</div>
</body>
</html>
예제 #15
0
파일: EasyView.php 프로젝트: que273/siremis
 /**
  * Render this view. This function is called by Render() or ReRender()
  *
  * @return mixed either print html content or return html content if called by Render(), or void if called by ReRender()
  */
 protected function _render()
 {
     $this->setClientScripts();
     if ($this->m_CacheLifeTime > 0) {
         $pageUrl = $this->curPageURL();
         $cache_id = md5($pageUrl);
         //try to process cache service.
         $cacheSvc = BizSystem::getService(CACHE_SERVICE, 1);
         $cacheSvc->init($this->m_Name, $this->m_CacheLifeTime);
         if ($cacheSvc->test($cache_id)) {
             BizSystem::log(LOG_DEBUG, "VIEW", "Cache Hit. url = " . $pageUrl);
             $output = $cacheSvc->load($cache_id);
         } else {
             include_once OPENBIZ_BIN . "/easy/ViewRenderer.php";
             $this->m_ConsoleOutput = false;
             $output = ViewRenderer::render($this);
             BizSystem::log(LOG_DEBUG, "VIEW", "Set cache. url = " . $pageUrl);
             $cacheSvc->save($output, $cache_id);
         }
         print $output;
     } else {
         include_once OPENBIZ_BIN . "/easy/ViewRenderer.php";
         ViewRenderer::render($this);
     }
     return;
     /*
             $this->setClientScripts();
           	include_once(OPENBIZ_BIN."/easy/ViewRenderer.php"); 
     	    return ViewRenderer::render($this);*/
 }
예제 #16
0
$all_member_list = $wdj_mysql_interface->getMemberListByMembershipIdNMemberHashkey($MEETING_MEMBERSHIP_ID, $login_user_info->__member_hashkey);
// TODO userid 생성. 번호로 정의되는 member_id는 외부 공격에 위험.
// SELECT MD5('testing');
//echo hash('crc32b', 'Wonder Jung');
// @ required
$wdj_mysql_interface->close();
?>

<html>
<head>

<?php 
// @ required
include_once "../../common.js.inc";
$view_render_var_arr = array("[__ROOT_PATH__]" => $service_root_path);
ViewRenderer::render("{$file_root_path}/template/head.include.toast-master.mobile.template", $view_render_var_arr);
?>

</head>






<body role="document">

	<table class="table" style="margin-bottom:0px;">

		<tbody id="list">
		</tbody>
예제 #17
0
<?php

require_once 'VewRenderer.php';
echo ViewRenderer::render('index', ['title' => 'Index Super Page', 'objects' => [['name' => 'Sofia', 'population' => 1500000], ['name' => 'Burgas', 'population' => 220000]]], 'layout');