Exemplo n.º 1
0
 public function localize()
 {
     if ($this->field === TableConst::COLUMN_ACTIONS) {
         return Language::get('table.' . TableConst::COLUMN_ACTIONS);
     }
     return Language::get(Platform::getModule() . '.table.' . $this->field);
 }
Exemplo n.º 2
0
 public function load()
 {
     $items = Config::get(Platform::getPackageName() . '::navigation');
     foreach ($items as $slug => $url) {
         $this->item($slug, $url);
     }
 }
Exemplo n.º 3
0
 public function localize()
 {
     if ($this->slug === Form::MAIN) {
         return Language::get('ui.main_panel');
     } else {
         return Language::get(Platform::getModule() . '.panels.' . $this->slug);
     }
 }
Exemplo n.º 4
0
 public function namespaced($key, $custom = false)
 {
     if ($custom) {
         return self::NS . '::' . $key;
     } else {
         return Platform::getPackageName() . '::' . $key;
     }
 }
Exemplo n.º 5
0
 public function __construct(Repository $source = null)
 {
     if (!isset($source)) {
         $driver = 'Spescina\\PlatformCore\\Repositories\\' . ucfirst(Config::get(Platform::getPackageName() . '::database.driver'));
         $source = new $driver();
     }
     $this->source = $source;
     $this->setTable($this->table);
 }
Exemplo n.º 6
0
 private function set($column, $sort, $module = null)
 {
     $this->column = $column;
     $this->sort = $sort;
     if ($module) {
         $this->module = $module;
     } else {
         $this->module = Platform::getModule();
     }
 }
Exemplo n.º 7
0
 public function url()
 {
     if (isset($this->options['url'])) {
         return $this->options['url'];
     }
     $id = array_key_exists('id', $this->options) ? $this->options['id'] : null;
     $queryString = array_key_exists('queryString', $this->options) ? $this->options['queryString'] : null;
     $url = URL::route('module', array(Platform::getModule(), $this->type, $id));
     if (count($queryString)) {
         $url .= '?' . http_build_query($queryString);
     }
     return $url;
 }
Exemplo n.º 8
0
<?php

/*
 |--------------------------------------------------------------------------
 | Application Response Macros
 |--------------------------------------------------------------------------
*/
use Spescina\PlatformCore\Components\Action\Action as ActionConst;
use Spescina\PlatformCore\Facades\Platform;
Response::macro('showForm', function ($objId = null, $withInput = false) {
    $response = Redirect::route('module', array(Platform::getModule(), ActionConst::ACTION_SHOWFORM, $objId));
    if ($withInput) {
        $response->withInput();
    }
    return $response;
});
Response::macro('listing', function () {
    return Redirect::route('module', array(Platform::getModule(), ActionConst::ACTION_LISTING));
});
Exemplo n.º 9
0
 public function localize($section)
 {
     return Language::get(Platform::getModule() . '.section.' . $section);
 }
Exemplo n.º 10
0
<?php

/*
 |--------------------------------------------------------------------------
 | Application & Route Filters
 |--------------------------------------------------------------------------
 |
 | Below you will find the "before" and "after" events for the application
 | which may be used to do any work before or after a request into your
 | application. Here you may also register your custom route filters.
 |
*/
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Route;
use Spescina\PlatformCore\Facades\Platform;
App::before(function ($request) {
    Route::match(array('GET', 'POST'), '{model}/{action?}/{id?}', array('as' => 'module', function ($module, $action = 'listing', $id = null) {
        return Platform::runModule($module, $action, $id);
    }))->where(array('model' => '[a-z]+', 'action' => '[a-z]+', 'id' => '[0-9]+'));
});
Route::filter('platform-core', function () {
});
Exemplo n.º 11
0
 public function localize($label)
 {
     $key = Platform::getModule() . '.form._labels_.' . $this->slug . '.' . $label;
     return Language::get($key);
 }
Exemplo n.º 12
0
 public function localize()
 {
     return Language::get(Platform::getModule() . '.form.' . $this->slug);
 }
Exemplo n.º 13
0
 public function applicable()
 {
     return $this->module === Platform::getModule();
 }
Exemplo n.º 14
0
 protected function doListing()
 {
     Page::toolbar()->add('add', array('action' => 'form', 'label' => 'add'));
     return View::make(Platform::getPackageName() . '::listing');
 }
Exemplo n.º 15
0
 private function paginate($query)
 {
     $paging = Config::get(Platform::getPackageName() . '::table.pagination');
     return $query->paginate($paging);
 }
Exemplo n.º 16
0
 public function load()
 {
     $this->item('root');
     $this->item(Platform::getModule());
 }