Example #1
0
/**
 * Trnaslate a text or a key
 * @param  string  $text Key or text to be translated
 * @param  boolean $echo Echo the result or return it
 * @param  array  $args  Aditionnal args for wordpress l10n functions
 * @return string        Translated text
 */
function trans($text, $echo = false, array $args = null)
{
    $config = Application::get('config');
    if ($config->get('lang.use_wordpress')) {
        $lang = Application::get('lang');
        return $lang->get($text);
    }
    if ($echo) {
        _e($text, $config->get('app.plugin_prefix'));
    } else {
        __($text, $config->get('app.plugin_prefix'));
    }
}
 public function home(Content $content, Ticket $ticket, User $user, Application $application, BusinessUnit $businessUnit)
 {
     //FIND USERS WITH SUBMITTED TICKETS
     $users_with_tickets = User::has('tickets')->get();
     //USERS WHO ARE NOT ADMIN
     $non_admin_users = $user->notAdmin()->get();
     $admin_users = $user->admins()->get();
     $tickets_all = $ticket->all()->count();
     $tickets_c = $ticket->completed()->get()->count();
     $prj_brief_records = $content->latest()->brief()->get();
     $prj_notes_records = $content->latest()->notes()->get();
     $status_records = $content->latest()->status()->get();
     $applications = $application->get();
     $users = $user->get();
     return view('pages.home', compact('prj_notes_records', 'status_records', 'tickets_c', 'tickets_all', 'users_with_tickets', 'applications', 'non_admin_users', 'admin_users', 'users'));
 }
Example #3
0
 public static function getRouteFromRequestAction($requestAction)
 {
     $config = Application::get('config');
     $format = $config->get("app.plugin_prefix") . "__%s";
     $routes = Application::get('routes');
     $routeAction = null;
     $route = null;
     // route to return
     sscanf($requestAction, $format, $routeAction);
     $routeAction = !isset($routeAction) || empty($routeAction) ? $config->get('app.plugin_dashboard_action') : $routeAction;
     // maybe throw an exception if `plugin_dashboard_action`is not set
     if (!$routeAction) {
         return false;
     }
     // format not exact
     $routes->all()->each(function ($item) use($routeAction, &$route) {
         if ($item['action'] === $routeAction) {
             $route = $item;
             return;
         }
     });
     return $route;
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $apps = Application::get();
     return view('apps', ['addnew' => 'App', 'title' => 'Applications', 'table' => 'apps', 'apps' => $apps]);
 }
Example #5
0
 public function get($key)
 {
     return Application::get($key);
 }
Example #6
0
 public function index()
 {
     $twig = Application::get('twig');
     $responseContent = $twig->render('videos.twig.htm', ['name' => 'younes']);
     return $responseContent;
 }
Example #7
0
 public function loadRoutes(Application $app)
 {
     $app['home.controller'] = function () use($app) {
         return new Controller\HomeController();
     };
     $app->mount('/admin', new Controller\Admin\BlogController());
     $app->get('/test/rr', "home.controller:test");
     $app->get('/', "home.controller:indexAction");
     $app->get('/record', "home.controller:record");
     $app->get('/test2', "home.controller:test2")->method('get|post');
     $app->get('/tracks', "home.controller:tracksAction");
     $app->get('/one/', function () use($app) {
         return $app->json(['a' => 'b']);
     })->bind('sidebar');
     $app->get('/admin/login', function (Request $request) use($app) {
         return $app['twig']->render('admin/login.twig', ['error' => $app['security.last_error']($request), 'last_username' => $app['session']->get('_security.last_username')]);
     });
     $app->get('/admin/', function () use($app) {
         return 'admin';
     });
     /**
      * редирект для всех несуществующих роутов в админку
      */
     $app->get('/admin/{all}', function () use($app) {
         return $app->redirect('/admin/');
     })->assert('all', '.*');
     $app['security.firewalls'] = ['login' => ['pattern' => '^/admin/login$'], 'secured_area' => ['pattern' => '^/admin', 'form' => ['login_path' => '/admin/login', 'check_path' => '/admin/check_login', 'always_use_default_target_path' => true, 'default_target_path' => 'post'], 'logout' => ['logout_path' => '/admin/logout', 'target' => '/', 'invalidate_session' => true], 'users' => ['admin' => ['ROLE_ADMIN', '5FZ2Z8QIkA7UTZ4BYkoC+GsReLf569mSKDsfods6LYQ8t+a8EW9oaircfMpmaLbPBh4FOBiiFyLfuZmTSUwzZg==']]]];
 }