Merge pull request #2851 from filipx/PHRAS-2327_report_refacto_41

Phras 2327 report refacto 41
This commit is contained in:
Nicolas Maillat
2018-12-12 10:39:59 +00:00
committed by GitHub
68 changed files with 913 additions and 9622 deletions

View File

@@ -5,7 +5,7 @@ install:
make install_assets
install_composer:
composer install
composer install --ignore-platform-reqs
install_asset_dependencies:
yarn upgrade

3
Vagrantfile vendored
View File

@@ -70,6 +70,9 @@ def config_net(config)
vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
end
end
config.vm.network :public_network, bridge:"en0: Ethernet"
config.hostmanager.ip_resolver = proc do |vm, resolving_vm|
if vm.id
if $env == "mac" || $env == "linux"

View File

@@ -65,8 +65,6 @@ class RouteLoader
'/prod/upload/' => Providers\Prod\Upload::class,
'/prod/WorkZone' => Providers\Prod\WorkZone::class,
'/prod/' => Providers\Prod\Root::class,
'/report/activity' => Providers\Report\Activity::class,
'/report/informations' => Providers\Report\Information::class,
'/report/' => Providers\Report\Root::class,
'/session/' => Providers\Root\Session::class,
'/setup' => Providers\Setup::class,

View File

@@ -1,802 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Controller\Report;
use Alchemy\Phrasea\Controller\Controller;
use Alchemy\Phrasea\Core\Response\CSVFileResponse;
use Goodby\CSV\Export\Standard\Collection\CallbackCollection;
use Goodby\CSV\Export\Standard\Exporter;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class ActivityController extends Controller
{
/**
* Display connexions report group by user
*
* @param Request $request
* @return JsonResponse
*/
public function doReportConnexionsByUsers(Request $request)
{
$activity = new \module_report_activity(
$this->app,
$request->request->get('dmin'),
$request->request->get('dmax'),
$request->request->get('sbasid'),
$request->request->get('collection')
);
$activity->setConfig(false);
$activity->setBound("user", true);
//set Limit
if ($activity->getEnableLimit()
&& ('' !== $page = $request->request->get('page', ''))
&& ('' !== $limit = $request->request->get('limit', ''))) {
$activity->setLimit($page, $limit);
} else {
$activity->setLimit(false, false);
}
if ($request->request->get('printcsv') == 'on') {
$activity->setHasLimit(false);
$activity->getConnexionBase(false, $request->request->get('on', 'user'));
return $this->getCSVResponse($activity, 'activity_connection_base');
}
$report = $activity->getConnexionBase(false, $request->request->get('on', 'user'));
return $this->app->json([
'rs' => $this->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' => false,
'title' => false,
]);
}
/**
* Display download report group by user
*
* @param Request $request
* @return JsonResponse
*/
public function doReportDownloadsByUsers(Request $request)
{
$conf = [
'user' => [$this->app->trans('report:: utilisateur'), 0, 1, 0, 0],
'nbdoc' => [$this->app->trans('report:: nombre de documents'), 0, 0, 0, 0],
'nbprev' => [$this->app->trans('report:: nombre de preview'), 0, 0, 0, 0],
];
$activity = new \module_report_activity(
$this->app,
$request->request->get('dmin'),
$request->request->get('dmax'),
$request->request->get('sbasid'),
$request->request->get('collection')
);
$activity->setConfig(false);
//set Limit
if ($activity->getEnableLimit()
&& ('' !== $page = $request->request->get('page', ''))
&& ('' !== $limit = $request->request->get('limit', ''))) {
$activity->setLimit($page, $limit);
} else {
$activity->setLimit(false, false);
}
$report = $activity->getDetailDownload($conf, $request->request->get('on'));
if ($request->request->get('printcsv') == 'on') {
$activity->setHasLimit(false);
return $this->getCSVResponse($activity, 'activity_detail_download');
}
return $this->app->json([
'rs' => $this->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' => false,
'title' => false,
]);
}
/**
* Display the most asked question
*
* @param Request $request
* @return JsonResponse
*/
public function doReportBestOfQuestions(Request $request)
{
$conf = [
'search' => [$this->app->trans('report:: question'), 0, 0, 0, 0],
'nb' => [$this->app->trans('report:: nombre'), 0, 0, 0, 0],
'nb_rep' => [$this->app->trans('report:: nombre de reponses'), 0, 0, 0, 0]
];
$activity = new \module_report_activity(
$this->app,
$request->request->get('dmin'),
$request->request->get('dmax'),
$request->request->get('sbasid'),
$request->request->get('collection')
);
$activity->setLimit(1, $request->request->get('limit', 20));
$activity->setTop(20);
$activity->setConfig(false);
if ($request->request->get('printcsv') == 'on') {
$activity->setHasLimit(false);
$activity->setPrettyString(false);
$activity->getTopQuestion($conf);
return $this->getCSVResponse($activity, 'activity_questions_best_of');
}
$report = $activity->getTopQuestion($conf);
return $this->app->json([
'rs' => $this->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' => false,
'title' => false
]);
}
/**
* Display report about questions that return no result
*
* @param Request $request
* @return JsonResponse
*/
public function doReportNoBestOfQuestions(Request $request)
{
$conf = [
'search' => [$this->app->trans('report:: question'), 0, 0, 0, 0],
'nb' => [$this->app->trans('report:: nombre'), 0, 0, 0, 0],
'nb_rep' => [$this->app->trans('report:: nombre de reponses'), 0, 0, 0, 0]
];
$activity = new \module_report_activity(
$this->app,
$request->request->get('dmin'),
$request->request->get('dmax'),
$request->request->get('sbasid'),
$request->request->get('collection')
);
//set Limit
if ($activity->getEnableLimit()
&& ('' !== $page = $request->request->get('page', ''))
&& ('' !== $limit = $request->request->get('limit', ''))) {
$activity->setLimit($page, $limit);
} else {
$activity->setLimit(false, false);
}
$activity->setConfig(false);
if ($request->request->get('printcsv') == 'on') {
$activity->setHasLimit(false);
$activity->setPrettyString(false);
$activity->getTopQuestion($conf, true);
return $this->getCSVResponse($activity, 'activity_top_ten_questions');
}
$report = $activity->getTopQuestion($conf, true);
return $this->app->json([
'rs' => $this->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' => false,
'title' => false
]);
}
/**
* Display an overview of connexion among hours of the da
*
* @param Request $request
* @return JsonResponse
*/
public function doReportSiteActiviyPerHours(Request $request)
{
$activity = new \module_report_activity(
$this->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);
$activity->getActivityPerHours();
return $this->getCSVResponse($activity, 'activity_per_hours');
}
$report = $activity->getActivityPerHours();
return $this->app->json([
'rs' => $this->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' => true,
'is_doc' => false
]),
'display_nav' => false,
'title' => false
]);
}
/**
* Display an overview of downloaded document grouped by day
*
* @param Request $request
* @return JsonResponse
*/
public function doReportSiteActivityPerDays(Request $request)
{
$conf = [
'ddate' => [$this->app->trans('report:: jour'), 0, 0, 0, 0],
'total' => [$this->app->trans('report:: total des telechargements'), 0, 0, 0, 0],
'preview' => [$this->app->trans('report:: preview'), 0, 0, 0, 0],
'document' => [$this->app->trans('report:: document'), 0, 0, 0, 0]
];
$activity = new \module_report_activity(
$this->app,
$request->request->get('dmin'),
$request->request->get('dmax'),
$request->request->get('sbasid'),
$request->request->get('collection')
);
//set Limit
if ($activity->getEnableLimit()
&& ('' !== $page = $request->request->get('page', ''))
&& ('' !== $limit = $request->request->get('limit', ''))) {
$activity->setLimit($page, $limit);
} else {
$activity->setLimit(false, false);
}
$activity->setConfig(false);
if ($request->request->get('printcsv') == 'on') {
$activity->setHasLimit(false);
$activity->setPrettyString(false);
$activity->getDownloadByBaseByDay($conf);
return $this->getCSVResponse($activity, 'activity_db_by_base_by_day');
}
$report = $activity->getDownloadByBaseByDay($conf);
return $this->app->json([
'rs' => $this->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' => false,
'title' => false,
]);
}
/**
* Display report about pushed documents
*
* @param Request $request
* @return JsonResponse
*/
public function doReportPushedDocuments(Request $request)
{
$conf = [
'user' => ['', 1, 0, 1, 1],
'getter' => ["Destinataire", 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],
];
$activity = new \module_report_push(
$this->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);
$this->doReport($request, $activity, $conf);
return $this->getCSVResponse($activity, 'activity_pushed_documents');
}
$report = $this->doReport($request, $activity, $conf);
if ($report instanceof Response) {
return $report;
}
return $this->app->json([
'rs' => $this->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'], // do we display the prev and next button ?
'next' => $report['next_page'], //Number of the next page
'prev' => $report['previous_page'], //Number of the previoous page
'page' => $report['page'], //The current page
'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters
'col' => $report['active_column'], //all the columns where a filter is applied
'limit' => $report['nb_record'],
]);
}
/**
* Display report about added documents
*
* @param Request $request
* @return JsonResponse
*/
public function doReportAddedDocuments(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],
];
$activity = new \module_report_add(
$this->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);
$this->doReport($request, $activity, $conf);
return $this->getCSVResponse($activity, 'activity_added_documents');
}
$report = $this->doReport($request, $activity, $conf);
if ($report instanceof Response) {
return $report;
}
return $this->app->json([
'rs' => $this->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'], // do we display the prev and next button ?
'next' => $report['next_page'], //Number of the next page
'prev' => $report['previous_page'], //Number of the previoous page
'page' => $report['page'], //The current page
'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters
'col' => $report['active_column'], //all the columns where a filter is applied
'limit' => $report['nb_record'],
]);
}
/**
* Display report about edited documents
*
* @param Request $request
* @return JsonResponse
*/
public function doReportEditedDocuments(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],
];
$activity = new \module_report_edit(
$this->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);
$this->doReport($request, $activity, $conf);
return $this->getCSVResponse($activity, 'activity_edited_documents');
}
$report = $this->doReport($request, $activity, $conf);
if ($report instanceof Response) {
return $report;
}
return $this->app->json([
'rs' => $this->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'], // do we display the prev and next button ?
'next' => $report['next_page'], //Number of the next page
'prev' => $report['previous_page'], //Number of the previoous page
'page' => $report['page'], //The current page
'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters
'col' => $report['active_column'], //all the columns where a filter is applied
'limit' => $report['nb_record'],
]);
}
/**
* Display report about validated documents
*
* @param Request $request
* @return JsonResponse
*/
public function doReportValidatedDocuments(Request $request)
{
$conf = [
'user' => ['', 1, 0, 1, 1],
'getter' => ["Destinataire", 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],
];
$activity = new \module_report_validate(
$this->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);
$this->doReport($request, $activity, $conf);
return $this->getCSVResponse($activity, 'activity_validated_documents');
}
$report = $this->doReport($request, $activity, $conf);
if ($report instanceof Response) {
return $report;
}
return $this->app->json([
'rs' => $this->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'], // do we display the prev and next button ?
'next' => $report['next_page'], //Number of the next page
'prev' => $report['previous_page'], //Number of the previoous page
'page' => $report['page'], //The current page
'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters
'col' => $report['active_column'], //all the columns where a filter is applied
'limit' => $report['nb_record'],
]);
}
/**
* Display report about documents sent by mail
*
* @param Request $request
* @return JsonResponse
*/
public function doReportSentDocuments(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' => [$this->app->trans('Receiver'), 1, 0, 1, 1],
];
$activity = new \module_report_sent(
$this->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);
$this->doReport($request, $activity, $conf);
return $this->getCSVResponse($activity, 'activity_send_documents');
}
$report = $this->doReport($request, $activity, $conf);
if ($report instanceof Response) {
return $report;
}
return $this->app->json([
'rs' => $this->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'], // do we display the prev and next button ?
'next' => $report['next_page'], //Number of the next page
'prev' => $report['previous_page'], //Number of the previoous page
'page' => $report['page'], //The current page
'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters
'col' => $report['active_column'], //all the columns where a filter is applied
'limit' => $report['nb_record'],
]);
}
/**
* Set Report configuration according to request parameters
*
* @param Request $request A request instance
* @param \module_report $report A report instance
* @param Array $conf A report column configuration
* @param Boolean $what Whether to group on a particular field or not
* @return Array
*/
private function doReport(Request $request, \module_report $report, $conf, $what = false)
{
if ($this->getConf()->get(['registry', 'modules', 'anonymous-report'])) {
if (isset($conf['user'])) {
unset($conf['user']);
}
if (isset($conf['ip'])) {
unset($conf['ip']);
}
}
//save initial conf
$base_conf = $conf;
//format conf according user preferences
if ('' !== $columnsList = $request->request->get('list_column', '')) {
$new_conf = $conf;
$columns = explode(",", $columnsList);
foreach (array_keys($conf) as $col) {
if (!in_array($col, $columns)) {
unset($new_conf[$col]);
}
}
$conf = $new_conf;
}
//display content of a table column when user click on it
if ($request->request->get('conf') == 'on') {
return $this->app->json(['liste' => $this->render('report/listColumn.html.twig', [
'conf' => $base_conf
]), "title" => $this->app->trans("configuration")]);
}
//set order
if (('' !== $order = $request->request->get('order', '')) && ('' !== $field = $request->request->get('champ', ''))) {
$report->setOrder($field, $order);
}
//work on filters
$mapColumnTitleToSqlField = $report->getTransQueryString();
$currentfilter = [];
if ('' !== $serializedFilter = $request->request->get('liste_filter', '')) {
$currentfilter = @unserialize(urldecode($serializedFilter));
}
$filter = new \module_report_filter($this->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 $this->app->json(['diag' => $this->render('report/colFilter.html.twig', [
'result' => $report->colFilter($field),
'field' => $field
]), "title" => $this->app->trans('filtrer les resultats sur la colonne %colonne%', ['%colonne%' => $field])]);
}
if ($field === $value) {
$filter->removeFilter($field);
} else {
$filter->addFilter($field, '=', $value);
}
}
//set new request filter if user asking for them
if ($request->request->get('precise') == 1) {
$filter->addFilter('xml', 'LIKE', $request->request->get('word', ''));
} elseif ($request->request->get('precise') == 2) {
$filter->addFilter('record_id', '=', $request->request->get('word', ''));
}
//set filters to current report
$report->setFilter($filter->getTabFilter());
$report->setActiveColumn($filter->getActiveColumn());
$report->setPostingFilter($filter->getPostingFilter());
// display a new arraywhere results are group
if ('' !== $groupby = $request->request->get('groupby', '')) {
$report->setConfig(false);
$groupby = current(explode(' ', $groupby));
$reportArray = $report->buildReport(false, $groupby);
if (count($reportArray['allChamps']) > 0 && count($reportArray['display']) > 0) {
$groupField = isset($reportArray['display'][$reportArray['allChamps'][0]]['title']) ? $reportArray['display'][$reportArray['allChamps'][0]]['title'] : '';
} else {
$groupField = isset($conf[strtolower($groupby)]['title']) ? $conf[strtolower($groupby)]['title'] : '';
}
return $this->app->json([
'rs' => $this->render('report/ajax_data_content.html.twig', [
'result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray,
'is_infouser' => false,
'is_nav' => false,
'is_groupby' => true,
'is_plot' => false,
'is_doc' => false,
]),
'display_nav' => false,
'title' => $this->app->trans('Groupement des resultats sur le champ %name%', ['%name%' => $groupField]),
]);
}
//set Limit
if ($report->getEnableLimit()
&& ('' !== $page = $request->request->get('page', ''))
&& ('' !== $limit = $request->request->get('limit', ''))) {
$report->setLimit($page, $limit);
} else {
$report->setLimit(false, false);
}
//time to build our report
if (false === $what) {
$reportArray = $report->buildReport($conf);
} else {
$reportArray = $report->buildReport($conf, $what, $request->request->get('tbl', false));
}
return $reportArray;
}
private function getCSVResponse(\module_report $report, $type)
{
// set headers
$headers = [];
foreach (array_keys($report->getDisplay()) as $k) {
$headers[$k] = $k;
}
// set headers as first row
$result = $report->getResult();
array_unshift($result, $headers);
$collection = new CallbackCollection($result, function ($row) use ($report) {
// restrict to displayed fields
return array_map('strip_tags', array_intersect_key($row, $report->getDisplay()));
});
$filename = sprintf('report_export_%s_%s.csv', $type, date('Ymd'));
/** @var Exporter $exporter */
$exporter = $this->app['csv.exporter'];
$response = new CSVFileResponse($filename, function () use ($exporter, $collection) {
$exporter->export('php://output', $collection);
});
return $response;
}
}

View File

