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


PHP format::arr_to_csv方法代码示例

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


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

示例1: doReportSentDocuments

 /**
  * Display report about documents sent by mail
  *
  * @param  Application  $app
  * @param  Request      $request
  * @return JsonResponse
  */
 public function doReportSentDocuments(Application $app, Request $request)
 {
     $conf = ['user' => ['', 1, 0, 1, 1], 'date' => ['', 1, 0, 1, 1], 'record_id' => ['', 1, 1, 1, 1], 'file' => ['', 1, 0, 1, 1], 'mime' => ['', 1, 0, 1, 1], 'comment' => [$app->trans('Receiver'), 1, 0, 1, 1]];
     $activity = new \module_report_sent($app, $request->request->get('dmin'), $request->request->get('dmax'), $request->request->get('sbasid'), $request->request->get('collection'));
     $activity->setConfig(false);
     if ($request->request->get('printcsv') == 'on') {
         $activity->setHasLimit(false);
         $activity->setPrettyString(false);
         try {
             $csv = \format::arr_to_csv($activity->getResult(), $activity->getDisplay());
         } catch (\Exception $e) {
             $csv = '';
         }
         return $app->json(['rs' => $csv]);
     }
     $report = $this->doReport($app, $request, $activity, $conf);
     if ($report instanceof Response) {
         return $report;
     }
     return $app->json(['rs' => $app['twig']->render('report/ajax_data_content.html.twig', ['result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false]), 'display_nav' => $report['display_nav'], 'next' => $report['next_page'], 'prev' => $report['previous_page'], 'page' => $report['page'], 'filter' => sizeof($report['filter']) > 0 ? serialize($report['filter']) : '', 'col' => $report['active_column'], 'limit' => $report['nb_record']]);
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:28,代码来源:Activity.php

示例2: connect

 public function connect(Application $app)
 {
     $app['controller.admin.users'] = $this;
     $controllers = $app['controllers_factory'];
     $app['firewall']->addMandatoryAuthentication($controllers);
     $controllers->before(function (Request $request) use($app) {
         $app['firewall']->requireAccessToModule('admin')->requireRight('manageusers');
     });
     $controllers->post('/rights/', function (Application $app) {
         $rights = new UserHelper\Edit($app, $app['request']);
         return $app['twig']->render('admin/editusers.html.twig', $rights->get_users_rights());
     });
     $controllers->get('/rights/', function (Application $app) {
         $rights = new UserHelper\Edit($app, $app['request']);
         return $app['twig']->render('admin/editusers.html.twig', $rights->get_users_rights());
     });
     $controllers->post('/rights/reset/', function (Application $app, Request $request) {
         try {
             $datas = ['error' => false];
             $helper = new UserHelper\Edit($app, $request);
             $helper->resetRights();
         } catch (\Exception $e) {
             $datas['error'] = true;
             $datas['message'] = $e->getMessage();
         }
         return $app->json($datas);
     })->bind('admin_users_rights_reset');
     $controllers->post('/delete/', function (Application $app) {
         $module = new UserHelper\Edit($app, $app['request']);
         $module->delete_users();
         return $app->redirectPath('admin_users_search');
     });
     $controllers->post('/rights/apply/', function (Application $app) {
         $datas = ['error' => true];
         try {
             $rights = new UserHelper\Edit($app, $app['request']);
             if (!$app['request']->request->get('reset_before_apply')) {
                 $rights->apply_rights();
             }
             if ($app['request']->request->get('template')) {
                 if ($app['request']->request->get('reset_before_apply')) {
                     $rights->resetRights();
                 }
                 $rights->apply_template();
             }
             $rights->apply_infos();
             $datas = ['error' => false];
         } catch (\Exception $e) {
             $datas['message'] = $e->getMessage();
         }
         return $app->json($datas);
     })->bind('admin_users_rights_apply');
     $controllers->post('/rights/quotas/', function (Application $app) {
         $rights = new UserHelper\Edit($app, $app['request']);
         return $app['twig']->render('admin/editusers_quotas.html.twig', $rights->get_quotas());
     });
     $controllers->post('/rights/quotas/apply/', function (Application $app) {
         $rights = new UserHelper\Edit($app, $app['request']);
         $rights->apply_quotas();
         return $app->json(['message' => '', 'error' => false]);
     });
     $controllers->post('/rights/time/', function (Application $app) {
         $rights = new UserHelper\Edit($app, $app['request']);
         return $app['twig']->render('admin/editusers_timelimit.html.twig', $rights->get_time());
     });
     $controllers->post('/rights/time/sbas/', function (Application $app) {
         $rights = new UserHelper\Edit($app, $app['request']);
         return $app['twig']->render('admin/editusers_timelimit_sbas.html.twig', $rights->get_time_sbas());
     });
     $controllers->post('/rights/time/apply/', function (Application $app) {
         $rights = new UserHelper\Edit($app, $app['request']);
         $rights->apply_time();
         return $app->json(['message' => '', 'error' => false]);
     });
     $controllers->post('/rights/masks/', function (Application $app) {
         $rights = new UserHelper\Edit($app, $app['request']);
         return $app['twig']->render('admin/editusers_masks.html.twig', $rights->get_masks());
     });
     $controllers->post('/rights/masks/apply/', function (Application $app) {
         $rights = new UserHelper\Edit($app, $app['request']);
         $rights->apply_masks();
         return $app->json(['message' => '', 'error' => false]);
     });
     $controllers->match('/search/', function (Application $app) {
         $users = new UserHelper\Manage($app, $app['request']);
         return $app['twig']->render('admin/users.html.twig', $users->search());
     })->bind('admin_users_search');
     $controllers->post('/search/export/', function () use($app) {
         $request = $app['request'];
         $users = new UserHelper\Manage($app, $app['request']);
         $userTable = [['ID', 'Login', 'Last Name', 'First Name', 'E-Mail', 'Created', 'Updated', 'Address', 'City', 'Zip', 'Country', 'Phone', 'Fax', 'Job', 'Company', 'Position']];
         foreach ($users->export() as $user) {
             $userTable[] = [$user->getId(), $user->getLogin(), $user->getLastName(), $user->getFirstName(), $user->getEmail(), $user->getCreated()->format(DATE_ATOM), $user->getUpdated()->format(DATE_ATOM), $user->getAddress(), $user->getCity(), $user->getZipCode(), $user->getCountry(), $user->getPhone(), $user->getFax(), $user->getJob(), $user->getCompany(), $user->getActivity()];
         }
         $CSVDatas = \format::arr_to_csv($userTable);
         $response = new Response($CSVDatas, 200, ['Content-Type' => 'text/csv']);
         $response->headers->set('Content-Disposition', 'attachment; filename=export.csv');
         return $response;
     })->bind('admin_users_search_export');
     $controllers->post('/apply_template/', function () use($app) {
//.........这里部分代码省略.........
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:101,代码来源:Users.php

示例3: doReportInformationsDocument

 /**
  * Display informations about a document
  *
  * @param  Application  $app
  * @param  Request      $request
  * @return JsonResponse
  */
 public function doReportInformationsDocument(Application $app, Request $request)
 {
     $config = ['photo' => [$app->trans('report:: document'), 0, 0, 0, 0], 'record_id' => [$app->trans('report:: record id'), 0, 0, 0, 0], 'date' => [$app->trans('report:: date'), 0, 0, 0, 0], 'type' => [$app->trans('phrseanet:: sous definition'), 0, 0, 0, 0], 'titre' => [$app->trans('report:: titre'), 0, 0, 0, 0], 'taille' => [$app->trans('report:: poids'), 0, 0, 0, 0]];
     $config_dl = ['ddate' => [$app->trans('report:: date'), 0, 0, 0, 0], 'user' => [$app->trans('report:: utilisateurs'), 0, 0, 0, 0], 'final' => [$app->trans('phrseanet:: sous definition'), 0, 0, 0, 0], 'coll_id' => [$app->trans('report:: collections'), 0, 0, 0, 0], 'comment' => [$app->trans('report:: commentaire'), 0, 0, 0, 0], 'fonction' => [$app->trans('report:: fonction'), 0, 0, 0, 0], 'activite' => [$app->trans('report:: activite'), 0, 0, 0, 0], 'pays' => [$app->trans('report:: pays'), 0, 0, 0, 0], 'societe' => [$app->trans('report:: societe'), 0, 0, 0, 0]];
     //format conf according user preferences
     if ('' !== ($columnsList = $request->request->get('list_column', ''))) {
         $new_conf = $config_dl;
         $columns = explode(',', $columnsList);
         foreach (array_keys($config_dl) as $col) {
             if (!in_array($col, $columns)) {
                 unset($new_conf[$col]);
             }
         }
         $config_dl = $new_conf;
     }
     try {
         $record = new \record_adapter($app, $request->request->get('sbasid'), $request->request->get('rid'));
     } catch (\Exception $e) {
         $app->abort(404);
     }
     $what = new \module_report_nav($app, $request->request->get('dmin'), $request->request->get('dmax'), $request->request->get('sbasid'), $request->request->get('collection'));
     $what->setPeriode('');
     $what->setCsv(false);
     $what->setPrint(false);
     $reportArray = $what->buildTabUserWhat($record->get_base_id(), $record->get_record_id(), $config);
     $title = $what->getTitle();
     $html = $app['twig']->render('report/ajax_data_content.html.twig', ['result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false]);
     $from = $request->request->get('from', '');
     if ('TOOL' === $from) {
         $what->setTitle('');
         return $app->json(['rs' => $html, 'display_nav' => false, 'title' => $title]);
     }
     if ('DASH' !== $from && 'PUSHDOC' !== $from) {
         $download = new \module_report_download($app, $request->request->get('dmin'), $request->request->get('dmax'), $request->request->get('sbasid'), $request->request->get('collection'));
         $mapColumnTitleToSqlField = $download->getTransQueryString();
         $currentfilter = [];
         if ('' !== ($serializedFilter = $request->request->get('liste_filter', ''))) {
             $currentfilter = @unserialize(urldecode($serializedFilter));
         }
         $filter = new \module_report_filter($app, $currentfilter, $mapColumnTitleToSqlField);
         if ('' !== ($filterColumn = $request->request->get('filter_column', ''))) {
             $field = current(explode(' ', $filterColumn));
             $value = $request->request->get('filter_value', '');
             if ($request->request->get('liste') == 'on') {
                 return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', ['result' => $download->colFilter($field), 'field' => $field]), 'title' => $app->trans('filtrer les resultats sur la colonne %colonne%', ['%colonne%' => $field])]);
             }
             if ($field === $value) {
                 $filter->removeFilter($field);
             } else {
                 $filter->addFilter($field, '=', $value);
             }
         }
         $filter->addfilter('record_id', '=', $record->get_record_id());
         $download->setFilter($filter->getTabFilter());
         $download->setOrder('ddate', 'DESC');
         $download->setTitle($app->trans('report:: historique des telechargements'));
         $download->setConfig(false);
         $reportArray = $download->buildReport($config_dl);
         if ($request->request->get('printcsv') == 'on') {
             $download->setPrettyString(false);
             try {
                 $csv = \format::arr_to_csv($download->getResult(), $download->getDisplay());
             } catch (\Exception $e) {
                 $csv = '';
             }
             return $app->json(['rs' => $csv]);
         }
         $html .= $app['twig']->render('report/ajax_data_content.html.twig', ['result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false]);
         return $app->json(['rs' => $html, 'display_nav' => false, 'title' => $title]);
     }
     if ($app['conf']->get(['registry', 'modules', 'anonymous-report']) == false && $from !== 'DOC' && $from !== 'DASH' && $from !== 'GEN' && $from !== 'PUSHDOC') {
         $conf = ['identifiant' => [$app->trans('report:: identifiant'), 0, 0, 0, 0], 'nom' => [$app->trans('report:: nom'), 0, 0, 0, 0], 'mail' => [$app->trans('report:: email'), 0, 0, 0, 0], 'adresse' => [$app->trans('report:: adresse'), 0, 0, 0, 0], 'tel' => [$app->trans('report:: telephone'), 0, 0, 0, 0]];
         $info = new \module_report_nav($app, $request->request->get('dmin'), $request->request->get('dmax'), $request->request->get('sbasid'), $request->request->get('collection'));
         $info->setPeriode('');
         $info->setConfig(false);
         $info->setTitle($app->trans('report:: utilisateur'));
         $reportArray = $info->buildTabGrpInfo(false, [], $request->request->get('user'), $conf, false);
         if ($request->request->get('printcsv') == 'on' && isset($download)) {
             $download->setPrettyString(false);
             try {
                 $csv = \format::arr_to_csv($download->getResult(), $download->getDisplay());
             } catch (\Exception $e) {
                 $csv = '';
             }
             return $app->json(['rs' => $csv]);
         }
         $html .= $app['twig']->render('report/ajax_data_content.html.twig', ['result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false]);
         return $app->json(['rs' => $html, 'display_nav' => false, 'title' => $title]);
     }
     return $app->json(['rs' => $html, 'display_nav' => false, 'title' => $title]);
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:98,代码来源:Informations.php

示例4: doReportClients

 /**
  * Display informations about client (browser, resolution etc ...)
  *
  * @param  Application  $app
  * @param  Request      $request
  * @return JsonResponse
  */
 public function doReportClients(Application $app, Request $request)
 {
     $nav = new \module_report_nav($app, $request->request->get('dmin'), $request->request->get('dmax'), $request->request->get('sbasid'), $request->request->get('collection'));
     $conf_nav = ['nav' => [$app->trans('report:: navigateur'), 0, 1, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0], 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]];
     $conf_combo = ['combo' => [$app->trans('report:: navigateurs et plateforme'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0], 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]];
     $conf_os = ['os' => [$app->trans('report:: plateforme'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0], 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]];
     $conf_res = ['res' => [$app->trans('report:: resolution'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0], 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]];
     $conf_mod = ['appli' => [$app->trans('report:: module'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0], 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]];
     $report = ['nav' => $nav->buildTabNav($conf_nav), 'os' => $nav->buildTabOs($conf_os), 'res' => $nav->buildTabRes($conf_res), 'mod' => $nav->buildTabModule($conf_mod), 'combo' => $nav->buildTabCombo($conf_combo)];
     if ($request->request->get('printcsv') == 'on') {
         return $app->json(['nav' => \format::arr_to_csv($report['nav']['result'], $conf_nav), 'os' => \format::arr_to_csv($report['os']['result'], $conf_os), 'res' => \format::arr_to_csv($report['res']['result'], $conf_res), 'mod' => \format::arr_to_csv($report['mod']['result'], $conf_mod), 'combo' => \format::arr_to_csv($report['combo']['result'], $conf_combo)]);
     }
     return $app->json(['rs' => $app['twig']->render('report/ajax_data_content.html.twig', ['result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => true, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false]), 'display_nav' => false, 'title' => false]);
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:21,代码来源:Root.php


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