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'); }); }
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); }
/** * Account overview */ public function get_index() { // 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')); // Add search to API options if (Input::has('q')) { $options['search'] = array('string' => Input::get('q'), 'columns' => array('name', 'email')); } // Get the Accounts $modules = API::get(array('account', 'all'), $options); // Paginate the Accounts $modules = Paginator::make($modules->get('results'), $modules->get('total'), $this->per_page); $this->layout->content = Module::page('module.index', $modules); }
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); }
public function get_update($id = null, $sub = null, $sub_id = null) { //var_dump($id, $sub, $sub_id); die; $account = API::get(array('account', $id), array('version' => $sub_id)); $this->layout->content = Module::page('account.update', $account); }
public function get_delete($slug = null) { // Get the Page $response = API::get(array('page', $slug)); // Handle response codes other than 200 OK if (!$response->success) { return Event::first($response->code); } // The request body is the Page $page = $response->get(); $this->layout->content = View::make('admin::page.delete')->with('page', $page); }