@@ -1,502 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Controller\Report;
use Alchemy\Phrasea\Controller\Controller;
use Alchemy\Phrasea\Core\Response\CSVFileResponse;
use Goodby\CSV\Export\Standard\Collection\CallbackCollection;
use Goodby\CSV\Export\Standard\Exporter;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
class InformationController extends Controller
{
/**
* Display information about a user
*
* @param Request $request
* @return JsonResponse
*/
public function doReportInformationUser(Request $request)
{
$conf = [
'config' => [
'photo' => [$this->app->trans('report:: document'), 0, 0, 0, 0],
'record_id' => [$this->app->trans('report:: record id'), 0, 0, 0, 0],
'date' => [$this->app->trans('report:: date'), 0, 0, 0, 0],
'type' => [$this->app->trans('phrseanet:: sous definition'), 0, 0, 0, 0],
'titre' => [$this->app->trans('report:: titre'), 0, 0, 0, 0],
'taille' => [$this->app->trans('report:: poids'), 0, 0, 0, 0]
],
'conf' => [
'identifiant' => [$this->app->trans('report:: identifiant'), 0, 0, 0, 0],
'nom' => [$this->app->trans('report:: nom'), 0, 0, 0, 0],
'mail' => [$this->app->trans('report:: email'), 0, 0, 0, 0],
'adresse' => [$this->app->trans('report:: adresse'), 0, 0, 0, 0],
'tel' => [$this->app->trans('report:: telephone'), 0, 0, 0, 0]
],
'config_cnx' => [
'ddate' => [$this->app->trans('report:: date'), 0, 0, 0, 0],
'appli' => [$this->app->trans('report:: modules'), 0, 0, 0, 0],
],
'config_dl' => [
'ddate' => [$this->app->trans('report:: date'), 0, 0, 0, 0],
'record_id' => [$this->app->trans('report:: record id'), 0, 1, 0, 0],
'final' => [$this->app->trans('phrseanet:: sous definition'), 0, 0, 0, 0],
'coll_id' => [$this->app->trans('report:: collections'), 0, 0, 0, 0],
'comment' => [$this->app->trans('report:: commentaire'), 0, 0, 0, 0],
],
'config_ask' => [
'search' => [$this->app->trans('report:: question'), 0, 0, 0, 0],
'ddate' => [$this->app->trans('report:: date'), 0, 0, 0, 0]
]
];
$report = null;
$html = $html_info = '';
$from = $request->request->get('from', '');
$on = $request->request->get('on', '');
$selectValue = $request->request->get('user', '');
if ('' === $selectValue) {
$this->app->abort(400);
}
if ('' !== $on && $this->getConf()->get(['registry', 'modules', 'anonymous-report']) == true) {
$conf['conf'] = [
$on => [$on, 0, 0, 0, 0],
'nb' => [$this->app->trans('report:: nombre'), 0, 0, 0, 0]
];
}
if ($from == 'CNXU' || $from == 'CNX') {
$report = new \module_report_connexion(
$this->app,
$request->request->get('dmin'),
$request->request->get('dmax'),
$request->request->get('sbasid'),
$request->request->get('collection')
);
$conf_array = $conf['config_cnx'];
$title = $this->app->trans('report:: historique des connexions');
} elseif ($from == 'USR' || $from == 'GEN') {
$report = new \module_report_download(
$this->app,
$request->request->get('dmin'),
$request->request->get('dmax'),
$request->request->get('sbasid'),
$request->request->get('collection')
);
$conf_array = $conf['config_dl'];
$title = $this->app->trans('report:: historique des telechargements');
} elseif ($from == 'ASK') {
$report = new \module_report_question(
$this->app,
$request->request->get('dmin'),
$request->request->get('dmax'),
$request->request->get('sbasid'),
$request->request->get('collection')
);
$conf_array = $conf['config_ask'];
$title = $this->app->trans('report:: historique des questions');
}
if ($report) {
$mapColumnTitleToSqlField = $report->getTransQueryString();
$currentfilter = [];
if ('' !== $serializedFilter = $request->request->get('liste_filter', '')) {
$currentfilter = @unserialize(urldecode($serializedFilter));
}
$filter = new \module_report_filter($this->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 $this->app->json([
'diag' => $this->render('report/colFilter.html.twig', [
'result' => $report->colFilter($field),
'field' => $field
]),
'title' => $this->app->trans('filtrer les resultats sur la colonne %colonne%', ['%colonne%' => $field])]);
}
if ($field === $value) {
$filter->removeFilter($field);
} else {
$filter->addFilter($field, '=', $value);
}
}
if ('' !== $selectValue && '' !== $from) {
$filter->addfilter('usrid', '=', $selectValue);
} elseif ('' !== $on && '' !== $selectValue) {
$filter->addfilter($on, '=', $selectValue);
}
if ($report instanceof \module_report_download) {
$report->setIsInformative(true);
}
$report->setFilter($filter->getTabFilter());
$report->setOrder('ddate', 'DESC');
$report->setConfig(false);
$report->setTitle($title);
$report->setHasLimit(false);
$reportArray = $report->buildReport($conf_array);
if ($request->request->get('printcsv') == 'on') {
$report->setPrettyString(false);
return $this->getCSVResponse($report, 'info_user');
}
$html = $this->render('report/ajax_data_content.html.twig', [
'result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray,
'is_infouser' => $report instanceof \module_report_download,
'is_nav' => false,
'is_groupby' => false,
'is_plot' => false,
'is_doc' => false
]);
}
$info = new \module_report_nav(
$this->app,
$request->request->get('dmin'),
$request->request->get('dmax'),
$request->request->get('sbasid'),
$request->request->get('collection')
);
$info->setPeriode('');
$info->setCsv(false);
$infoArray = $info->buildTabGrpInfo(
null !== $report ? $report->getReq() : '',
null !== $report ? $report->getParams() : [],
$selectValue,
$conf['conf'],
$on
);
if (false == $this->app['conf']->get(['registry', 'modules', 'anonymous-report'])) {
$html_info = $this->render('report/ajax_data_content.html.twig', [
'result' => isset($infoArray['report']) ? $infoArray['report'] : $infoArray,
'is_infouser' => false,
'is_nav' => false,
'is_groupby' => false,
'is_plot' => false,
'is_doc' => false
]);
$title = ('' === $on && isset($infoArray['result'])) ? $infoArray['result'][0]['identifiant'] : $selectValue;
} else {
$title = $selectValue;
}
return $this->app->json([
'rs' => sprintf('%s%s', $html_info, $html),
'display_nav' => false,
'title' => $title
]);
}
/**
* Display a browser version
*
* @param Request $request
* @return JsonResponse
*/
public function doReportInformationBrowser(Request $request)
{
$conf = [
'version' => [$this->app->trans('report::version'), 0, 0, 0, 0],
'nb' => [$this->app->trans('report:: nombre'), 0, 0, 0, 0]
];
$info = new \module_report_nav(
$this->app,
$request->request->get('dmin'),
$request->request->get('dmax'),
$request->request->get('sbasid'),
$request->request->get('collection')
);
$info->setCsv(false);
$info->setConfig(false);
if ('' === $browser = $request->request->get('user', '')) {
$this->app->abort(400);
}
$reportArray = $info->buildTabInfoNav($conf, $browser);
return $this->app->json([
'rs' => $this->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
]),
'display_nav' => false,
'title' => $browser
]);
}
/**
* Display information about a document
*
* @param Request $request
* @return JsonResponse
*/
public function doReportInformationDocument(Request $request)
{
$config = [
'photo' => [$this->app->trans('report:: document'), 0, 0, 0, 0],
'record_id' => [$this->app->trans('report:: record id'), 0, 0, 0, 0],
'date' => [$this->app->trans('report:: date'), 0, 0, 0, 0],
'type' => [$this->app->trans('phrseanet:: sous definition'), 0, 0, 0, 0],
'titre' => [$this->app->trans('report:: titre'), 0, 0, 0, 0],
'taille' => [$this->app->trans('report:: poids'), 0, 0, 0, 0]
];
$config_dl = [
'ddate' => [$this->app->trans('report:: date'), 0, 0, 0, 0],
'user' => [$this->app->trans('report:: utilisateurs'), 0, 0, 0, 0],
'final' => [$this->app->trans('phrseanet:: sous definition'), 0, 0, 0, 0],
'coll_id' => [$this->app->trans('report:: collections'), 0, 0, 0, 0],
'comment' => [$this->app->trans('report:: commentaire'), 0, 0, 0, 0],
'fonction' => [$this->app->trans('report:: fonction'), 0, 0, 0, 0],
'activite' => [$this->app->trans('report:: activite'), 0, 0, 0, 0],
'pays' => [$this->app->trans('report:: pays'), 0, 0, 0, 0],
'societe' => [$this->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(
$this->app,
$request->request->get('sbasid'),
$request->request->get('rid')
);
} catch (\Exception $e) {
$this->app->abort(404);
}
$what = new \module_report_nav(
$this->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);
/** @var \record_adapter $record */
$reportArray = $what->buildTabUserWhat(
$record->getBaseId(),
$record->getRecordId(),
$config
);
$title = $what->getTitle();
$html = $this->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 $this->app->json([
'rs' => $html,
'display_nav' => false,
'title' => $title
]);
}
if ('DASH' !== $from && 'PUSHDOC' !== $from) {
$download = new \module_report_download(
$this->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($this->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 $this->app->json([
'diag' => $this->render('report/colFilter.html.twig', [
'result' => $download->colFilter($field),
'field' => $field
]),
'title' => $this->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->getRecordId());
$download->setFilter($filter->getTabFilter());
$download->setOrder('ddate', 'DESC');
$download->setTitle($this->app->trans('report:: historique des telechargements'));
$download->setConfig(false);
$reportArray = $download->buildReport($config_dl);
if ($request->request->get('printcsv') == 'on') {
$download->setPrettyString(false);
return $this->getCSVResponse($download, 'info_document');
}
$html .= $this->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 $this->app->json([
'rs' => $html,
'display_nav' => false,
'title' => $title
]);
}
if ($this->getConf()->get(['registry', 'modules', 'anonymous-report']) == false && $from !== 'DOC' && $from !== 'DASH' && $from !== 'GEN' && $from !== 'PUSHDOC') {
$conf = [
'identifiant' => [$this->app->trans('report:: identifiant'), 0, 0, 0, 0],
'nom' => [$this->app->trans('report:: nom'), 0, 0, 0, 0],
'mail' => [$this->app->trans('report:: email'), 0, 0, 0, 0],
'adresse' => [$this->app->trans('report:: adresse'), 0, 0, 0, 0],
'tel' => [$this->app->trans('report:: telephone'), 0, 0, 0, 0]
];
$info = new \module_report_nav(
$this->app,
$request->request->get('dmin'),
$request->request->get('dmax'),
$request->request->get('sbasid'),
$request->request->get('collection')
);
$info->setPeriode('');
$info->setConfig(false);
$info->setTitle($this->app->trans('report:: utilisateur'));
$reportArray = $info->buildTabGrpInfo(false, [], $request->request->get('user'), $conf, false);
if ($request->request->get('printcsv') == 'on' && isset($download)) {
return $this->getCSVResponse($this->app, $info, 'info_user');
}
$html .= $this->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 $this->app->json([
'rs' => $html,
'display_nav' => false,
'title' => $title
]);
}
return $this->app->json([
'rs' => $html,
'display_nav' => false,
'title' => $title
]);
}
private function getCSVResponse(\module_report $report, $type)
{
// set headers
$headers = [];
foreach (array_keys($report->getDisplay()) as $k) {
$headers[$k] = $k;
}
// set headers as first row
$result = $report->getResult();
array_unshift($result, $headers);
$collection = new CallbackCollection($result, function ($row) use ($report) {
// restrict fields to the displayed ones
return array_map('strip_tags', array_intersect_key($row, $report->getDisplay()));
});
/** @var Exporter $exporter */
$exporter = $this->app['csv.exporter'];
$filename = sprintf('report_export_%s_%s.csv', $type, date('Ymd'));
$response = new CSVFileResponse($filename, function () use ($exporter, $collection) {
$exporter->export('php://output', $collection);
});
return $response;
}
}

View File

@@ -10,12 +10,8 @@
namespace Alchemy\Phrasea\Controller\Report;
use Alchemy\Phrasea\Controller\Controller;
use Alchemy\Phrasea\Core\Response\CSVFileResponse;
use Goodby\CSV\Export\Standard\Collection\CallbackCollection;
use Goodby\CSV\Export\Standard\Exporter;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class RootController extends Controller
{
@@ -53,22 +49,34 @@ class RootController extends Controller
$granted = [];
foreach ($this->getAclForUser()->get_granted_base([\ACL::CANREPORT]) as $collection) {
if (!isset($granted[$collection->get_sbas_id()])) {
$granted[$collection->get_sbas_id()] = [
'id' => $collection->get_sbas_id(),
'name' => $collection->get_databox()->get_viewname(),
'collections' => []
$acl = $this->getAclForUser();
foreach ($acl->get_granted_base([\ACL::CANREPORT]) as $collection) {
$sbas_id = $collection->get_sbas_id();
if (!isset($granted[$sbas_id])) {
$granted[$sbas_id] = [
'id' => $sbas_id,
'name' => $collection->get_databox()->get_viewname(),
'collections' => [],
'metas' => []
];
foreach ($collection->get_databox()->get_meta_structure() as $meta) {
// skip the fields that can't be reported
if (!$meta->is_report() || ($meta->isBusiness() && !$acl->can_see_business_fields($collection->get_databox()))) {
continue;
}
$granted[$sbas_id]['metas'][] = $meta->get_name();
}
}
$granted[$collection->get_sbas_id()]['collections'][] = [
'id' => $collection->get_coll_id(),
$granted[$sbas_id]['collections'][] = [
'id' => $collection->get_coll_id(),
'base_id' => $collection->get_base_id(),
'name' => $collection->get_name()
'name' => $collection->get_name(),
];
}
$conf = $this->getConf();
return $this->render('report/report_layout_child.html.twig', [
'ajax_dash' => true,
'dashboard' => null,
@@ -82,594 +90,4 @@ class RootController extends Controller
'ajax_chart' => false
]);
}
/**
* Gets available collections where current user can see report and
* format date
*
* @param Request $request
* @return JsonResponse
*/
public function initReport(Request $request)
{
$popbases = $request->request->get('popbases', []);
if ('' === $dmin = $request->request->get('dmin', '')) {
$dmin = date('Y') . '-' . date('m') . '-01';
}
if ('' === $dmax = $request->request->get('dmax', '')) {
$dmax = date('Y') . '-' . date('m') . '-' . date('d');
}
$dmin = \DateTime::createFromFormat('Y-m-d H:i:s', sprintf('%s 00:00:00', $dmin));
$dmax = \DateTime::createFromFormat('Y-m-d H:i:s', sprintf('%s 23:59:59', $dmax));
//get user's sbas & collections selection from popbases
$selection = [];
$liste = $id_sbas = '';
$i = 0;
foreach (array_fill_keys($popbases, 0) as $key => $val) {
$exp = explode('_', $key);
if ($exp[0] != $id_sbas && $i != 0) {
$selection[$id_sbas]['liste'] = $liste;
$liste = '';
}
$selection[$exp[0]][] = $exp[1];
$liste .= (empty($liste) ? '' : ',') . $exp[1];
$id_sbas = $exp[0];
$i ++;
}
//fill the last entry
$selection[$id_sbas]['liste'] = $liste;
return $this->render('report/ajax_report_content.html.twig', [
'selection' => $selection,
'anonymous' => $this->getConf()->get(['registry', 'modules', 'anonymous-report']),
'ajax' => true,
'dmin' => $dmin->format('Y-m-d H:i:s'),
'dmax' => $dmax->format('Y-m-d H:i:s'),
]);
}
/**
* Display instance connexion report
*
* @param Request $request
* @return JsonResponse
*/
public function doReportConnexions(Request $request)
{
$cnx = new \module_report_connexion(
$this->app,
$request->request->get('dmin'),
$request->request->get('dmax'),
$request->request->get('sbasid'),
$request->request->get('collection')
);
$conf = [
'user' => [$this->app->trans('phraseanet::utilisateurs'), 1, 1, 1, 1],
'ddate' => [$this->app->trans('report:: date'), 1, 0, 1, 1],
'ip' => [$this->app->trans('report:: IP'), 1, 0, 0, 0],
'appli' => [$this->app->trans('report:: modules'), 1, 0, 0, 0],
'fonction' => [$this->app->trans('report::fonction'), 1, 1, 1, 1],
'activite' => [$this->app->trans('report::activite'), 1, 1, 1, 1],
'pays' => [$this->app->trans('report::pays'), 1, 1, 1, 1],
'societe' => [$this->app->trans('report::societe'), 1, 1, 1, 1]
];
if ($request->request->get('printcsv') == 'on') {
$cnx->setHasLimit(false);
$cnx->setPrettyString(false);
$this->doReport($request, $cnx, $conf);
return $this->getCSVResponse($cnx, 'connections');
}
$report = $this->doReport($request, $cnx, $conf);
if ($report instanceof Response) {
return $report;
}
return $this->app->json([
'rs' => $this->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'], // do we display the prev and next button ?
'next' => $report['next_page'], //Number of the next page
'prev' => $report['previous_page'], //Number of the previoous page
'page' => $report['page'], //The current page
'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters
'col' => $report['active_column'], //all the columns where a filter is applied
'limit' => $report['nb_record']
]);
}
/**
* Display instance questions report
*
* @param Request $request
* @return JsonResponse
*/
public function doReportQuestions(Request $request)
{
$questions = new \module_report_question(
$this->app,
$request->request->get('dmin'),
$request->request->get('dmax'),
$request->request->get('sbasid'),
$request->request->get('collection')
);
$conf = [
'user' => [$this->app->trans('report:: utilisateur'), 1, 1, 1, 1],
'search' => [$this->app->trans('report:: question'), 1, 0, 1, 1],
'ddate' => [$this->app->trans('report:: date'), 1, 0, 1, 1],
'fonction' => [$this->app->trans('report:: fonction'), 1, 1, 1, 1],
'activite' => [$this->app->trans('report:: activite'), 1, 1, 1, 1],
'pays' => [$this->app->trans('report:: pays'), 1, 1, 1, 1],
'societe' => [$this->app->trans('report:: societe'), 1, 1, 1, 1]
];
if ($request->request->get('printcsv') == 'on') {
$questions->setHasLimit(false);
$questions->setPrettyString(false);
$this->doReport($request, $questions, $conf);
return $this->getCSVResponse($questions, 'questions');
}
$report = $this->doReport($request, $questions, $conf);
if ($report instanceof Response) {
return $report;
}
return $this->app->json([
'rs' => $this->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'], // do we display the prev and next button ?
'next' => $report['next_page'], //Number of the next page
'prev' => $report['previous_page'], //Number of the previoous page
'page' => $report['page'], //The current page
'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters
'col' => $report['active_column'], //all the columns where a filter is applied
'limit' => $report['nb_record']
]);
}
/**
* Display instance download report
*
* @param Request $request
* @return JsonResponse
*/
public function doReportDownloads(Request $request)
{
$download = new \module_report_download(
$this->app,
$request->request->get('dmin'),
$request->request->get('dmax'),
$request->request->get('sbasid'),
$request->request->get('collection')
);
$conf_pref = [];
foreach (\module_report::getPreff($this->app, $request->request->get('sbasid')) as $field) {
$conf_pref[strtolower($field)] = [$field, 0, 0, 0, 0];
}
$conf = array_merge([
'user' => [$this->app->trans('report:: utilisateurs'), 1, 1, 1, 1],
'ddate' => [$this->app->trans('report:: date'), 1, 0, 1, 1],
'record_id' => [$this->app->trans('report:: record id'), 1, 1, 1, 1],
'final' => [$this->app->trans('phrseanet:: sous definition'), 1, 0, 1, 1],
'coll_id' => [$this->app->trans('report:: collections'), 1, 0, 1, 1],
'comment' => [$this->app->trans('report:: commentaire'), 1, 0, 0, 0],
'fonction' => [$this->app->trans('report:: fonction'), 1, 1, 1, 1],
'activite' => [$this->app->trans('report:: activite'), 1, 1, 1, 1],
'pays' => [$this->app->trans('report:: pays'), 1, 1, 1, 1],
'societe' => [$this->app->trans('report:: societe'), 1, 1, 1, 1]
], $conf_pref);
if ($request->request->get('printcsv') == 'on') {
$download->setHasLimit(false);
$download->setPrettyString(false);
$this->doReport($request, $download, $conf);
$r = $this->getCSVResponse($download, 'download');
return $r;
}
$report = $this->doReport($request, $download, $conf);
if ($report instanceof Response) {
return $report;
}
return $this->app->json([
'rs' => $this->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'], // do we display the prev and next button ?
'next' => $report['next_page'], //Number of the next page
'prev' => $report['previous_page'], //Number of the previoous page
'page' => $report['page'], //The current page
'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters
'col' => $report['active_column'], //all the columns where a filter is applied
'limit' => $report['nb_record']
]);
}
/**
* Display instance document report
*
* @param Request $request
* @return JsonResponse
*/
public function doReportDocuments(Request $request)
{
$document = new \module_report_download(
$this->app,
$request->request->get('dmin'),
$request->request->get('dmax'),
$request->request->get('sbasid'),
$request->request->get('collection')
);
$conf_pref = [];
foreach (\module_report::getPreff($this->app, $request->request->get('sbasid')) as $field) {
$conf_pref[$field] = array($field, 0, 0, 0, 0);
}
$conf = array_merge([
'telechargement' => [$this->app->trans('report:: telechargements'), 1, 0, 0, 0],
'record_id' => [$this->app->trans('report:: record id'), 1, 1, 1, 0],
'final' => [$this->app->trans('phraseanet:: sous definition'), 1, 0, 1, 1],
'file' => [$this->app->trans('report:: fichier'), 1, 0, 0, 1],
'mime' => [$this->app->trans('report:: type'), 1, 0, 1, 1],
'size' => [$this->app->trans('report:: taille'), 1, 0, 1, 1]
], $conf_pref);
if ($request->request->get('printcsv') == 'on') {
$document->setHasLimit(false);
$document->setPrettyString(false);
$this->doReport($request, $document, $conf, 'record_id');
$r = $this->getCSVResponse($document, 'documents');
return $r;
}
$report = $this->doReport($request, $document, $conf, 'record_id');
if ($report instanceof Response) {
return $report;
}
return $this->app->json([
'rs' => $this->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' => true
]),
'display_nav' => $report['display_nav'], // do we display the prev and next button ?
'next' => $report['next_page'], //Number of the next page
'prev' => $report['previous_page'], //Number of the previoous page
'page' => $report['page'], //The current page
'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters
'col' => $report['active_column'], //all the columns where a filter is applied
'limit' => $report['nb_record']
]);
}
/**
* Display information about client (browser, resolution etc ...)
*
* @param Request $request
* @return JsonResponse
*/
public function doReportClients(Request $request)
{
$nav = new \module_report_nav(
$this->app,
$request->request->get('dmin'),
$request->request->get('dmax'),
$request->request->get('sbasid'),
$request->request->get('collection')
);
$conf_nav = [
'nav' => [$this->app->trans('report:: navigateur'), 0, 1, 0, 0],
'nb' => [$this->app->trans('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [$this->app->trans('report:: pourcentage'), 0, 0, 0, 0]
];
$conf_combo = [
'combo' => [$this->app->trans('report:: navigateurs et plateforme'), 0, 0, 0, 0],
'nb' => [$this->app->trans('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [$this->app->trans('report:: pourcentage'), 0, 0, 0, 0]
];
$conf_os = [
'os' => [$this->app->trans('report:: plateforme'), 0, 0, 0, 0],
'nb' => [$this->app->trans('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [$this->app->trans('report:: pourcentage'), 0, 0, 0, 0]
];
$conf_res = [
'res' => [$this->app->trans('report:: resolution'), 0, 0, 0, 0],
'nb' => [$this->app->trans('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [$this->app->trans('report:: pourcentage'), 0, 0, 0, 0]
];
$conf_mod = [
'appli' => [$this->app->trans('report:: module'), 0, 0, 0, 0],
'nb' => [$this->app->trans('report:: nombre'), 0, 0, 0, 0],
'pourcent' => [$this->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') {
$result = [];
$result[] = array_keys($conf_nav);
foreach ($report['nav']['result'] as $row) {
$result[] = array_values($row);
};
$result[] = array_keys($conf_os);
foreach ($report['os']['result'] as $row) {
$result[] = array_values($row);
};
$result[] = array_keys($conf_res);
foreach ($report['res']['result'] as $row) {
$result[] = array_values($row);
};
$result[] = array_keys($conf_mod);
foreach ($report['mod']['result'] as $row) {
$result[] = array_values($row);
};
$result[] = array_keys($conf_combo);
foreach ($report['combo']['result'] as $row) {
$result[] = array_values($row);
};
/** @var Exporter $exporter */
$exporter = $this->app['csv.exporter'];
$filename = sprintf('report_export_info_%s.csv', date('Ymd'));
$response = new CSVFileResponse($filename, function () use ($exporter, $result) {
$exporter->export('php://output', $result);
});
return $response;
}
return $this->app->json([
'rs' => $this->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
]);
}
/**
* Set Report configuration according to request parameters
*
* @param Request $request A request instance
* @param \module_report $report A report instance
* @param Array $conf A report column configuration
* @param Boolean $what Whether to group on a particular field or not
* @return Array
*/
private function doReport(Request $request, \module_report $report, $conf, $what = false)
{
if ($this->getConf()->get(['registry', 'modules', 'anonymous-report']) == true) {
if (isset($conf['user'])) {
unset($conf['user']);
}
if (isset($conf['ip'])) {
unset($conf['ip']);
}
}
//save initial conf
$base_conf = $conf;
//format conf according user preferences
if ('' !== $columnsList = $request->request->get('list_column', '')) {
$new_conf = $conf;
$columns = explode(',', $columnsList);
foreach (array_keys($conf) as $col) {
if (!in_array($col, $columns)) {
unset($new_conf[$col]);
}
}
$conf = $new_conf;
}
//display content of a table column when user click on it
if ($request->request->get('conf') == 'on') {
return $this->app->json(['liste' => $this->render('report/listColumn.html.twig', [
'conf' => $base_conf
]), 'title' => $this->app->trans('configuration')]);
}
//set order
if (('' !== $order = $request->request->get('order', '')) && ('' !== $field = $request->request->get('champ', ''))) {
$report->setOrder($field, $order);
}
//work on filters
$mapColumnTitleToSqlField = $report->getTransQueryString();
$currentfilter = [];
if ('' !== $serializedFilter = $request->request->get('liste_filter', '')) {
$currentfilter = @unserialize(urldecode($serializedFilter));
}
$filter = new \module_report_filter($this->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 $this->app->json(['diag' => $this->render('report/colFilter.html.twig', [
'result' => $report->colFilter($field),
'field' => $field
]), 'title' => $this->app->trans('filtrer les resultats sur la colonne %colonne%', ['%colonne%' => $field])]);
}
if ($field === $value) {
$filter->removeFilter($field);
} else {
$filter->addFilter($field, '=', $value);
}
}
//set new request filter if user asking for them
if ($request->request->get('precise') == 1) {
$filter->addFilter('xml', 'LIKE', $request->request->get('word', ''));
} elseif ($request->request->get('precise') == 2) {
$filter->addFilter('record_id', '=', $request->request->get('word', ''));
}
//set filters to current report
$report->setFilter($filter->getTabFilter());
$report->setActiveColumn($filter->getActiveColumn());
$report->setPostingFilter($filter->getPostingFilter());
// display a new arraywhere results are group
if ('' !== $groupby = $request->request->get('groupby', '')) {
$report->setConfig(false);
$groupby = current(explode(' ', $groupby));
$reportArray = $report->buildReport(false, $groupby);
if (count($reportArray['allChamps']) > 0 && count($reportArray['display']) > 0) {
$groupField = isset($reportArray['display'][$reportArray['allChamps'][0]]['title']) ? $reportArray['display'][$reportArray['allChamps'][0]]['title'] : '';
} else {
$groupField = isset($conf[strtolower($groupby)]['title']) ? $conf[strtolower($groupby)]['title'] : '';
}
return $this->app->json([
'rs' => $this->render('report/ajax_data_content.html.twig', [
'result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray,
'is_infouser' => false,
'is_nav' => false,
'is_groupby' => true,
'is_plot' => false,
'is_doc' => false
]),
'display_nav' => false,
'title' => $this->app->trans('Groupement des resultats sur le champ %name%', ['%name%' => $groupField])
]);
}
//set Limit
if ($report->getEnableLimit()
&& ('' !== $page = $request->request->get('page', ''))
&& ('' !== $limit = $request->request->get('limit', ''))) {
$report->setLimit($page, $limit);
} else {
$report->setLimit(false, false);
}
//time to build our report
if (false === $what) {
$reportArray = $report->buildReport($conf);
} else {
$reportArray = $report->buildReport($conf, $what, $request->request->get('tbl', false));
}
return $reportArray;
}
/**
* Prefix the method to call with the controller class name
*
* @param string $method The method to call
* @return string
*/
private function call($method)
{
return sprintf('%s::%s', __CLASS__, $method);
}
private function getCSVResponse(\module_report $report, $type)
{
// set headers
$headers = [];
foreach (array_keys($report->getDisplay()) as $k) {
$headers[$k] = $k;
}
// set headers as first row
$result = $report->getResult();
array_unshift($result, $headers);
$collection = new CallbackCollection($result, function ($row) use ($headers) {
// restrict fields to the displayed ones
// return array_map("strip_tags", array_intersect_key($row, $report->getDisplay()));
$ret = array();
foreach($headers as $f) {
$ret[$f] = array_key_exists($f, $row) ? strip_tags($row[$f]) : '';
}
return $ret;
});
$filename = sprintf('report_export_%s_%s.csv', $type, date('Ymd'));
/** @var Exporter $exporter */
$exporter = $this->app['csv.exporter'];
$cb = function () use ($exporter, $collection) {
$exporter->export('php://output', $collection);
};
$response = new CSVFileResponse($filename, $cb);
return $response;
}
}

View File

@@ -88,8 +88,6 @@ class ControllerProviderServiceProvider implements ServiceProviderInterface
Prod\Upload::class => [],
Prod\UsrLists::class => [],
Prod\WorkZone::class => [],
Report\Activity::class => [],
Report\Information::class => [],
Report\Root::class => [],
Root\Account::class => [],
Root\Developers::class => [],

View File

@@ -1,81 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\ControllerProvider\Report;
use Alchemy\Phrasea\Application as PhraseaApplication;
use Alchemy\Phrasea\Controller\Report\ActivityController;
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
use Silex\Application;
use Silex\ControllerProviderInterface;
use Silex\ServiceProviderInterface;
class Activity implements ControllerProviderInterface, ServiceProviderInterface
{
use ControllerProviderTrait;
public function register(Application $app)
{
$app['controller.report.activity'] = $app->share(function (PhraseaApplication $app) {
return new ActivityController($app);
});
}
public function boot(Application $app)
{
// no-op
}
public function connect(Application $app)
{
$controllers = $this->createAuthenticatedCollection($app);
$firewall = $this->getFirewall($app);
$controllers->before(function () use ($firewall) {
$firewall->requireAccessToModule('report');
});
$controllers->post('/users/connexions', 'controller.report.activity:doReportConnexionsByUsers')
->bind('report_activity_users_connexions');
$controllers->post('/users/downloads', 'controller.report.activity:doReportDownloadsByUsers')
->bind('report_activity_users_downloads');;
$controllers->post('/questions/best-of', 'controller.report.activity:doReportBestOfQuestions')
->bind('report_activity_questions_bestof');
$controllers->post('/questions/no-best-of', 'controller.report.activity:doReportNoBestOfQuestions')
->bind('report_activity_questions_nobestof');
$controllers->post('/instance/hours', 'controller.report.activity:doReportSiteActiviyPerHours')
->bind('report_activity_instance_hours');
$controllers->post('/instance/days', 'controller.report.activity:doReportSiteActivityPerDays')
->bind('report_activity_instance_days');
$controllers->post('/documents/pushed', 'controller.report.activity:doReportPushedDocuments')
->bind('report_activity_documents_pushed');
$controllers->post('/documents/added', 'controller.report.activity:doReportAddedDocuments')
->bind('report_activity_documents_added');
$controllers->post('/documents/edited', 'controller.report.activity:doReportEditedDocuments')
->bind('report_activity_documents_edited');
$controllers->post('/documents/validated', 'controller.report.activity:doReportValidatedDocuments')
->bind('report_activity_documents_validated');
$controllers->post('/documents/sent', 'controller.report.activity:doReportSentDocuments')
->bind('report_activity_documents_sent');
return $controllers;
}
}

View File

@@ -1,57 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\ControllerProvider\Report;
use Alchemy\Phrasea\Application as PhraseaApplication;
use Alchemy\Phrasea\Controller\Report\InformationController;
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
use Silex\Application;
use Silex\ControllerProviderInterface;
use Silex\ServiceProviderInterface;
class Information implements ControllerProviderInterface, ServiceProviderInterface
{
use ControllerProviderTrait;
public function register(Application $app)
{
$app['controller.report.information'] = $app->share(function (PhraseaApplication $app) {
return new InformationController($app);
});
}
public function boot(Application $app)
{
// no-op
}
public function connect(Application $app)
{
$controllers = $this->createAuthenticatedCollection($app);
$firewall = $this->getFirewall($app);
$controllers->before(function () use ($firewall) {
$firewall->requireAccessToModule('report');
});
$controllers->post('/user', 'controller.report.information:doReportInformationUser')
->bind('report_infomations_user');
$controllers->post('/browser', 'controller.report.information:doReportInformationBrowser')
->bind('report_infomations_browser');
$controllers->post('/document', 'controller.report.information:doReportInformationDocument')
->bind('report_infomations_document');
return $controllers;
}
}

View File

@@ -9,6 +9,7 @@
*/
namespace Alchemy\Phrasea\Report\Controller;
use Alchemy\Phrasea\Controller\Controller;
use Alchemy\Phrasea\Report\Report;
use Alchemy\Phrasea\Report\ReportConnections;
use Alchemy\Phrasea\Report\ReportDownloads;
@@ -16,10 +17,11 @@ use Alchemy\Phrasea\Report\ReportFactory;
use Alchemy\Phrasea\Report\ReportRecords;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
class ProdReportController
class ProdReportController extends Controller
{
private static $mapFromExtension = [
'csv' => [
@@ -55,6 +57,19 @@ class ProdReportController
$this->acl = $acl;
}
/**
* route prod/report/connections
*
* @param Request $request
* @return Response
*/
public function indexAction(Request $request)
{
return new Response($this->render('prod/report/index.html.twig', [
'truc' => "hello"
]));
}
/**
* route prod/report/connections
*

View File

@@ -58,20 +58,27 @@ class ProdReportControllerProvider implements ControllerProviderInterface, Servi
public function connect(Application $app)
{
$controllers = $this->createAuthenticatedCollection($app);
$controllers
->get('/', 'controller.prod.report:indexAction')
;
$controllers
->get('/connections/{sbasId}/', 'controller.prod.report:connectionsAction')
->assert('sbasId', '\d+')
->bind('report2_connections')
;
$controllers
->get('/downloads/{sbasId}/', 'controller.prod.report:downloadsAction')
->assert('sbasId', '\d+')
->bind('report2_downloads')
;
$controllers
->get('/records/{sbasId}/', 'controller.prod.report:recordsAction')
->assert('sbasId', '\d+')
->bind('report2_records')
;
return $controllers;

View File

@@ -72,8 +72,6 @@ class ReportRecords extends Report
. " AND r.record_id >= " . $row['from'] . " AND r.record_id <= " . $row['to'] . "\n"
. "GROUP BY `record_id`\n";
// file_put_contents("/tmp/phraseanet-log.txt", sprintf("%s (%d) %s\n", __FILE__, __LINE__, var_export($sql, true)), FILE_APPEND);
$stmt = $this->databox->get_connection()->executeQuery($sql, []);
$rows = $stmt->fetchAll();
$stmt->closeCursor();

View File

@@ -8,13 +8,7 @@ gulp.task('copy-report-images', function(){
.pipe(gulp.dest( config.paths.build + 'report/images'));
});
gulp.task('build-report-print-css', function(){
return utils.buildCssGroup([
config.paths.src + 'report/styles/main-print.scss'
], 'print', 'report/css/', debugMode);
});
gulp.task('build-report-css', ['build-report-print-css'], function(){
gulp.task('build-report-css', function(){
return utils.buildCssGroup([
config.paths.src + 'report/styles/main.scss'
], 'report', 'report/css/', debugMode);
@@ -22,10 +16,6 @@ gulp.task('build-report-css', ['build-report-print-css'], function(){
gulp.task('build-report-js', function(){
var reportGroup = [
config.paths.src + 'report/js/jquery.print.js',
config.paths.src + 'report/js/jquery.cluetip.js',
config.paths.src + 'report/js/jquery.nicoslider.js',
config.paths.src + 'report/js/jquery.gvChart-0.1.js',
config.paths.src + 'report/js/report.js'
];
return utils.buildJsGroup(reportGroup, 'report', 'report/js', debugMode);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2018-11-26T14:58:45Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
<file date="2018-12-11T12:17:04Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2018-11-26T15:00:25Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
<file date="2018-12-11T12:19:04Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2018-11-26T15:02:11Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
<file date="2018-12-11T12:20:50Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2018-11-26T15:04:05Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
<file date="2018-12-11T12:22:28Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

Binary file not shown.

After

Width:  |  Height:  |  Size: 657 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

View File

@@ -1,632 +0,0 @@
/*
* jQuery clueTip plugin
* Version 1.1pre (May 16, 2010)
* @requires jQuery v1.3+
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
/*
*
* Full list of options/settings can be found at the bottom of this file and at http://plugins.learningjquery.com/cluetip/
*
* Examples can be found at http://plugins.learningjquery.com/cluetip/demo/
*
*/
(function($) {
$.cluetip = {version: '1.1pre'};
var $cluetip, $cluetipInner, $cluetipOuter, $cluetipTitle, $cluetipArrows, $cluetipWait, $dropShadow, imgCount;
var insertionType = 'appendTo', insertionElement = 'body';
$.fn.cluetip = function(js, options) {
if (typeof js == 'object') {
options = js;
js = null;
}
if (js == 'destroy') {
return this.removeData('cluetip').unbind('.cluetip');
}
// merge per-call options with defaults
options = $.extend(true, {}, $.fn.cluetip.defaults, options || {});
/** =create cluetip divs **/
if (!$('#cluetip').length) {
$(['<div id="cluetip">',
'<div id="cluetip-outer">',
'<h3 id="cluetip-title"></h3>',
'<div id="cluetip-inner"></div>',
'</div>',
'<div id="cluetip-extra"></div>',
'<div id="cluetip-arrows" class="cluetip-arrows"></div>',
'</div>'].join(''))
[insertionType](insertionElement).hide();
var cluezIndex = +options.cluezIndex;
$cluetip = $('#cluetip').css({position: 'absolute'});
$cluetipOuter = $('#cluetip-outer').css({position: 'relative', zIndex: cluezIndex});
$cluetipInner = $('#cluetip-inner');
$cluetipTitle = $('#cluetip-title');
$cluetipArrows = $('#cluetip-arrows');
$cluetipWait = $('<div id="cluetip-waitimage"></div>')
.css({position: 'absolute'}).insertBefore($cluetip).hide();
}
var cluetipPadding = (parseInt($cluetip.css('paddingLeft'),10)||0) + (parseInt($cluetip.css('paddingRight'),10)||0);
this.each(function(index) {
var link = this, $this = $(this);
// support metadata plugin (v1.0 and 2.0)
var opts = $.extend(true, {}, options, $.metadata ? $this.metadata() : $.meta ? $this.data() : {});
// start out with no contents (for ajax activation)
var cluetipContents = false;
cluezIndex = +opts.cluezIndex;
$this.data('cluetip', {title: link.title, zIndex: cluezIndex});
var isActive = false, closeOnDelay = 0;
var tipAttribute = $this.attr(opts.attribute), ctClass = opts.cluetipClass;
if (!tipAttribute && !opts.splitTitle && !js) {
return true;
}
// if hideLocal is set to true, on DOM ready hide the local content that will be displayed in the clueTip
if (opts.local && opts.localPrefix) {tipAttribute = opts.localPrefix + tipAttribute;}
if (opts.local && opts.hideLocal) { $(tipAttribute + ':first').hide(); }
var tOffset = parseInt(opts.topOffset, 10), lOffset = parseInt(opts.leftOffset, 10);
// vertical measurement variables
var tipHeight, wHeight,
defHeight = isNaN(parseInt(opts.height, 10)) ? 'auto' : (/\D/g).test(opts.height) ? opts.height : opts.height + 'px';
var sTop, linkTop, posY, tipY, mouseY, baseline;
// horizontal measurement variables
var tipInnerWidth = parseInt(opts.width, 10) || 275,
tipWidth = tipInnerWidth + cluetipPadding + opts.dropShadowSteps,
linkWidth = this.offsetWidth,
linkLeft, posX, tipX, mouseX, winWidth;
// parse the title
var tipParts;
var tipTitle = (opts.attribute != 'title') ? $this.attr(opts.titleAttribute) : '';
if (opts.splitTitle) {
if (tipTitle == undefined) {tipTitle = '';}
tipParts = tipTitle.split(opts.splitTitle);
tipTitle = tipParts.shift();
}
if (opts.escapeTitle) {
tipTitle = tipTitle.replace(/&/g,'&amp;').replace(/>/g,'&gt;').replace(/</g,'&lt;');
}
var localContent;
function returnFalse() { return false; }
/***************************************
* ACTIVATION
****************************************/
//activate clueTip
var activate = function(event) {
if (!opts.onActivate($this)) {
return false;
}
isActive = true;
$cluetip.removeClass().css({width: tipInnerWidth});
if (tipAttribute == $this.attr('href')) {
$this.css('cursor', opts.cursor);
}
if (opts.hoverClass) {
$this.addClass(opts.hoverClass);
}
linkTop = posY = $this.offset().top;
linkLeft = $this.offset().left;
mouseX = event.pageX;
mouseY = event.pageY;
if (link.tagName.toLowerCase() != 'area') {
sTop = $(document).scrollTop();
winWidth = $(window).width();
}
// position clueTip horizontally
if (opts.positionBy == 'fixed') {
posX = linkWidth + linkLeft + lOffset;
$cluetip.css({left: posX});
} else {
posX = (linkWidth > linkLeft && linkLeft > tipWidth)
|| linkLeft + linkWidth + tipWidth + lOffset > winWidth
? linkLeft - tipWidth - lOffset
: linkWidth + linkLeft + lOffset;
if (link.tagName.toLowerCase() == 'area' || opts.positionBy == 'mouse' || linkWidth + tipWidth > winWidth) { // position by mouse
if (mouseX + 20 + tipWidth > winWidth) {
$cluetip.addClass(' cluetip-' + ctClass);
posX = (mouseX - tipWidth - lOffset) >= 0 ? mouseX - tipWidth - lOffset - parseInt($cluetip.css('marginLeft'),10) + parseInt($cluetipInner.css('marginRight'),10) : mouseX - (tipWidth/2);
} else {
posX = mouseX + lOffset;
}
}
var pY = posX < 0 ? event.pageY + tOffset : event.pageY;
$cluetip.css({
left: (posX > 0 && opts.positionBy != 'bottomTop') ? posX : (mouseX + (tipWidth/2) > winWidth) ? winWidth/2 - tipWidth/2 : Math.max(mouseX - (tipWidth/2),0),
zIndex: $this.data('cluetip').zIndex
});
$cluetipArrows.css({zIndex: $this.data('cluetip').zIndex+1});
}
wHeight = $(window).height();
/***************************************
* load a string from cluetip method's first argument
***************************************/
if (js) {
if (typeof js == 'function') {
js = js.call(link);
}
$cluetipInner.html(js);
cluetipShow(pY);
}
/***************************************
* load the title attribute only (or user-selected attribute).
* clueTip title is the string before the first delimiter
* subsequent delimiters place clueTip body text on separate lines
***************************************/
else if (tipParts) {
var tpl = tipParts.length;
$cluetipInner.html(tpl ? tipParts[0] : '');
if (tpl > 1) {
for (var i=1; i < tpl; i++){
$cluetipInner.append('<div class="split-body">' + tipParts[i] + '</div>');
}
}
cluetipShow(pY);
}
/***************************************
* load external file via ajax
***************************************/
else if (!opts.local && tipAttribute.indexOf('#') !== 0) {
if (/\.(jpe?g|tiff?|gif|png)$/i.test(tipAttribute)) {
$cluetipInner.html('<img src="' + tipAttribute + '" alt="' + tipTitle + '" />');
cluetipShow(pY);
} else if (cluetipContents && opts.ajaxCache) {
$cluetipInner.html(cluetipContents);
cluetipShow(pY);
} else {
var optionBeforeSend = opts.ajaxSettings.beforeSend,
optionError = opts.ajaxSettings.error,
optionSuccess = opts.ajaxSettings.success,
optionComplete = opts.ajaxSettings.complete;
var ajaxSettings = {
cache: false, // force requested page not to be cached by browser
url: tipAttribute,
beforeSend: function(xhr) {
if (optionBeforeSend) {optionBeforeSend.call(link, xhr, $cluetip, $cluetipInner);}
$cluetipOuter.children().empty();
if (opts.waitImage) {
$cluetipWait
.css({top: mouseY+20, left: mouseX+20, zIndex: $this.data('cluetip').zIndex-1})
.show();
}
},
error: function(xhr, textStatus) {
if (isActive) {
if (optionError) {
optionError.call(link, xhr, textStatus, $cluetip, $cluetipInner);
} else {
$cluetipInner.html('<i>sorry, the contents could not be loaded</i>');
}
}
},
success: function(data, textStatus) {
cluetipContents = opts.ajaxProcess.call(link, data);
if (isActive) {
if (optionSuccess) {optionSuccess.call(link, data, textStatus, $cluetip, $cluetipInner);}
$cluetipInner.html(cluetipContents);
}
},
complete: function(xhr, textStatus) {
if (optionComplete) {optionComplete.call(link, xhr, textStatus, $cluetip, $cluetipInner);}
var imgs = $cluetipInner[0].getElementsByTagName('img');
imgCount = imgs.length;
for (var i=0, l = imgs.length; i < l; i++) {
if (imgs[i].complete) {
imgCount--;
}
}
if (imgCount && !$.browser.opera) {
$(imgs).bind('load error', function() {
imgCount--;
if (imgCount<1) {
$cluetipWait.hide();
if (isActive) { cluetipShow(pY); }
}
});
} else {
$cluetipWait.hide();
if (isActive) { cluetipShow(pY); }
}
}
};
var ajaxMergedSettings = $.extend(true, {}, opts.ajaxSettings, ajaxSettings);
$.ajax(ajaxMergedSettings);
}
/***************************************
* load an element from the same page
***************************************/
} else if (opts.local) {
var $localContent = $(tipAttribute + (/#\S+$/.test(tipAttribute) ? '' : ':eq(' + index + ')')).clone(true).show();
if (opts.localIdSuffix) {
$localContent.attr('id', $localContent[0].id + opts.localIdSuffix);
}
$cluetipInner.html($localContent);
cluetipShow(pY);
}
};
// get dimensions and options for cluetip and prepare it to be shown
var cluetipShow = function(bpY) {
$cluetip.addClass('cluetip-' + ctClass);
if (opts.truncate) {
var $truncloaded = $cluetipInner.text().slice(0,opts.truncate) + '...';
$cluetipInner.html($truncloaded);
}
function doNothing() {}; //empty function
tipTitle ? $cluetipTitle.show().html(tipTitle) : (opts.showTitle) ? $cluetipTitle.show().html('&nbsp;') : $cluetipTitle.hide();
if (opts.sticky) {
var $closeLink = $('<div id="cluetip-close"><a href="#">' + opts.closeText + '</a></div>');
(opts.closePosition == 'bottom') ? $closeLink.appendTo($cluetipInner) : (opts.closePosition == 'title') ? $closeLink.prependTo($cluetipTitle) : $closeLink.prependTo($cluetipInner);
$closeLink.bind('click.cluetip', function() {
cluetipClose();
return false;
});
if (opts.mouseOutClose) {
$cluetip.bind('mouseleave.cluetip', function() {
cluetipClose();
});
} else {
$cluetip.unbind('mouseleave.cluetip');
}
}
// now that content is loaded, finish the positioning
var direction = '';
$cluetipOuter.css({zIndex: $this.data('cluetip').zIndex, overflow: defHeight == 'auto' ? 'visible' : 'auto', height: defHeight});
tipHeight = defHeight == 'auto' ? Math.max($cluetip.outerHeight(),$cluetip.height()) : parseInt(defHeight,10);
tipY = posY;
baseline = sTop + wHeight;
if (opts.positionBy == 'fixed') {
tipY = posY - opts.dropShadowSteps + tOffset;
} else if ( (posX < mouseX && Math.max(posX, 0) + tipWidth > mouseX) || opts.positionBy == 'bottomTop') {
if (posY + tipHeight + tOffset > baseline && mouseY - sTop > tipHeight + tOffset) {
tipY = mouseY - tipHeight - tOffset;
direction = 'top';
} else {
tipY = mouseY + tOffset;
direction = 'bottom';
}
} else if ( posY + tipHeight + tOffset > baseline ) {
tipY = (tipHeight >= wHeight) ? sTop : baseline - tipHeight - tOffset;
} else if ($this.css('display') == 'block' || link.tagName.toLowerCase() == 'area' || opts.positionBy == "mouse") {
tipY = bpY - tOffset;
} else {
tipY = posY - opts.dropShadowSteps;
}
if (direction == '') {
posX < linkLeft ? direction = 'left' : direction = 'right';
}
$cluetip.css({top: tipY + 'px'}).removeClass().addClass('clue-' + direction + '-' + ctClass).addClass(' cluetip-' + ctClass);
if (opts.arrows) { // set up arrow positioning to align with element
var bgY = (posY - tipY - opts.dropShadowSteps);
$cluetipArrows.css({top: (/(left|right)/.test(direction) && posX >=0 && bgY > 0) ? bgY + 'px' : /(left|right)/.test(direction) ? 0 : ''}).show();
} else {
$cluetipArrows.hide();
}
// (first hide, then) ***SHOW THE CLUETIP***
// handle dropshadow divs first
$dropShadow = createDropShadows(opts);
if ($dropShadow && $dropShadow.length) {
$dropShadow.hide().css({height: tipHeight, width: tipInnerWidth, zIndex: $this.data('cluetip').zIndex-1}).show();
}
$cluetip.hide()[opts.fx.open](opts.fx.openSpeed || 0);
if ($.fn.bgiframe) { $cluetip.bgiframe(); }
// delayed close (not fully tested)
if (opts.delayedClose > 0) {
closeOnDelay = setTimeout(cluetipClose, opts.delayedClose);
}
// trigger the optional onShow function
opts.onShow.call(link, $cluetip, $cluetipInner);
};
/***************************************
=INACTIVATION
-------------------------------------- */
var inactivate = function(event) {
isActive = false;
$cluetipWait.hide();
if (!opts.sticky || (/click|toggle/).test(opts.activation) ) {
cluetipClose();
clearTimeout(closeOnDelay);
}
if (opts.hoverClass) {
$this.removeClass(opts.hoverClass);
}
};
// close cluetip and reset some things
var cluetipClose = function() {
$cluetipOuter
.parent().hide().removeClass();
opts.onHide.call(link, $cluetip, $cluetipInner);
$this.removeClass('cluetip-clicked');
if (tipTitle) {
$this.attr(opts.titleAttribute, tipTitle);
}
$this.css('cursor','');
if (opts.arrows) {
$cluetipArrows.css({top: ''});
}
};
$(document).bind('hideCluetip', function(e) {
cluetipClose();
});
/***************************************
=BIND EVENTS
-------------------------------------- */
// activate by click
if ( (/click|toggle/).test(opts.activation) ) {
$this.bind('click.cluetip', function(event) {
if ($cluetip.is(':hidden') || !$this.is('.cluetip-clicked')) {
activate(event);
$('.cluetip-clicked').removeClass('cluetip-clicked');
$this.addClass('cluetip-clicked');
} else {
inactivate(event);
}
this.blur();
return false;
});
// activate by focus; inactivate by blur
} else if (opts.activation == 'focus') {
$this.bind('focus.cluetip', function(event) {
activate(event);
});
$this.bind('blur.cluetip', function(event) {
inactivate(event);
});
// activate by hover
} else {
// clicking is returned false if clickThrough option is set to false
$this[opts.clickThrough ? 'unbind' : 'bind']('click', returnFalse);
//set up mouse tracking
var mouseTracks = function(evt) {
if (opts.tracking == true) {
var trackX = posX - evt.pageX;
var trackY = tipY ? tipY - evt.pageY : posY - evt.pageY;
$this.bind('mousemove.cluetip', function(evt) {
$cluetip.css({left: evt.pageX + trackX, top: evt.pageY + trackY });
});
}
};
if ($.fn.hoverIntent && opts.hoverIntent) {
$this.hoverIntent({
sensitivity: opts.hoverIntent.sensitivity,
interval: opts.hoverIntent.interval,
over: function(event) {
activate(event);
mouseTracks(event);
},
timeout: opts.hoverIntent.timeout,
out: function(event) {inactivate(event); $this.unbind('mousemove.cluetip');}
});
} else {
$this.bind('mouseenter.cluetip', function(event) {
activate(event);
mouseTracks(event);
})
.bind('mouseleave.cluetip', function(event) {
inactivate(event);
$this.unbind('mousemove.cluetip');
});
}
$this.bind('mouseover.cluetip', function(event) {
$this.attr('title','');
}).bind('mouseleave.cluetip', function(event) {
$this.attr('title', $this.data('cluetip').title);
});
}
});
/** =private functions
************************************************************/
/** =create dropshadow divs **/
function createDropShadows(options, newDropShadow) {
var dropShadowSteps = (options.dropShadow && options.dropShadowSteps) ? +options.dropShadowSteps : 0;
if ($.support.boxShadow) {
var dsOffsets = dropShadowSteps === 0 ? '0 0 ' : '1px 1px ';
$('#cluetip').css($.support.boxShadow, dsOffsets + dropShadowSteps + 'px rgba(0,0,0,0.5)');
return false;
}
var oldDropShadow = $('#cluetip .cluetip-drop-shadow');
if (dropShadowSteps == oldDropShadow.length) {
return oldDropShadow;
}
oldDropShadow.remove();
var dropShadows = [];
for (var i=0; i < dropShadowSteps;) {
dropShadows[i++] = '<div style="top:' + i + 'px;left:' + i + 'px;"></div>';
}
newDropShadow = $(dropShadows.join(''))
.css({
position: 'absolute',
backgroundColor: '#FFF',
zIndex: cluezIndex -1
})
.addClass('cluetip-drop-shadow')
.prependTo('#cluetip');
return newDropShadow;
}
return this;
};
(function() {
$.support = $.support || {};
// check support for CSS3 properties (currently only boxShadow)
var div = document.createElement('div'),
divStyle = div.style,
styleProps = ['boxShadow'],
prefixes = ['moz', 'Moz', 'webkit', 'o'];
for (var i=0, sl = styleProps.length; i < sl; i++) {
var prop = styleProps[i],
uProp = prop.charAt(0).toUpperCase() + prop.slice(1);
if ( typeof divStyle[ prop ] !== 'undefined' ) {
$.support[ prop ] = prop;
} else {
for (var j=0, pl = prefixes.length; j < pl; j++) {
if (typeof divStyle[ prefixes[j] + uProp ] !== 'undefined') {
$.support[ prop ] = prefixes[j] + uProp;
break;
}
}
}
}
div = null; delete div;
})();
/*
* options for clueTip
*
* each one can be explicitly overridden by changing its value.
* for example: $.fn.cluetip.defaults.width = 200;
* would change the default width for all clueTips to 200.
*
* each one can also be overridden by passing an options map to the cluetip method.
* for example: $('a.example').cluetip({width: 200});
* would change the default width to 200 for clueTips invoked by a link with class of "example"
*
*/
$.fn.cluetip.defaults = { // set up default options
width: 'auto', // The width of the clueTip
height: 'auto', // The height of the clueTip
cluezIndex: 9999, // Sets the z-index style property of the clueTip
positionBy: 'auto', // Sets the type of positioning: 'auto', 'mouse','bottomTop', 'fixed'
topOffset: 5, // Number of px to offset clueTip from top of invoking element
leftOffset: 5, // Number of px to offset clueTip from left of invoking element
local: false, // Whether to use content from the same page for the clueTip's body
localPrefix: null, // string to be prepended to the tip attribute if local is true
localIdSuffix: null, // string to be appended to the cluetip content element's id if local is true
hideLocal: true, // If local option is set to true, this determines whether local content
// to be shown in clueTip should be hidden at its original location
attribute: 'rel', // the attribute to be used for fetching the clueTip's body content
titleAttribute: 'title', // the attribute to be used for fetching the clueTip's title
splitTitle: '', // A character used to split the title attribute into the clueTip title and divs
// within the clueTip body. more info below [6]
escapeTitle: false, // whether to html escape the title attribute
showTitle: false, // show title bar of the clueTip, even if title attribute not set
cluetipClass: '',// class added to outermost clueTip div in the form of 'cluetip-' + clueTipClass.
hoverClass: '', // class applied to the invoking element onmouseover and removed onmouseout
waitImage: true, // whether to show a "loading" img, which is set in jquery.cluetip.css
cursor: 'help',
arrows: false, // if true, displays arrow on appropriate side of clueTip
dropShadow: false, // set to false if you don't want the drop-shadow effect on the clueTip
dropShadowSteps: 6, // adjusts the size of the drop shadow
sticky: false, // keep visible until manually closed
mouseOutClose: false, // close when clueTip is moused out
activation: 'hover', // set to 'click' to force user to click to show clueTip
// set to 'focus' to show on focus of a form element and hide on blur
clickThrough: false, // if true, and activation is not 'click', then clicking on link will take user to the link's href,
// even if href and tipAttribute are equal
tracking: false, // if true, clueTip will track mouse movement (experimental)
delayedClose: 0, // close clueTip on a timed delay (experimental)
closePosition: 'top', // location of close text for sticky cluetips; can be 'top' or 'bottom' or 'title'
closeText: 'Close', // text (or HTML) to to be clicked to close sticky clueTips
truncate: 0, // number of characters to truncate clueTip's contents. if 0, no truncation occurs
// effect and speed for opening clueTips
fx: {
open: 'show', // can be 'show' or 'slideDown' or 'fadeIn'
openSpeed: ''
},
// settings for when hoverIntent plugin is used
hoverIntent: {
sensitivity: 3,
interval: 50,
timeout: 0
},
// short-circuit function to run just before clueTip is shown.
onActivate: function(e) {return true;},
// function to run just after clueTip is shown.
onShow: function(ct, ci){},
// function to run just after clueTip is hidden.
onHide: function(ct, ci){},
// whether to cache results of ajax request to avoid unnecessary hits to server
ajaxCache: true,
// process data retrieved via xhr before it's displayed
ajaxProcess: function(data) {
data = data.replace(/<(script|style|title)[^<]+<\/(script|style|title)>/gm, '').replace(/<(link|meta)[^>]+>/g,'');
return data;
},
// can pass in standard $.ajax() parameters. Callback functions, such as beforeSend,
// will be queued first within the default callbacks.
// The only exception is error, which overrides the default
ajaxSettings: {
// error: function(ct, ci) { /* override default error callback */ }
// beforeSend: function(ct, ci) { /* called first within default beforeSend callback }
dataType: 'html'
},
debug: false
};
/*
* Global defaults for clueTips. Apply to all calls to the clueTip plugin.
*
* @example $.cluetip.setup({
* insertionType: 'prependTo',
* insertionElement: '#container'
* });
*
* @property
* @name $.cluetip.setup
* @type Map
* @cat Plugins/tooltip
* @option String insertionType: Default is 'appendTo'. Determines the method to be used for inserting the clueTip into the DOM. Permitted values are 'appendTo', 'prependTo', 'insertBefore', and 'insertAfter'
* @option String insertionElement: Default is 'body'. Determines which element in the DOM the plugin will reference when inserting the clueTip.
*
*/
var insertionType = 'appendTo', insertionElement = 'body';
$.cluetip.setup = function(options) {
if (options && options.insertionType && (options.insertionType).match(/appendTo|prependTo|insertBefore|insertAfter/)) {
insertionType = options.insertionType;
}
if (options && options.insertionElement) {
insertionElement = options.insertionElement;
}
};
})(jQuery);

View File

@@ -1,86 +0,0 @@
/*
* jQuery gvChart plugin
* This plugin was created to simplify things when using Google Visualisation Charts.
* It still needs to be used with google script import tag, however now you can
* crate chart from your table.
* All examples you will find on http://www.ivellios.toron.pl/technikalia/demos/gvChart/
* @name jquery.gvChart-1.0.1.js
* @author Janusz Kamieński - http://www.ivellios.toron.pl/technikalia
* @version 1.0.1
* @date December 04, 2010
* @category jQuery plugin google charts
* @copyright (c) 2010 Janusz Kamieński (www.ivellios.toron.pl)
* @license CC Attribution Works 3.0 Poland - http://creativecommons.org/licenses/by/3.0/pl/deed.en_US
* @example Visit http://www.ivellios.toron.pl/technikalia/demos/gvChart/ for more informations about this jQuery plugin
*/
(function (jQuery){
jQuery.fn.gvChart = function(settings){
defaults={
hideTable: true,
chartType: 'AreaChart',
chartDivID: 'gvChartDiv',
gvSettings: null
};
var el = document.createElement('div');
jQuery(el).insertBefore(this);
gvChartCount++;
gvChartID = defaults.chartDivID+gvChartCount;
jQuery(el).attr('id',gvChartID);
jQuery(el).addClass('gvChart');
if(settings){
jQuery.extend(defaults,settings);
}
if(defaults.hideTable)
$(this).hide();
var data = new google.visualization.DataTable();
// add X label
data.addColumn('string','X labels');
var a = new Array();
var headers = $(this).find('thead').find('th');
var rows = $(this).find('tbody').find('tr');
rows.each(function(index){
data.addColumn('number',$(this).find('th').text());
});
data.addRows(headers.length-1);
headers.each(function(index){
if(index){
data.setCell(index-1, 0, $(this).text());
}
});
rows.each(function(index){
$(this).find('td').each(function(index2){
data.setCell(index2, index+1, parseFloat($(this).text()));
});
});
chartSettings = {
title : $(this).find('caption').text()
};
if(defaults.gvSettings){
jQuery.extend(chartSettings,defaults.gvSettings);
}
eval("var chart = new google.visualization."+defaults.chartType+"(document.getElementById('"+gvChartID+"'))");
chart.draw(data, chartSettings);
}
})(jQuery);
function gvChartInit(){
gvChartCount = 0;
google.load('visualization', '1', {packages: ['corechart']});
}

View File

@@ -1,138 +0,0 @@
(function ($) {
$.fn.nicoslider = function (options) {
var defaults = {
start: 0,
color: '#F6F2F1',
sliderHeight: false
};
var opts = $.extend({}, $.fn.nicoslider.defaults, defaults, options);
return this.each(function () {
new nicoslide(this, opts);
});
};
var nicoslide = function (slider, o) {
var $slider = $(slider);
$sliderWidth = $slider.parent().innerWidth();
$sliderCss = {
'width': $sliderWidth,
'background-color': o.color
};
$slider.css($sliderCss);
var ul = $slider.find("ul");
var ulWidth = 0;
var liHeight = 0;
$slider.find("li").each(function () {
ulWidth += $(this).width() + 5;
ulWidth += parseInt($(this).css("padding-left"));
ulWidth += parseInt($(this).css("padding-right"));
ulWidth += parseInt($(this).css("margin-left"));
ulWidth += parseInt($(this).css("margin-right"));
liHeight = Math.max(liHeight, $(this).outerHeight());
});
//5 % of slider width
$scrollWidth = Math.round(parseInt($sliderWidth) * parseFloat("0.05"));
//min 30 px;
if ($scrollWidth < 30) {
$scrollWidth = 30;
}
var $wrapperWidth = Math.round(parseInt($sliderWidth) - ( 2 * $scrollWidth ));
if (ulWidth > $wrapperWidth) {
ul.wrapAll("<div class='wrapper'></div>");
$wrapper = $slider.find(".wrapper");
$ulHeight = ul.height();
$wrapper.width($wrapperWidth);
$wrapper.height($ulHeight);
$wrapperCss = {
'overflow': 'hidden',
'float': 'left',
'position': 'relative'
};
$wrapper.css($wrapperCss);
ul.css('position', 'absolute');
ul.width(ulWidth);
$slider.prepend("<div class='scrollleft'></div>");
$slider.append("<div class='scrollright'></div>");
var rightScroll = $slider.find(".scrollright");
var leftScroll = $slider.find(".scrollleft");
rightScroll.append("<div class='rb'>&gt;</div>");
leftScroll.append("<div class='lb'>&lt;</div>");
$("div.rb").css('float', 'right');
rightCss = {
'width': $scrollWidth - ($wrapper.outerWidth(true) - $wrapper.innerWidth()),
'height': liHeight + 5,
'float': 'right',
'background-color': o.color,
'cursor': 'pointer',
' user-select': 'none'
};
leftCss = {
'width': $scrollWidth - ($wrapper.outerWidth(true) - $wrapper.innerWidth()),
'height': liHeight + 5,
'float': 'left',
'background-color': o.color,
'cursor': 'pointer',
' user-select': 'none'
};
leftScroll.css(leftCss);
rightScroll.css(rightCss);
var rightScrollWidth = rightScroll.width();
var leftScrollWidth = leftScroll.width();
var scrollXpos = 0;
var scrollStepSpeed = 40;
var speed = 8;
var shift = o.start;
//scroll a droite
rightScroll.bind("click", function (e) {
var x = e.pageX - ($(this).offset().left);
scrollXpos = Math.round((x / rightScrollWidth) * scrollStepSpeed);
shift += (scrollXpos * speed);
if (shift > (ulWidth - $wrapperWidth) + 50) {
shift = (ulWidth - $wrapperWidth) + 50;
}
ul.animate({
left: -shift
}, 1);
});
//scroll a gauche
leftScroll.bind("click", function (e) {
var x = $(this).innerWidth() - (e.pageX - $(this).offset().left);
scrollXpos = Math.round((x / leftScrollWidth) * scrollStepSpeed);
shift -= (scrollXpos * speed);
if (shift < 0) {
shift = 0;
}
ul.animate({
left: -shift
}, 1);
});
}
};
})(jQuery);

View File

@@ -1,75 +0,0 @@
// -----------------------------------------------------------------------
// Eros Fratini - eros@recoding.it
// jqprint 0.3
//
// - 19/06/2009 - some new implementations, added Opera support
// - 11/05/2009 - first sketch
//
// Printing plug-in for jQuery, evolution of jPrintArea: http://plugins.jquery.com/project/jPrintArea
// requires jQuery 1.3.x
//
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
//------------------------------------------------------------------------
(function($) {
var opt;
$.fn.jqprint = function (options) {
opt = $.extend({}, $.fn.jqprint.defaults, options);
var $element = (this instanceof jQuery) ? this : $(this), doc;
if (opt.operaSupport && $.browser.opera)
{
var tab = window.open("","jqPrint-preview");
tab.document.open();
doc = tab.document;
}
else
{
var $iframe = $("<iframe />");
if (!opt.debug) { $iframe.css({ position: "absolute", width: "0px", height: "0px", left: "-600px", top: "-600px" }); }
$iframe.appendTo("body");
doc = $iframe[0].contentWindow.document;
}
if (opt.importCSS)
{
if ($("link[media=print]").length > 0)
{
$("link[media=print]").each( function() {
doc.write("<link type='text/css' rel='stylesheet' href='" + $(this).attr("href") + "' media='print' />");
});
}
else
{
$("link").each( function() {
doc.write("<link type='text/css' rel='stylesheet' href='" + $(this).attr("href") + "' />");
});
}
}
if (opt.printContainer) { doc.write($element.outer()); }
else { $element.each( function() { doc.write($(this).html()); }); }
doc.close();
(opt.operaSupport && $.browser.opera ? tab : $iframe[0].contentWindow).focus();
setTimeout( function() { (opt.operaSupport && $.browser.opera ? tab : $iframe[0].contentWindow).print(); if (tab) { tab.close(); } }, 1000);
};
$.fn.jqprint.defaults = {
debug: false,
importCSS: true,
printContainer: true,
operaSupport: true
};
// Thanks to 9__, found at http://users.livejournal.com/9__/380664.html
jQuery.fn.outer = function() {
return $($('<div></div>').html(this.clone())).html();
};
})(jQuery);

File diff suppressed because it is too large Load Diff

View File

@@ -1,51 +0,0 @@
/* global */
#cluetip-close img {
border: 0;
}
#cluetip-title {
overflow: hidden;
}
#cluetip-title #cluetip-close {
float: right;
position: relative;
}
#cluetip-waitimage {
width: 43px;
height: 11px;
position: absolute;
background-image: url(images/wait.gif); //@TODO fix url
}
.cluetip-arrows {
display: none;
position: absolute;
top: 0;
left: -11px;
height: 22px;
width: 11px;
background-repeat: no-repeat;
background-position: 0 0;
}
#cluetip-extra {
display: none;
}
/* stupid IE6 HasLayout hack */
.cluetip-rounded #cluetip-title,
.cluetip-rounded #cluetip-inner {
zoom: 1;
}
#cluetip{
background-color: #333;
border: 1px solid #333;
}
#cluetip table{
border: 1px solid #333;
border-collapse:collapse;
}
#cluetip thead th, #cluetip tfoot{
background-color:white;
color:white;
}

View File

@@ -1,531 +0,0 @@
.clearLeft {
clear: left;
}
#chart_detail {
cursor: pointer;
}
.form_csv {
width: 15px;
height: 16px;
margin-left: 10px;
margin-left: 5px;
}
/*hack tout sauf ie 6-7-8*/
:root * > .form_csv {
margin-top: 6px;
}
.lt-ie9 .form_csv {
margin-top: -8px;
}
.lt-ie9 th {
height: 50px;
}
#query {
background: #555;
border: none;
color: #F3852B;
}
.form label {
display: inline-block;
vertical-align: baseline;
color: #FFF;
}
form.report_form input[type=text] {
width: 40px;
}
.form_csv input[name=submit] {
background: url('#{$reportImagesPath}csv.gif') top right no-repeat;
width: 15px;
height: 16px;
cursor: pointer;
border: 0;
}
.left {
float: left;
}
iframe {
border: none;
}
.columnjson_title {
color: #555555;
font-weight: bolder;
}
.report_form fieldset {
margin: 0;
padding: 0;
}
.curfilter {
font-size: 12px;
color: #333;
}
.curfilter em {
font-size: 16px;
color: #333;
}
.columnjson_link_box {
margin: 2px;
width: 100px;
float: left;
}
.columnjson_link {
color: black;
margin: 2px;
font-size: 10px;
text-decoration: none;
}
.no_results {
margin-top: 50px;
}
.horizontal-scroller {
position: relative;
top: 0;
left: 0;
}
#mainTabs {
border: none;
}
.answers {
background-color: $reportBackgroundColor;
}
.report-table tr.odd {
background-color: #CDCDCD;
}
.report-table tr.even {
background-color: #FFF;
}
.imgdash {
margin-bottom: 20px;
}
#holder {
height: 250px;
width: 800px;
}
#title_dash {
float: left;
font-size: 18px;
color: $reportBackgroundColor;
}
#periode_dash {
float: right;
font-size: 18px;
color: #FF9000;
font-weight: bolder;
}
#liste_dash {
clear: both;
width: 100%;
border-top: 2px solid #212121;
font-weight: lighter;
font-size: x-small;
font-style: italic;
padding-top: 10px;
padding-bottom: 10px;
color: white;
}
.report-table {
padding: 0 auto;
clear: both;
margin-bottom: 10px;
overflow: auto;
}
.report-table table {
border-collapse: collapse;
border-color: white;
font-family: "Trebuchet MS", "Lucida Sans Unicode", verdana, lucida, helvetica, sans-serif;
font-size: 0.8em;
margin: 0 auto;
width: 100%;
padding-top: 2px;
}
.orderby:hover {
cursor: pointer;
}
.report-table caption {
font-size: x-large;
font-weight: 900;
padding: 2px;
text-align: left;
background-color: $reportBackgroundColor;
color: #202020;
border-bottom: 1px solid #9C9B99;
border-top: 1px solid #9C9B99;
}
.report-table th {
border: 1px solid white;
text-align: center;
font-weight: bolder;
}
.report-table td {
border: 1px solid white;
vertical-align: 4px;
text-align: center;
color: #202020;
min-width: 50px;
width: auto;
white-space: nowrap;
}
.report-table thead th {
text-align: center;
font-weight: bolder;
font-size: small;
border-bottom: 3px solid $reportBackgroundColor;
border-top: 3px solid $reportBackgroundColor;
background-color: #FF9000;
min-width: 50px;
width: auto;
white-space: nowrap;
}
.report-table tfoot td {
background-color: #FF9000;
}
.report-table tbody a {
color: #333;
}
.report-table tbody a:hover {
color: white;
}
.report-table tr:hover {
background-color: #FF9000;
}
.report-table tbody td a {
padding-right: 12px;
}
.report-table tfoot {
background-color: FF9000;
border: 1px solid #505050;
}
#dash .answers {
background-color: #555555;
min-height: 400px;
}
.spacer {
clear: both;
}
div.left {
float: left;
padding-left: 10px;
}
div.right {
float: right;
padding-right: 10px;
}
.jqprint {
margin-left: 10px;
}
.config {
margin-left: 10px;
}
.center {
margin: 0 auto;
text-align: center;
}
table.center {
margin: 0 auto;
text-align: center;
}
.current_filter {
color: #708090;
width: 100%;
clear: left;
text-align: center;
font-size: 12px;
font-style: italic;
padding-left: 45px;
padding-right: 45px;
}
.floatleft {
float: left;
padding: 20px 5px 20px 5px;
}
.leftControl {
float: left;
margin-right: 5px;
margin-top: 10px;
cursor: pointer;
}
.rightControl {
float: left;
margin-left: 5px;
margin-top: 10px;
cursor: pointer;
}
#dashboard.loading {
background: url('#{$reportImagesPath}dash-ajax-loader.gif') #696969 no-repeat center center;
}
#dashboard-table table {
font: normal 76%/150% "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
border: none;
color: #000;
width: 400px;
}
#dashboard-table caption {
font-size: medium;
text-align: center;
font-weight: bolder;
color: #FF9000;
padding: 3px;
border-top: 1px solid white;
}
#dashboard-table table a {
color: #523A0B;
text-decoration: none;
border-bottom: 1px dotted;
}
#dashboard-table table a:visited {
color: #444;
font-weight: normal;
}
#dashboard-table table a:hover {
border-bottom-style: solid;
}
#dashboard-table thead th, thead td {
border-top: 5px solid #555555;
border-left: none;
border-bottom: none;
border-right: none;
background: #FF9000;
}
#dashboard-table thead th.grey {
background: #555555;
}
#dashboard-table tbody tr:hover td, tbody tr:hover th {
background-color: #FF9000;
}
#dashboard-table tbody th, td {
text-align: center;
vertical-align: top;
}
#dashboard-table tbody td {
background-color: white;
}
#dashboard-table tbody th {
font-weight: normal;
white-space: nowrap;
}
#dashboard-table tbody th a:link, tbody th a:visited {
font-weight: bold;
}
#dashboard-table tbody td, tbody th {
border: 1px solid #fff;
border-width: 1px 0;
}
#dashboard-table tfoot td {
color: white;
border-left: none;
border-right: none;
border-top: none;
}
#mainTabs fieldset {
width: 400px;
}
#title_dash {
font-weight: bold;
font-size: x-large;
}
#dashboard-table {
padding-top: 30px;
}
.form_titre {
padding: 10px 5px;
font-size: 15px;
text-align: left;
color: $reportBackgroundColor;
font-weight: bold;
// border-bottom: 1px solid #323232;
margin: 0;
}
/*
.form1 {
float: left;
width: 140px;
padding: 3px;
border-right: 1px groove #454545;
}
.form2 {
float: left;
width: 400px;
padding: 3px;
border-right: 1px groove #454545;
}
.form3 {
float: left;
width: 420px;
padding: 3px;
}
*/
input {
font-family: Verdana, sans-serif;
padding: 2px;
border: 1px solid #555555;
}
table.tablesorter tr th {
background-image: url('#{$sharedIconPath}bg.gif');
background-repeat: no-repeat;
background-position: center right;
cursor: pointer;
background-color: #777777
}
table.tablesorter tr th.SortUp {
background-image: url('#{$sharedIconPath}desc.gif');
}
table.tablesorter tr th.hover {
background-color: #376974;
}
table.tablesorter tr th.active {
background-color: #61bcd0;
}
table.tablesorter tr th.SortDown {
background-image: url('#{$sharedIconPath}asc.gif');
}
#mainContainer {
background-color: #212121;
}
#form {
height: 150px;
}
.answers {
overflow-y: auto;
overflow-x: hidden;
clear: left;
}
#form-container {
width: 1000px;
margin: 0 auto;
background-color: transparent;
}
#navigation {
background-color: transparent;
border: none;
border-bottom: 1px solid black;
margin-top: 10px;
}
.content {
// margin: -1px 45px;
}
.onload {
background-image: url('#{$sharedIconPath}ajax-loader.gif');
background-position: center center;
background-repeat: no-repeat;
}
.ui-tabs, .ui-tabs .ui-tabs-panel {
padding: 0;
}
.ui-widget-overlay {
opacity: 0.7;
filter: alpha(opacity=40);
}
.aroundTable {
width: 900px;
overflow: auto;
}
.imgdash {
table {
margin: auto;
margin-top: 15px;
margin-bottom: 15px;
width: 100%;
}
td, th {
border: 1px solid #bbb;
background: #ddd;
text-align: center;
border-radius: 0.5px;
}
caption {
font-weight: bold;
}
}

