@@ -13,6 +13,9 @@ |
||
| 13 | 13 | 'value', |
| 14 | 14 | ]; |
| 15 | 15 | |
| 16 | + /** |
|
| 17 | + * @param string $provider |
|
| 18 | + */ |
|
| 16 | 19 | public function getvalueByKey($provider, $key = '', $login = true) |
| 17 | 20 | { |
| 18 | 21 | $social = ''; |
@@ -113,6 +113,9 @@ |
||
| 113 | 113 | return 'no'; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | + /** |
|
| 117 | + * @param string $body |
|
| 118 | + */ |
|
| 116 | 119 | public function inlineAttachment($body) |
| 117 | 120 | { |
| 118 | 121 | $attachments = $this->attach; |
@@ -113,6 +113,9 @@ |
||
| 113 | 113 | return 'no'; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | + /** |
|
| 117 | + * @param string $body |
|
| 118 | + */ |
|
| 116 | 119 | public function inlineAttachment($body) |
| 117 | 120 | { |
| 118 | 121 | if ($this->attach()->where('poster', 'INLINE')->get()->count() > 0) { |
@@ -24,6 +24,9 @@ |
||
| 24 | 24 | return $value; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | + /** |
|
| 28 | + * @param integer $key |
|
| 29 | + */ |
|
| 27 | 30 | public function checkArray($key, $array) |
| 28 | 31 | { |
| 29 | 32 | $value = ''; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | /** |
| 84 | 84 | * |
| 85 | 85 | * @param CreateAssetRequest $request |
| 86 | - * @return type |
|
| 86 | + * @return \Illuminate\Http\JsonResponse |
|
| 87 | 87 | */ |
| 88 | 88 | public function handleCreate(CreateAssetRequest $request) { |
| 89 | 89 | try { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | /** |
| 130 | 130 | * |
| 131 | 131 | * @param CreateAssetRequest $request |
| 132 | - * @return type |
|
| 132 | + * @return \Illuminate\Http\JsonResponse |
|
| 133 | 133 | */ |
| 134 | 134 | public function handleEdit($id, CreateAssetRequest $request) { |
| 135 | 135 | try { |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | /** |
| 153 | 153 | * |
| 154 | 154 | * @param type $id |
| 155 | - * @return type |
|
| 155 | + * @return \Illuminate\Http\RedirectResponse |
|
| 156 | 156 | */ |
| 157 | 157 | public function assetHandledelete($id) { |
| 158 | 158 | try { |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | /** |
| 186 | 186 | * |
| 187 | 187 | * @param Request $request |
| 188 | - * @return type |
|
| 188 | + * @return \Illuminate\Http\RedirectResponse |
|
| 189 | 189 | */ |
| 190 | 190 | public function attachAssetToTicket(Request $request) { |
| 191 | 191 | try { |
@@ -255,7 +255,6 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | /** |
| 257 | 257 | * |
| 258 | - * @param type $threadid |
|
| 259 | 258 | */ |
| 260 | 259 | public function timelineMarble($asset, $ticketid) { |
| 261 | 260 | if ($asset) { |
@@ -268,7 +267,7 @@ discard block |
||
| 268 | 267 | * |
| 269 | 268 | * @param type $asset |
| 270 | 269 | * @param type $ticketid |
| 271 | - * @return type |
|
| 270 | + * @return string |
|
| 272 | 271 | */ |
| 273 | 272 | public function marble($asset, $ticketid) { |
| 274 | 273 | $user = \App\Plugins\ServiceDesk\Controllers\Library\UtilityController::getManagedByAssetId($asset->id); |
@@ -283,9 +282,9 @@ discard block |
||
| 283 | 282 | * |
| 284 | 283 | * @param type $ticketid |
| 285 | 284 | * @param type $asset_name |
| 286 | - * @param type $user_name |
|
| 287 | - * @param type $managed_by |
|
| 288 | - * @return type |
|
| 285 | + * @param string $user_name |
|
| 286 | + * @param string $managed_by |
|
| 287 | + * @return string |
|
| 289 | 288 | */ |
| 290 | 289 | public function marbleHtml($ticketid, $asset_name, $user_name, $managed_by, $assetid) { |
| 291 | 290 | $url = url('service-desk/asset/detach/' . $ticketid); |
@@ -313,7 +312,7 @@ discard block |
||
| 313 | 312 | /** |
| 314 | 313 | * |
| 315 | 314 | * @param type $ticketid |
| 316 | - * @return type |
|
| 315 | + * @return \Illuminate\Http\RedirectResponse |
|
| 317 | 316 | */ |
| 318 | 317 | public function detach($ticketid) { |
| 319 | 318 | $relation = \App\Plugins\ServiceDesk\Controllers\Library\UtilityController::getRelationOfTicketByTable($ticketid, 'sd_asset'); |
@@ -430,11 +429,18 @@ discard block |
||
| 430 | 429 | } |
| 431 | 430 | } |
| 432 | 431 | |
| 432 | + /** |
|
| 433 | + * @param string $date |
|
| 434 | + */ |
|
| 433 | 435 | public function convertDate($date) { |
| 434 | 436 | $converted_date = date('Y-m-d H:i:s', strtotime($date)); |
| 435 | 437 | return $converted_date; |
| 436 | 438 | } |
| 437 | 439 | |
| 440 | + /** |
|
| 441 | + * @param string $first |
|
| 442 | + * @param string $last |
|
| 443 | + */ |
|
| 438 | 444 | public function getAssets($first, $last) { |
| 439 | 445 | $asset = new SdAssets(); |
| 440 | 446 | $assets = $asset->leftJoin('department', 'sd_assets.department_id', '=', 'department.id') |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | }) |
| 48 | 48 | // ->showColumns('assigned_on') |
| 49 | 49 | ->addColumn('action', function($model) { |
| 50 | - $url = url('service-desk/assets/' . $model->id . '/delete'); |
|
| 50 | + $url = url('service-desk/assets/'.$model->id.'/delete'); |
|
| 51 | 51 | $delete = \App\Plugins\ServiceDesk\Controllers\Library\UtilityController::deletePopUp($model->id, $url, "Delete $model->subject"); |
| 52 | - return "<a href=" . url('service-desk/assets/' . $model->id . '/edit') . " class='btn btn-info btn-sm'>Edit</a> " |
|
| 52 | + return "<a href=".url('service-desk/assets/'.$model->id.'/edit')." class='btn btn-info btn-sm'>Edit</a> " |
|
| 53 | 53 | . $delete |
| 54 | - . " <a href=" . url('service-desk/assets/' . $model->id . '/show') . " class='btn btn-primary btn-sm'>View</a>"; |
|
| 54 | + . " <a href=".url('service-desk/assets/'.$model->id.'/show')." class='btn btn-primary btn-sm'>View</a>"; |
|
| 55 | 55 | }) |
| 56 | 56 | ->searchColumns('name', 'department_id', 'asset_type_id', 'impact_type_id', 'managed_by', 'used_by', 'location_id') |
| 57 | 57 | ->orderColumns('description', 'subject', 'reason', 'impact', 'rollout_plan', 'backout_plan', 'status_id', 'priority_id', 'change_type_id', 'impact_id', 'location_id', 'approval_id') |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $asset_type_id = $request->input('asset_type'); |
| 217 | 217 | return \Datatable::table() |
| 218 | 218 | ->addColumn('#', 'Assets', 'Used By') |
| 219 | - ->setUrl(url('service-desk/asset-type/' . $asset_type_id)) |
|
| 219 | + ->setUrl(url('service-desk/asset-type/'.$asset_type_id)) |
|
| 220 | 220 | ->render(); |
| 221 | 221 | } catch (Exception $ex) { |
| 222 | 222 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | ->addColumn('used_by', function($model) { |
| 245 | 245 | $users = new \App\User(); |
| 246 | 246 | $user = $users->find($model->used_by); |
| 247 | - return $user->first_name . ' ' . $user->last_name; |
|
| 247 | + return $user->first_name.' '.$user->last_name; |
|
| 248 | 248 | }) |
| 249 | 249 | ->searchColumns('names') |
| 250 | 250 | ->make(); |
@@ -274,8 +274,8 @@ discard block |
||
| 274 | 274 | $user = \App\Plugins\ServiceDesk\Controllers\Library\UtilityController::getManagedByAssetId($asset->id); |
| 275 | 275 | $managed = \App\Plugins\ServiceDesk\Controllers\Library\UtilityController::getManagedByAssetId($asset->id); |
| 276 | 276 | $asset_name = $asset->name; |
| 277 | - $user_name = $user->first_name . ' ' . $user->last_name; |
|
| 278 | - $managed_by = $managed->first_name . ' ' . $managed->last_name; |
|
| 277 | + $user_name = $user->first_name.' '.$user->last_name; |
|
| 278 | + $managed_by = $managed->first_name.' '.$managed->last_name; |
|
| 279 | 279 | return $this->marbleHtml($ticketid, $asset_name, $user_name, $managed_by, $asset->id); |
| 280 | 280 | } |
| 281 | 281 | |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | * @return type |
| 289 | 289 | */ |
| 290 | 290 | public function marbleHtml($ticketid, $asset_name, $user_name, $managed_by, $assetid) { |
| 291 | - $url = url('service-desk/asset/detach/' . $ticketid); |
|
| 291 | + $url = url('service-desk/asset/detach/'.$ticketid); |
|
| 292 | 292 | $detach_popup = \App\Plugins\ServiceDesk\Controllers\Library\UtilityController::deletePopUp($ticketid, $url, "Delete", " ", "Delete", true); |
| 293 | 293 | |
| 294 | 294 | return "<div class='box box-primary'>" |
@@ -299,11 +299,11 @@ discard block |
||
| 299 | 299 | . "<div class='col-md-12'>" |
| 300 | 300 | . "<table class='table'>" |
| 301 | 301 | . "<tr>" |
| 302 | - . "<th>" . ucfirst($asset_name) . "</th>" |
|
| 303 | - . "<th><i>Used by: </i> " . ucfirst($user_name) . "</th>" |
|
| 304 | - . "<th><i>Managed by: </i> " . ucfirst($managed_by) . "</th>" |
|
| 305 | - . "<th>" . $detach_popup |
|
| 306 | - . " | <a href=" . url('service-desk/assets/' . $assetid . '/show/') . ">View</a></th>" |
|
| 302 | + . "<th>".ucfirst($asset_name)."</th>" |
|
| 303 | + . "<th><i>Used by: </i> ".ucfirst($user_name)."</th>" |
|
| 304 | + . "<th><i>Managed by: </i> ".ucfirst($managed_by)."</th>" |
|
| 305 | + . "<th>".$detach_popup |
|
| 306 | + . " | <a href=".url('service-desk/assets/'.$assetid.'/show/').">View</a></th>" |
|
| 307 | 307 | . "</table>" |
| 308 | 308 | . "</div>" |
| 309 | 309 | . "</div>" |
@@ -417,13 +417,13 @@ discard block |
||
| 417 | 417 | $date = $request->input('date'); |
| 418 | 418 | $date = str_replace(' ', '', $date); |
| 419 | 419 | $date_array = explode(':', $date); |
| 420 | - $first = $date_array[0] . " 00:00:00"; |
|
| 421 | - $second = $date_array[1] . " 23:59:59"; |
|
| 420 | + $first = $date_array[0]." 00:00:00"; |
|
| 421 | + $second = $date_array[1]." 23:59:59"; |
|
| 422 | 422 | $first_date = $this->convertDate($first); |
| 423 | 423 | $second_date = $this->convertDate($second); |
| 424 | 424 | $assets = $this->getAssets($first_date, $second_date); |
| 425 | 425 | $excel_controller = new \App\Http\Controllers\Common\ExcelController(); |
| 426 | - $filename = "assets" . $date; |
|
| 426 | + $filename = "assets".$date; |
|
| 427 | 427 | $excel_controller->export($filename, $assets); |
| 428 | 428 | } catch (Exception $ex) { |
| 429 | 429 | return redirect()->back()->with('fails', $ex->getMessage()); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | /** |
| 68 | 68 | * |
| 69 | 69 | * @param CreateAssetstypesRequest $request |
| 70 | - * @return type |
|
| 70 | + * @return \Illuminate\Http\RedirectResponse |
|
| 71 | 71 | */ |
| 72 | 72 | public function handleCreate(CreateAssetstypesRequest $request) { |
| 73 | 73 | try { |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | /** |
| 117 | 117 | * |
| 118 | 118 | * @param type $id |
| 119 | - * @return type |
|
| 119 | + * @return \Illuminate\Http\RedirectResponse |
|
| 120 | 120 | */ |
| 121 | 121 | public function assetHandledelete($id) { |
| 122 | 122 | try { |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | return \Datatable::Collection($assets) |
| 41 | 41 | ->showColumns('name', 'created_at', 'updated_at') |
| 42 | 42 | ->addColumn('action', function($model) { |
| 43 | - return "<a href=" . url('service-desk/assetstypes/' . $model->id . '/edit') . " class='btn btn-info btn-xs'>Edit</a> "; |
|
| 43 | + return "<a href=".url('service-desk/assetstypes/'.$model->id.'/edit')." class='btn btn-info btn-xs'>Edit</a> "; |
|
| 44 | 44 | }) |
| 45 | 45 | ->searchColumns('name', 'created_at', 'updated_at') |
| 46 | 46 | ->orderColumns('name', 'created_at', 'updated_at') |
@@ -97,6 +97,9 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | + /** |
|
| 101 | + * @param string $name |
|
| 102 | + */ |
|
| 100 | 103 | public function checkField($name, $array) { |
| 101 | 104 | $res = ""; |
| 102 | 105 | if (is_string($array)) { |
@@ -207,6 +210,9 @@ discard block |
||
| 207 | 210 | return $html; |
| 208 | 211 | } |
| 209 | 212 | |
| 213 | + /** |
|
| 214 | + * @param boolean $json |
|
| 215 | + */ |
|
| 210 | 216 | public function getForeach($values, $name, $label, $type, $sub_type, $class, $required, $placeholder, $description, $multiple, $json) { |
| 211 | 217 | $html = ""; |
| 212 | 218 | $array = []; |
@@ -392,6 +398,9 @@ discard block |
||
| 392 | 398 | } |
| 393 | 399 | } |
| 394 | 400 | |
| 401 | + /** |
|
| 402 | + * @param string $html |
|
| 403 | + */ |
|
| 395 | 404 | public function popUp($id, $title, $html) { |
| 396 | 405 | return '<a href="#form" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#form' . $id . '">Preview</a> |
| 397 | 406 | <div class="modal fade" id="form' . $id . '"> |
@@ -421,11 +421,11 @@ |
||
| 421 | 421 | $forms = new Form(); |
| 422 | 422 | $form = $forms->find($id); |
| 423 | 423 | if ($form) { |
| 424 | - $form->delete(); |
|
| 424 | + $form->delete(); |
|
| 425 | 425 | } |
| 426 | 426 | return redirect()->back()->with('success', "$form->title deleted successfully"); |
| 427 | 427 | } catch (Exception $ex) { |
| 428 | - return redirect()->back()->with('fails', $ex->getMessage()); |
|
| 428 | + return redirect()->back()->with('fails', $ex->getMessage()); |
|
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $form = $forms->where('asset_type_id', $id)->first(); |
| 114 | 114 | if ($form) { |
| 115 | 115 | $title = $form->title; |
| 116 | - $html = "<h1>$title</h1>" . $this->getFields($form->id, $assetid); |
|
| 116 | + $html = "<h1>$title</h1>".$this->getFields($form->id, $assetid); |
|
| 117 | 117 | } |
| 118 | 118 | if ($view == true) { |
| 119 | 119 | return view("service::form-builder.show", compact('html')); |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | case "text": |
| 182 | 182 | return "<label>$label</label>" |
| 183 | 183 | //.\Form::text($name,null,['class'=>$class,'placeholder'=>$placeholder,'required'=>$is_required]); |
| 184 | - . "<input type='$type' class='$class' placeholder='$placeholder' name='$name' value=" . $this->value($fieldid, $assetid) . " $required>"; |
|
| 184 | + . "<input type='$type' class='$class' placeholder='$placeholder' name='$name' value=".$this->value($fieldid, $assetid)." $required>"; |
|
| 185 | 185 | case "date": |
| 186 | 186 | return "<label>$label</label>" |
| 187 | 187 | . "<input type='$type' class='$class' placeholder='$placeholder' name='$name' $required>"; |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $html .= "<label>$label</label></br>"; |
| 216 | 216 | foreach ($values as $index => $value) { |
| 217 | 217 | //if ($json == false) { |
| 218 | - $html .= "<input type='checkbox' name='$name' class='$class' value='$value->value'>" . $value->option . "</br>"; |
|
| 218 | + $html .= "<input type='checkbox' name='$name' class='$class' value='$value->value'>".$value->option."</br>"; |
|
| 219 | 219 | // } else { |
| 220 | 220 | // $array[$index] = $values->lists('option','value')->toArray(); |
| 221 | 221 | // } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $html .= "<label>$label</label></br>"; |
| 226 | 226 | foreach ($values as $index => $value) { |
| 227 | 227 | //if ($json == false) { |
| 228 | - $html .= "<input type='radio' name='$name' class='$class' value='$value->value'>" . $value->option . "</br>"; |
|
| 228 | + $html .= "<input type='radio' name='$name' class='$class' value='$value->value'>".$value->option."</br>"; |
|
| 229 | 229 | // } else { |
| 230 | 230 | // $array[$index] = $value->lists('option','value')->toArray(); |
| 231 | 231 | // } |
@@ -235,12 +235,12 @@ discard block |
||
| 235 | 235 | $html .= "<label>$label</label><select class='$class' name='$name' placeholder='$placeholder' $required>"; |
| 236 | 236 | foreach ($values as $index => $value) { |
| 237 | 237 | //if ($json == false) { |
| 238 | - $html .= "<option value='$value->value'>" . $value->option . "</option>"; |
|
| 238 | + $html .= "<option value='$value->value'>".$value->option."</option>"; |
|
| 239 | 239 | //} else { |
| 240 | 240 | //$array[$index] = $value->lists('option','value')->toArray(); |
| 241 | 241 | //} |
| 242 | 242 | } |
| 243 | - $html .="</select>"; |
|
| 243 | + $html .= "</select>"; |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | if ($json == false) { |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | $url = url('service-desk/form-builder/'.$model->id.'/delete'); |
| 285 | 285 | $title = "Delete $model->title"; |
| 286 | 286 | $delete = \App\Plugins\ServiceDesk\Controllers\Library\UtilityController::deletePopUp($model->id, $url, $title); |
| 287 | - return "<a href=" . url('service-desk/form-builder/' . $model->id . '/edit') . " class='btn btn-sm btn-primary'>Edit</a> " |
|
| 287 | + return "<a href=".url('service-desk/form-builder/'.$model->id.'/edit')." class='btn btn-sm btn-primary'>Edit</a> " |
|
| 288 | 288 | . $preview.$delete; |
| 289 | 289 | }) |
| 290 | 290 | ->searchColumns('title') |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | } |
| 381 | 381 | switch ($render) { |
| 382 | 382 | case "view": |
| 383 | - $html = "<h1>$title</h1>" . $html; |
|
| 383 | + $html = "<h1>$title</h1>".$html; |
|
| 384 | 384 | return view("service::form-builder.show", compact('html')); |
| 385 | 385 | case "popup": |
| 386 | 386 | return $this->popUp($id, $title, $html); |
@@ -393,18 +393,18 @@ discard block |
||
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | public function popUp($id, $title, $html) { |
| 396 | - return '<a href="#form" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#form' . $id . '">Preview</a> |
|
| 397 | - <div class="modal fade" id="form' . $id . '"> |
|
| 396 | + return '<a href="#form" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#form'.$id.'">Preview</a> |
|
| 397 | + <div class="modal fade" id="form' . $id.'"> |
|
| 398 | 398 | <div class="modal-dialog"> |
| 399 | 399 | <div class="modal-content"> |
| 400 | 400 | <div class="modal-header"> |
| 401 | 401 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
| 402 | - <h4 class="modal-title">' . $title . '</h4> |
|
| 402 | + <h4 class="modal-title">' . $title.'</h4> |
|
| 403 | 403 | </div> |
| 404 | 404 | <div class="modal-body"> |
| 405 | 405 | <div class="row"> |
| 406 | 406 | <div class="col-md-12"> |
| 407 | - ' . $html . ' |
|
| 407 | + ' . $html.' |
|
| 408 | 408 | </div> |
| 409 | 409 | </div> |
| 410 | 410 | </div> |
@@ -416,8 +416,8 @@ discard block |
||
| 416 | 416 | </div>'; |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - public function delete($id){ |
|
| 420 | - try{ |
|
| 419 | + public function delete($id) { |
|
| 420 | + try { |
|
| 421 | 421 | $forms = new Form(); |
| 422 | 422 | $form = $forms->find($id); |
| 423 | 423 | if ($form) { |
@@ -39,6 +39,9 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | + /** |
|
| 43 | + * @param string $table |
|
| 44 | + */ |
|
| 42 | 45 | public static function saveTicketRelation($ticketid, $table, $id) { |
| 43 | 46 | |
| 44 | 47 | $relation = new \App\Plugins\ServiceDesk\Model\Common\TicketRelation(); |
@@ -64,6 +67,9 @@ discard block |
||
| 64 | 67 | } |
| 65 | 68 | } |
| 66 | 69 | |
| 70 | + /** |
|
| 71 | + * @param string $table |
|
| 72 | + */ |
|
| 67 | 73 | public static function saveAssetRelation($assetid, $table, $id) { |
| 68 | 74 | if (is_array($assetid)) { |
| 69 | 75 | $assetid = implode(',', $assetid); |
@@ -95,6 +101,9 @@ discard block |
||
| 95 | 101 | return $asset; |
| 96 | 102 | } |
| 97 | 103 | |
| 104 | + /** |
|
| 105 | + * @param string $table |
|
| 106 | + */ |
|
| 98 | 107 | public static function getRelationOfTicketByTable($ticketid,$table) { |
| 99 | 108 | $realtions = new \App\Plugins\ServiceDesk\Model\Common\TicketRelation(); |
| 100 | 109 | $realtion = $realtions->where('ticket_id',$ticketid)->where('owner','LIKE',$table."%")->first(); |
@@ -189,6 +198,10 @@ discard block |
||
| 189 | 198 | } |
| 190 | 199 | } |
| 191 | 200 | |
| 201 | + /** |
|
| 202 | + * @param integer $saved |
|
| 203 | + * @param string $value |
|
| 204 | + */ |
|
| 192 | 205 | public static function storeAttachment($saved, $owner, $value, $type, $size) { |
| 193 | 206 | $attachments = new Attachments(); |
| 194 | 207 | $attachments->create([ |
@@ -200,6 +213,9 @@ discard block |
||
| 200 | 213 | ]); |
| 201 | 214 | } |
| 202 | 215 | |
| 216 | + /** |
|
| 217 | + * @param string $table |
|
| 218 | + */ |
|
| 203 | 219 | public static function deleteAttachments($id, $table) { |
| 204 | 220 | $owner = "$table:$id"; |
| 205 | 221 | $attachments = new Attachments(); |
@@ -231,6 +247,9 @@ discard block |
||
| 231 | 247 | return $attach; |
| 232 | 248 | } |
| 233 | 249 | |
| 250 | + /** |
|
| 251 | + * @param string $table |
|
| 252 | + */ |
|
| 234 | 253 | public static function storeAssetRelation($table, $id, $asset_ids = [], $update = false) { |
| 235 | 254 | $relations = new AssetRelation(); |
| 236 | 255 | $owner = "$table:$id"; |
@@ -269,6 +288,9 @@ discard block |
||
| 269 | 288 | } |
| 270 | 289 | } |
| 271 | 290 | |
| 291 | + /** |
|
| 292 | + * @param \SimpleXMLElement $xml |
|
| 293 | + */ |
|
| 272 | 294 | public static function xmlToArray($xml, $options = array()) { |
| 273 | 295 | $defaults = array( |
| 274 | 296 | 'namespaceSeparator' => ':', //you may want this to be something other than a colon |
@@ -432,6 +454,9 @@ discard block |
||
| 432 | 454 | return $result; |
| 433 | 455 | } |
| 434 | 456 | |
| 457 | + /** |
|
| 458 | + * @param string $activity |
|
| 459 | + */ |
|
| 435 | 460 | public static function cabMessage($cabid, $activity, $url) { |
| 436 | 461 | $cabs = new \App\Plugins\ServiceDesk\Model\Cab\Cab(); |
| 437 | 462 | $cab = $cabs->find($cabid); |
@@ -475,6 +500,9 @@ discard block |
||
| 475 | 500 | } |
| 476 | 501 | } |
| 477 | 502 | |
| 503 | + /** |
|
| 504 | + * @param \Illuminate\Http\Request $requests |
|
| 505 | + */ |
|
| 478 | 506 | public static function storeGeneralInfo($modelid, $table, $requests) { |
| 479 | 507 | $owner = "$table:$modelid"; |
| 480 | 508 | $request = $requests->except('_token', 'attachment', 'identifier'); |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | public static function assetSearch($query, $format = 'json') { |
| 16 | 16 | $assets = new SdAssets(); |
| 17 | - $asset = $assets->where('name', 'LIKE', '%' . $query . '%')->select('name as label', 'id as value'); |
|
| 17 | + $asset = $assets->where('name', 'LIKE', '%'.$query.'%')->select('name as label', 'id as value'); |
|
| 18 | 18 | |
| 19 | 19 | if ($format == 'json') { |
| 20 | 20 | $asset = $asset->get()->toJson(); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | public static function saveTicketRelation($ticketid, $table, $id) { |
| 43 | 43 | |
| 44 | 44 | $relation = new \App\Plugins\ServiceDesk\Model\Common\TicketRelation(); |
| 45 | - $relations = $relation->where('ticket_id', $ticketid)->where('owner','LIKE',$table."%")->get(); |
|
| 45 | + $relations = $relation->where('ticket_id', $ticketid)->where('owner', 'LIKE', $table."%")->get(); |
|
| 46 | 46 | if ($relations->count() > 0) { |
| 47 | 47 | foreach ($relations as $del) { |
| 48 | 48 | $del->delete(); |
@@ -95,10 +95,10 @@ discard block |
||
| 95 | 95 | return $asset; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - public static function getRelationOfTicketByTable($ticketid,$table) { |
|
| 99 | - $realtions = new \App\Plugins\ServiceDesk\Model\Common\TicketRelation(); |
|
| 100 | - $realtion = $realtions->where('ticket_id',$ticketid)->where('owner','LIKE',$table."%")->first(); |
|
| 101 | - if($realtion){ |
|
| 98 | + public static function getRelationOfTicketByTable($ticketid, $table) { |
|
| 99 | + $realtions = new \App\Plugins\ServiceDesk\Model\Common\TicketRelation(); |
|
| 100 | + $realtion = $realtions->where('ticket_id', $ticketid)->where('owner', 'LIKE', $table."%")->first(); |
|
| 101 | + if ($realtion) { |
|
| 102 | 102 | return $realtion; |
| 103 | 103 | } |
| 104 | 104 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | if ($attachment) { |
| 176 | 176 | $name = $attachment->getClientOriginalName(); |
| 177 | 177 | $destinationPath = 'uploads/service-desk/attachments'; |
| 178 | - $value = rand(0000, 9999) . '.' . $name; |
|
| 178 | + $value = rand(0000, 9999).'.'.$name; |
|
| 179 | 179 | $type = $attachment->getClientOriginalExtension(); |
| 180 | 180 | $size = $attachment->getSize(); |
| 181 | 181 | if ($saved == 2) { |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $saved = $attachment->saved; |
| 215 | 215 | if ($saved == 2) { |
| 216 | 216 | $file = $attachment->value; |
| 217 | - $path = public_path('uploads' . DIRECTORY_SEPARATOR . 'service-desk' . DIRECTORY_SEPARATOR . 'attachments' . DIRECTORY_SEPARATOR . $file); |
|
| 217 | + $path = public_path('uploads'.DIRECTORY_SEPARATOR.'service-desk'.DIRECTORY_SEPARATOR.'attachments'.DIRECTORY_SEPARATOR.$file); |
|
| 218 | 218 | unlink($path); |
| 219 | 219 | } |
| 220 | 220 | $attachment->delete(); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $saved = $attachment->saved; |
| 225 | 225 | if ($saved == 2) { |
| 226 | 226 | $file = $attachment->value; |
| 227 | - $attach = public_path('uploads' . DIRECTORY_SEPARATOR . 'service-desk' . DIRECTORY_SEPARATOR . 'attachments' . DIRECTORY_SEPARATOR . $file); |
|
| 227 | + $attach = public_path('uploads'.DIRECTORY_SEPARATOR.'service-desk'.DIRECTORY_SEPARATOR.'attachments'.DIRECTORY_SEPARATOR.$file); |
|
| 228 | 228 | } else { |
| 229 | 229 | $attach = $attachment->value; |
| 230 | 230 | } |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | if ($options['keySearch']) |
| 292 | 292 | $attributeName = str_replace($options['keySearch'], $options['keyReplace'], $attributeName); |
| 293 | 293 | $attributeKey = $options['attributePrefix'] |
| 294 | - . ($prefix ? $prefix . $options['namespaceSeparator'] : '') |
|
| 294 | + . ($prefix ? $prefix.$options['namespaceSeparator'] : '') |
|
| 295 | 295 | . $attributeName; |
| 296 | 296 | $attributesArray[$attributeKey] = (string) $attribute; |
| 297 | 297 | } |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | $childTagName = str_replace($options['keySearch'], $options['keyReplace'], $childTagName); |
| 311 | 311 | //add namespace prefix, if any |
| 312 | 312 | if ($prefix) |
| 313 | - $childTagName = $prefix . $options['namespaceSeparator'] . $childTagName; |
|
| 313 | + $childTagName = $prefix.$options['namespaceSeparator'].$childTagName; |
|
| 314 | 314 | |
| 315 | 315 | if (!isset($tagsArray[$childTagName])) { |
| 316 | 316 | //only entry with this key |
@@ -355,8 +355,8 @@ discard block |
||
| 355 | 355 | $value = self::value($item); |
| 356 | 356 | $options = true; |
| 357 | 357 | } elseif ($options == false) { |
| 358 | - $it = '=' . '"' . $item . '" '; |
|
| 359 | - $field .= $index . $it; |
|
| 358 | + $it = '='.'"'.$item.'" '; |
|
| 359 | + $field .= $index.$it; |
|
| 360 | 360 | } |
| 361 | 361 | } |
| 362 | 362 | |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | public static function value($item) { |
| 376 | 376 | $result = ""; |
| 377 | 377 | foreach ($item as $k => $v) { |
| 378 | - $result .= '<option value=' . '"' . $k . '"' . '>' . $v . '</option>'; |
|
| 378 | + $result .= '<option value='.'"'.$k.'"'.'>'.$v.'</option>'; |
|
| 379 | 379 | } |
| 380 | 380 | return $result; |
| 381 | 381 | } |
@@ -383,14 +383,14 @@ discard block |
||
| 383 | 383 | public static function deletePopUp($id, $url, $title = "Delete", $class = "btn btn-sm btn-danger", $btn_name = "Delete", $button_check = true) { |
| 384 | 384 | $button = ""; |
| 385 | 385 | if ($button_check == true) { |
| 386 | - $button = '<a href="#delete" class="' . $class . '" data-toggle="modal" data-target="#delete' . $id . '">' . $btn_name . '</a>'; |
|
| 386 | + $button = '<a href="#delete" class="'.$class.'" data-toggle="modal" data-target="#delete'.$id.'">'.$btn_name.'</a>'; |
|
| 387 | 387 | } |
| 388 | - return $button . '<div class="modal fade" id="delete' . $id . '"> |
|
| 388 | + return $button.'<div class="modal fade" id="delete'.$id.'"> |
|
| 389 | 389 | <div class="modal-dialog"> |
| 390 | 390 | <div class="modal-content"> |
| 391 | 391 | <div class="modal-header"> |
| 392 | 392 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
| 393 | - <h4 class="modal-title">' . $title . '</h4> |
|
| 393 | + <h4 class="modal-title">' . $title.'</h4> |
|
| 394 | 394 | </div> |
| 395 | 395 | <div class="modal-body"> |
| 396 | 396 | <div class="row"> |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | </div> |
| 402 | 402 | <div class="modal-footer"> |
| 403 | 403 | <button type="button" id="close" class="btn btn-default pull-left" data-dismiss="modal">Close</button> |
| 404 | - <a href="' . $url . '" class="btn btn-danger">Delete</a> |
|
| 404 | + <a href="' . $url.'" class="btn btn-danger">Delete</a> |
|
| 405 | 405 | </div> |
| 406 | 406 | </div> |
| 407 | 407 | </div> |
@@ -456,9 +456,9 @@ discard block |
||
| 456 | 456 | //dd($url); |
| 457 | 457 | if ($user) { |
| 458 | 458 | $email = $user->email; |
| 459 | - $name = $user->first_name . " " . $user->last_name; |
|
| 459 | + $name = $user->first_name." ".$user->last_name; |
|
| 460 | 460 | if ($leader) { |
| 461 | - $heads = $leader->first_name . " " . $leader->last_name; |
|
| 461 | + $heads = $leader->first_name." ".$leader->last_name; |
|
| 462 | 462 | } |
| 463 | 463 | //dd([$email,$name,$heads,$url]); |
| 464 | 464 | $php_mailer = new \App\Http\Controllers\Common\PhpMailController(); |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | public static function getAttachmentSize($size) { |
| 508 | 508 | $units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); |
| 509 | 509 | $power = $size > 0 ? floor(log($size, 1024)) : 0; |
| 510 | - $value = number_format($size / pow(1024, $power), 2, '.', ',') . ' ' . $units[$power]; |
|
| 510 | + $value = number_format($size / pow(1024, $power), 2, '.', ',').' '.$units[$power]; |
|
| 511 | 511 | return $value; |
| 512 | 512 | } |
| 513 | 513 | |
@@ -288,8 +288,9 @@ discard block |
||
| 288 | 288 | foreach ($namespaces as $prefix => $namespace) { |
| 289 | 289 | foreach ($xml->attributes($namespace) as $attributeName => $attribute) { |
| 290 | 290 | //replace characters in attribute name |
| 291 | - if ($options['keySearch']) |
|
| 292 | - $attributeName = str_replace($options['keySearch'], $options['keyReplace'], $attributeName); |
|
| 291 | + if ($options['keySearch']) { |
|
| 292 | + $attributeName = str_replace($options['keySearch'], $options['keyReplace'], $attributeName); |
|
| 293 | + } |
|
| 293 | 294 | $attributeKey = $options['attributePrefix'] |
| 294 | 295 | . ($prefix ? $prefix . $options['namespaceSeparator'] : '') |
| 295 | 296 | . $attributeName; |
@@ -306,11 +307,13 @@ discard block |
||
| 306 | 307 | list($childTagName, $childProperties) = each($childArray); |
| 307 | 308 | |
| 308 | 309 | //replace characters in tag name |
| 309 | - if ($options['keySearch']) |
|
| 310 | - $childTagName = str_replace($options['keySearch'], $options['keyReplace'], $childTagName); |
|
| 310 | + if ($options['keySearch']) { |
|
| 311 | + $childTagName = str_replace($options['keySearch'], $options['keyReplace'], $childTagName); |
|
| 312 | + } |
|
| 311 | 313 | //add namespace prefix, if any |
| 312 | - if ($prefix) |
|
| 313 | - $childTagName = $prefix . $options['namespaceSeparator'] . $childTagName; |
|
| 314 | + if ($prefix) { |
|
| 315 | + $childTagName = $prefix . $options['namespaceSeparator'] . $childTagName; |
|
| 316 | + } |
|
| 314 | 317 | |
| 315 | 318 | if (!isset($tagsArray[$childTagName])) { |
| 316 | 319 | //only entry with this key |
@@ -331,8 +334,9 @@ discard block |
||
| 331 | 334 | //get text content of node |
| 332 | 335 | $textContentArray = array(); |
| 333 | 336 | $plainText = trim((string) $xml); |
| 334 | - if ($plainText !== '') |
|
| 335 | - $textContentArray[$options['textContent']] = $plainText; |
|
| 337 | + if ($plainText !== '') { |
|
| 338 | + $textContentArray[$options['textContent']] = $plainText; |
|
| 339 | + } |
|
| 336 | 340 | |
| 337 | 341 | //stick it all together |
| 338 | 342 | $propertiesArray = !$options['autoText'] || $attributesArray || $tagsArray || ($plainText === '') ? array_merge($attributesArray, $tagsArray, $textContentArray) : $plainText; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | /** |
| 68 | 68 | * |
| 69 | 69 | * @param CreateLocationRequest $request |
| 70 | - * @return type |
|
| 70 | + * @return \Illuminate\Http\RedirectResponse |
|
| 71 | 71 | */ |
| 72 | 72 | public function handleCreate(CreateLocationRequest $request) { |
| 73 | 73 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | /** |
| 112 | 112 | * |
| 113 | 113 | * @param CreateLocationRequest $request |
| 114 | - * @return type |
|
| 114 | + * @return \Illuminate\Http\RedirectResponse |
|
| 115 | 115 | */ |
| 116 | 116 | public function handleEdit(CreateLocationRequest $request) { |
| 117 | 117 | try { |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | /** |
| 135 | 135 | * |
| 136 | 136 | * @param type $id |
| 137 | - * @return type |
|
| 137 | + * @return \Illuminate\Http\RedirectResponse |
|
| 138 | 138 | */ |
| 139 | 139 | public function handledelete($id) { |
| 140 | 140 | try { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | }) |
| 40 | 40 | ->showColumns('title', 'email', 'phone', 'address') |
| 41 | 41 | ->addColumn('action', function($model) { |
| 42 | - return "<a href=" . url('service-desk/location-types/' . $model->id . '/edit') . " class='btn btn-info btn-sm'>Edit</a> <a href=" . url('service-desk/location-types/' . $model->id . '/show') . " class='btn btn-primary btn-sm'>View</a>"; |
|
| 42 | + return "<a href=".url('service-desk/location-types/'.$model->id.'/edit')." class='btn btn-info btn-sm'>Edit</a> <a href=".url('service-desk/location-types/'.$model->id.'/show')." class='btn btn-primary btn-sm'>View</a>"; |
|
| 43 | 43 | }) |
| 44 | 44 | ->searchColumns('title', 'email', 'phone', 'address') |
| 45 | 45 | ->orderColumns('location_category_id', 'title', 'email', 'phone', 'address') |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $locations = $location->lists('title', 'id')->toArray(); |
| 168 | 168 | if (count($locations) > 0) { |
| 169 | 169 | foreach ($locations as $key => $value) { |
| 170 | - $html .= "<option value='" . $key . "'>" . $value . "</option>"; |
|
| 170 | + $html .= "<option value='".$key."'>".$value."</option>"; |
|
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | return $html; |