/**
  * Constructor
  *
  * @param Norm\Cursor $entries Entries that we want to page
  */
 public function __construct(Cursor $entries)
 {
     $this->entries = $entries;
     $this->app = App::getInstance();
     $configCollection = $this->app->config('norm.collections');
     if (isset($configCollection['default'])) {
         if (isset($configCollection['default']['limit'])) {
             $this->limit = $configCollection['default']['limit'];
         }
     }
     $this->baseUrl = URL::current();
 }
Example #2
0
 public static function actionButton($name, $options, $context)
 {
     if (empty($options)) {
         $options = array();
     }
     $app = \Slim\Slim::getInstance();
     if (is_null(@$options['url'])) {
         $options['url'] = $app->request->getResourceUri() . '/%s/' . $name;
     }
     $url = \Bono\Helper\URL::site(sprintf($options['url'], $context['$id']));
     $label = static::get($name, @$options['label'], $context);
     return '<a href="' . $url . '">' . $label . '</a>';
 }
Example #3
0
<div class="wrapper">
    <p>You are not authorized to access this page, maybe you should login first to access it or you can go back to previous page.</p>
    <div class="row button-form">
        <div class="span-12">
            <div class="row">
                <a href="javascript:history.back()" class="button">Back</a>
                <a href="<?php 
echo URL::site('/login') . '?!continue=' . \Bono\Helper\URL::redirect();
?>
" class="button">Login</a>
            </div>
        </div>
    </div>
</div>
Example #4
0
<?php

use Bono\Helper\URL;
?>

<div>
    <a href="<?php 
echo URL::site($_controller->getBaseUri() . '/null/create');
?>
" class="button">Add</a>
</div>

<table class="table table-nowrap table-stripped">
    <thead>
        <tr class="grid-head-row">
            <?php 
foreach ($_schema as $field) {
    ?>
            <th><?php 
    echo $field['label'];
    ?>
</th>
            <?php 
}
?>

            <?php 
if (isset($_actions)) {
    ?>
                <th style="width:1px">&nbsp;</th>
            <?php 
Example #5
0
 /**
  * [getRedirectUri description]
  * @return [type] [description]
  */
 public function getRedirectUri()
 {
     return URL::redirect($this->getBaseUri());
 }
Example #6
0
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Luthor</title>
    <link rel="stylesheet" href="<?php 
echo \Bono\Helper\URL::base('css/naked.css');
?>
">
    <link rel="stylesheet" href="<?php 
echo \Bono\Helper\URL::base('css/font-awesome.css');
?>
">
    <link rel="stylesheet" href="<?php 
echo \Bono\Helper\URL::base('css/emp.css');
?>
">
</head>

<?php 
use Bono\Helper\URL;
?>

<body>
    <div class="fixed navbar" style="text-align: center">
        Welcome
    </div>
    <div class="container">
        <?php 
if (isset($flash['error'])) {
    ?>
 /**
  * Get full URL of web service endpoint
  *
  * @see MarkdownProvider::getDefaultEndPoint
  * @return string
  */
 public function getServiceUrl()
 {
     return URL::site($this->getDefaultEndPoint());
 }
Example #8
0
<fieldset>
    <legend>Container</legend>
    <?php 
foreach ($entry as $key => $value) {
    ?>
    <div class="row">
        <div class="span-12">
            <label><?php 
    echo $key;
    ?>
</label>
            <span class="field"><?php 
    echo $value;
    ?>
</span>
        </div>
    </div>
    <?php 
}
?>
</fieldset>
<div class="row">
    <a href="<?php 
echo \Bono\Helper\URL::site($_controller->getBaseUri());
?>
" class="button">Back to List</a>
</div>
Example #9
0
 /**
  * [resolveAssetPath description]
  *
  * @param string $path [description]
  *
  * @return [type] [description]
  */
 public function resolveAssetPath($path = '')
 {
     $cwd = getcwd();
     foreach ($this->baseDirectories as $dirs) {
         foreach ($dirs as $dir) {
             $file = $dir . '/www/' . $path;
             $srcDir = dirname($file);
             $destDir = dirname($cwd . '/' . $path);
             if (!is_dir($srcDir)) {
                 continue;
             }
             if ($srcDir != $destDir) {
                 $this->copy($srcDir, $destDir);
                 break 2;
             }
         }
     }
     foreach ($this->baseDirectories as $dirs) {
         foreach ($dirs as $dir) {
             $file = $dir . '/www/' . $path;
             if (is_readable($file)) {
                 return URL::base() . $path;
             }
         }
     }
 }
Example #10
0
<script type="text/javascript">
    // FIXME create custom event using plain javascript only!
    // (function() {
    //     "use strict";

    //     var $obj = $('[name=<?php 
echo $self['name'];
?>
]');
    //     var criterias = JSON.parse('<?php 
echo json_encode($criteria);
?>
');
    //     var baseUrl = "<?php 
echo URL::site('/' . $foreign->name) . '.json';
?>
";
    //     var foreignKey = "<?php 
echo $self['foreignKey'];
?>
";
    //     var foreignLabel = "<?php 
echo $self['foreignLabel'];
?>
";

    //     $(function() {
    //         $obj.trigger('change');
    //     });
Example #11
0
 public function renderActionButton($name, $value, $context)
 {
     if (empty($value)) {
         $url = URL::site($this->app->controller->getBaseUri() . '/' . $context['$id'] . '/' . $name);
         return '<a href="' . $url . '">' . $this->humanize($name) . "</a>\n";
     } else {
         return $value($name, $value, $context);
     }
 }
Example #12
0
 /**
  * [redirect description]
  *
  * @param string  $url    [description]
  * @param integer $status [description]
  *
  * @return [type] [description]
  */
 public function redirect($url = ':self', $status = 302)
 {
     $scheme = parse_url($url, PHP_URL_SCHEME);
     if (isset($scheme)) {
         return parent::redirect($url, $status);
     }
     if ($url === ':self') {
         $app = \Slim\Slim::getInstance();
         $url = $app->request->getResourceUri();
     }
     $url = \Bono\Helper\URL::site($url);
     return parent::redirect($url, $status);
 }
Example #13
0
 public function getRedirectUri()
 {
     return URL::redirect();
 }