View File

@@ -1,264 +0,0 @@
$reportBackgroundColor: #FFFFFF; //#F6F2F1;
html {
overflow-y: scroll;
}
#form-container {
background-color: white;
}
#mainmenu {
display: none;
}
#mainContainer {
background-color: white;
}
thead img {
display: none;
}
thead a {
display: none;
}
form {
display: none;
}
ul {
display: none;
}
.ui-tabs-nav {
display: none;
}
.config {
display: none;
}
.jqprint {
display: none;
}
.noprint {
display: none;
}
.ui-state-default {
display: none;
}
.ui-tabs-hide {
display: none;
}
.report-table table {
border-collapse: collapse;
border-color: white;
font-family: "Trebuchet MS", "Lucida Sans Unicode", verdana, lucida, helvetica, sans-serif;
font-size: 0.8em;
margin: 10px auto;
width: 100%;
padding-top: 10px;
}
.report-table caption {
font-size: x-large;
font-weight: 900;
padding: 5px, 5px, 2px, 5px;
text-align: left;
background-color: $reportBackgroundColor;
/*color:#9C9B99;*/
color: #202020;
border-bottom: 1px solid #9C9B99;
border-top: 1px solid #9C9B99;
}
#dash .answers {
background-color: #555555;
}
.spacer {
clear: both;
}
p.left {
float: left;
padding-left: 10px;
}
p.right {
float: right;
padding-right: 10px;
}
.report-table th {
border: 1px solid black;
text-align: center;
font-weight: bolder;
padding: 0px;
}
.report-table td {
border: 1px solid black;
vertical-align: 4px;
text-align: center;
color: #202020;
}
.report-table thead th {
text-align: center;
background-color: #FF9000;
font-weight: bolder;
font-size: small;
color: #202020;
border-bottom: 3px solid black;
border-top: 3px solid black;
}
.report-table tfoot td {
background-color: #FF9000;
}
.report-table tbody tr:hover td, tbody tr:hover th {
/*background-color: #FF9000;*/
}
.report-table tr.odd td, tr.odd th {
background-color: #ddd;
}
.report-table tbody a {
color: #333;
}
.report-table tbody a:visited {
color: #999999;
}
.report-table tbody a:hover {
color: #FF9000;
}
.report-table tbody a:active {
color: #33c;
}
.report-table tbody td + td + td + td a {
padding-right: 12px;
}
.report-table tfoot th, tfoot td {
text-align: center;
color: #222;
}
.report-table tfoot {
background-color: FF9000;
border: 1px solid #505050;
}
.center {
margin: 0 auto;
text-align: center;
}
table .center {
margin: 0 auto;
text-align: center;
}
#dashboard-table table {
font: normal 76%/150% "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
border-collapse: separate;
border-spacing: 0;
margin: 0 0 1em;
color: #000;
}
#dashboard-table table a {
color: #523A0B;
text-decoration: none;
border-bottom: 1px dotted;
}
#dashboard-table table a:visited {
color: #444;
font-weight: normal;
}
#dashboard-table table a:visited:after {
content: "\00A0\221A";
}
#dashboard-table table a:hover {
border-bottom-style: solid;
}
#dashboard-table thead th, thead td, tfoot th, tfoot td {
border: 1px solid #523A0B;
border-width: 1px 0;
background: #EBE5D9;
}
#dashboard-table th {
font-weight: bold;
line-height: normal;
padding: 0.25em 0.5em;
text-align: left;
}
#dashboard-table tbody th, td {
padding: 0.25em 0.5em;
text-align: left;
vertical-align: top;
}
#dashboard-table tbody th {
font-weight: normal;
white-space: nowrap;
}
#dashboard-table tbody th a:link, tbody th a:visited {
font-weight: bold;
}
#dashboard-table tbody td, tbody th {
border: 1px solid #fff;
border-width: 1px 0;
}
#title_dash {
font-weight: bold;
font-size: x-large;
}
#liste_dash {
font-weight: lighter;
font-size: x-small;
font-style: italic;
padding-bottom: 50px;
}
.img-dash {
float: left;
padding: 5px;
}
#dashboard-table {
clear: both;
width: 400px;
padding-top: 50px;
}
.answers {
clear: left;
}
#mainContainer {
background-color: #FF9000;
}

