예제 #1
0
 /**
  * User profile page.
  *
  * @return View
  */
 public function getIndex()
 {
     // Get the user information
     $user = Sentry::getUser();
     $location_list = locationsList();
     return View::make('frontend/account/profile', compact('user'))->with('location_list', $location_list);
 }
예제 #2
0
 /**
  * LDAP import
  *
  * @author Aladin Alaily
  * @return View
  */
 public function getLDAP()
 {
     // Get all the available groups
     $groups = Sentry::getGroupProvider()->findAll();
     // Selected groups
     $selectedGroups = Input::old('groups', array());
     // Get all the available permissions
     $permissions = Config::get('permissions');
     $this->encodeAllPermissions($permissions);
     // Selected permissions
     $selectedPermissions = Input::old('permissions', array('superuser' => -1));
     $this->encodePermissions($selectedPermissions);
     $location_list = locationsList();
     // Show the page
     return View::make('backend/users/ldap', compact('groups', 'selectedGroups', 'permissions', 'selectedPermissions'))->with('location_list', $location_list);
 }
예제 #3
0
 /**
  * Accessory update.
  *
  * @param  int  $accessoryId
  * @return View
  */
 public function getEdit($accessoryId = null)
 {
     // Check if the accessory exists
     if (is_null($accessory = Accessory::find($accessoryId))) {
         // Redirect to the blogs management page
         return Redirect::to('admin/accessories')->with('error', Lang::get('admin/accessories/message.does_not_exist'));
     } else {
         if (!Company::isCurrentUserHasAccess($accessory)) {
             return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
         }
     }
     $category_list = array('' => '') + DB::table('categories')->where('category_type', '=', 'accessory')->whereNull('deleted_at')->orderBy('name', 'ASC')->lists('name', 'id');
     $company_list = Company::getSelectList();
     $location_list = locationsList();
     return View::make('backend/accessories/edit', compact('accessory'))->with('category_list', $category_list)->with('company_list', $company_list)->with('location_list', $location_list);
 }
예제 #4
0
 /**
  * Asset clone.
  *
  * @param  int  $assetId
  * @return View
  */
 public function getClone($assetId = null)
 {
     // Check if the asset exists
     if (is_null($asset_to_clone = Asset::find($assetId))) {
         // Redirect to the asset management page
         return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
     } else {
         if (!Company::isCurrentUserHasAccess($asset_to_clone)) {
             return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
         }
     }
     // Grab the dropdown lists
     $model_list = modelList();
     $statuslabel_list = statusLabelList();
     $location_list = locationsList();
     $manufacturer_list = manufacturerList();
     $category_list = categoryList();
     $supplier_list = suppliersList();
     $assigned_to = usersList();
     $statuslabel_types = statusTypeList();
     $company_list = Company::getSelectList();
     $asset = clone $asset_to_clone;
     $asset->id = null;
     $asset->asset_tag = '';
     $asset->serial = '';
     $asset->assigned_to = '';
     return View::make('backend/hardware/edit')->with('supplier_list', $supplier_list)->with('model_list', $model_list)->with('statuslabel_list', $statuslabel_list)->with('statuslabel_types', $statuslabel_types)->with('assigned_to', $assigned_to)->with('asset', $asset)->with('location_list', $location_list)->with('manufacturer', $manufacturer_list)->with('category', $category_list)->with('company_list', $company_list);
 }
예제 #5
0
 /**
  *  Display bulk edit screen
  *
  * @return View
  **/
 public function postBulkEdit($assets = null)
 {
     if (!Company::isCurrentUserAuthorized()) {
         return Redirect::to('hardware')->with('error', Lang::get('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();
             if ($settings->qr_code == '1') {
                 $assets = Asset::find($asset_ids);
                 $assetcount = count($assets);
                 $count = 0;
                 return View::make('backend/hardware/labels')->with('assets', $assets)->with('settings', $settings)->with('count', $count);
             } else {
                 // QR codes are not enabled
                 return Redirect::to("hardware")->with('error', 'Barcodes are not enabled in Admin > Settings');
             }
         } elseif (Input::get('bulk_actions') == 'delete') {
             $assets = Asset::with('assigneduser', 'assetloc')->find($asset_ids);
             return View::make('backend/hardware/bulk-delete')->with('assets', $assets);
             // Bulk edit
         } elseif (Input::get('bulk_actions') == 'edit') {
             $assets = Input::get('edit_asset');
             $supplier_list = array('' => '') + suppliersList();
             $statuslabel_list = array('' => '') + statusLabelList();
             $location_list = array('' => '') + locationsList();
             $models_list = array('' => '') + modelList();
             $companies_list = array('' => '') + array('clear' => Lang::get('general.remove_company')) + companyList();
             return View::make('backend/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');
     }
 }