예제 #1
0
파일: module.php 프로젝트: reith2004/admin
 public static function update($view, $id)
 {
     // Get the Account
     $response = API::get(array('account', $id));
     // Handle response codes other than 200 OK
     if (!$response->success) {
         return Event::first($response->code);
     }
     // The response body is the Account
     $account = $response->get();
     // Get Roles and put it in a nice array for the dropdown
     $roles = array('' => '') + model_array_pluck(API::get(array('role', 'all'))->get('results'), function ($role) {
         return $role->lang->name;
     }, 'id');
     // Get the Roles that belong to a User and put it in a nice array for the dropdown
     $active_roles = array();
     if (isset($account->roles)) {
         $active_roles = model_array_pluck($account->roles, 'id', '');
     }
     // Get Languages and put it in a nice array for the dropdown
     $languages = model_array_pluck(API::get(array('language', 'all'))->get('results'), function ($language) {
         return $language->name;
     }, 'id');
     $view->text('name', __('admin::account.update.form.name'), Input::old('name', $account->name));
     $view->text('email', __('admin::account.update.form.email'), Input::old('email', $account->email));
     $view->password('password', __('admin::account.update.form.password'));
     $view->multiple('roles[]', __('admin::account.update.form.roles'), $roles, Input::old('roles', $active_roles));
     $view->dropdown('language_id', __('admin::account.update.form.language'), $languages, Input::old('language_id', $account->language->id));
     $view->actions(function ($view) {
         $view->submit(__('admin::account.update.buttons.edit'), 'primary');
     });
 }
예제 #2
0
파일: base.php 프로젝트: reith2004/admin
 /**
  * __construct
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     API::$component = 'admin';
     $this->url = Config::get('layla.admin.url_prefix') . '/';
     View::share('base_url', URL::base());
 }
예제 #3
0
파일: account.php 프로젝트: reith2004/admin
 public function delete_delete($id = null)
 {
     // Delete the Account
     $response = API::delete(array('account', $id));
     // Handle response codes other than 200 OK
     if (!$response->success) {
         return Event::first($response->code);
     }
     // Add success notification
     Notification::success('Successfully deleted account');
     return Redirect::to(prefix('admin') . 'accounts');
 }
예제 #4
0
파일: group.php 프로젝트: reith2004/admin
 public function get_read_multiple($id = null)
 {
     // Set API options
     $options = array('offset' => (Input::get('page', 1) - 1) * $this->per_page, 'limit' => $this->per_page, 'sort_by' => Input::get('sort_by', 'name'), 'order' => Input::get('order', 'ASC'), 'filter' => array('module_id' => $id));
     // Add search to API options
     if (Input::has('q')) {
         $options['search'] = array('string' => Input::get('q'), 'columns' => array('name'));
     }
     // Get the Accounts
     $mediagroups = API::get(array('media', $id, 'groups'), $options);
     // Paginate the mediagroups
     $mediagroups = Paginator::make($mediagroups->get('results'), $mediagroups->get('total'), $this->per_page);
     $this->layout->content = Module::page('media.group.read_multiple', $mediagroups, $id);
 }
예제 #5
0
파일: module.php 프로젝트: reith2004/admin
 public function delete($view, $id)
 {
     // Get the Account
     $response = API::get(array('module', $id));
     // Handle response codes other than 200 OK
     if (!$response->success) {
         return Event::first($response->code);
     }
     // The response body is the Account
     $module = $response->get();
     $view->page_header(function ($view) {
         $view->float_right(function ($view) {
             $view->search();
         });
         $view->title(__('admin::module.delete.title'));
     });
     $view->well(function ($view) use($module) {
         $view->raw(__('admin::module.delete.message', array('name' => $module->name, 'email' => $module->email)));
     });
     $view->form(Module::form('module.delete', $id), 'DELETE', prefix('admin') . 'module/delete/' . $id);
 }
예제 #6
0
파일: page.php 프로젝트: reith2004/admin
 public function delete_delete($slug = null)
 {
     // Delete the Page
     $response = API::delete(array('page', $slug));
     // Handle response codes other than 200 OK
     if (!$response->success) {
         return Event::first($response->code);
     }
     // Add success notification
     Notification::success('Successfully deleted page');
     return Redirect::to(prefix('admin') . 'pages');
 }