View File

@@ -3,10 +3,8 @@ $sharedIconPath: '../../../assets/common/images/icons/';
@import '../../vendors/jquery-contextmenu/styles/jquery.contextmenu';
@import '../../_shared/styles/jquery-ui/dark-hive';
$reportBackgroundColor: #FFFFFF; //#F6F2F1;
$reportBackgroundColor: #212121; //#F6F2F1;
$reportImagesPath: '../images/';
@import './tables';
@import './jquery-cluetip';
@import './jquery-ui/report-detailed';
$mainMenuBackgroundColor: #3b3b3b;
@@ -14,12 +12,332 @@ $mainMenuBottomBorder: none;
$mainMenuLinkColor: #b1b1b1;
$mainMenuLinkHoverColor: #FFFFFF;
$mainMenuLinkActiveColor: #FFFFFF;
$select-color: #000;
$select-background: #FFFFFF;
$select-width: 330px;
$select-height: 26px;
// $mainMenuMarginBottom: 30px;
@import '../../_shared/styles/main-menu';
#mainTabs {
background-color: #212121;
/* Report layout */
#mainContent {
background-color: $reportBackgroundColor;
}
.report_wrapper {
padding-bottom: 24px;
#form-container {
width: 860px;
margin: 0 auto;
padding-top: 10px;
.report_heading {
font-size: 30px;
color: #fff;
padding: 5px 0;
}
#mainTabs {
background-color: #565656;
padding: 0;
border: 0 none;
#navigation {
padding: 0;
.navigation_tab {
width: 33.3333%;
margin: 0;
border: 0 none;
border-radius: 0;
background: transparent;
overflow: hidden;
&:first-child a {
border-top-left-radius: 5px;
}
&:last-child a {
box-shadow: none;
border-top-right-radius: 6px;
}
a {
background: #565656;
font-size: 16px;
color: #cbcbcb;
text-align: center;
display: block;
float: none;
padding: 6px 16px;
box-shadow: inset -1px 0 0 #000;
&:hover {
background-color: #444444;
color: #f4f4f4;
}
&:focus {
outline: none !important;
}
}
}
.navigation_tab.ui-state-active {
z-index: 1;
a {
background: #bfbfbf;
color: #000;
box-shadow: 0 2px 4px 0 rgba(0,0,0,.5);
&:hover {
background-color: #bfbfbf;
color: #000;
}
}
}
}
.inside-container {
padding: 0;
form.form {
margin: 0;
}
.form_content.form2 .select-styled:after {
background-color: #666666;
}
.form_content {
position: relative;
padding: 16px 27px 10px;
.form_titre {
font-size: 22px;
padding-bottom: 20px;
}
.control-group {
display: inline-block;
margin-right: 24px;
margin-bottom: 6px;
label {
display: inline;
margin-right: 2px;
}
.input-prepend {
margin: 0;
.dmin, .dmax {
border: 0 none;
height: 16px;
border-radius: 0 6px 6px 0;
}
.add-on {
border: 0 none;
width: 16px;
height: 16px;
line-height: 16px;
border-radius: 6px 0 0 6px;
background: #727272 url('/assets/common/images/icons/calendar-white.png') no-repeat center/16px;
}
.add-on.disabled_image {
background-image: url('/assets/common/images/icons/calendar-grey.png');
background-color: #d8d8d8;
}
}
}
.collist {
.collist_buttons {
position: absolute;
right: 60px;
top: 20px;
button {
background: #3f3f3f;
border: 0 none;
color: #fff;
text-shadow: none;
height: 22px;
border-radius: 12px;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
min-width: 94px;
margin-left: 26px;
font-size: 11px;
font-weight: 500;
padding: 0 10px;
&:hover {
background: #ddd;
color: #000;
}
&:focus {
outline: none;
}
}
}
ul {
margin: 0;
li {
display: table;
}
}
.custom_checkbox_label {
position: relative;
margin-bottom: 0;
padding-bottom: 3px;
&:last-child {
padding-bottom: 0;
}
input {
opacity: 0;
cursor: pointer;
}
.custom_checkbox {
position: absolute;
top: 5px;
left: 0;
height: 11px;
width: 11px;
background: transparent url('/assets/common/images/icons/unchecked.png') no-repeat;
}
input:checked ~ .custom_checkbox {
background-image: url('/assets/common/images/icons/checked.png')
}
}
}
// custom select
.select-hidden {
display: none;
visibility: hidden;
padding-right: 10px;
}
.custom_select {
cursor: pointer;
display: inline-block;
position: relative;
font-size: 16px;
color: $select-color;
width: $select-width;
height: $select-height;
}
.select-styled {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
font-size: 14px;
line-height: 16px;
padding: 5px 10px;
background-color: $select-background;
border-radius: 5px;
transition: all 0.2s ease-in;
&:after {
content:"";
width: 26px;
height: 26px;
position: absolute;
top: 0;
right: -2px;
background: #404040 url(/assets/common/images/icons/double-arrow-white.png) no-repeat center/9px;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}
&:hover {
background-color: darken($select-background, 2);
}
&:active, &.active {
background-color: darken($select-background, 5);
}
}
.select-options {
display: none;
position: absolute;
top: 12px;
right: -12px;
left: 12px;
z-index: 9;
margin: 0;
padding: 0;
list-style: none;
background-color: darken($select-background, 5);
border-radius: 5px;
opacity: .93;
overflow: hidden;
li {
margin: 0;
line-height: 26px;
text-indent: 15px;
font-size: 14px;
border-top: 1px solid darken($select-background, 10);
transition: all 0.15s ease-in;
&:first-child {
border: 0 none;
}
&:hover {
color: $select-background;
background: #5b5b5b;
}
&[rel="hide"] {
display: none;
}
}
}
// custom select end
}
.form_content.form1 {
background-color: #343434;
}
.form_submit {
position: relative;
height: 90px;
background-color: #b5b5b5;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
button {
position: relative;
top: 50%;
left: 50%;
font-size: 15px;
color: #fff;
padding: 5px 62px;
display: block;
background-color: #4f4f4f;
border: 0 none;
border-radius: 15px;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.3);
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
&:hover {
background-color: #2c2c2c;
}
}
button.disabled {
background: #656565;
cursor: default;
&:hover {
background: #656565;
}
}
}
}
#report-connections {
.form2 {
background-color: #414141;
}
.form3 {
background-color: #6b6b6b;
}
}
#report-downloads {
.form_content:nth-child(2) {
background-color: #414141;
}
.form_content:nth-child(3) {
background-color: #4f4f4f;
}
.form3 {
background-color: #6b6b6b;
}
}
#report-records {
.form_content:nth-child(3) {
background-color: #4f4f4f;
}
.form_content:nth-child(2) {
background-color: #414141;
}
.form3 {
background-color: #5c5c5c;
}
}
}
}
}
#report-activite,

