Exemplo n.º 1
0
 public function setupTheme($theme = 'defsault', $layout = 'default')
 {
     $this->theme = Theme::uses($theme)->layout($layout);
     Former::framework('TwitterBootstrap3');
     Former::config('fetch_errors', true);
     Former::config('push_checkboxes', true);
 }
Exemplo n.º 2
0
 /**
  * Show the account settings page
  *
  * @return View
  */
 public function showAccountSettings()
 {
     $page_title = 'Account Settings';
     $user =& $this->user;
     // Populate the form fields with the user information
     Former::populate($user);
     return View::make('user.account-settings', compact('user', 'page_title'));
 }
Exemplo n.º 3
0
 public function editUser($userId)
 {
     $user = \Cms\Models\User::find($userId);
     $populate = $user->getAttributes();
     unset($populate['password']);
     Former::populate($populate);
     return View::make('cms::users.user', array("user" => $user));
 }
Exemplo n.º 4
0
 /**
  * Show the editing page
  *
  * @param integer $id User ID
  */
 public function edit($id)
 {
     try {
         $user = User::with('role', 'soldiers.player')->findOrFail($id);
         $roles = Role::lists('role_name', 'role_id');
         $page_title = Lang::get('navigation.admin.adkats.items.users.items.edit.title', ['id' => $id]);
         Former::populate($user);
         return View::make('admin.adkats.users.edit', compact('user', 'page_title', 'roles'));
     } catch (ModelNotFoundException $e) {
         return Redirect::route('admin.adkats.users.index')->withErrors([sprintf('User #%u doesn\'t exist.', $id)]);
     }
 }
Exemplo n.º 5
0
 /** Create Menu */
 public function menu($menu_id = 0)
 {
     if ($menu_id) {
         $menu = Menu::find($menu_id);
         if (!$menu) {
             return Redirect::route('cmsEdit');
         }
         View::share("title", Lang::get('cms::m.update-menu') . ": " . $menu->title);
         Former::populate($menu);
     } else {
         $menu = new Menu();
         View::share("title", Lang::get('cms::m.create-menu'));
     }
     return View::make('cms::menus.menu', array("menu" => $menu));
 }
Exemplo n.º 6
0
 public function edit($id)
 {
     try {
         $server = Server::findOrFail($id);
         // If no setting entry exists for the server we need to create it
         if (is_null($server->setting)) {
             $setting = new Setting(['server_id' => $id]);
             $setting->server()->associate($server)->save();
             $server->load('setting');
         }
         Former::populate($server->setting);
         return View::make('admin.site.servers.edit', compact('server'))->with('page_title', 'Server Settings');
     } catch (ModelNotFoundException $e) {
         return Redirect::route('admin.site.servers.index')->withErrors(['Server doesn\'t exist.']);
     }
 }
Exemplo n.º 7
0
 /**
  * Edit an item
  *
  * @param integer $item_id An item id
  */
 public function getUpdate($item_id)
 {
     // If we gave an ID, fetch corresponding object
     if (!is_object($item_id)) {
         // Fetch data from item
         $item = $this->object->find($item_id);
         // If invalid item, redirect to create form
         if (!$item) {
             return Redirect::action($this->here . '@getCreate');
         }
     } else {
         $item = $item_id;
     }
     // Populate form if Former is installed
     if (class_exists('Former')) {
         Former::populate($item);
     }
     return View::make($this->form)->with('item', $item)->with('mode', 'update');
 }
Exemplo n.º 8
0
 /**
  * Show the editing page
  *
  * @param integer $id User ID
  */
 public function edit($id)
 {
     try {
         // If the user we are editing is the current logged in user don't refetch them.
         if ($this->isLoggedIn && $this->user->id == $id) {
             $user = $this->user;
         } else {
             $user = User::findOrFail($id);
         }
         // Get the list of roles
         $roles = Role::lists('name', 'id');
         // Set the page title
         $page_title = Lang::get('navigation.admin.site.items.users.items.edit.title', ['id' => $id]);
         // Populate the form fields with the user information
         Former::populate($user);
         return View::make('admin.site.users.edit', compact('user', 'page_title', 'roles'));
     } catch (ModelNotFoundException $e) {
         $this->messages[] = Lang::get('alerts.user.invlid', ['userid' => $id]);
         return Redirect::route('admin.site.users.index')->withErrors($this->messages);
     }
 }
Exemplo n.º 9
0
 public function edit($id)
 {
     try {
         $server = Server::findOrFail($id);
         // If no setting entry exists for the server we need to create it
         if (is_null($server->setting)) {
             try {
                 $battlelog = App::make('BFACP\\Libraries\\Battlelog\\BattlelogServer')->server($server);
                 $serverguid = $battlelog->guid();
             } catch (Exception $e) {
                 $serverguid = null;
                 Session::flash('warnings', ['Unable to automatically get the battlelog server guid. Please manually enter it.']);
             }
             $setting = new Setting(['server_id' => $id, 'battlelog_guid' => $serverguid]);
             $setting->server()->associate($server)->save();
             $server->load('setting');
         }
         Former::populate($server->setting);
         return View::make('admin.site.servers.edit', compact('server'))->with('page_title', 'Server Settings');
     } catch (ModelNotFoundException $e) {
         return Redirect::route('admin.site.servers.index')->withErrors(['Server doesn\'t exist.']);
     }
 }
Exemplo n.º 10
0
 public function testCanUseFacadeWithoutContainer()
 {
     $text = Former::text('foo')->render();
     $this->assertEquals('<input class="form-control" id="foo" type="text" name="foo">', $text);
 }
Exemplo n.º 11
0
 /**
  * Update the specified resource in storage.
  *
  * @param $company
  * @return Response
  */
 public function postEdit($model)
 {
     $title = 'Edit ' . ucfirst($this->singleName) . ' Details - ' . $model->name;
     $controller = $this->name;
     $input_validation = $this->validateModel();
     if ($input_validation !== true) {
         $this->populateForm();
         Former::withErrors($input_validation);
         return View::make('site/' . $this->name . '/edit', compact('title', 'model', 'controller'))->with('error', 'Not saved!');
     }
     $this->saveModel($model);
     $this->populateForm($model);
     return View::make('site/' . $this->name . '/edit', compact('title', 'model', 'controller'))->with('success', 'Saved!');
 }