当前位置: 首页>>代码示例>>PHP>>正文


PHP Helper::gracefulDecrypt方法代码示例

本文整理汇总了PHP中app\helpers\Helper::gracefulDecrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::gracefulDecrypt方法的具体用法?PHP Helper::gracefulDecrypt怎么用?PHP Helper::gracefulDecrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\helpers\Helper的用法示例。


在下文中一共展示了Helper::gracefulDecrypt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDatatable


//.........这里部分代码省略.........
         default:
             $assets->NotArchived();
             break;
     }
     if ($request->has('status_id')) {
         $assets->where('status_id', '=', e($request->get('status_id')));
     }
     $allowed_columns = ['id', 'name', 'asset_tag', 'serial', 'model', 'model_number', 'last_checkout', 'category', 'manufacturer', 'notes', 'expected_checkin', 'order_number', 'companyName', 'location', 'image', 'status_label', 'assigned_to', 'created_at', 'purchase_date', 'purchase_cost'];
     $all_custom_fields = CustomField::all();
     //used as a 'cache' of custom fields throughout this page load
     foreach ($all_custom_fields as $field) {
         $allowed_columns[] = $field->db_column_name();
     }
     $order = $request->get('order') === 'asc' ? 'asc' : 'desc';
     $sort = in_array($request->get('sort'), $allowed_columns) ? $request->get('sort') : 'asset_tag';
     switch ($sort) {
         case 'model':
             $assets = $assets->OrderModels($order);
             break;
         case 'model_number':
             $assets = $assets->OrderModelNumber($order);
             break;
         case 'category':
             $assets = $assets->OrderCategory($order);
             break;
         case 'manufacturer':
             $assets = $assets->OrderManufacturer($order);
             break;
         case 'companyName':
             $assets = $assets->OrderCompany($order);
             break;
         case 'location':
             $assets = $assets->OrderLocation($order);
             break;
         case 'status_label':
             $assets = $assets->OrderStatus($order);
             break;
         case 'assigned_to':
             $assets = $assets->OrderAssigned($order);
             break;
         default:
             $assets = $assets->orderBy($sort, $order);
             break;
     }
     $assetCount = $assets->count();
     $assets = $assets->skip($offset)->take($limit)->get();
     $rows = array();
     foreach ($assets as $asset) {
         $inout = '';
         $actions = '<div style="white-space: nowrap;">';
         if ($asset->deleted_at == '') {
             if (Gate::allows('assets.create')) {
                 $actions .= '<a href="' . route('clone/hardware', $asset->id) . '" class="btn btn-info btn-sm" title="Clone asset" data-toggle="tooltip"><i class="fa fa-clone"></i></a> ';
             }
             if (Gate::allows('assets.edit')) {
                 $actions .= '<a href="' . route('update/hardware', $asset->id) . '" class="btn btn-warning btn-sm" title="Edit asset" data-toggle="tooltip"><i class="fa fa-pencil icon-white"></i></a> ';
             }
             if (Gate::allows('assets.delete')) {
                 $actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/hardware', $asset->id) . '" data-content="' . trans('admin/hardware/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($asset->asset_tag) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
             }
         } elseif ($asset->model->deleted_at == '') {
             $actions .= '<a href="' . route('restore/hardware', $asset->id) . '" title="Restore asset" data-toggle="tooltip" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
         }
         $actions .= '</div>';
         if ($asset->availableForCheckout()) {
             if (Gate::allows('assets.checkout')) {
                 $inout = '<a href="' . route('checkout/hardware', $asset->id) . '" class="btn btn-info btn-sm" title="Checkout this asset to a user" data-toggle="tooltip">' . trans('general.checkout') . '</a>';
             }
         } else {
             if (Gate::allows('assets.checkin')) {
                 $inout = '<a href="' . route('checkin/hardware', $asset->id) . '" class="btn btn-primary btn-sm" title="Checkin this asset" data-toggle="tooltip">' . trans('general.checkin') . '</a>';
             }
         }
         $purchase_cost = Helper::formatCurrencyOutput($asset->purchase_cost);
         $row = array('checkbox' => '<div class="text-center"><input type="checkbox" name="edit_asset[' . $asset->id . ']" class="one_required"></div>', 'id' => $asset->id, 'image' => $asset->image && $asset->image != '' ? '<img src="' . config('app.url') . '/uploads/assets/' . $asset->image . '" height=50 width=50>' : ($asset->model && $asset->model->image != '' ? '<img src="' . config('app.url') . '/uploads/models/' . $asset->model->image . '" height=40 width=50>' : ''), 'name' => '<a title="' . e($asset->name) . '" href="hardware/' . $asset->id . '/view">' . e($asset->name) . '</a>', 'asset_tag' => '<a title="' . e($asset->asset_tag) . '" href="hardware/' . $asset->id . '/view">' . e($asset->asset_tag) . '</a>', 'serial' => e($asset->serial), 'model' => $asset->model ? (string) link_to('/hardware/models/' . $asset->model->id . '/view', e($asset->model->name)) : 'No model', 'model_number' => $asset->model && $asset->model->modelno ? (string) $asset->model->modelno : '', 'status_label' => $asset->assigneduser ? 'Deployed' : (e($asset->assetstatus) ? e($asset->assetstatus->name) : ''), 'assigned_to' => $asset->assigneduser ? (string) link_to(config('app.url') . '/admin/users/' . $asset->assigned_to . '/view', e($asset->assigneduser->fullName())) : '', 'location' => $asset->assigneduser && $asset->assigneduser->userloc != '' ? (string) link_to('admin/settings/locations/' . $asset->assigneduser->userloc->id . '/view', e($asset->assigneduser->userloc->name)) : ($asset->defaultLoc != '' ? (string) link_to('admin/settings/locations/' . $asset->defaultLoc->id . '/edit', e($asset->defaultLoc->name)) : ''), 'category' => $asset->model && $asset->model->category ? (string) link_to('/admin/settings/categories/' . $asset->model->category->id . '/view', e($asset->model->category->name)) : '', 'manufacturer' => $asset->model && $asset->model->manufacturer ? (string) link_to('/admin/settings/manufacturers/' . $asset->model->manufacturer->id . '/view', e($asset->model->manufacturer->name)) : '', 'eol' => $asset->eol_date() ? $asset->eol_date() : '', 'purchase_cost' => $purchase_cost, 'purchase_date' => $asset->purchase_date ? $asset->purchase_date : '', 'notes' => e($asset->notes), 'order_number' => $asset->order_number != '' ? '<a href="' . config('app.url') . '/hardware?order_number=' . e($asset->order_number) . '">' . e($asset->order_number) . '</a>' : '', 'last_checkout' => $asset->last_checkout != '' ? e($asset->last_checkout) : '', 'expected_checkin' => $asset->expected_checkin != '' ? e($asset->expected_checkin) : '', 'created_at' => $asset->created_at != '' ? e($asset->created_at->format('F j, Y h:iA')) : '', 'change' => $inout ? $inout : '', 'actions' => $actions ? $actions : '', 'companyName' => is_null($asset->company) ? '' : e($asset->company->name));
         foreach ($all_custom_fields as $field) {
             $column_name = $field->db_column_name();
             if ($field->isFieldDecryptable($asset->{$column_name})) {
                 if (Gate::allows('admin')) {
                     if ($field->format == 'URL' && $asset->{$column_name} != '') {
                         $row[$column_name] = '<a href="' . Helper::gracefulDecrypt($field, $asset->{$column_name}) . '" target="_blank">' . Helper::gracefulDecrypt($field, $asset->{$column_name}) . '</a>';
                     } else {
                         $row[$column_name] = Helper::gracefulDecrypt($field, $asset->{$column_name});
                     }
                 } else {
                     $row[$field->db_column_name()] = strtoupper(trans('admin/custom_fields/general.encrypted'));
                 }
             } else {
                 if ($field->format == 'URL' && $asset->{$field->db_column_name()} != '') {
                     $row[$field->db_column_name()] = '<a href="' . $asset->{$field->db_column_name()} . '" target="_blank">' . $asset->{$field->db_column_name()} . '</a>';
                 } else {
                     $row[$field->db_column_name()] = e($asset->{$field->db_column_name()});
                 }
             }
         }
         $rows[] = $row;
     }
     $data = array('total' => $assetCount, 'rows' => $rows);
     return $data;
 }
开发者ID:stijni,项目名称:snipe-it,代码行数:101,代码来源:AssetsController.php


注:本文中的app\helpers\Helper::gracefulDecrypt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。