View File

@@ -1,25 +0,0 @@
{%block dashboard_content %}
<div id="title_dash" class="center" style="clear:left;">{{ "report:: Dashboard" | trans }}</div>
<div id="periode_dash" class="center" >{{ dashboard.getTitleDate('dmin') }} - {{ dashboard.getTitleDate('dmax') }}</div>
<div id="liste_dash" class="center">
<em id="em_all" class="selected_em" >Toutes les bases</em>
{% for key in dashboard.authorizedCollection|keys %}
<em id="em_{{ key }}" >{{ key|sbas_labels(app) }}</em>
{% endfor %}
</div>
<div id="dashboard-table" >
<div class ="center" style="width:820px;">
<div id='currentDashboard'>
{% block currentDashboard %}
{% endblock currentDashboard %}
</div>
</div>
</div>
<script type="text/javascript">
$("#liste_dash").find("em").removeClass("selected_em");
$("#em_{{dashboard.sbasid}}").addClass("selected_em");
</script>
{% endblock %}

View File

@@ -1,84 +0,0 @@
{% extends "report/ajax_dashboard_content.html.twig" %}
{% import "report/dashboard_macro.html.twig" as dash %}
{% block currentDashboard %}
{% set item = dashboard.dashboard %}
{% if "activity"|key_exists(item) %}
{% set title1 = "report:: activite par heure" | trans %}
{% set title2 = "report:: Connexion" | trans %}
{{ dash.table_activity("mytablehour", title1, title2, item.activity)}}
{% endif %}
{% if "activity_day"|key_exists(item) %}
{% set title1 = "report:: activite par jour" | trans %}
{% set title2 = "report:: Connexion" | trans %}
{{dash.table_activity("mytabledaytotal", title1, title2, item.activity_day)}}
{%endif%}
{% if "activity_added"|key_exists(item) %}
{% set title1 = "report:: activite document ajoute" | trans %}
{{ dash.table_activity("mytableadded", title1 , "", item.activity_added)}}
{%endif %}
{% if "activity_edited"|key_exists(item) %}
{% set title1 = "report:: activite document edite" | trans %}
{{ dash.table_activity("mytableedited", title1 , "", item.activity_edited)}}
{% endif %}
{% if "nb_conn"|key_exists(item) and "nb_dl"|key_exists(item)%}
{% set title1 = "report:: Cumul telechargements & connexions" | trans %}
{% set title2 = "report:: telechargements" | trans %}
{% set title3 = "report::Connexion" | trans %}
{{ dash.connexion_download(title1, title2, title3, item.nb_dl, item.nb_conn, dashboard.getTitleDate('dmin'),dashboard.getTitleDate('dmax'))}}
{% endif %}
{% if "top_ten_user_doc"|key_exists(item)%}
{% set title1 = "report:: Utilisateurs les plus actifs" | trans %}
{% set title2 = "report:: utilisateurs" | trans %}
{% set title3 = "report:: telechargements document" | trans %}
{{ dash.table(title1~"("~ title3~")", title2, title3, item.top_ten_user_doc, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "false") }}
{% endif %}
{% if "top_ten_user_prev"|key_exists(item) %}
{% set title1 = "report:: Utilisateurs les plus actifs" | trans %}
{% set title2 = "report:: utilisateurs" | trans %}
{% set title3 = "report:: telechargements preview" | trans %}
{{ dash.table(title1~"("~ title3~")", title2, title3, item.top_ten_user_prev, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "false") }}
{%endif %}
{% if "top_ten_user_poiddoc"|key_exists(item) %}
{% set title1 = "report:: Utilisateurs les plus actifs" | trans %}
{% set title2 = "report:: utilisateurs" | trans %}
{% set title3 = "report:: poids document" | trans %}
{{ dash.table(title1~"("~ title3~")", title2, title3, item.top_ten_user_poiddoc, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "true", "false") }}
{%endif %}
{% if "top_ten_user_poidprev"|key_exists(item) %}
{% set title1 = "report:: Utilisateurs les plus actifs" | trans %}
{% set title2 = "report:: utilisateurs" | trans %}
{% set title3 = "report:: poids preview" | trans %}
{{ dash.table(title1~"("~ title3~")", title2, title3, item.top_ten_user_poidprev, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "true", "false") }}
{%endif %}
{% if "top_dl_doc"|key_exists(item) %}
{% set title1 = "report:: documents les plus telecharges" | trans %}
{% set title2 = "report:: document" | trans %}
{% set title3 = "report:: telechargements" | trans %}
{{ dash.table(title1, title2, title3, item.top_dl_doc, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "true") }}
{%endif %}
{% if "top_dl_preview"|key_exists(item) %}
{% set title1 = "report:: preview les plus telecharges" | trans %}
{% set title2 = "report:: preview" | trans %}
{% set title3 = "report:: telechargements" | trans %}
{{ dash.table(title1, title2, title3, item.top_dl_preview, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "true") }}
{%endif %}
{% if "ask"|key_exists(item) %}
{% set title1 = "report:: Les questions les plus posees" | trans %}
{% set title2 = "report:: utilisateurs" | trans %}
{% set title3 = "report:: question" | trans %}
{{ dash.table(title1, title2, title3, item.ask, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "false") }}
{%endif %}
{% if "top_ten_question"|key_exists(item) %}
{% set title1 = "report:: question" | trans %}
{% set title2 = "report:: poids preview" | trans %}
{{dash.top_ten_question(app['phraseanet.registry'].get('GV_homeTitle'), title1, title2, item.top_ten_question,dashboard.getTitleDate('dmin') , dashboard.getTitleDate('dmax')) }}
{%endif %}
{% if "top_ten_site"|key_exists(item) %}
{% set title1 = "report:: site d\'ou les photo sont les plus consultees" | trans %}
{% set title2 = "report:: site" | trans %}
{% set title3 = "report:: nombre de vue" | trans %}
{{ dash.table(title1, title2, title3, item.top_ten_site, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "false") }}
{%endif %}
{%endblock currentDashboard %}

