コード例 #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);
 }
コード例 #2
0
ファイル: UsersController.php プロジェクト: BP4U/BFAdminCP
 /**
  * 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'));
 }
コード例 #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));
 }
コード例 #4
0
ファイル: UsersController.php プロジェクト: BP4U/BFAdminCP
 /**
  * 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)]);
     }
 }
コード例 #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));
 }
コード例 #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.']);
     }
 }
コード例 #7
0
ファイル: Restful.php プロジェクト: anahkiasen/cerberus
 /**
  * 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');
 }
コード例 #8
0
ファイル: UsersController.php プロジェクト: BP4U/BFAdminCP
 /**
  * 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);
     }
 }
コード例 #9
0
ファイル: ServersController.php プロジェクト: BP4U/BFAdminCP
 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.']);
     }
 }
コード例 #10
0
ファイル: FormerTest.php プロジェクト: mahitiinfo/rubanbridge
 public function testCanUseFacadeWithoutContainer()
 {
     $text = Former::text('foo')->render();
     $this->assertEquals('<input class="form-control" id="foo" type="text" name="foo">', $text);
 }
コード例 #11
0
ファイル: CRUDController.php プロジェクト: strikles/php
 /**
  * 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!');
 }