Exemplo n.º 1
0
 /**
  * 实例化调用方法,传递需要的数据到模板
  */
 protected function run()
 {
     $_function_get = 'get_' . $this->class_key;
     #$_class_key = $this->object_code.'_'.$this->class_key;
     #$this->add_data($_class_key,$this->$_function_get());
     #DebugTools::print_r($this->$_function_get());
     if ($this->output == 'html') {
         $dir = Yaf_Registry::get('config')->application->directory . '/widgets/views/';
         $widget_view = new Yaf_View_Simple($dir);
         $widget_view->assign('data', $this->{$_function_get}());
         $widget_view->assign('assist_data', $this->assist_data);
         echo $widget_view->render($this->class_key . '.phtml');
         #DebugTools::print_r($res);
         #Yaf_Loader::getInstance()->import($dir.'/item_condition.phtml');
         #DebugTools::print_r($widget_view);
         /*if (empty($this->view)){$this->view = $this->class_key;}
           $this->render($this->view,array(
               'data'=>$this->$_function_get(),
               'assist_data'=>$this->assist_data
           ));*/
     } else {
         if ($this->output == 'json') {
             $this->output_json($this->{$_function_get}());
         } else {
             if ($this->output == 'array') {
                 $this->output_array($this->{$_function_get}());
             }
         }
     }
 }
Exemplo n.º 2
0
 public function postDispatch(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response)
 {
     # 得到 body 代码
     $body = $response->getBody();
     # 清理 body
     $response->clearBody();
     # 使用 布局
     $layout = new Yaf_View_Simple($this->_layoutDir);
     $layout->content = $body;
     /*
     		if(false !== strpos(REDIRECT_URL, '/loan_')){
        $loan   = LoanModel::getInfoByUid($_SESSION['user']['uid']);
        if(empty($loan)){
            $loan   = array(
                'loan_total'  => 0,
                'deposit_total'  => 0,
                'loan_over'=> 0,
                'ybc_over' => 0,
                'loan_lock'=> 0,
                'ybc_lock' => 0
            );
        }
        $layout->assign('loan', $loan);
             }
     */
     $layout->assign('layout', $this->_layoutVars);
     $response->setBody($layout->render($this->_layoutFile));
 }
Exemplo n.º 3
0
 public function postDispatch(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response)
 {
     /* get the body of the response */
     $body = $response->getBody();
     /*clear existing response*/
     $response->clearBody();
     /* wrap it in the layout */
     $layout = new Yaf_View_Simple($this->_layoutDir);
     $layout->content = $body;
     $layout->assign('layout', $this->_layoutVars);
     /* set the response to use the wrapped version of the content */
     $response->setBody($layout->render($this->_layoutFile));
 }
Exemplo n.º 4
0
 public function render($viewPath, $tplVars = NULL)
 {
     if (isset($_GET['rdtest']) && $_GET['rdtest'] == 1 && App::environment(APP_ENVIRONMENT_DEVELOPMENT)) {
         $this->assign('view_path', $viewPath);
         return parent::render(Enhancer_Const::getDebugViewFilePath(), $tplVars);
     }
     return parent::render($viewPath, $tplVars);
 }
Exemplo n.º 5
0
 public function testCase040()
 {
     $output = $this->view->render(null);
     $this->assertFalse($output);
     $output = $this->view->render(0);
     $this->assertFalse($output);
     $output = $this->view->render(true);
     $this->assertFalse($output);
 }
Exemplo n.º 6
0
<?php

if (isset($argv[1])) {
    $_GET['mode'] = $argv[1];
}
if (isset($_GET['mode']) && $_GET['mode'] == 'yaf') {
    include 'bootstrap_yaf_so.php';
} else {
    include 'bootstrap.php';
}
$view = new Yaf_View_Simple(TEST_APPLICATION_PATH . 'application/views/');
$view->render('test/testCase039.phtml', array('tpl' => 'test/testCase038.phtml'));
Exemplo n.º 7
0
 public function setScriptPath($strTpl)
 {
     return parent::setScriptPath($this->fixTplPath($strTpl));
 }
Exemplo n.º 8
0
 public function render($tpl, $tpl_var = array())
 {
     return parent::render($this->getTpl($tpl), $tpl_var);
 }
Exemplo n.º 9
0
<?php

if (isset($argv[1])) {
    $_GET['mode'] = $argv[1];
}
if (isset($_GET['mode']) && $_GET['mode'] == 'yaf') {
    include 'bootstrap_yaf_so.php';
} else {
    include 'bootstrap.php';
}
$view = new Yaf_View_Simple(TEST_APPLICATION_PATH . 'application/views/');
$view->render('test/testCase038.phtml');
Exemplo n.º 10
0
 /**
  * method to render component page
  * 
  * @param string $viewName the view name to render
  * @return type
  */
 protected function renderView($viewName, array $params = array())
 {
     $path = Billrun_Factory::config()->getConfigValue('application.directory');
     $view_path = $path . '/views/' . strtolower($this->getRequest()->getControllerName());
     $view = new Yaf_View_Simple($view_path);
     foreach ($params as $key => $val) {
         $view->assign($key, $val);
     }
     return $view->render($viewName . '.phtml', $params);
 }