View File

@@ -1,124 +0,0 @@
{% block ajax_data_content %}
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
$("input[type=button]").button();
$('a.jqprint').unbind('click').bind('click', function(){
$(this).closest('.report-table').jqprint();
return( false );
});
/*$(document).ready(function(){
//set slider position
if(!jQuery.support.boxModel)
{
$(".horizontal-scroller:visible").css("position", "absolute");
}
else
{
$(".horizontal-scroller:visible").css("position", "fixed");
}
});*/
</script>
{% if is_infouser %}
<script type="text/javascript">
$('#dialog .bound').each( function () {
var riid = $(this).html();
var new_a = $(this).html('<img style="float:right;margin-right:5px;" src="/assets/report/images/loupe2.png" />');
$(this).before(riid);
$(this).attr('rel', '{{ path('report_infomations_document') }}').cluetip({
width: 600,
ajaxCache: true,
arrows: true,
ajaxSettings : {
type : 'POST',
dataType: 'json',
data : ({
rid : riid,
sbasid : '{{ app['request'].get('sbasid') }}',
collection : '{{ app['request'].get('collection') }}',
dmin : '{{ app['request'].get('dmin') }}',
dmax : '{{ app['request'].get('dmax') }}',
from : 'TOOL'
})
},
ajaxProcess : function (data) {
return data.rs;
}
});
});
</script>
{% endif %}
{% if is_plot %}
<script type="text/javascript">
$("table:visible:first thead tr").prepend("<th>{{ 'report::Heures' | trans }}</th>");
$("table:visible:first tbody tr:first").prepend("<th>{{ 'report:: Connexion' | trans }}</th>");
$colspan = $("table:visible:first tfoot tr:first td").attr("colspan");
$colspan++;
$("table:visible:first tfoot tr:first td").attr("colspan", $colspan);
</script>
{% endif %}
{% if is_nav %}
{% for key, result in result %}
{% set index = key %}
<div class="graph">
{% include "report/generate_tab.html.twig" %}
<table class="navi">
<caption></caption>
<thead>
<th></th>
{% if result.legend|length > 1 %}
{% for key, value in result.legend %}
<th>{{ value }}</th>
{% endfor %}
{% endif %}
</thead>
<tbody>
<tr>
<th></th>
{% if result.value|length > 1 %}
{% for key, value in result.value %}
<td>{{ value }}</td>
{% endfor %}
{% endif %}
</tr>
</tbody>
</table>
</div>
{% endfor %}
{% elseif is_plot %}
{% include "report/generate_tab.html.twig" %}
<table class="tblsite" style="visibility:hidden;">
<caption></caption>
<thead>
<th></th>
{% if result.legend|length > 1 %}
{% for key, value in result.legend %}
<th>{{ value }}</th>
{% endfor %}
{% endif %}
</thead>
<tbody>
<tr>
<th>{{ "report:: Connexion" | trans }}</th>
{% if result.result.0|length > 1 %}
{% for key, value in result.result.0 %}
<td>{{ value }}</td>
{% endfor %}
{% endif %}
</tr>
</tbody>
</table>
<script type="text/javascript">
</script>
{% else %}
{% include "report/generate_tab.html.twig" %}
{% endif %}
{% endblock %}

View File

@@ -1,66 +0,0 @@
{% block ajax_loaded_content %}
<div class="tabs">
<div class="horizontal-scroller">
<ul class="tabb">
{% for key in selection|keys %}
<li class ="number_{{ key }}"><a href="#tab-{{ key }}-{{ app['request'].get('tbl') }}">{{ key|sbas_labels(app)}}</a></li>
{% endfor %}
</ul>
</div>
{% for key, value in selection %}
<div id="tab-{{ key }}-{{ app['request'].get('tbl') }}">
<div class="load">
{% block ajax_data_content %}{% endblock %}
</div>
<form style="display:none;" onsubmit="return false;" class="report_form">
<fieldset style="float:left; border:none;">
<label for="page" style="font-size:10px;float:left;margin-left:35px;"><i></i></label>
<div style="clear:left;">
<input type="button" name="prev" value ="&lt;" class="prev ui-state-hover"/>
<input type="text" name="page" value="1" size ="2" class="enterformsubmiter"/>
<input type="button" name="next" value ="&gt;" class="next ui-state-hover"/>
</div>
</fieldset>
<fieldset style="float:right;border:none;text-align:right;">
<div style="clear:right;">
<label for="limit" style="font-size:10px"><i>nombre de ligne(s) par page</i></label>
<input type="text" name="limit" value="30" size="2" class="enterformsubmiter"/>
<input type="button" name="go" value ="ok" class="submiter" />
</div>
</fieldset>
<input type="hidden" name="tbl" value ="{{ app['request'].get('tbl') }}"/>
<input type="hidden" name="action" value ="{{ app['request'].get('action') }}"/>
<input type="hidden" name="dmin" value ="{{ dmin }}"/>
<input type="hidden" name="dmax" value ="{{ dmax }}"/>
<input type="hidden" name="sbasid" value ="{{ key }}"/>
<input type="hidden" name="collection" value ="{{ value.liste }}"/>
<input type="hidden" name="user" value =""/>
<input type="hidden" name="word" value ="{{ app['request'].get('tbl') == 'DOC' ? app['request'].get('preciseWord') : '' }}"/>
<input type="hidden" name="precise" value ="{{ app['request'].get('tbl') == 'DOC' ? app['request'].get('precise') : '' }}"/>
<input type="hidden" name="order" value =""/>
<input type="hidden" name="champ" value =""/>
<input type="hidden" name="rid" value =""/>
<input type="hidden" name="filter_column" value =""/>
<input type="hidden" name="filter_value" value =""/>
<input type="hidden" name="liste" value ="off"/>
<input type="hidden" name="liste_filter" value =""/>
<input type="hidden" name="conf" value ="off"/>
<input type="hidden" name="list_column" value =""/>
<input type="hidden" name="groupby" value =""/>
<input type="hidden" name="societe" value =""/>
<input type="hidden" name="pays" value =""/>
<input type="hidden" name="fonction" value =""/>
<input type="hidden" name="activite" value =""/>
{% if anonymous %}
<input type="hidden" name="on" value ="{{ app['request'].get('on') }}"/>
{% else %}
<input type="hidden" name="on" value =""/>
{% endif %}
<input type="hidden" name="docwhat" value ="{{ app['request'].get('tbl') == 'WDOC' ? app['request'].get('docwhat') : '' }}"/>
<input type="hidden" name="from" value =""/>
<input type="hidden" name="printcsv" value ="off"/>
</form>
</div>
{% endfor %}
</div>
{% endblock %}

View File

@@ -1,28 +0,0 @@
{% block alldash %}
<div style="margin-top:15px;">
<div style="float:left;">
<label for="dmin">{{ "report:: Du (date)" | trans }}</label>
<input class= "dminDash" name="dmin" type="text" value="{{ dashboard_array.date.date.dmin}}" size="10" />
</div>
<div style="float:left;">
<label for="dmax">{{ "report:: Au (date)" | trans }}</label>
<input class="dmaxDash" name="dmax" type="text" value="{{dashboard_array.date.date.dmax}}" size="10" />
</div>
</div>
<div id="chooose" style="float:left;">
<select name="nameDash">
<option value="all" checked = 'checked'>Global</option>
{% for it in dashboard_array.authorizedCollection %}
<option value="{{it.sbas_id}}" >{{ it.name }}</option>
{% endfor %}
</select>
</div>
<div id="title_dash" class="center" style="clear:left;">{{ "report:: Dashboard" | trans }}</div>
<div id="periode_dash" class="center" >{{ dashboard_array.date.title.dmin }} - {{ dashboard_array.date.title.dmax }}</div>
<div id="liste_dash" class="center">{{ dashboard_array.listeStringBase }}</div>
<div id="dashboard-table" >
{%block dashboard_content %}{% endblock %}
</div>
{% endblock %}

View File

@@ -2,7 +2,6 @@
{% block stylesheet %}
<link type="text/css" rel="stylesheet" href="/assets/report/css/report{% if not app.debug %}.min{% endif %}.css" media="screen">
<link type="text/css" rel="stylesheet" href="/assets/report/css/print{% if not app.debug %}.min{% endif %}.css" media="print">
{% endblock stylesheet %}
{% block icon %}
@@ -39,9 +38,6 @@
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="/assets/common/js/common{% if not app.debug %}.min{% endif %}.js"></script>
<script type="text/javascript" src="/assets/report/js/report{% if not app.debug %}.min{% endif %}.js"></script>
<script type="text/javascript">
gvChartInit();
</script>
{% endblock javascript%}

View File

@@ -1,30 +0,0 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="{{ app['locale'] }}"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="{{ app['locale'] }}"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="{{ app['locale'] }}"> <![endif]-->
<!--[if gt IE 8]>
<!-->
<html lang="{{ app['locale'] }}">
<!--<![endif]-->
<head>
{% block head %}
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="user-scalable=no, width=980px" />
<title>{% block title %}{% endblock %} - Reports </title>
{% block stylesheet %}{% endblock %}
{% block icon %}{% endblock %}
{% block javascript %}{% endblock %}
{% endblock %}
</head>
<body style="overflow:hidden;">
<div id="mainContainer" style="position:absolute;top:0;bottom:0;left:0;right:0;">
{% block menubar %}<div id="mainMenu" class="PNB"></div>{% endblock %}
<div id="form-container" >
<div id="mainTabs">
{% block all_content %}{% endblock %}
</div>
</div>
{% block javascript_google %}{% endblock %}
</div>
</body>
</html>

View File

@@ -1,57 +0,0 @@
{% block draw_activity_day %}
{% if ajax_chart %}
{% if rs|length > 0 %}
<div class="aroundTable">
<table class="center imgdash" id="mytableday">
<caption>{{ "report:: activite par jour" | trans }}</caption>
<thead>
<tr>
<th></th>
{% for key, value in legendDay %}
<th>{{ value }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
<tr>
<th>{{ "report:: Connexion" | trans }} {{ sbas_id|sbas_labels(app) }}</th>
{% for key, value in rs %}
<td>{{ value }}</td>
{% endfor %}
</tr>
</tbody>
</table>
</div>
{% endif %}
{% else %}
{% if dashboard_array.dashboard.activity_day|length > 0 %}
<div class="aroundTable">
<table class="center imgdash" id="mytableday">
<caption>{{ "report:: activite par jour" | trans }}</caption>
<thead>
<tr>
<th></th>
{% for key, value in dashboard_array.legendDay %}
<th>{{ value }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for key, value in dashboard_array.dashboard.activity_day %}
{% if loop.index == 1 %}
<tr>
<th>{{ "report:: Connexion" | trans }} {{ key|sbas_labels(app)}}</th>
{% if value|length > 0 %}
{% for k, v in value %}
<td>{{ v }}</td>
{% endfor %}
{% endif %}
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% endif %}
{% endblock %}

View File

@@ -1,20 +0,0 @@
{% block colFilter %}
<form>
<fieldset>
<select name='filtre'>
<option value="{{ field }}">{{ "report:: Enlever le filtre" | trans }}</option>
{% for value in result %}
<option value="{{ value.value }}">
{% if value.val == "" %}
{{ "report:: non-renseigne" | trans }}
{% else %}
{{ value.val }}
{% endif %}
</option>
{% else %}
<option value="">{{ "report:: non-renseigne" | trans }}</option>
{%endfor %}
</select>
</fieldset>
</form>
{% endblock %}

View File

