Exemplo n.º 1
0
 public function fetch($handler = '', $first = true)
 {
     $this->header('Pina-Response: Json');
     $this->contentType('text/html');
     $app = App::get();
     $this->view->assign('params', \Pina\Request::params());
     $t = $this->view->fetch('file:' . $handler . '.tpl');
     if ($first) {
         $this->view->assign("content", $t);
         ResourceManager::mode('layout');
         $t = $this->view->fetch('Layout/' . $app . '/' . $this->view->getLayout() . '.tpl');
     }
     return $t;
 }
Exemplo n.º 2
0
 public function fetch($handler = '', $first = true)
 {
     $this->header('Pina-Response: Json');
     $this->contentType('text/html');
     if ($first && isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
         $first = false;
     }
     $app = App::get();
     $t = $this->view->fetch('Modules/' . $handler . '.tpl');
     if ($first) {
         $this->view->assign("content", $t);
         ResourceManager::mode('layout');
         $t = $this->view->fetch('Layout/' . $app . '/' . $this->view->getLayout() . '.tpl');
     }
     //\Pina\Modules\Core\Language::rewrite($t);
     return $t;
 }
Exemplo n.º 3
0
function smarty_block_style($params, $content, &$view, &$repeat)
{
    if ($repeat) {
        return;
    }
    if (empty($content) && empty($params['src'])) {
        return '';
    }
    if (!empty($params['src']) && !empty($params['module'])) {
        $from = App::path() . "/default/Modules/" . $params['module'] . '/static/' . ltrim($params['src'], '/');
        $to = App::path() . '/public/cache/css/' . $params['module'] . '.' . str_replace("/", ".", $params['src']);
        if (!file_exists($to) && file_exists($from)) {
            copy($from, $to);
        }
        $params['src'] = "/cache/css/" . $params['module'] . "." . str_replace("/", ".", $params['src']);
    }
    if (!empty($params['src'])) {
        ResourceManager::append('css', '<link rel="stylesheet" href="' . $params['src'] . '" />');
    } elseif (!empty($content)) {
        ResourceManager::append('css', $content);
    }
    return '';
}
Exemplo n.º 4
0
function smarty_block_script($params, $content, &$view, &$repeat)
{
    if ($repeat) {
        return;
    }
    if (empty($content) && empty($params['src'])) {
        return '';
    }
    if (!empty($params['src']) && !empty($params['module'])) {
        $from = App::path() . "/default/Modules/" . $params['module'] . '/static/' . ltrim($params['src'], '/');
        $to = App::path() . '/public/cache/js/' . $params['module'] . '.' . str_replace("/", ".", $params['src']);
        if (!file_exists($to) && file_exists($from)) {
            copy($from, $to);
        }
        $params['src'] = "/cache/js/" . $params['module'] . "." . str_replace("/", ".", $params['src']);
    }
    if (!empty($params['src'])) {
        ResourceManager::append('js', '<script src="' . $params['src'] . '" type="text/javascript"></script>');
    } elseif (!empty($content)) {
        ResourceManager::append('js', $content);
    }
    return '';
}
Exemplo n.º 5
0
function smarty_function_styles($params, &$view)
{
    return \Pina\ResourceManager::fetch('css');
}
Exemplo n.º 6
0
function smarty_function_scripts($params, &$view)
{
    return \Pina\ResourceManager::fetch('js');
}