Esempio n. 1
0
 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');
     });
 }
Esempio n. 2
0
 /**
  * __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());
 }
Esempio n. 3
0
 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');
 }
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
 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);
 }
Esempio n. 6
0
 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');
 }