Ejemplo n.º 1
0
 /**
  * Display the bulk edit page.
  *
  * @author [A. Gianotto] [<*****@*****.**>]
  * @param  int  $assetId
  * @since [v2.0]
  * @return View
  */
 public function postBulkEdit($assets = null)
 {
     if (!Company::isCurrentUserAuthorized()) {
         return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
     } elseif (!Input::has('edit_asset')) {
         return redirect()->back()->with('error', 'No assets selected');
     } else {
         $asset_raw_array = Input::get('edit_asset');
         foreach ($asset_raw_array as $asset_id => $value) {
             $asset_ids[] = $asset_id;
         }
     }
     if (Input::has('bulk_actions')) {
         // Create labels
         if (Input::get('bulk_actions') == 'labels') {
             $settings = Setting::getSettings();
             $assets = Asset::find($asset_ids);
             $count = 0;
             return View::make('hardware/labels')->with('assets', $assets)->with('settings', $settings)->with('count', $count)->with('settings', $settings);
         } elseif (Input::get('bulk_actions') == 'delete') {
             $assets = Asset::with('assigneduser', 'assetloc')->find($asset_ids);
             return View::make('hardware/bulk-delete')->with('assets', $assets);
             // Bulk edit
         } elseif (Input::get('bulk_actions') == 'edit') {
             $assets = Input::get('edit_asset');
             $supplier_list = Helper::suppliersList();
             $statuslabel_list = Helper::statusLabelList();
             $location_list = Helper::locationsList();
             $models_list = Helper::modelList();
             $companies_list = array('' => '') + array('clear' => trans('general.remove_company')) + Helper::companyList();
             return View::make('hardware/bulk')->with('assets', $assets)->with('supplier_list', $supplier_list)->with('statuslabel_list', $statuslabel_list)->with('location_list', $location_list)->with('models_list', $models_list)->with('companies_list', $companies_list);
         }
     } else {
         return redirect()->back()->with('error', 'No action selected');
     }
 }
Ejemplo n.º 2
0
 /**
  * Returns a view that confirms the user's a bulk delete will be applied to.
  *
  * @author [A. Gianotto] [<*****@*****.**>]
  * @since [v1.7]
  * @return View
  */
 public function postBulkEdit()
 {
     if (!Input::has('edit_user') || count(Input::has('edit_user')) == 0) {
         return redirect()->back()->with('error', 'No users selected');
     } else {
         $statuslabel_list = Helper::statusLabelList();
         $user_raw_array = array_keys(Input::get('edit_user'));
         $licenses = DB::table('license_seats')->whereIn('assigned_to', $user_raw_array)->get();
         //print_r($licenses);
         $users = User::whereIn('id', $user_raw_array)->with('groups', 'assets', 'licenses', 'accessories')->get();
         // $users = Company::scopeCompanyables($users)->get();
         return View::make('users/confirm-bulk-delete', compact('users', 'statuslabel_list'));
     }
 }