Ejemplo n.º 1
0
 static function run()
 {
     $code = 1;
     $msg = '';
     $data = null;
     App::init();
     try {
         $data = self::execute();
     } catch (AppBreakException $e) {
         return;
     } catch (Exception $e) {
         if (App::$controller && App::$controller->is_ajax) {
             $code = $e->getCode();
             $msg = $e->getMessage();
             if (!strlen($msg)) {
                 $msg = 'error';
             }
         } else {
             return self::error_handle($e);
         }
     }
     if (App::$controller && App::$controller->is_ajax) {
         $resp = array('code' => $code, 'message' => $msg, 'data' => $data);
         if (defined('JSON_UNESCAPED_UNICODE')) {
             $json = json_encode($resp, JSON_UNESCAPED_UNICODE);
         } else {
             $json = json_encode($resp);
         }
         $jp = App::$controller->jp;
         if (!preg_match('/^[a-z0-9_]+$/i', $jp)) {
             $jp = false;
         }
         if ($jp) {
             echo "{$jp}({$json});";
         } else {
             echo $json;
         }
     } else {
         $layout = find_layout_file();
         if ($layout) {
             $params = App::$context->as_array();
             extract($params);
             include $layout;
         } else {
             _view();
         }
     }
 }
Ejemplo n.º 2
0
 static function _run()
 {
     $code = 1;
     $msg = '';
     $data = null;
     App::init();
     try {
         $data = self::execute();
     } catch (AppBreakException $e) {
         return;
     } catch (Exception $e) {
         if (App::$controller && App::$controller->is_ajax) {
             $code = $e->getCode();
             $msg = $e->getMessage();
             if (!strlen($msg)) {
                 $msg = 'error';
             }
         } else {
             return self::error_handle($e);
         }
     }
     if (App::$controller && App::$controller->is_ajax) {
         $resp = array('code' => $code, 'message' => $msg, 'data' => $data);
         if (defined('JSON_UNESCAPED_UNICODE')) {
             $json = json_encode($resp, JSON_UNESCAPED_UNICODE);
         } else {
             $json = json_encode($resp);
         }
         $jp = App::$controller->jp;
         if (!preg_match('/^[a-z0-9_]+$/i', $jp)) {
             $jp = false;
         }
         if ($jp) {
             echo "{$jp}({$json});";
         } else {
             echo $json;
         }
     } else {
         #var_dump(find_view_and_layout());
         list($__view, $__layout) = find_view_and_layout();
         if (!$__view) {
             Logger::trace("No view for " . base_path());
         } else {
             Logger::trace("View {$__view}");
             $params = App::$context->as_array();
             extract($params);
             ob_start();
             include $__view;
             self::$view_content = ob_get_clean();
         }
         if ($__layout) {
             Logger::trace("Layout {$__layout}");
             $params = App::$context->as_array();
             extract($params);
             include $__layout;
         } else {
             if (App::$controller->layout !== false) {
                 Logger::error("No layout for " . base_path());
             }
             _view();
         }
     }
 }
function view($view_name, $arr_data = array(), $return_string = true)
{
    $file = DIR . $GLOBALS['d'] . DS . 'views' . DS . $view_name . PHP_EXT;
    return _view($file, $arr_data, $return_string);
}
Ejemplo n.º 4
0
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>iphp</title>
	<meta name="description" content="iphp framework" />
	<meta name="keywords" content="iphp framework" />
	<link href="<?php 
echo _url('/css/style.css');
?>
" rel="stylesheet" />
</head>
<body>

<div class="container">
	<?php 
_view();
?>
		
	<div class="footer">
		Copyright&copy;2014-2016 <a href="http://github.com/ideawu/iphp">iphp</a>. All rights reserved.
	</div>
</div>
<!-- /container -->

</body>
</html>
Ejemplo n.º 5
0
 /**
  * Print ascii logo.
  */
 protected function logo()
 {
     /* Get some theme going */
     $this->output->getFormatter()->setStyle('p', new OutputFormatterStyle('magenta', 'black'));
     $this->output->getFormatter()->setStyle('t', new OutputFormatterStyle('white', 'black'));
     $this->output->writeln(_view('ascii.logo')->render());
 }
Ejemplo n.º 6
0
    header("Content-type: application/octetstream");
    header("Cache-Control: no-cache");
    header("Pragma: no-cache");
    header("Expires: -1");
    $path = $conf['htcaas_php_path'];
    $command = <<<EOS
{$path}/cli/cli.tar.php "{$a}"
EOS;
    passthru($command);
    exit;
}
if ($mode == 'view') {
    pagehead();
    $sjid = $form['sjid'];
    $mjid = $form['mjid'];
    if ($sjid) {
        ptitle("Result List of a SubJob id={$sjid}");
    } else {
        if ($mjid) {
            ptitle("Result List of a MetaJob id={$mjid}");
        } else {
            die('Error' . ':' . __FILE__ . ':' . __LINE__);
        }
    }
    _view($sjid, $mjid);
    pagetail();
    exit;
}
pagehead();
pagetail();
exit;
Ejemplo n.º 7
0
<!DOCTYPE html>
<html>
<head>
    <title><?php 
echo _title();
?>
</title>
    <?php 
include _i('inc/tpl/head.php');
?>
</head>
<body>
    <?php 
include _i('inc/tpl/header.php');
?>
    <?php 
include _view();
?>
    <?php 
include _i('inc/tpl/footer.php');
?>
</body>
</html>
Ejemplo n.º 8
0
Archivo: App.php Proyecto: lkmmmj/iphp
 private static function html_resp()
 {
     #var_dump(find_view_and_layout());
     list($__view, $__layout) = find_view_and_layout();
     if (!$__view) {
         Logger::trace("No view for " . base_path());
     } else {
         Logger::trace("View {$__view}");
         $__params = App::$context->as_array();
         extract($__params);
         ob_start();
         include $__view;
         self::$view_content = ob_get_clean();
     }
     if ($__layout) {
         Logger::trace("Layout {$__layout}");
         $__params = App::$context->as_array();
         extract($__params);
         include $__layout;
     } else {
         if (App::$controller->layout !== false) {
             Logger::error("No layout for " . base_path());
         }
         _view();
     }
 }