@@ -1,114 +0,0 @@
{% macro table(title, titleLeft, titleRight, object, dmin, dmax, unite, sbasid) %}
{% if object|length > 0 %}
<table style="margin:0 auto; margin-bottom:30px;">
<caption>{{ title }}</caption>
<thead>
<tr>
<th>{{ titleLeft }}</th>
<th>{{ titleRight }}</th>
</tr>
</thead>
<tbody>
{% for key, value in object %}
<tr>
{% if value.id == "false" %}
<td>{{ value.lib|e }}</td>
{% else %}
{% if sbasid == "true" %}
<td><a href="#" id= "id_{{ value.id }}_{{ value.sbasid }}" class ="hasSbas">{{ value.lib|e }}</a></td>
{% else %}
<td><a href="#" id= "id_{{ value.id }}" >{{ value.lib|e }}</a></td>
{% endif %}
{% endif %}
<td>{{ unite == "true" ? value.nb | formatOctets : value.nb }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<td colspan='2'>{{ dmin }} - {{ dmax }}</td>
</tr>
</tfoot>
</table>
{% endif %}
{% endmacro %}
{% macro top_ten_question(home_title, title_left, title_right, item, dmin, dmax)%}
{% if item|length > 0 %}
<table style="margin:0 auto; margin-bottom:30px;">
<caption>{% trans with {'%home_title%' : home_title} %}report:: Volumetrie des questions posees sur %home_title%{% endtrans %}</caption>
<thead>
<tr>
<th>{{ title_left }}</th>
<th>{{ title_right }}</th>
</tr>
</thead>
<tbody>
{% for key, value in item %}
<tr>
<td>{{ value.lib|e }}</td>
<td>{{ value.nb }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<td colspan='2'>{{ dmin }} - {{ dmax }}</td>
</tr>
</tfoot>
</table>
{%endif%}
{% endmacro %}
{% macro connexion_download(title, title_left, title_right, itemco, itemdl, dmin, dmax ) %}
<table style="margin:0 auto; margin-bottom:30px;">
<caption>{{ title }}</caption>
<thead>
<tr>
<th>{{ title_left }}</th>
<th>{{ title_right }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ itemco }}</td>
<td>{{ itemdl }}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan='2'>{{ dmin }} - {{ dmax }}</td>
</tr>
</tfoot>
</table>
{% endmacro %}
{% macro table_activity( id, title, title_abscisse, item) %}
{% if item|length > 0 %}
<table border='1' class="center imgdash" id = "{{id}}">
<caption>{{ title }}</caption>
<thead>
<tr>
<th></th>
{% for key in item|keys %}
<th>{{ key }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
<tr>
<th>
{% if title_abscisse|length > 0 %}
{{ title_abscisse }}
{% endif %}
</th>
{% for value in item %}
<td>{{ value }}</td>
{% endfor %}
</tr>
</tbody>
</table>
{% endif %}
{% endmacro %}

View File

@@ -1,49 +1,67 @@
{% block form_date_and_base %}
<div class="form1 span3">
<div class="form1 form_content">
<div class="form_titre">{{ "report:: 1 - Periode" | trans }}</div>
<div class="control-group">
<label for="dmin">{{ "report:: Du (date)" | trans }}</label>
<div class="controls" style="display:inline-block">
<input class= "dmin" name="dmin" type="text" value="{{ "-1 month"|date("Y-m-d") }}" size="10" style='width:100px'/>
<div class="input-prepend">
<span class="add-on"></span>
<input class="dmin" name="dmin" type="text"
value="{{ "-1 month"|date("Y-m-d") }}" size="10"
placeholder="{{ "YYYY-MM-DD" | trans }}"
/>
</div>
</div>
<div class="control-group">
<label for="dmax">{{ "report:: Au (date)" | trans }}</label>
<div class="controls" style="display:inline-block">
<input class="dmax" name="dmax" type="text" value="{{ "now"|date("Y-m-d") }}" size="10" style='width:100px'/>
<label for="dmax">{{ "report:: Au (date)" | trans }}</label>
<div class="input-prepend">
<span class="add-on"></span>
<input class="dmax" name="dmax" type="text"
value="{{ "now"|date("Y-m-d") }}" size="10"
placeholder="{{ "YYYY-MM-DD" | trans }}"
/>
</div>
</div>
</div>
<div class="form2 span5">
<div class="form_titre">{{ "report:: 2 - Bases" | trans }}</div>
<div id="select_one">
<ul class="multiselect" style="max-height: 150px; overflow-y: auto; overflow-x: hidden;">
<li>
<a href="javascript:void(0);" class="select-all btn btn-mini">
{% trans %}Select all{% endtrans %}
</a>
<a href="javascript:void(0);" class="deselect-all btn btn-mini">
{% trans %}Deselect all{% endtrans %}
</a>
</li>
{% for sbas_id,databox in granted_bases %}
<li><label data-group-id="{{ loop.index }}" class="multiselect-group"><b>{{ databox.name }}</b></label></li>
{% for collection in databox.collections %}
<li >
<a href="javascript:void(0);">
<label class="checkbox">
<input name="popbases[]" checked="checked" type="checkbox" class="coll-checkbox checkbox-{{ loop.parent.loop.index }}" value="{{ sbas_id }}_{{ collection.id }}">
{{ collection.name }}
</label>
</a>
<div class="form2 form_content">
<div class="form_titre">{{ "report:: 2 - Base" | trans }}</div>
<select class="select_one sbas_select" name="sbas">
{% for sbas_id,databox in granted_bases %}
<option
value="{{ sbas_id }}"
data-action="{{ path(route, {'sbasId': sbas_id}) }}"
>{{ databox.name }}</option>
{% endfor %}
</select>
</div>
<div class="form2 form_content">
{% if displayCollections == true %}
<div class="form_titre">
{{ "report:: 3 - Collections" | trans }}
</div>
{% for sbas_id,databox in granted_bases %}
<div class="collist collist-{{ sbas_id }}">
<div class="collist_buttons">
<button class="select-all btn btn-mini" data-target_selector="#chkcol-{{ tab }}-{{ sbas_id }} input:checkbox">
{% trans %}Select all{% endtrans %}
</button>
<button class="unselect-all btn btn-mini" data-target_selector="#chkcol-{{ tab }}-{{ sbas_id }} input:checkbox">
{% trans %}Deselect all{% endtrans %}
</button>
</div>
<ul id="chkcol-{{ tab }}-{{ sbas_id }}" style="max-height: 150px; overflow-y: auto; overflow-x: hidden;">
{% for collection in databox.collections %}
<li>
<label class="checkbox custom_checkbox_label">
<input name="base[]" checked="checked" type="checkbox" value="{{ collection.base_id }}">
<span class="custom_checkbox"></span>
{{ collection.name }}
</label>
</li>
{% endfor %}
{% endfor %}
</ul>
</div>
{% endfor %}
</ul>
</div>
{% endfor %}
{% endif %}
</div>
{% endblock form_date_and_base %}

View File

@@ -1,117 +0,0 @@
{% if result.result|length > 0 %}
<div class="report-table curfilter" style="color:#555555;">
{% if result.posting_filter|length > 0 %}
{% for filter in result.posting_filter %}
- <b>{{ filter.f }}</b> = <i>{{ filter.v }}</i> -
{% endfor %}
{% endif %}
</div>
<div class="report-table result-table" >
<table {% if is_plot %} class="plot" {% endif %} {% if is_nav %} class="{{index}}" {% endif %}>
<caption>
<div class="left titleleft">
<div class="title left">{{ result.title }}</div>
{% if result.config %}
<a href="#" class="config left"><img title="{{ 'report :: configurer le tableau' | trans }}" src="/assets/report/images/config.png"/></a>
{% endif %}
{% if result.print %}
<a href="#" class="jqprint left"><img title="{{ 'report :: imprimer le tableau' | trans }}" src="/assets/report/images/print.png"/></a>
{% endif %}
{% if result.csv %}
<a id="export_csv" class="left" href="#" style="display:inline-block; width: 20px;height:20px;margin-left: 10px;">
<img title="{{ 'CSV export' | trans }}" src="/assets/report/images/csv.gif">
</a>
{% endif %}
</div>
<div class="right">{{ result.periode }}</div>
<div style="clear:both;height:2px;"></div>
<div class="right" style="font-weight:lighter;font-size:10px;">
{% set total_count = result.total %}
{% if total_count > 0 and total_count != 0 %}
<i>
{% if total_count == 1 %}
{% trans %}1 result{% endtrans %}
{% else %}
{% trans with {'%total_count%' : total_count} %}%total_count% results{% endtrans %}
{% endif %}
</i>
{% endif %}
</div>
<div class="spacer"></div>
</caption>
<thead>
{% set colspan = "" %}
{% for key, value in result.display %}
<th class="{{ key }}" scope="col" >
{% if value.sort == 1 %}
<div class="orderby">
<img title="{{ "Trier" | trans }}" style="float:left;top:0;left:0;" class="asc" src="/assets/report/images/arrow_up.png" />
<img title="{{ "Trier" | trans }}" style="float:left;top:0;left:0;" class="desc" src="/assets/report/images/arrow_down.png" />
{% endif %}
<div class="title_th" style="clear:both;color:black;">{{ value.title }}</div>
{% if value.sort == 1 %}
</div>
{% endif %}
<div style="height:8px;">
{% if value.filter == 1 %}
<a href="#" title="{{ "Filtrer" | trans }}" style="float:left;bottom:0;left:0;font-size:8px;" class="{{ key }} filter ">{{ "report :: filtrer" | trans }}</a>
{% endif %}
{% if value.groupby == 1 %}
<a href="#" title="{{ "Grouper" | trans }}" style="float:right;bottom:0;right:0;font-size:8px;" class="{{ key }} groupby ">{{ "report :: grouper" | trans }}</a>
{% endif %}
</div>
</th>
{% set colspan = loop.length %}
{% endfor %}
</thead>
<tbody>
{% for tr, value in result.result %}
{% if loop.index is even %}
<tr class="even">
{% else %}
<tr class="odd">
{% endif %}
{% for class, config in result.display %}
<td class="{{ class }}">
{% for key , res in value %}
{% if key|lower == class %}
{% if config.bound == 1 and "</i>" not in res %}
{% if key == "user" and value.user == "<b>TOTAL</b>" %}
{{ res|raw }}
{% elseif is_nav or is_doc %}
<a href="#" rel ="" class="{{res}} bound">{{ res|raw }}</a>
{% else %}
<a href="#" rel ="" class="{{value.usrid}} bound">{{ res|raw }}</a>
{% endif %}
{% else %}
{{ res|raw }}
{% endif %}
{% endif %}
{% endfor %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<td colspan="{{colspan}}"></td>
</tr>
</tfoot>
</table>
</div>
{% else %}
<div class="report-table center" style="margin-top:50px;" >
<b>{{ result.title }}</b>
<br />
<img src="/assets/report/images/noresults.png" />
<br />
<i>{{ "report :: aucun resultat trouve" | trans }}</i><br />
</div>
{% endif %}

View File

@@ -1,43 +0,0 @@
{% block listColumn %}
<div class='modalwrapper' style="height:400px; overflow-y: auto">
<div class="columnjson_title">{{ "Cochez les cases correspondantes aux colonnes que vous desirez voire apparaitre dans le report" | trans }} </div> <br />
<div>
<div class="columnjson_link_box">
<a class="columnjson_link" href='#' id='on'><img src ='/assets/report/images/checkbox_checked.png' />{{ "cocher tout" | trans }}</a>
</div>
&nbsp;&nbsp;
<div class="columnjson_link_box">
<a class="columnjson_link" href='#' id='off'><img src ='/assets/report/images/checkbox_unchecked.png' />{{ "tout decocher" | trans }}</a>
</div>
</div>
<br />
<form>
{% for key, value in conf %}
{% set k="true" %}
{% for key2, value2 in value %}
{% if value2 == 1 %}
{% set k = "false" %}
{% endif %}
{% endfor %}
{% set val = key %}
{% if key == "date" %}
{% set val = "ddate" %}
{% endif %}
{% if k == "true" %}
<input type='checkbox' value='{{ val }}' name='{{ key }}' checked='checked' /><label style='color:yellow;'>{{ value.0 }}</label><br />
{% else %}
<input type='checkbox' value='{{ val }}' name='{{ key }}' checked='checked'/><label>{{ value.0 }}</label><br />
{% endif %}
{% endfor %}
</form>
</div>
<script type="text/javascript">
$('a#on').click(function(){
$(this).closest('#dialog').find(':checkbox').prop('checked', true);
});
$('a#off').click(function(){
$(this).closest('#dialog').find(':checkbox').prop('checked', false);
});
</script>
{% endblock %}

View File

@@ -1,8 +0,0 @@
<div class="row-fluid">
<div class="span12">
<button class="hided" style="margin-left:3px;float:left;"></button>
<button class="showed" style="display:none;margin-left:3px;float:left;"></button>
<button class="hided" style="margin-right:10px;float:right;"></button>
<button class="showed" style="display:none;margin-right:10px;float:right;"></button>
</div>
</div>

View File

@@ -1,34 +1,29 @@
{% extends "report/all_content.html.twig" %}
{% block report_layout %}
<div id="form-container" style="margin-top:50px;" >
<div id="mainTabs">
<ul id="navigation">
<li><a href="#dash">{{ "report:: Dashboard" | trans }}</a></li>
<li><a href="#report-connexions">{{ "report:: Connexion" | trans }}</a></li>
<li><a href="#report-telechargement">{{ "report:: telechargements" | trans }}</a></li>
<li><a href="#report-activite">{{ "report:: activite du site" | trans }}</a></li>
</ul>
<div class="report_wrapper">
<div id="form-container">
<h2 class="report_heading">{{"report:: Phraseanet report" | trans}}</h2>
<div id="mainTabs">
<ul id="navigation">
<li class="navigation_tab"><a href="#report-connections">{{ "report:: Connexion" | trans }}</a></li>
<li class="navigation_tab"><a href="#report-downloads">{{ "report:: telechargements" | trans }}</a></li>
<li class="navigation_tab"><a href="#report-records">{{ "report:: Databox content" | trans }}</a></li>
</ul>
{% block report_dashboard_layout %}
{% endblock report_dashboard_layout %}
{% block report_connections_layout %}
{% endblock report_connections_layout %}
{% block report_downloads_layout %}
{% endblock report_downloads_layout %}
{% block report_connexion_layout %}
{% endblock report_connexion_layout %}
{% block report_records_layout %}
{% endblock report_records_layout %}
{% block report_telechargement_layout %}
{% endblock report_telechargement_layout %}
{% block report_activite_layout %}
{% endblock report_activite_layout %}
{# END MAINTABS #}
{# END MAINTABS #}
</div>
{# END FORM CONTAINER #}
</div>
{# END FORM CONTAINER #}
</div>
<iframe name="iframe" style="display:none;"></iframe>
{% endblock report_layout %}

View File

@@ -1,214 +1,97 @@
{% extends "report/report_layout.html.twig" %}
{% block report_dashboard_layout %}
<div id="dash" class="inside-container">
<div class="answers container-fluid">
<div class="content">
<div class="row-fluid">
<div class="well-large well" style="background: #313131;margin-top:20px;border:none;">
<form id="dashboard-form" class="form-inline" method="GET" action="{{ path("report_dashboard") }}">
<label for="dminDash" style="color:#eee">{{ "from"|trans|title }}</label>
<div class="input-prepend">
<span class="add-on"><i class="icon fa fa-calendar" aria-hidden="true"></i></span>
<input id="dminDash" name="dmin" style="font-size: 14px;width:220px;" size="10" type="text" placeholder="{{ "from"|trans }}" value="{{ "-1 month"|date("Y-m-d") }}">
</div>
<label for="dmaxDash" style="color:#eee">{{ "to"|trans|title }}</label>
<div class="input-prepend">
to
<span class="add-on"><i class="icon fa fa-calendar" aria-hidden="true"></i></span>
<input id="dmaxDash" name="dmax" style="font-size: 14px;width:220px;" size="10" type="text" placeholder="{{ "to"|trans }}" value="{{ "now"|date("Y-m-d") }}">
</div>
<button class="btn submit-dashboard" type="button">{{ "Generate" | trans }}</button>
</form>
<div>
<span class="text-info" style="font-style: italic">
<i class="icon fa fa-exclamation-triangle" aria-hidden="true"></i>
{{
"Report generation may take a long time to generate, depending on the number of collections and the period selected." | trans
}}
</span>
</div>
{# <div id="chooose" style="margin-left:15px;float:left;margin-top:15px;"> #}
{# <div class="form_titre">{% trans "report:: 2 - Bases" %}</div> #}
{# <label for="nameDash"></label> #}
{# <select name="nameDash" style = "background-color:#555;color:orange;border:none;"> #}
{# <option value="all">Global</option> #}
{# {% for it in dashboard.authorizedCollection %} #}
{# <option value="{{it.sbas_id}}">{{ it.name }}</option> #}
{# {% endfor %} #}
{#</select> #}
{#</div> #}
</div>
</div>
<div id='dashboard' class="well well-large text-center" style="background-color:#696969;border:none;">
<button class="btn btn-primary submit-dashboard" style="
padding: 18px 28px;
font-size: 22px; //change this to your desired size
line-height: normal;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;"
>
{{ "Generate dashboard" | trans }}
</button>
</div>
</div>
</div>
</div>
{% endblock report_dashboard_layout %}
{% block report_connections_layout %}
<div id="report-connections" class="inside-container">
<form class="form row-fluid" id="report-connections-form" >
{% block report_connexion_layout %}
<div id="report-connexions" class="inside-container">
{% include "report/form_date_and_base.html.twig" with {'tab': "connections", 'route': "report2_connections", 'displayCollections':false } %}
<form class="form row-fluid" >
{% include "report/form_date_and_base.html.twig" %}
{% block form_connexion %}
<div class="form3 span4">
<div class="form_titre">{{ "report:: 3 - Type de report" | trans }} </div>
{% if not anonymous %}
<div>
<input name="tbl" type="radio" value="CNXU" data-action="{{ path('report_activity_users_connexions') }}" id="CNXU-input" class="formsubmiter" />
<label for="CNXU-input">{{ "report:: (connexions) Par utilisateurs" | trans }}</label>
</div>
{% else %}
<div>
<input name="tbl" type="radio" value="CNXU" data-action="{{ path('report_activity_users_connexions') }}" id="CNXU-input" class="formsubmiter" />
<label for="CNXU-input">{{ "report:: Grouper par" | trans }}</label>
<select class="options" style="display:inline;display:none;" id="list-select" name="on" >
<option selected ="selected" value="fonction" class="formsubmiter">{{ "report:: fonction" | trans }}</option>
<option value="societe" class="formsubmiter">{{ "report:: societe" | trans }}</option>
<option value="activite" class="formsubmiter">{{ "report:: activite" | trans }}</option>
<option value="pays" class="formsubmiter">{{ "report:: pays" | trans }}</option>
</select>
</div>
{% endif %}
<div>
<input name="tbl" type="radio" value="CNX" data-action="{{ path('report_connexions') }}" id="CNX-input" class="formsubmiter" />
<label for="CNX-input">{{ "report:: (connexions) Globales" | trans }}</label>
</div>
<div>
<input name="tbl" type="radio" value="CNXB" data-action="{{ path('report_clients') }}" id="CNXB-input" class="formsubmiter" />
<label for="CNXB-input">{{ "report:: (connexions) OS et navigateurs" | trans }}</label>
</div>
</div>
<div class="form3 form_content">
<div class="form_titre">{{ "report:: 3 - Type de report" | trans }} </div>
<select class="select_one" name="group">
{% for x in ['','user','nav','nav,version','os','os,nav','os,nav,version','res'] %}
{% set l="report:: (connexions) #{x}" %}
<option value="{{ x }}" id="connections_{{ x }}">{{ l | trans }}</option>
{% endfor %}
</select>
</div>
{% endblock form_connexion %}
</form>
{% include "report/panel_hide_button.html.twig" %}
<div class="answers">
<div class="content">
{% if ajax %}
{% include "report/ajax_report_content.html.twig" %}
{%endif%}
</div>
<div class="form_submit">
<button class="formsubmiter" data-form_selector="#report-connections-form">Download</button>
</div>
</div>
{% endblock report_connexion_layout %}
{% endblock report_connections_layout %}
{% block report_telechargement_layout %}
<div id="report-telechargement" class="inside-container">
<form class="form row-fluid" >
{% include "report/form_date_and_base.html.twig" %}
{% block form_telechargement %}
<div class="form3 span4">
<div class="form_titre">{% trans %}report:: 3 - Type de report{% endtrans %}</div>
{% if anonymous %}
<div>
<input name="tbl" type="radio" value="USR" data-action="{{ path('report_activity_users_downloads') }}" id="USR-dl" class="formsubmiter" />
<label for="USR-dl">{{ "report:: Grouper par" | trans }}</label>
<select class="options" style="display:inline;display:none;" id="list-select2" name="on" >
<option selected ="selected" value="fonction" class="formsubmiter">{{ "report:: fonction" | trans }}</option>
<option value="societe" class="formsubmiter">{{ "report:: societe" | trans }}</option>
<option value="activite" class="formsubmiter">{{ "report:: activite" | trans }}</option>
<option value="pays" class="formsubmiter">{{ "report:: pays" | trans }}</option>
</select>
</div>
{% else %}
<div>
<input name="tbl" type="radio" value="USR" data-action="{{ path('report_activity_users_downloads') }}" id="USR-input" class="formsubmiter" />
<label for="USR-input">{{ "report:: par utilisateurs" | trans }}</label>
</div>
{% endif %}
<div>
<input name="tbl" type="radio" value="GEN" data-action="{{ path('report_downloads') }}" id="GEN-input" class="formsubmiter" />
<label for="GEN-input">{{ "report:: (telechargement) Global" | trans }}</label>
</div>
<div>
<input name="tbl" type="radio" value="DAY" data-action="{{ path('report_activity_instance_days') }}" id="DAY-input" class="formsubmiter" />
<label for="DAY-input">{{ "report:: (telechargement) Par jours base par base" | trans }}</label>
</div>
<div>
<input name="tbl" type="radio" value="DOC" data-action="{{ path('report_documents') }}" id="DOC-input" class="formsubmiter" />
<label for="DOC-input">{{ "report:: (telechargement) Par documents sur la base" | trans }}</label>
<select class="options" id="precise" name="precise" style="display:none;">
<option value="0">{{ "report::aucune precision" | trans }}</option>
<option value="1">{{ "report::la description contient" | trans }}</option>
<option value="2">{{ "report:: recordid" | trans }}</option>
</select>
<input name="preciseWord" type="text" value="" class="options entersubmiter" />
</div>
</div>
{% endblock form_telechargement %}
{% block report_downloads_layout %}
<div id="report-downloads" class="inside-container">
<form class="form row-fluid" id="report-downloads-form" >
{% include "report/form_date_and_base.html.twig" with {'tab': "downloads", 'route': "report2_downloads", 'displayCollections': true } %}
<div class="form3 form_content">
<div class="form_titre">{% trans %}report:: 3 - Type de report{% endtrans %}</div>
<select class="select_one" name="group">
{% for x in ['','user','record'] %}
{% set l="report:: (downloads) #{x}" %}
<option value="{{ x }}" id="downloads_{{ x }}">{{ l | trans }}</option>
{% endfor %}
</select>
</div>
</form>
{% include "report/panel_hide_button.html.twig" %}
<div class="answers">
<div class="content">
{% if ajax %}
{% include "report/ajax_report_content.html.twig" %}
{%endif%}
</div>
</div>
</div>
{% endblock report_telechargement_layout %}
{% block report_activite_layout %}
<div id="report-activite" class="inside-container">
<form class="form row-fluid" >
{% include "report/form_date_and_base.html.twig" %}
{% block form_activite %}
<div class="form3 span4">
<div class="form_titre">{{ "report:: 3 - Type de report" | trans }} </div>
{% if anonymous %}
<input name="on" type="hidden" value="" checked="checked"/>
{% endif %}
<div>
<input name="tbl" type="radio" value="ASK" data-action="{{ path('report_questions') }}" id="ASK-input" class="formsubmiter" />
<label for="ASK-input">{{ "report:: toutes les questions" | trans }}</label>
</div>
<div>
<input name="tbl" type="radio" value="BESTOF" data-action="{{ path('report_activity_questions_bestof') }}" id="BESTOF-input" class="formsubmiter" />
<label for="BESTOF-input">{{ "report:: Les questions les plus posees" | trans }}</label>
</div>
<div>
<input name="tbl" type="radio" value="NOBESTOF" data-action="{{ path('report_activity_questions_nobestof') }}" id="NOBESTOF-input" class="formsubmiter" />
<label for="NOBESTOF-input">{{ "report:: questions sans reponses" | trans }}</label>
</div>
<div>
<input name="tbl" type="radio" value="SITEACTIVITY" data-action="{{ path('report_activity_instance_hours') }}" id="SITEACTIVITY-input" class="formsubmiter" />
<label for="SITEACTIVITY-input">{{ "report:: activite du site" | trans }}</label>
</div>
<div>
<input name="tbl" type="radio" value="WDOC" data-action="{{ path('report_activity_documents_pushed') }}" id="WDOC" class="formsubmiter" />
<label for="WDOC">{{ "report:: document" | trans }}</label>
<select class="options formsubmiter" style="display:inline;display:none;" id="list-select3" name="docwhat" >
<option selected ="selected" value="PUSHDOC" data-action="{{ path('report_activity_documents_pushed') }}" class="formsubmiter">{{ "report:: pushe" | trans }}</option>
<option value="ADDDOC" data-action="{{ path('report_activity_documents_added') }}" class="formsubmiter">{{ "report:: ajoute" | trans }}</option>
<option value="EDIDOC" data-action="{{ path('report_activity_documents_edited') }}" class="formsubmiter">{{ "report:: edite" | trans }}</option>
<option value="VALIDOC" data-action="{{ path('report_activity_documents_validated') }}" class="formsubmiter">{{ "report:: valide" | trans }}</option>
<option value="SENTDOC" data-action="{{ path('report_activity_documents_sent') }}" class="formsubmiter">{{ "Sent" | trans }}</option>
</select>
</div>
</div>
{% endblock form_activite %}
</form>
{% include "report/panel_hide_button.html.twig" %}
<div class="answers">
<div class="content">
{% if ajax %}
{% include "report/ajax_report_content.html.twig" %}
{%endif%}
</div>
<div class="form_submit">
<button class="formsubmiter" data-form_selector="#report-downloads-form">Download</button>
</div>
</div>
{% endblock report_activite_layout %}
{% endblock report_downloads_layout %}
{% block report_records_layout %}
<div id="report-records" class="inside-container">
<form class="form row-fluid" id="report-records-form" >
{% include "report/form_date_and_base.html.twig" with {'tab': "records", 'route': "report2_records", 'displayCollections': true } %}
{% block form_records %}
<div class="form3 form_content">
<div class="form_titre">{{ "report:: 4 - Fields" | trans }}</div>
<div class="collist">
<div class="collist_buttons">
<button class="select-all btn btn-mini" data-target_selector="#chkfld-records input:checkbox">
{% trans %}Select all{% endtrans %}
</button>
<button class="unselect-all btn btn-mini" data-target_selector="#chkfld-records input:checkbox">
{% trans %}Deselect all{% endtrans %}
</button>
</div>
<ul id="chkfld-records" style="max-height: 150px; overflow-y: auto; overflow-x: hidden;">
{% for sbas_id,databox in granted_bases %}
{% for meta in databox.metas %}
<li>
<label class="checkbox custom_checkbox_label">
<input name="meta[]" checked="checked" type="checkbox" value="{{ meta }}">
<span class="custom_checkbox"></span>
{{ meta }}
</label>
</li>
{% endfor %}
{% endfor %}
</ul>
</div>
</div>
{% endblock form_records %}
</form>
<div class="form_submit">
<button class="formsubmiter" data-form_selector="#report-records-form">Download</button>
</div>
</div>
{% endblock report_records_layout %}

View File

@@ -1,667 +0,0 @@
<?php
namespace Alchemy\Tests\Phrasea\Controller\Report;
/**
* @group functional
* @group legacy
* @group authenticated
* @group web
*/
class ActivityTest extends \PhraseanetAuthenticatedWebTestCase
{
private $dmin;
private $dmax;
public function __construct()
{
$this->dmax = new \DateTime('now');
$this->dmin = new \DateTime('-1 month');
}
public function testDoReportConnexionsByUsers()
{
self::$DI['client']->request('POST', '/report/activity/users/connexions', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'page' => 1,
'limit' => 10,
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportConnexionsByUsersCSV()
{
self::$DI['client']->request('POST', '/report/activity/users/connexions', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'page' => 1,
'limit' => 10,
'printcsv' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportDownloadsByUsers()
{
self::$DI['client']->request('POST', '/report/activity/users/downloads', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'page' => 1,
'limit' => 10,
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportDownloadsByUsersCSV()
{
self::$DI['client']->request('POST', '/report/activity/users/downloads', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'page' => 1,
'limit' => 10,
'printcsv' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportBestOfQuestions()
{
self::$DI['client']->request('POST', '/report/activity/questions/best-of', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'limit' => 10,
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportBestOfQuestionsCSV()
{
self::$DI['client']->request('POST', '/report/activity/questions/best-of', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'limit' => 10,
'printcsv' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportNoBestOfQuestions()
{
self::$DI['client']->request('POST', '/report/activity/questions/no-best-of', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'limit' => 10,
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportNoBestOfQuestionsCSV()
{
self::$DI['client']->request('POST', '/report/activity/questions/no-best-of', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'limit' => 10,
'printcsv' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportSiteActiviyPerHours()
{
self::$DI['client']->request('POST', '/report/activity/instance/hours', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportSiteActiviyPerHoursCSV()
{
self::$DI['client']->request('POST', '/report/activity/instance/hours', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'printcsv' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportSiteActivityPerDays()
{
self::$DI['client']->request('POST', '/report/activity/instance/days', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportSiteActivityPerDaysCSV()
{
self::$DI['client']->request('POST', '/report/activity/instance/days', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'printcsv' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportPushedDocuments()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/pushed', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'order' => 'ASC',
'champ' => 'user',
'page' => 1,
'limit' => 10,
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportPushedDocumentsPrintCSV()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/pushed', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'printcsv' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportPushedDocumentsFilterColumns()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/pushed', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'list_column' => 'user ddate',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportPushedDocumentsFilterResultOnOneColumn()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/pushed', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'filter_column' => 'user',
'filter_value' => 'admin',
'liste' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportPushedDocumentsFilterConf()
{
self::$DI['client']->request('POST', '/report/activity/documents/pushed', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'conf' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportPushedDocumentsGroupBy()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/pushed', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'groupby' => 'user',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportAddedDocuments()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/added', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'order' => 'ASC',
'champ' => 'user',
'page' => 1,
'limit' => 10,
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportAddedDocumentsPrintCSV()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/added', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'printcsv' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportAddedDocumentsFilterColumns()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/added', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'list_column' => 'user ddate',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportAddedDocumentsFilterResultOnOneColumn()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/added', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'filter_column' => 'user',
'filter_value' => 'admin',
'liste' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportAddedDocumentsFilterConf()
{
self::$DI['client']->request('POST', '/report/activity/documents/added', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'conf' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportAddedDocumentsGroupBy()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/added', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'groupby' => 'user',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportEditedDocuments()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/edited', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'order' => 'ASC',
'champ' => 'user',
'page' => 1,
'limit' => 10,
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportEditedDocumentsPrintCSV()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/edited', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'printcsv' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportEditedDocumentsFilterColumns()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/edited', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'list_column' => 'user ddate',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportEditedDocumentsFilterResultOnOneColumn()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/edited', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'filter_column' => 'user',
'filter_value' => 'admin',
'liste' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportEditedDocumentsFilterConf()
{
self::$DI['client']->request('POST', '/report/activity/documents/edited', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'conf' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportEditedDocumentsGroupBy()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/edited', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'groupby' => 'user',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportValidatedDocuments()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/validated', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'order' => 'ASC',
'champ' => 'user',
'page' => 1,
'limit' => 10,
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportValidatedDocumentsPrintCSV()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/validated', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'printcsv' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportValidatedDocumentsFilterColumns()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/validated', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'list_column' => 'user ddate',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportValidatedDocumentsFilterResultOnOneColumn()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/validated', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'filter_column' => 'user',
'filter_value' => 'admin',
'liste' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportValidatedDocumentsFilterConf()
{
self::$DI['client']->request('POST', '/report/activity/documents/validated', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'conf' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportValidatedDocumentsGroupBy()
{
$this->markTestSkipped(
'Report is broken since table "log_colls" is deleted.'
);
self::$DI['client']->request('POST', '/report/activity/documents/validated', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'groupby' => 'user',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
}

View File

@@ -1,339 +0,0 @@
<?php
namespace Alchemy\Tests\Phrasea\Controller\Report;
use Alchemy\Phrasea\Model\Entities\User;
use Symfony\Component\HttpKernel\Client;
/**
* @group functional
* @group legacy
* @group authenticated
* @group web
*/
class InformationsTest extends \PhraseanetAuthenticatedWebTestCase
{
/**
* @var \DateTime
*/
private $dmin;
/**
* @var \DateTime
*/
private $dmax;
/**
* @var Client
*/
private $client;
public function setUp()
{
parent::setUp();
$this->dmax = new \DateTime('now');
$this->dmin = new \DateTime('-1 month');
$this->client = $this->getClient();
}
public function testDoReportUserBadRequest()
{
$this->client->request('POST', '/report/informations/user', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
]);
$response = $this->client->getResponse();
$this->assertFalse($response->isOk());
$this->assertEquals(400, $response->getStatusCode());
}
public function testDoReportUser()
{
$this->client->request('POST', '/report/informations/user', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
'user' => $this->getUser()->getId(),
]);
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportUserFromConnexion()
{
$this->client->request('POST', '/report/informations/user', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
'user' => $this->getUser()->getId(),
'from' => 'CNX',
]);
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportUserFromQuestion()
{
$this->client->request('POST', '/report/informations/user', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
'from' => 'ASK',
'user' => $this->getUser()->getId(),
]);
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportUserFromDownload()
{
$this->client->request('POST', '/report/informations/user', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
'from' => 'GEN',
'user' => $this->getUser()->getId(),
]);
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportUserFromConnexionCSV()
{
$this->client->request('POST', '/report/informations/user', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
'from' => 'CNX',
'printcsv' => 'on',
'user' => $this->getUser()->getId(),
]);
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportUserFromQuestionCSV()
{
$this->client->request('POST', '/report/informations/user', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
'from' => 'ASK',
'printcsv' => 'on',
'user' => $this->getUser()->getId(),
]);
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportUserFromDownloadCSV()
{
$this->client->request('POST', '/report/informations/user', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
'from' => 'GEN',
'printcsv' => 'on',
'user' => $this->getUser()->getId(),
]);
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportUserFromDownloadOnCustomField()
{
$this->client->request('POST', '/report/informations/user', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
'from' => 'GEN',
'on' => 'email',
'user' => $this->getUser()->getEmail()
]);
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportUserFromConnexionOnCustomField()
{
$this->client->request('POST', '/report/informations/user', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
'from' => 'CNX',
'on' => 'email',
'user' => $this->getUser()->getEmail()
]);
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportUserFromQuestionOnCustomField()
{
$this->client->request('POST', '/report/informations/user', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
'from' => 'ASK',
'on' => 'email',
'user' => $this->getUser()->getEmail()
]);
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportInformationBrowserBadRequest()
{
$this->client->request('POST', '/report/informations/browser', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
]);
$response = $this->client->getResponse();
$this->assertFalse($response->isOk());
$this->assertEquals(400, $response->getStatusCode());
}
public function testDoReportInfomationsBrowser()
{
$this->client->request('POST', '/report/informations/browser', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
'user' => 'chrome',
]);
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportInfomationsDocumentsNotFound()
{
$this->client->request('POST', '/report/informations/document', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
'sbasid' => 0,
'rid' => 0,
]);
$response = $this->client->getResponse();
$this->assertFalse($response->isOk());
$this->assertEquals(404, $response->getStatusCode());
}
public function testDoReportInfomationsDocuments()
{
$this->client->request('POST', '/report/informations/document', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
'sbasid' => $this->getRecord1()->getDataboxId(),
'rid' => $this->getRecord1()->getRecordId(),
]);
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportInfomationsDocumentsFromTool()
{
$this->client->request('POST', '/report/informations/document', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
'sbasid' => $this->getRecord1()->getDataboxId(),
'rid' => $this->getRecord1()->getRecordId(),
'from' => 'TOOL'
]);
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportInfomationsDocumentsFromDashboard()
{
$this->client->request('POST', '/report/informations/document', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
'sbasid' => $this->getRecord1()->getDataboxId(),
'rid' => $this->getRecord1()->getRecordId(),
'from' => 'DASH'
]);
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportInfomationsDocumentsFromOther()
{
$this->client->request('POST', '/report/informations/document', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
'sbasid' => $this->getCollection()->get_sbas_id(),
'collection' => $this->getCollection()->get_coll_id(),
'sbasid' => $this->getRecord1()->getDataboxId(),
'rid' => $this->getRecord1()->getRecordId(),
'user' => $this->getUser()->getId()
]);
$response = $this->client->getResponse();
$this->assertTrue($response->isOk());
}
/**
* @return User
*/
private function getUser()
{
return self::$DI['user'];
}
}

View File

@@ -29,435 +29,4 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
$this->assertTrue($response->isOk());
}
public function testRouteDashboardJson()
{
$this->authenticate(self::$DI['app']);
$response = $this->XMLHTTPRequest('GET', '/report/dashboard', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmin->format('Y-m-d'),
]);
$this->assertTrue($response->isOk());
}
public function testRouteInitReport()
{
self::$DI['client']->request('POST', '/report/init', ['popbases' => ['1_1']]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportConnexions()
{
self::$DI['client']->request('POST', '/report/connexions', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'order' => 'ASC',
'champ' => 'user',
'page' => 1,
'limit' => 10,
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportConnexionsPrintCSV()
{
self::$DI['client']->request('POST', '/report/connexions', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'printcsv' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportConnexionsFilterColumns()
{
self::$DI['client']->request('POST', '/report/connexions', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'list_column' => 'user ddate',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportConnexionsFilterResultOnOneColumn()
{
self::$DI['client']->request('POST', '/report/connexions', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'filter_column' => 'user',
'filter_value' => 'admin',
'liste' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportConnexionsFilterConf()
{
self::$DI['client']->request('POST', '/report/connexions', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'conf' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportConnexionsGroupBy()
{
self::$DI['client']->request('POST', '/report/connexions', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'groupby' => 'user',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportQuestions()
{
self::$DI['client']->request('POST', '/report/questions', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'order' => 'ASC',
'champ' => 'user',
'page' => 1,
'limit' => 10,
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportQuestionsPrintCSV()
{
self::$DI['client']->request('POST', '/report/questions', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'printcsv' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportQuestionsFilterColumns()
{
self::$DI['client']->request('POST', '/report/questions', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'list_column' => 'user ddate',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportQuestionsFilterResultOnOneColumn()
{
self::$DI['client']->request('POST', '/report/questions', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'filter_column' => 'user',
'filter_value' => 'admin',
'liste' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportQuestionsFilterConf()
{
self::$DI['client']->request('POST', '/report/questions', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'conf' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportQuestionsGroupBy()
{
self::$DI['client']->request('POST', '/report/questions', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'groupby' => 'user',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportDownloads()
{
self::$DI['client']->request('POST', '/report/downloads', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'order' => 'ASC',
'champ' => 'user',
'page' => 1,
'limit' => 10,
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportDownloadsPrintCSV()
{
self::$DI['client']->request('POST', '/report/downloads', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'printcsv' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportDownloadsFilterColumns()
{
self::$DI['client']->request('POST', '/report/downloads', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'list_column' => 'user ddate',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportDownloadsFilterResultOnOneColumn()
{
self::$DI['client']->request('POST', '/report/downloads', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'filter_column' => 'user',
'filter_value' => 'admin',
'liste' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportDownloadsFilterConf()
{
self::$DI['client']->request('POST', '/report/downloads', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'conf' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportDownloadsGroupBy()
{
self::$DI['client']->request('POST', '/report/downloads', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'groupby' => 'user',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportDocuments()
{
self::$DI['client']->request('POST', '/report/documents', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'order' => 'ASC',
'champ' => 'final',
'tbl' => 'DOC',
'page' => 1,
'limit' => 10,
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportDocumentsPrintCSV()
{
self::$DI['client']->request('POST', '/report/documents', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'printcsv' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportDocumentsFilterColumns()
{
self::$DI['client']->request('POST', '/report/documents', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'list_column' => 'file mime',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportDocumentsFilterResultOnOneColumn()
{
self::$DI['client']->request('POST', '/report/documents', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'filter_column' => 'mime',
'filter_value' => 'pdf',
'liste' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportDocumentsFilterConf()
{
self::$DI['client']->request('POST', '/report/documents', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'conf' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportDocumentsGroupBy()
{
self::$DI['client']->request('POST', '/report/documents', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'groupby' => 'mime',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportClients()
{
self::$DI['client']->request('POST', '/report/clients', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
public function testDoReportClientPrintCSV()
{
self::$DI['client']->request('POST', '/report/clients', [
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'printcsv' => 'on',
]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
}
}