mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 21:13:26 +00:00
Use short array declaration
This commit is contained in:
@@ -134,16 +134,16 @@ class module_console_checkExtension extends Command
|
||||
return 1;
|
||||
}
|
||||
|
||||
$tbases = array();
|
||||
$tbases = [];
|
||||
|
||||
foreach ($phSession["bases"] as $phbase) {
|
||||
$tcoll = array();
|
||||
$tcoll = [];
|
||||
foreach ($phbase["collections"] as $coll) {
|
||||
$tcoll[] = 0 + $coll["base_id"];
|
||||
}
|
||||
if (sizeof($tcoll) > 0) {
|
||||
$kbase = "S" . $phbase["sbas_id"];
|
||||
$tbases[$kbase] = array();
|
||||
$tbases[$kbase] = [];
|
||||
$tbases[$kbase]["sbas_id"] = $phbase["sbas_id"];
|
||||
$tbases[$kbase]["searchcoll"] = $tcoll;
|
||||
$tbases[$kbase]["mask_xor"] = $tbases[$kbase]["mask_and"] = 0;
|
||||
@@ -172,7 +172,7 @@ class module_console_checkExtension extends Command
|
||||
, false
|
||||
, PHRASEA_MULTIDOC_DOCONLY
|
||||
, ''
|
||||
, array()
|
||||
, []
|
||||
);
|
||||
|
||||
if ($ret) {
|
||||
@@ -206,10 +206,10 @@ class module_console_checkExtension extends Command
|
||||
// prepare the test before closing session
|
||||
if (function_exists("phrasea_public_query")) {
|
||||
// fill an array for each sbas to query
|
||||
$tbases = array();
|
||||
$tbases = [];
|
||||
foreach ($phSession["bases"] as $phbase) {
|
||||
// fill an array of collections to query for this sbas
|
||||
$tcoll = array();
|
||||
$tcoll = [];
|
||||
foreach ($phbase["collections"] as $coll) {
|
||||
$tcoll[] = 0 + $coll["base_id"];
|
||||
}
|
||||
@@ -220,11 +220,11 @@ class module_console_checkExtension extends Command
|
||||
$treeq = $qp->parsequery($input->getOption('query'));
|
||||
$arrayq = $qp->makequery($treeq);
|
||||
|
||||
$tbases["S".$phbase["sbas_id"]] = array( // key does no matter
|
||||
$tbases["S".$phbase["sbas_id"]] = [ // key does no matter
|
||||
"sbas_id" => $phbase["sbas_id"], // sbas_id
|
||||
"searchcoll" => $tcoll, // colls to query
|
||||
"arrayq" => $arrayq // parsed query
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -249,7 +249,7 @@ class module_console_checkExtension extends Command
|
||||
$tbases // array of sbas with colls and query
|
||||
, PHRASEA_MULTIDOC_DOCONLY // mode
|
||||
, '' // sortfield
|
||||
, array() // search business fields
|
||||
, [] // search business fields
|
||||
, '' // lng for stemmed search
|
||||
, 0 // offset for first answer (start=0)
|
||||
, 5 // nbr of answers
|
||||
|
@@ -57,7 +57,7 @@ class module_console_fieldsMerge extends Command
|
||||
return 1;
|
||||
}
|
||||
|
||||
$sources = array();
|
||||
$sources = [];
|
||||
|
||||
foreach ($input->getArgument('source') as $source_id) {
|
||||
$sources[] = $databox->get_meta_structure()->get_element($source_id);
|
||||
@@ -71,7 +71,7 @@ class module_console_fieldsMerge extends Command
|
||||
|
||||
$destination = $databox->get_meta_structure()->get_element($input->getArgument('destination'));
|
||||
|
||||
$types = $multis = array();
|
||||
$types = $multis = [];
|
||||
|
||||
foreach ($sources as $source) {
|
||||
array_push($types, $source->get_type());
|
||||
@@ -97,7 +97,7 @@ class module_console_fieldsMerge extends Command
|
||||
);
|
||||
}
|
||||
|
||||
$field_names = array();
|
||||
$field_names = [];
|
||||
|
||||
foreach ($sources as $source) {
|
||||
$field_names[] = $source->get_name();
|
||||
@@ -172,7 +172,7 @@ class module_console_fieldsMerge extends Command
|
||||
foreach ($results as $row) {
|
||||
$record = $databox->get_record($row['record_id']);
|
||||
|
||||
$datas = array();
|
||||
$datas = [];
|
||||
|
||||
foreach ($sources as $source) {
|
||||
try {
|
||||
@@ -195,11 +195,11 @@ class module_console_fieldsMerge extends Command
|
||||
}
|
||||
|
||||
foreach ((array) $datas as $data) {
|
||||
$record->set_metadatas(array(array(
|
||||
$record->set_metadatas([[
|
||||
'meta_struct_id' => $destination->get_id(),
|
||||
'meta_id' => null,
|
||||
'value' => $data,
|
||||
)), true);
|
||||
]], true);
|
||||
}
|
||||
|
||||
$this->getService('phraseanet.SE')->updateRecord($record);
|
||||
|
@@ -102,7 +102,7 @@ class module_console_fieldsRename extends Command
|
||||
|
||||
foreach ($results as $row) {
|
||||
$record = $databox->get_record($row['record_id']);
|
||||
$record->set_metadatas(array());
|
||||
$record->set_metadatas([]);
|
||||
unset($record);
|
||||
}
|
||||
|
||||
|
@@ -43,7 +43,7 @@ class module_console_sphinxGenerateSuggestion extends Command
|
||||
foreach ($params as $sbas_id => $p) {
|
||||
$index = sprintf("%u", crc32(
|
||||
str_replace(
|
||||
array('.', '%')
|
||||
['.', '%']
|
||||
, '_'
|
||||
, sprintf('%s_%s_%s_%s', $p['host'], $p['port'], $p['user'], $p['dbname'])
|
||||
)
|
||||
@@ -61,7 +61,7 @@ class module_console_sphinxGenerateSuggestion extends Command
|
||||
return 1;
|
||||
}
|
||||
|
||||
$builder = ProcessBuilder::create(array('/usr/local/bin/indexer'));
|
||||
$builder = ProcessBuilder::create(['/usr/local/bin/indexer']);
|
||||
$builder->add('metadatas' . $index)
|
||||
->add('--buildstops')
|
||||
->add($tmp_file)
|
||||
|
@@ -39,13 +39,13 @@ class module_console_systemClearCache extends Command
|
||||
$finder
|
||||
->exclude('.git')
|
||||
->exclude('.svn')
|
||||
->in(array(
|
||||
->in([
|
||||
$this->container['root.path'] . '/tmp/cache_minify/',
|
||||
$this->container['root.path'] . '/tmp/cache_twig/',
|
||||
$this->container['root.path'] . '/tmp/cache/profiler/',
|
||||
$this->container['root.path'] . '/tmp/doctrine/',
|
||||
$this->container['root.path'] . '/tmp/serializer/',
|
||||
));
|
||||
]);
|
||||
|
||||
$filesystem = new Filesystem();
|
||||
|
||||
|
@@ -39,7 +39,7 @@ class module_console_systemExport extends Command
|
||||
* To implement
|
||||
*/
|
||||
// $this->addOption('excludefield', 'f', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY
|
||||
// , 'Exclude field from XML', array());
|
||||
// , 'Exclude field from XML', []);
|
||||
|
||||
/**
|
||||
* To implement
|
||||
@@ -57,10 +57,10 @@ class module_console_systemExport extends Command
|
||||
, 'Limit files quantity (for test purposes)', false);
|
||||
|
||||
$this->addOption('base_id', 'b', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY
|
||||
, 'Restrict on base_ids', array());
|
||||
, 'Restrict on base_ids', []);
|
||||
|
||||
$this->addOption('sbas_id', 's', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY
|
||||
, 'Restrict on sbas_ids', array());
|
||||
, 'Restrict on sbas_ids', []);
|
||||
|
||||
$this->addArgument('directory', InputOption::VALUE_REQUIRED
|
||||
, 'The directory where to export');
|
||||
@@ -134,7 +134,7 @@ class module_console_systemExport extends Command
|
||||
}
|
||||
|
||||
$go = true;
|
||||
$coll_ids = array();
|
||||
$coll_ids = [];
|
||||
|
||||
if (count($restrictBaseIds) > 0) {
|
||||
$go = false;
|
||||
@@ -187,7 +187,7 @@ class module_console_systemExport extends Command
|
||||
$record = $databox->get_record($row['record_id']);
|
||||
if (($done % $docPerDir) === 0) {
|
||||
$dir_increment ++;
|
||||
$in_dir_files = array();
|
||||
$in_dir_files = [];
|
||||
$current_dir = $local_export . sprintf($dir_format, $dir_increment) . '/';
|
||||
$this->getService('filesystem')->mkdir($current_dir);
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ class module_console_systemMailCheck extends Command
|
||||
{
|
||||
$output->writeln("Processing...");
|
||||
|
||||
$bad_users = array();
|
||||
$bad_users = [];
|
||||
if (version_compare($this->getService('phraseanet.appbox')->get_version(), '3.9', '<')) {
|
||||
$bad_users = MailChecker::getWrongEmailUsers($this->container);
|
||||
}
|
||||
@@ -76,7 +76,7 @@ class module_console_systemMailCheck extends Command
|
||||
. 'continue (C), detach from mail (d), or stop (s)</question>';
|
||||
|
||||
$continue = mb_strtolower($dialog->ask($output, $question, 'C'));
|
||||
} while ( ! in_array($continue, array('c', 'd', 's')));
|
||||
} while ( ! in_array($continue, ['c', 'd', 's']));
|
||||
|
||||
if ($continue == 's') {
|
||||
return false;
|
||||
|
@@ -35,10 +35,10 @@ class module_console_systemTemplateGenerator extends Command
|
||||
|
||||
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$tplDirs = array(
|
||||
$tplDirs = [
|
||||
realpath(__DIR__ . '/../../../../templates/web/'),
|
||||
realpath(__DIR__ . '/../../../../templates/mobile/')
|
||||
);
|
||||
];
|
||||
|
||||
$n_ok = $n_error = 0;
|
||||
|
||||
@@ -48,9 +48,9 @@ class module_console_systemTemplateGenerator extends Command
|
||||
$this->container['twig'];
|
||||
|
||||
foreach ($tplDirs as $tplDir) {
|
||||
$this->container['twig.loader.filesystem']->setPaths(array($tplDir));
|
||||
$this->container['twig.loader.filesystem']->setPaths([$tplDir]);
|
||||
$finder = new Finder();
|
||||
foreach ($finder->files()->in(array($tplDir)) as $file) {
|
||||
foreach ($finder->files()->in([$tplDir]) as $file) {
|
||||
try {
|
||||
$this->container['twig']->loadTemplate(str_replace($tplDir, '', $file->getPathname()));
|
||||
$output->writeln('' . $file . '');
|
||||
|
@@ -58,7 +58,7 @@ class module_console_systemUpgrade extends Command
|
||||
|
||||
do {
|
||||
$continue = mb_strtolower($dialog->ask($output, '<question>' . _('Continuer ?') . ' (Y/n)</question>', 'Y'));
|
||||
} while (!in_array($continue, array('y', 'n')));
|
||||
} while (!in_array($continue, ['y', 'n']));
|
||||
} else {
|
||||
$continue = 'y';
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ class module_report
|
||||
* The result of the report
|
||||
* @var array
|
||||
*/
|
||||
public $report = array();
|
||||
public $report = [];
|
||||
|
||||
/**
|
||||
* The title of the report
|
||||
@@ -53,25 +53,25 @@ class module_report
|
||||
* default displayed value in the formated tab
|
||||
* @var array
|
||||
*/
|
||||
protected $display = array();
|
||||
protected $display = [];
|
||||
|
||||
/**
|
||||
* ?
|
||||
* @var <array>
|
||||
*/
|
||||
protected $default_display = array();
|
||||
protected $default_display = [];
|
||||
|
||||
/**
|
||||
* Contain all the field from the sql request
|
||||
* @var array
|
||||
*/
|
||||
protected $champ = array();
|
||||
protected $champ = [];
|
||||
|
||||
/**
|
||||
* result of the report
|
||||
* @var array
|
||||
*/
|
||||
protected $result = array();
|
||||
protected $result = [];
|
||||
|
||||
/**
|
||||
* The id of all collections from a databox
|
||||
@@ -117,7 +117,7 @@ class module_report
|
||||
/**
|
||||
* the request executed
|
||||
*/
|
||||
protected $params = array();
|
||||
protected $params = [];
|
||||
|
||||
/**
|
||||
* do we display next and previous button
|
||||
@@ -159,33 +159,33 @@ class module_report
|
||||
* filter executed on report choose by the user
|
||||
* @var array;
|
||||
*/
|
||||
protected $tab_filter = array();
|
||||
protected $tab_filter = [];
|
||||
|
||||
/**
|
||||
* column displayed in the report choose by the user
|
||||
* @var <array>
|
||||
*/
|
||||
protected $active_column = array();
|
||||
protected $active_column = [];
|
||||
|
||||
/**
|
||||
* array that contains the string displayed
|
||||
* foreach filters
|
||||
* @var <array>
|
||||
*/
|
||||
protected $posting_filter = array();
|
||||
protected $posting_filter = [];
|
||||
|
||||
/**
|
||||
* The ORDER BY filters of the query
|
||||
* by default is empty
|
||||
* @var array
|
||||
*/
|
||||
protected $tab_order = array();
|
||||
protected $tab_order = [];
|
||||
|
||||
/**
|
||||
* define columns that are boundable
|
||||
* @var <array>
|
||||
*/
|
||||
protected $bound = array();
|
||||
protected $bound = [];
|
||||
|
||||
/**
|
||||
* do we display print button
|
||||
@@ -209,7 +209,7 @@ class module_report
|
||||
* gettext correspondance for all available columns in report
|
||||
* @var array
|
||||
*/
|
||||
protected $cor = array();
|
||||
protected $cor = [];
|
||||
|
||||
/**
|
||||
* group result of a report this is the name ogf the grouped column
|
||||
@@ -232,7 +232,7 @@ class module_report
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected $cor_query = array();
|
||||
protected $cor_query = [];
|
||||
protected $isInformative;
|
||||
|
||||
/**
|
||||
@@ -596,8 +596,8 @@ class module_report
|
||||
{
|
||||
$row = array_shift($rs);
|
||||
|
||||
$this->champ = is_array($row) ? array_keys($row) : array();
|
||||
$this->default_display = is_array($row) ? array_keys($row) : array();
|
||||
$this->champ = is_array($row) ? array_keys($row) : [];
|
||||
$this->default_display = is_array($row) ? array_keys($row) : [];
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -657,7 +657,7 @@ class module_report
|
||||
*/
|
||||
private function setCor()
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
'user' => _('report:: utilisateur'),
|
||||
'coll_id' => _('report:: collections'),
|
||||
'connexion' => _('report:: Connexion'),
|
||||
@@ -680,7 +680,7 @@ class module_report
|
||||
'size' => _('report:: taille'),
|
||||
'copyright' => _('report:: copyright'),
|
||||
'final' => _('phraseanet:: sous definition')
|
||||
);
|
||||
];
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -691,14 +691,14 @@ class module_report
|
||||
*/
|
||||
private function setDay()
|
||||
{
|
||||
return Array(
|
||||
return [
|
||||
1 => _('phraseanet::jours:: lundi'),
|
||||
2 => _('phraseanet::jours:: mardi'),
|
||||
3 => _('phraseanet::jours:: mercredi'),
|
||||
4 => _('phraseanet::jours:: jeudi'),
|
||||
5 => _('phraseanet::jours:: vendredi'),
|
||||
6 => _('phraseanet::jours:: samedi'),
|
||||
7 => _('phraseanet::jours:: dimanche'));
|
||||
7 => _('phraseanet::jours:: dimanche')];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -707,7 +707,7 @@ class module_report
|
||||
*/
|
||||
private function setMonth()
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
_('janvier'),
|
||||
_('fevrier'),
|
||||
_('mars'),
|
||||
@@ -720,7 +720,7 @@ class module_report
|
||||
_('octobre'),
|
||||
_('novembre'),
|
||||
_('decembre')
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -759,9 +759,9 @@ class module_report
|
||||
*/
|
||||
protected function initDefaultConfigColumn($display)
|
||||
{
|
||||
$array = array();
|
||||
$array = [];
|
||||
foreach ($display as $key => $value)
|
||||
$array[$value] = array("", 0, 0, 0, 0);
|
||||
$array[$value] = ["", 0, 0, 0, 0];
|
||||
$this->setConfigColumn($array);
|
||||
}
|
||||
|
||||
@@ -791,13 +791,13 @@ class module_report
|
||||
$bound = array_key_exists($column, $this->bound) ? $this->bound[$column] : $row[2];
|
||||
$filter = (isset($row[3]) ? $row[3] : 0);
|
||||
$groupby = $row[4];
|
||||
$config = array(
|
||||
$config = [
|
||||
'title' => empty($title) ? (empty($title_text) ? $column : $title_text) : $title,
|
||||
'sort' => $sort,
|
||||
'bound' => $bound,
|
||||
'filter' => $filter,
|
||||
'groupby' => $groupby
|
||||
);
|
||||
];
|
||||
|
||||
$this->display[$column] = $config;
|
||||
}
|
||||
@@ -857,7 +857,7 @@ class module_report
|
||||
|
||||
public static function getPreff(Application $app, $sbasid)
|
||||
{
|
||||
$tab = array();
|
||||
$tab = [];
|
||||
|
||||
$databox = $app['phraseanet.appbox']->get_databox((int) $sbasid);
|
||||
|
||||
|
@@ -23,7 +23,7 @@ class module_report_activity extends module_report
|
||||
* Array correspondance column -> to query
|
||||
* @var array
|
||||
*/
|
||||
protected $cor_query = array(
|
||||
protected $cor_query = [
|
||||
'user' => 'log.user',
|
||||
'site' => 'log.site',
|
||||
'societe' => 'log.societe',
|
||||
@@ -39,7 +39,7 @@ class module_report_activity extends module_report
|
||||
'final' => 'log_docs.final',
|
||||
'comment' => 'log_docs.comment',
|
||||
'size' => 'subdef.size'
|
||||
);
|
||||
];
|
||||
|
||||
public function __construct(Application $app, $arg1, $arg2, $sbas_id, $collist)
|
||||
{
|
||||
@@ -69,7 +69,7 @@ class module_report_activity extends module_report
|
||||
|
||||
private function setDisplayForActivity($rs)
|
||||
{
|
||||
$hours = array();
|
||||
$hours = [];
|
||||
|
||||
for ($i = 0; $i < 24; $i ++) {
|
||||
array_push($this->display, $i);
|
||||
@@ -90,13 +90,13 @@ class module_report_activity extends module_report
|
||||
*/
|
||||
public function getActivityPerHours()
|
||||
{
|
||||
$this->result = array();
|
||||
$this->result = [];
|
||||
$this->title = _('report:: activite par heure');
|
||||
|
||||
$sqlBuilder = new module_report_sql($this->app, $this);
|
||||
|
||||
$filter = $sqlBuilder->getFilters()->getReportFilter();
|
||||
$params = array_merge(array(), $filter['params']);
|
||||
$params = array_merge([], $filter['params']);
|
||||
|
||||
$sql = "
|
||||
SELECT tt.heures, SUM(1) AS nb
|
||||
@@ -150,12 +150,12 @@ class module_report_activity extends module_report
|
||||
*/
|
||||
public function getAllQuestionByUser($value, $what)
|
||||
{
|
||||
$result = array();
|
||||
$result = [];
|
||||
|
||||
$sqlBuilder = new module_report_sql($this->app, $this);
|
||||
|
||||
$filter = $sqlBuilder->getFilters()->getReportFilter();
|
||||
$params = array_merge(array(':main_value' => $value), $filter['params']);
|
||||
$params = array_merge([':main_value' => $value], $filter['params']);
|
||||
|
||||
$sql = "
|
||||
SELECT DATE_FORMAT(log_search.date,'%Y-%m-%d %H:%i:%S') AS date ,
|
||||
@@ -203,12 +203,12 @@ class module_report_activity extends module_report
|
||||
*/
|
||||
public function getTopQuestion($tab = false, $no_answer = false)
|
||||
{
|
||||
$this->report['value'] = array();
|
||||
$this->report['value2'] = array();
|
||||
$this->report['value'] = [];
|
||||
$this->report['value2'] = [];
|
||||
|
||||
$sqlBuilder = new module_report_sql($this->app, $this);
|
||||
$filter = $sqlBuilder->getFilters()->getReportFilter();
|
||||
$params = array_merge(array(), $filter['params']);
|
||||
$params = array_merge([], $filter['params']);
|
||||
|
||||
($no_answer) ? $this->title = _('report:: questions sans reponses') : $this->title = _('report:: questions les plus posees');
|
||||
|
||||
@@ -268,10 +268,10 @@ class module_report_activity extends module_report
|
||||
*/
|
||||
public function getAllDownloadByUserBase($usr, $config = false)
|
||||
{
|
||||
$result = array();
|
||||
$result = [];
|
||||
$sqlBuilder = new module_report_sql($this->app, $this);
|
||||
$filter = $sqlBuilder->getFilters()->getReportFilter();
|
||||
$params = array_merge(array(), $filter['params']);
|
||||
$params = array_merge([], $filter['params']);
|
||||
$databox = $this->app['phraseanet.appbox']->get_databox($this->sbas_id);
|
||||
|
||||
$sql = "
|
||||
@@ -331,7 +331,7 @@ class module_report_activity extends module_report
|
||||
|
||||
$sqlBuilder = new module_report_sql($this->app, $this);
|
||||
$filter = $sqlBuilder->getFilters()->getReportFilter();
|
||||
$params = array_merge(array(), $filter['params']);
|
||||
$params = array_merge([], $filter['params']);
|
||||
|
||||
$sql = "
|
||||
SELECT tt.record_id, DATE_FORMAT(tt.the_date, GET_FORMAT(DATE, 'INTERNAL')) AS ddate, tt.final, SUM(1) AS nb
|
||||
@@ -357,7 +357,7 @@ class module_report_activity extends module_report
|
||||
|
||||
$this->setChamp($rs);
|
||||
$this->setDisplay($tab);
|
||||
$total = array('tot_doc' => 0, 'tot_prev' => 0, 'tot_dl' => 0);
|
||||
$total = ['tot_doc' => 0, 'tot_prev' => 0, 'tot_dl' => 0];
|
||||
$i = -1;
|
||||
|
||||
$last_date = null;
|
||||
@@ -366,12 +366,12 @@ class module_report_activity extends module_report
|
||||
$date = $this->app['date-formatter']->getPrettyString(new DateTime($row['ddate']));
|
||||
if ($date != $last_date) {
|
||||
$i ++;
|
||||
$this->result[$i] = array(
|
||||
$this->result[$i] = [
|
||||
'ddate' => $date,
|
||||
'document' => 0,
|
||||
'preview' => 0,
|
||||
'total' => 0
|
||||
);
|
||||
];
|
||||
$last_date = $date;
|
||||
}
|
||||
|
||||
@@ -419,7 +419,7 @@ class module_report_activity extends module_report
|
||||
|
||||
$sqlBuilder = new module_report_sql($this->app, $this);
|
||||
$filter = $sqlBuilder->getFilters()->getReportFilter();
|
||||
$params = array_merge(array(), $filter['params']);
|
||||
$params = array_merge([], $filter['params']);
|
||||
|
||||
$this->req = "
|
||||
SELECT SUM(1) AS connexion, tt.user, tt.usrid FROM (
|
||||
@@ -452,9 +452,9 @@ class module_report_activity extends module_report
|
||||
//set title
|
||||
$this->title = _('report:: Detail des connexions');
|
||||
//set champ
|
||||
$this->champ = array($on, 'connexion');
|
||||
$this->champ = [$on, 'connexion'];
|
||||
//set display
|
||||
$this->default_display = array($on, 'connexion');
|
||||
$this->default_display = [$on, 'connexion'];
|
||||
//set configuration of column
|
||||
($tab) ? $this->setConfigColumn($tab) :
|
||||
$this->initDefaultConfigColumn($this->default_display);
|
||||
@@ -507,7 +507,7 @@ class module_report_activity extends module_report
|
||||
|
||||
$sqlBuilder = new module_report_sql($this->app, $this);
|
||||
$filter = $sqlBuilder->getFilters()->getReportFilter();
|
||||
$params = array_merge(array(), $filter['params']);
|
||||
$params = array_merge([], $filter['params']);
|
||||
|
||||
$sql = "
|
||||
SELECT tt.usrid, TRIM(" . $on . ") AS " . $on . ", tt.final, sum(1) AS nb, sum(size) AS poid
|
||||
@@ -532,12 +532,12 @@ class module_report_activity extends module_report
|
||||
|
||||
$save_user = "";
|
||||
$i = -1;
|
||||
$total = array(
|
||||
$total = [
|
||||
'nbdoc' => 0,
|
||||
'poiddoc' => 0,
|
||||
'nbprev' => 0,
|
||||
'poidprev' => 0
|
||||
);
|
||||
];
|
||||
|
||||
$this->setChamp($rs);
|
||||
|
||||
@@ -618,13 +618,13 @@ class module_report_activity extends module_report
|
||||
public static function topTenUser(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
|
||||
{
|
||||
$conn = connection::getPDOConnection($app, $sbas_id);
|
||||
$result = array();
|
||||
$result['top_ten_doc'] = array();
|
||||
$result['top_ten_prev'] = array();
|
||||
$result['top_ten_poiddoc'] = array();
|
||||
$result['top_ten_poidprev'] = array();
|
||||
$result = [];
|
||||
$result['top_ten_doc'] = [];
|
||||
$result['top_ten_prev'] = [];
|
||||
$result['top_ten_poiddoc'] = [];
|
||||
$result['top_ten_poidprev'] = [];
|
||||
|
||||
$params = array(':site_id' => $app['configuration']['main']['key']);
|
||||
$params = [':site_id' => $app['configuration']['main']['key']];
|
||||
|
||||
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$params = array_merge($params, $datefilter['params']);
|
||||
@@ -698,13 +698,13 @@ class module_report_activity extends module_report
|
||||
public static function activity(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
|
||||
{
|
||||
$conn = connection::getPDOConnection($app, $sbas_id);
|
||||
$res = array();
|
||||
$res = [];
|
||||
$datefilter =
|
||||
module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter =
|
||||
module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
|
||||
$params = array(':site_id' => $app['configuration']['main']['key']);
|
||||
$params = [':site_id' => $app['configuration']['main']['key']];
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
|
||||
$sql = "
|
||||
@@ -744,14 +744,14 @@ class module_report_activity extends module_report
|
||||
public static function activityDay(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
|
||||
{
|
||||
$conn = connection::getPDOConnection($app, $sbas_id);
|
||||
$result = array();
|
||||
$res = array();
|
||||
$result = [];
|
||||
$res = [];
|
||||
$datefilter =
|
||||
module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter =
|
||||
module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
|
||||
$params = array(':site_id' => $app['configuration']['main']['key']);
|
||||
$params = [':site_id' => $app['configuration']['main']['key']];
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
|
||||
$sql = "
|
||||
@@ -786,13 +786,13 @@ class module_report_activity extends module_report
|
||||
public static function activityQuestion(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
|
||||
{
|
||||
$conn = connection::getPDOConnection($app, $sbas_id);
|
||||
$result = array();
|
||||
$result = [];
|
||||
$datefilter =
|
||||
module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter =
|
||||
module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
|
||||
$params = array(':site_id' => $app['configuration']['main']['key']);
|
||||
$params = [':site_id' => $app['configuration']['main']['key']];
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
|
||||
$sql = "
|
||||
@@ -826,13 +826,13 @@ class module_report_activity extends module_report
|
||||
public static function activiteTopQuestion(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
|
||||
{
|
||||
$conn = connection::getPDOConnection($app, $sbas_id);
|
||||
$result = array();
|
||||
$result = [];
|
||||
$datefilter =
|
||||
module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter =
|
||||
module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
|
||||
$params = array(':site_id' => $app['configuration']['main']['key']);
|
||||
$params = [':site_id' => $app['configuration']['main']['key']];
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
|
||||
$sql = "
|
||||
@@ -854,7 +854,7 @@ class module_report_activity extends module_report
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$conv = array(" " => "");
|
||||
$conv = [" " => ""];
|
||||
foreach ($rs as $row) {
|
||||
$question = $row['question'];
|
||||
$question = mb_strtolower(strtr($question, $conv));
|
||||
@@ -869,11 +869,11 @@ class module_report_activity extends module_report
|
||||
public static function activiteTopTenSiteView(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
|
||||
{
|
||||
$conn = connection::getPDOConnection($app, $sbas_id);
|
||||
$result = array();
|
||||
$result = [];
|
||||
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
|
||||
$params = array();
|
||||
$params = [];
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
|
||||
$sql = "
|
||||
@@ -912,11 +912,11 @@ class module_report_activity extends module_report
|
||||
public static function activiteAddedDocument(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
|
||||
{
|
||||
$conn = connection::getPDOConnection($app, $sbas_id);
|
||||
$result = array();
|
||||
$result = [];
|
||||
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
|
||||
$params = array();
|
||||
$params = [];
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
|
||||
$sql = "
|
||||
@@ -947,11 +947,11 @@ class module_report_activity extends module_report
|
||||
public static function activiteEditedDocument(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
|
||||
{
|
||||
$conn = connection::getPDOConnection($app, $sbas_id);
|
||||
$result = array();
|
||||
$result = [];
|
||||
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
|
||||
$params = array();
|
||||
$params = [];
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
|
||||
$sql = "
|
||||
@@ -983,11 +983,11 @@ class module_report_activity extends module_report
|
||||
public static function activiteAddedTopTenUser(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
|
||||
{
|
||||
$conn = connection::getPDOConnection($app, $sbas_id);
|
||||
$result = array();
|
||||
$result = [];
|
||||
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
|
||||
$params = array();
|
||||
$params = [];
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
|
||||
$sql = "
|
||||
|
@@ -13,7 +13,7 @@ use Alchemy\Phrasea\Application;
|
||||
|
||||
class module_report_add extends module_report
|
||||
{
|
||||
protected $cor_query = array(
|
||||
protected $cor_query = [
|
||||
'user' => 'log.user',
|
||||
'site' => 'log.site',
|
||||
'societe' => 'log.societe',
|
||||
@@ -29,7 +29,7 @@ class module_report_add extends module_report
|
||||
'final' => 'd.final',
|
||||
'comment' => 'd.comment',
|
||||
'size' => 's.size'
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* constructor
|
||||
@@ -71,7 +71,7 @@ class module_report_add extends module_report
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
|
||||
foreach ($rs as $row) {
|
||||
$value = $row['val'];
|
||||
@@ -88,7 +88,7 @@ class module_report_add extends module_report
|
||||
elseif ($field == 'size')
|
||||
$caption = p4string::format_octets($value);
|
||||
|
||||
$ret[] = array('val' => $caption, 'value' => $value);
|
||||
$ret[] = ['val' => $caption, 'value' => $value];
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
@@ -13,7 +13,7 @@ use Alchemy\Phrasea\Application;
|
||||
|
||||
class module_report_connexion extends module_report
|
||||
{
|
||||
protected $cor_query = array(
|
||||
protected $cor_query = [
|
||||
'user' => 'log.user',
|
||||
'usrid' => 'log.usrid',
|
||||
'ddate' => 'log.date',
|
||||
@@ -25,7 +25,7 @@ class module_report_connexion extends module_report
|
||||
'sit_session' => 'log.sit_session',
|
||||
'appli' => 'log.appli',
|
||||
'ip' => 'log.ip'
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* constructor
|
||||
@@ -64,7 +64,7 @@ class module_report_connexion extends module_report
|
||||
*/
|
||||
public function colFilter($field)
|
||||
{
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
$sqlBuilder = $this->sqlBuilder('connexion');
|
||||
$var = $sqlBuilder->sqlDistinctValByField($field);
|
||||
$sql = $var['sql'];
|
||||
@@ -83,7 +83,7 @@ class module_report_connexion extends module_report
|
||||
$caption = $this->app['date-formatter']->getPrettyString(new DateTime($value));
|
||||
else
|
||||
$caption = $row['val'];
|
||||
$ret[] = array('val' => $caption, 'value' => $value);
|
||||
$ret[] = ['val' => $caption, 'value' => $value];
|
||||
}
|
||||
|
||||
return $ret;
|
||||
@@ -140,9 +140,9 @@ class module_report_connexion extends module_report
|
||||
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
|
||||
$params = array_merge(array(
|
||||
$params = array_merge([
|
||||
':site_id' => $app['configuration']['main']['key']
|
||||
),
|
||||
],
|
||||
$datefilter['params'],
|
||||
$collfilter['params']
|
||||
);
|
||||
|
@@ -36,13 +36,13 @@ class module_report_dashboard implements module_report_dashboard_componentInterf
|
||||
* a le droit de report
|
||||
* @var <array>
|
||||
*/
|
||||
public $authorizedCollection = array();
|
||||
public $authorizedCollection = [];
|
||||
|
||||
/**
|
||||
* @desc le tableau qui contient le dashboard
|
||||
* @var <array>
|
||||
*/
|
||||
public $dashboard = array();
|
||||
public $dashboard = [];
|
||||
|
||||
/**
|
||||
* @des le nombre par defaut de resultats afficher par categorie
|
||||
@@ -207,7 +207,7 @@ class module_report_dashboard implements module_report_dashboard_componentInterf
|
||||
$tri = $this->group()->tri();
|
||||
$x = $tri->getDash();
|
||||
$a = $tri->top()->getTop($this->nbtop);
|
||||
$this->dashboard = array();
|
||||
$this->dashboard = [];
|
||||
foreach ($a as $k => $v) {
|
||||
if (array_key_exists($k, $x)) {
|
||||
$x[$k] = $v;
|
||||
@@ -239,23 +239,23 @@ class module_report_dashboard implements module_report_dashboard_componentInterf
|
||||
*/
|
||||
public function getAllColl()
|
||||
{
|
||||
$all_coll = array();
|
||||
$all_coll = [];
|
||||
|
||||
$base_ids = $this->app['acl']->get($this->usr)->get_granted_base(array('canreport'));
|
||||
$base_ids = $this->app['acl']->get($this->usr)->get_granted_base(['canreport']);
|
||||
|
||||
foreach ($base_ids as $base_id => $collection) {
|
||||
$databox = $collection->get_databox();
|
||||
$sbas_id = $databox->get_sbas_id();
|
||||
if ( ! isset($all_coll[$sbas_id])) {
|
||||
$all_coll[$sbas_id] = array();
|
||||
$all_coll[$sbas_id] = [];
|
||||
$all_coll[$sbas_id]['name_sbas'] = $databox->get_label($this->app['locale.I18n']);
|
||||
}
|
||||
$all_coll[$sbas_id]['sbas_collections'][] = array(
|
||||
$all_coll[$sbas_id]['sbas_collections'][] = [
|
||||
'base_id' => $base_id,
|
||||
'sbas_id' => $sbas_id,
|
||||
'coll_id' => $collection->get_base_id(),
|
||||
'name' => $collection->get_label($this->app['locale.I18n'])
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return $all_coll;
|
||||
@@ -270,17 +270,17 @@ class module_report_dashboard implements module_report_dashboard_componentInterf
|
||||
$all_coll = $this->getAllColl();
|
||||
|
||||
foreach ($all_coll as $sbas => $info) {
|
||||
$listeColl = array();
|
||||
$listeColl = [];
|
||||
|
||||
foreach ($info['sbas_collections'] as $key => $value) {
|
||||
$listeColl[] = (int) $value['coll_id'];
|
||||
}
|
||||
|
||||
$this->authorizedCollection[(int) $sbas] = array(
|
||||
$this->authorizedCollection[(int) $sbas] = [
|
||||
'sbas_id' => (int) $sbas,
|
||||
'coll' => implode(',', $listeColl),
|
||||
'name' => phrasea::sbas_labels($sbas, $this->app)
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return;
|
||||
|
@@ -54,7 +54,7 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
|
||||
* @desc le tableau qui contien les resultats
|
||||
* @var <array>
|
||||
*/
|
||||
public $report = array();
|
||||
public $report = [];
|
||||
private $app;
|
||||
|
||||
/**
|
||||
@@ -242,9 +242,9 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
|
||||
|
||||
public function __sleep()
|
||||
{
|
||||
$vars = array();
|
||||
$vars = [];
|
||||
foreach ($this as $key => $value) {
|
||||
if (in_array($key, array('app')))
|
||||
if (in_array($key, ['app']))
|
||||
continue;
|
||||
$vars[] = $key;
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@
|
||||
class module_report_dashboard_group implements module_report_dashboard_componentInterface
|
||||
{
|
||||
public $group_dash;
|
||||
public $dashboard = array();
|
||||
public $dashboard = [];
|
||||
private $valid = false;
|
||||
|
||||
/**
|
||||
@@ -35,7 +35,7 @@ class module_report_dashboard_group implements module_report_dashboard_component
|
||||
{
|
||||
if ($this->valid) {
|
||||
if (is_null($this->group_dash))
|
||||
$this->group_dash = array();
|
||||
$this->group_dash = [];
|
||||
foreach ($this->dashboard as $key => $dash) {
|
||||
if (is_object($dash) &&
|
||||
$dash instanceof module_report_dashboard_feed &&
|
||||
|
@@ -11,8 +11,8 @@
|
||||
|
||||
class module_report_dashboard_merge implements module_report_dashboard_componentInterface
|
||||
{
|
||||
public $sort = array();
|
||||
public $sorted = array();
|
||||
public $sort = [];
|
||||
public $sorted = [];
|
||||
private $currentkey;
|
||||
private $valid = false;
|
||||
|
||||
|
@@ -11,8 +11,8 @@
|
||||
|
||||
class module_report_dashboard_sort implements module_report_dashboard_componentInterface
|
||||
{
|
||||
public $arrayToSort = array();
|
||||
public $arraySorted = array();
|
||||
public $arrayToSort = [];
|
||||
public $arraySorted = [];
|
||||
|
||||
public function __construct(module_report_dashboard_merge $tridash)
|
||||
{
|
||||
@@ -99,7 +99,7 @@ class module_report_dashboard_sort implements module_report_dashboard_componentI
|
||||
|
||||
foreach ($args as $n => $field) {
|
||||
if (is_string($field)) { // = clef
|
||||
$tmp = array();
|
||||
$tmp = [];
|
||||
foreach ($data as $key => $row)
|
||||
$tmp[$key] = $row[$field];
|
||||
$args[$n] = &$tmp;
|
||||
@@ -130,15 +130,15 @@ class module_report_dashboard_sort implements module_report_dashboard_componentI
|
||||
public function getTop($nbtop)
|
||||
{
|
||||
if ( ! is_int($nbtop)) {
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
$tmp = array();
|
||||
$tmp = [];
|
||||
|
||||
if ($this->isValid()) {
|
||||
foreach ($this->arraySorted as $k => $v) {
|
||||
$i = 0;
|
||||
$tmp[$k] = array();
|
||||
$tmp[$k] = [];
|
||||
foreach ($v as $a) {
|
||||
if ($i < $nbtop)
|
||||
array_push($tmp[$k], $a);
|
||||
|
@@ -13,7 +13,7 @@ use Alchemy\Phrasea\Application;
|
||||
|
||||
class module_report_download extends module_report
|
||||
{
|
||||
protected $cor_query = array(
|
||||
protected $cor_query = [
|
||||
'user' => 'log.user',
|
||||
'site' => 'log.site',
|
||||
'societe' => 'log.societe',
|
||||
@@ -31,7 +31,7 @@ class module_report_download extends module_report
|
||||
'size' => 'subdef.size',
|
||||
'mime' => 'subdef.mime',
|
||||
'file' => 'subdef.file'
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* constructor
|
||||
@@ -65,7 +65,7 @@ class module_report_download extends module_report
|
||||
|
||||
public function colFilter($field, $on = false)
|
||||
{
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
$sqlBuilder = $this->sqlBuilder('download');
|
||||
$var = $sqlBuilder->sqlDistinctValByField($field);
|
||||
$sql = $var['sql'];
|
||||
@@ -86,7 +86,7 @@ class module_report_download extends module_report
|
||||
$caption = p4string::format_octets($value);
|
||||
else
|
||||
$caption = $value;
|
||||
$ret[] = array('val' => $caption, 'value' => $value);
|
||||
$ret[] = ['val' => $caption, 'value' => $value];
|
||||
}
|
||||
|
||||
return $ret;
|
||||
@@ -174,7 +174,7 @@ class module_report_download extends module_report
|
||||
{
|
||||
$conn = connection::getPDOConnection($app, $sbas_id);
|
||||
|
||||
$params = array(':site_id' => $app['configuration']['main']['key']);
|
||||
$params = [':site_id' => $app['configuration']['main']['key']];
|
||||
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
@@ -210,16 +210,16 @@ class module_report_download extends module_report
|
||||
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||
$conn = $databox->get_connection();
|
||||
|
||||
$params = array(':site_id' => $app['configuration']['main']['key']);
|
||||
$params = [':site_id' => $app['configuration']['main']['key']];
|
||||
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
|
||||
$finalfilter = "";
|
||||
$array = array(
|
||||
'preview' => array(),
|
||||
'document' => array()
|
||||
);
|
||||
$array = [
|
||||
'preview' => [],
|
||||
'document' => []
|
||||
];
|
||||
|
||||
$finalfilter .= $datefilter['sql'] . ' AND ';
|
||||
$finalfilter .= $collfilter['sql'] . ' AND ';
|
||||
|
@@ -13,7 +13,7 @@ use Alchemy\Phrasea\Application;
|
||||
|
||||
class module_report_edit extends module_report
|
||||
{
|
||||
protected $cor_query = array(
|
||||
protected $cor_query = [
|
||||
'user' => 'log.user',
|
||||
'site' => 'log.site',
|
||||
'societe' => 'log.societe',
|
||||
@@ -29,7 +29,7 @@ class module_report_edit extends module_report
|
||||
'final' => 'd.final',
|
||||
'comment' => 'd.comment',
|
||||
'size' => 's.size'
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* constructor
|
||||
@@ -72,7 +72,7 @@ class module_report_edit extends module_report
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
foreach ($rs as $row) {
|
||||
$value = $row['val'];
|
||||
$caption = $value;
|
||||
@@ -89,7 +89,7 @@ class module_report_edit extends module_report
|
||||
$caption = p4string::format_octets($value);
|
||||
}
|
||||
|
||||
$ret[] = array('val' => $caption, 'value' => $value);
|
||||
$ret[] = ['val' => $caption, 'value' => $value];
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
@@ -14,10 +14,10 @@ use Alchemy\Phrasea\Application;
|
||||
class module_report_filter
|
||||
{
|
||||
private $app;
|
||||
private $posting_filter = array();
|
||||
private $cor_query = array();
|
||||
private $active_column = array();
|
||||
private $trans = array(
|
||||
private $posting_filter = [];
|
||||
private $cor_query = [];
|
||||
private $active_column = [];
|
||||
private $trans = [
|
||||
'user' => 'phraseanet::utilisateurs',
|
||||
'ddate' => 'report:: date',
|
||||
'ip' => 'report:: IP',
|
||||
@@ -31,7 +31,7 @@ class module_report_filter
|
||||
'coll_id' => 'report:: collections',
|
||||
'comment' => 'report:: commentaire',
|
||||
'search' => 'report:: question',
|
||||
);
|
||||
];
|
||||
|
||||
public function __construct(Application $app, $current_filter, $correspondance)
|
||||
{
|
||||
@@ -64,7 +64,7 @@ class module_report_filter
|
||||
public function addFilter($field, $operator, $value)
|
||||
{
|
||||
if ($this->checkSameFilter($field, $operator, $value))
|
||||
$this->tab_filter[] = array('f' => $field, 'o' => $operator, 'v' => $value);
|
||||
$this->tab_filter[] = ['f' => $field, 'o' => $operator, 'v' => $value];
|
||||
}
|
||||
|
||||
public function getPostingFilter()
|
||||
@@ -87,7 +87,7 @@ class module_report_filter
|
||||
$value = $this->app['date-formatter']->getPrettyString(new DateTime($value));
|
||||
}
|
||||
|
||||
$this->posting_filter[] = array('f' => $field, 'v' => $value);
|
||||
$this->posting_filter[] = ['f' => $field, 'v' => $value];
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@ class module_report_nav extends module_report
|
||||
*/
|
||||
public $total_pourcent = null;
|
||||
public $config = false;
|
||||
public $cor_query = array(
|
||||
public $cor_query = [
|
||||
'user' => 'log.user',
|
||||
'site' => 'log.site',
|
||||
'societe' => 'log.societe',
|
||||
@@ -35,7 +35,7 @@ class module_report_nav extends module_report
|
||||
'final' => 'log_docs.final',
|
||||
'comment' => 'log_docs.comment',
|
||||
'size' => 'subdef.size'
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* constructor
|
||||
@@ -57,7 +57,7 @@ class module_report_nav extends module_report
|
||||
$filter = $sqlBuilder->getFilters();
|
||||
|
||||
$report_filter = $filter->getReportFilter();
|
||||
$params = array_merge(array(), $report_filter['params']);
|
||||
$params = array_merge([], $report_filter['params']);
|
||||
|
||||
$sql = '
|
||||
SELECT SUM(1) AS total FROM (
|
||||
@@ -81,12 +81,12 @@ class module_report_nav extends module_report
|
||||
*/
|
||||
private function initialize()
|
||||
{
|
||||
$this->report['legend'] = array();
|
||||
$this->report['value'] = array();
|
||||
$this->result = array();
|
||||
$this->champ = array();
|
||||
$this->default_display = array();
|
||||
$this->display = array();
|
||||
$this->report['legend'] = [];
|
||||
$this->report['value'] = [];
|
||||
$this->result = [];
|
||||
$this->champ = [];
|
||||
$this->default_display = [];
|
||||
$this->display = [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,7 +109,7 @@ class module_report_nav extends module_report
|
||||
}
|
||||
|
||||
$report_filter = $filter->getReportFilter();
|
||||
$params = array_merge(array(), $report_filter['params']);
|
||||
$params = array_merge([], $report_filter['params']);
|
||||
|
||||
$sql = '
|
||||
SELECT tt.nav, SUM(1) AS nb, ROUND((SUM(1) / ' . $this->total_pourcent . ' * 100), 1) AS pourcent
|
||||
@@ -168,7 +168,7 @@ class module_report_nav extends module_report
|
||||
}
|
||||
|
||||
$report_filter = $filter->getReportFilter();
|
||||
$params = array_merge(array(), $report_filter['params']);
|
||||
$params = array_merge([], $report_filter['params']);
|
||||
|
||||
$sql = '
|
||||
SELECT tt.os, COUNT(os) AS nb, ROUND((COUNT(os)/' . $this->total_pourcent . '*100),1) AS pourcent
|
||||
@@ -226,7 +226,7 @@ class module_report_nav extends module_report
|
||||
}
|
||||
|
||||
$report_filter = $filter->getReportFilter();
|
||||
$params = array_merge(array(), $report_filter['params']);
|
||||
$params = array_merge([], $report_filter['params']);
|
||||
|
||||
$sql = '
|
||||
SELECT tt.res, COUNT(res) AS nb, ROUND((COUNT(res)/ ' . $this->total_pourcent . '*100),1) AS pourcent
|
||||
@@ -286,7 +286,7 @@ class module_report_nav extends module_report
|
||||
}
|
||||
|
||||
$report_filter = $filter->getReportFilter();
|
||||
$params = array_merge(array(), $report_filter['params']);
|
||||
$params = array_merge([], $report_filter['params']);
|
||||
|
||||
$sql = "
|
||||
SELECT tt.combo, COUNT( tt.combo ) AS nb, ROUND((COUNT(tt.combo)/" . $this->total_pourcent . "*100), 1) AS pourcent
|
||||
@@ -338,8 +338,8 @@ class module_report_nav extends module_report
|
||||
$sqlBuilder = new module_report_sql($this->app, $this);
|
||||
$filter = $sqlBuilder->getFilters();
|
||||
$this->title = _('report:: modules');
|
||||
$x = array();
|
||||
$tab_appli = array();
|
||||
$x = [];
|
||||
$tab_appli = [];
|
||||
|
||||
$this->total_pourcent = $this->setTotalPourcent();
|
||||
|
||||
@@ -348,7 +348,7 @@ class module_report_nav extends module_report
|
||||
}
|
||||
|
||||
$report_filter = $filter->getReportFilter();
|
||||
$params = array_merge(array(), $report_filter['params']);
|
||||
$params = array_merge([], $report_filter['params']);
|
||||
|
||||
$sql = '
|
||||
SELECT tt.appli
|
||||
@@ -391,11 +391,11 @@ class module_report_nav extends module_report
|
||||
foreach ($tab_appli as $appli => $nb) {
|
||||
$pourcent = round(($nb / $total) * 100, 1);
|
||||
foreach ($this->champ as $key => $value) {
|
||||
$this->result[] = array(
|
||||
$this->result[] = [
|
||||
'appli' => $appli,
|
||||
'nb' => $nb,
|
||||
'pourcent' => $pourcent . '%'
|
||||
);
|
||||
];
|
||||
}
|
||||
$this->report['value'][] = $nb;
|
||||
$this->report['legend'][] = $appli;
|
||||
@@ -412,7 +412,7 @@ class module_report_nav extends module_report
|
||||
{
|
||||
$this->initialize();
|
||||
empty($on) ? $on = false : "";
|
||||
$filter_id_apbox = $filter_id_datbox = array();
|
||||
$filter_id_apbox = $filter_id_datbox = [];
|
||||
$conn = $this->app['phraseanet.appbox']->get_connection();
|
||||
|
||||
$this->title = sprintf(_('report:: Information sur les utilisateurs correspondant a %s'), $val);
|
||||
@@ -452,7 +452,7 @@ class module_report_nav extends module_report
|
||||
WHERE (usr_id = :value)';
|
||||
}
|
||||
|
||||
$params2 = array(':value' => $val);
|
||||
$params2 = [':value' => $val];
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute($params2);
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
@@ -503,21 +503,21 @@ class module_report_nav extends module_report
|
||||
}
|
||||
|
||||
$this->setDisplay($tab);
|
||||
$this->champ = array(
|
||||
$this->champ = [
|
||||
'photo',
|
||||
'record_id',
|
||||
'date',
|
||||
'type',
|
||||
'titre',
|
||||
'taille'
|
||||
);
|
||||
];
|
||||
|
||||
$document = $record->get_subdef('document');
|
||||
$this->title = sprintf(
|
||||
_('report:: Information sur l\'enregistrement numero %d'), (int) $rid);
|
||||
|
||||
$x = $record->get_thumbnail();
|
||||
$this->result[] = array(
|
||||
$this->result[] = [
|
||||
'photo' =>
|
||||
"<img style='width:" . $x->get_width() . "px;height:" . $x->get_height() . "px;'
|
||||
src='" . $x->get_url() . "'>"
|
||||
@@ -526,7 +526,7 @@ class module_report_nav extends module_report
|
||||
, 'type' => $document->get_mime()
|
||||
, 'titre' => $record->get_title()
|
||||
, 'taille' => $document->get_size()
|
||||
);
|
||||
];
|
||||
|
||||
$this->setDisplayNav();
|
||||
$this->setReport();
|
||||
@@ -542,7 +542,7 @@ class module_report_nav extends module_report
|
||||
$sqlBuilder = new module_report_sql($this->app, $this);
|
||||
$filter = $sqlBuilder->getFilters();
|
||||
$report_filter = $filter->getReportFilter();
|
||||
$params = array_merge($report_filter['params'], array(':browser' => $navigator));
|
||||
$params = array_merge($report_filter['params'], [':browser' => $navigator]);
|
||||
|
||||
$sql = "
|
||||
SELECT DISTINCT(tt.version), COUNT(tt.version) as nb
|
||||
|
@@ -13,7 +13,7 @@ use Alchemy\Phrasea\Application;
|
||||
|
||||
class module_report_push extends module_report
|
||||
{
|
||||
protected $cor_query = array(
|
||||
protected $cor_query = [
|
||||
'user' => 'log.user',
|
||||
'site' => 'log.site',
|
||||
'societe' => 'log.societe',
|
||||
@@ -29,7 +29,7 @@ class module_report_push extends module_report
|
||||
'final' => 'd.final',
|
||||
'comment' => 'd.comment',
|
||||
'size' => 's.size'
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* constructor
|
||||
@@ -72,7 +72,7 @@ class module_report_push extends module_report
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
|
||||
foreach ($rs as $row) {
|
||||
$value = $row['val'];
|
||||
@@ -90,7 +90,7 @@ class module_report_push extends module_report
|
||||
$caption = p4string::format_octets($value);
|
||||
}
|
||||
|
||||
$ret[] = array('val' => $caption, 'value' => $value);
|
||||
$ret[] = ['val' => $caption, 'value' => $value];
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
@@ -13,7 +13,7 @@ use Alchemy\Phrasea\Application;
|
||||
|
||||
class module_report_question extends module_report
|
||||
{
|
||||
protected $cor_query = array(
|
||||
protected $cor_query = [
|
||||
'user' => 'log.user',
|
||||
'usrid' => 'log.usrid',
|
||||
'ddate' => 'log_search.date',
|
||||
@@ -26,7 +26,7 @@ class module_report_question extends module_report
|
||||
'sit_session' => 'log.sit_session',
|
||||
'appli' => 'log.appli',
|
||||
'ip' => 'log.ip'
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* constructor
|
||||
@@ -58,7 +58,7 @@ class module_report_question extends module_report
|
||||
|
||||
public function colFilter($field)
|
||||
{
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
$sqlBuilder = $this->sqlBuilder('question');
|
||||
$var = $sqlBuilder->sqlDistinctValByField($field);
|
||||
$sql = $var['sql'];
|
||||
@@ -76,7 +76,7 @@ class module_report_question extends module_report
|
||||
$caption = $this->app['date-formatter']->getPrettyString(new DateTime($value));
|
||||
else
|
||||
$caption = $row['val'];
|
||||
$ret[] = array('val' => $caption, 'value' => $value);
|
||||
$ret[] = ['val' => $caption, 'value' => $value];
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
@@ -13,7 +13,7 @@ use Alchemy\Phrasea\Application;
|
||||
|
||||
class module_report_sent extends module_report
|
||||
{
|
||||
protected $cor_query = array(
|
||||
protected $cor_query = [
|
||||
'user' => 'log.user',
|
||||
'site' => 'log.site',
|
||||
'societe' => 'log.societe',
|
||||
@@ -29,7 +29,7 @@ class module_report_sent extends module_report
|
||||
'final' => 'd.final',
|
||||
'comment' => 'd.comment',
|
||||
'size' => 's.size'
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* constructor
|
||||
@@ -72,7 +72,7 @@ class module_report_sent extends module_report
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
|
||||
foreach ($rs as $row) {
|
||||
$value = $row['val'];
|
||||
@@ -90,7 +90,7 @@ class module_report_sent extends module_report
|
||||
$caption = p4string::format_octets($value);
|
||||
}
|
||||
|
||||
$ret[] = array('val' => $caption, 'value' => $value);
|
||||
$ret[] = ['val' => $caption, 'value' => $value];
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
@@ -43,7 +43,7 @@ class module_report_sql
|
||||
$this->connbas = connection::getPDOConnection($app, $report->getSbasId());
|
||||
$this->filter = new module_report_sqlfilter($app, $report);
|
||||
$this->sql = '';
|
||||
$this->params = array();
|
||||
$this->params = [];
|
||||
$this->total_row = 0;
|
||||
$this->enable_limit = $report->getEnableLimit();
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ class module_report_sqlaction extends module_report_sql implements module_report
|
||||
|
||||
public function setAction($action)
|
||||
{
|
||||
$a = array('edit', 'add', 'push', 'validate', 'mail');
|
||||
$a = ['edit', 'add', 'push', 'validate', 'mail'];
|
||||
|
||||
if (in_array($action, $a)) {
|
||||
$this->action = $action;
|
||||
@@ -38,10 +38,10 @@ class module_report_sqlaction extends module_report_sql implements module_report
|
||||
|
||||
public function buildSql()
|
||||
{
|
||||
$customFieldMap = array();
|
||||
$customFieldMap = [];
|
||||
|
||||
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
|
||||
$this->params = array_merge(array(':action' => $this->action), $filter['params']);
|
||||
$filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false];
|
||||
$this->params = array_merge([':action' => $this->action], $filter['params']);
|
||||
|
||||
if ($this->groupby == false) {
|
||||
$this->sql = "
|
||||
@@ -55,7 +55,7 @@ class module_report_sqlaction extends module_report_sql implements module_report
|
||||
WHERE (" . $filter['sql'] . ") AND (d.action = :action)
|
||||
) AS tt";
|
||||
|
||||
$customFieldMap = array(
|
||||
$customFieldMap = [
|
||||
'log.usrid' => 'tt.usrid',
|
||||
'log.user' => 'tt.user',
|
||||
'd.final' => 'getter',
|
||||
@@ -64,7 +64,7 @@ class module_report_sqlaction extends module_report_sql implements module_report
|
||||
'record.mime' => 'tt.mime',
|
||||
'file' => 'tt.file',
|
||||
'd.comment' => 'tt.comment'
|
||||
);
|
||||
];
|
||||
|
||||
$stmt = $this->getConnBas()->prepare($this->sql);
|
||||
$stmt->execute($this->params);
|
||||
@@ -100,8 +100,8 @@ class module_report_sqlaction extends module_report_sql implements module_report
|
||||
|
||||
public function sqlDistinctValByField($field)
|
||||
{
|
||||
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
|
||||
$this->params = array_merge(array(':action' => $this->action), $filter['params']);
|
||||
$filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false];
|
||||
$this->params = array_merge([':action' => $this->action], $filter['params']);
|
||||
|
||||
$this->sql = "
|
||||
SELECT DISTINCT(val)
|
||||
@@ -116,6 +116,6 @@ class module_report_sqlaction extends module_report_sql implements module_report
|
||||
AND (d.action = :action)
|
||||
) AS tt " . ($this->filter->getOrderFilter() ? $this->filter->getOrderFilter() : '');
|
||||
|
||||
return array('sql' => $this->sql, 'params' => $this->params);
|
||||
return ['sql' => $this->sql, 'params' => $this->params];
|
||||
}
|
||||
}
|
||||
|
@@ -21,8 +21,8 @@ class module_report_sqlconnexion extends module_report_sql implements module_rep
|
||||
|
||||
public function buildSql()
|
||||
{
|
||||
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
|
||||
$this->params = array_merge(array(), $filter['params']);
|
||||
$filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false];
|
||||
$this->params = array_merge([], $filter['params']);
|
||||
|
||||
if ($this->groupby == false) {
|
||||
$this->sql = "
|
||||
@@ -76,8 +76,8 @@ class module_report_sqlconnexion extends module_report_sql implements module_rep
|
||||
|
||||
public function sqlDistinctValByField($field)
|
||||
{
|
||||
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
|
||||
$this->params = array_merge(array(), $filter['params']);
|
||||
$filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false];
|
||||
$this->params = array_merge([], $filter['params']);
|
||||
|
||||
$this->sql = '
|
||||
SELECT DISTINCT(val)
|
||||
@@ -88,6 +88,6 @@ class module_report_sqlconnexion extends module_report_sql implements module_rep
|
||||
WHERE (' . $filter['sql'] . ')
|
||||
) AS tt ORDER BY val ASC';
|
||||
|
||||
return array('sql' => $this->sql, 'params' => $this->params);
|
||||
return ['sql' => $this->sql, 'params' => $this->params];
|
||||
}
|
||||
}
|
||||
|
@@ -25,10 +25,10 @@ class module_report_sqldownload extends module_report_sql implements module_repo
|
||||
|
||||
public function buildSql()
|
||||
{
|
||||
$customFieldMap = array();
|
||||
$customFieldMap = [];
|
||||
|
||||
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
|
||||
$this->params = array_merge(array(), $filter['params']);
|
||||
$filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false];
|
||||
$this->params = array_merge([], $filter['params']);
|
||||
|
||||
if ($this->groupby == false) {
|
||||
$this->sql = "
|
||||
@@ -57,14 +57,14 @@ class module_report_sqldownload extends module_report_sql implements module_repo
|
||||
INNER JOIN record ON (log_docs.record_id = record.record_id)
|
||||
INNER JOIN subdef ON (log_docs.record_id = subdef.record_id)';
|
||||
|
||||
$customFieldMap = array(
|
||||
$customFieldMap = [
|
||||
$field => $name,
|
||||
'log_docs.comment' => 'tt.comment',
|
||||
'subdef.size' => 'tt.size',
|
||||
'subdef.file' => 'tt.file',
|
||||
'subdef.mime' => 'tt.mime',
|
||||
'log_docs.final' => 'tt.final',
|
||||
);
|
||||
];
|
||||
|
||||
} elseif ($this->on == 'DOC') {
|
||||
$this->sql = '
|
||||
@@ -115,8 +115,8 @@ class module_report_sqldownload extends module_report_sql implements module_repo
|
||||
|
||||
public function sqlDistinctValByField($field)
|
||||
{
|
||||
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
|
||||
$this->params = array_merge(array(), $filter['params']);
|
||||
$filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false];
|
||||
$this->params = array_merge([], $filter['params']);
|
||||
|
||||
$this->sql = '
|
||||
SELECT DISTINCT(tt.val)
|
||||
@@ -135,6 +135,6 @@ class module_report_sqldownload extends module_report_sql implements module_repo
|
||||
$this->sql .= $this->filter->getOrderFilter() ? : '';
|
||||
$this->sql .= $this->filter->getLimitFilter() ? : '';
|
||||
|
||||
return array('sql' => $this->sql, 'params' => $this->params);
|
||||
return ['sql' => $this->sql, 'params' => $this->params];
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ class module_report_sqlfilter
|
||||
{
|
||||
public $conn;
|
||||
private $filter;
|
||||
private $cor_query = array();
|
||||
private $cor_query = [];
|
||||
private $app;
|
||||
private $report;
|
||||
|
||||
@@ -34,16 +34,16 @@ class module_report_sqlfilter
|
||||
|
||||
public static function constructDateFilter($dmin, $dmax)
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
'sql' => ($dmin && $dmax ? ' log_date.date > :date_min AND log_date.date < :date_max ' : false)
|
||||
, 'params' => ($dmin && $dmax ? array(':date_min' => $dmin, ':date_max' => $dmax) : array())
|
||||
);
|
||||
, 'params' => ($dmin && $dmax ? [':date_min' => $dmin, ':date_max' => $dmax] : [])
|
||||
];
|
||||
}
|
||||
|
||||
public static function constructCollectionFilter(Application $app, $list_coll_id)
|
||||
{
|
||||
$ret = array('sql' => '', 'params' => array());
|
||||
$coll_filter = array();
|
||||
$ret = ['sql' => '', 'params' => []];
|
||||
$coll_filter = [];
|
||||
foreach (array_filter(explode(',', $list_coll_id)) as $val) {
|
||||
$val = \phrasea::collFromBas($app, $val);
|
||||
if ($val) {
|
||||
@@ -64,7 +64,7 @@ class module_report_sqlfilter
|
||||
{
|
||||
$finalfilter = '';
|
||||
|
||||
$params = array(':log_site' => $this->app['configuration']['main']['key']);
|
||||
$params = [':log_site' => $this->app['configuration']['main']['key']];
|
||||
|
||||
if ($this->filter['date']) {
|
||||
$finalfilter .= $this->filter['date']['sql'] . ' AND ';
|
||||
@@ -80,22 +80,22 @@ class module_report_sqlfilter
|
||||
}
|
||||
$finalfilter .= ' log.site = :log_site';
|
||||
|
||||
return array('sql' => $finalfilter, 'params' => $params);
|
||||
return ['sql' => $finalfilter, 'params' => $params];
|
||||
}
|
||||
|
||||
public function getGvSitFilter()
|
||||
{
|
||||
$params = array();
|
||||
$params = [];
|
||||
|
||||
$sql = 'log.site = :log_site_gv_filter';
|
||||
$params[':log_site_gv_filter'] = $this->app['configuration']['main']['key'];
|
||||
|
||||
return array('sql' => $sql, 'params' => $params);
|
||||
return ['sql' => $sql, 'params' => $params];
|
||||
}
|
||||
|
||||
public function getUserIdFilter($id)
|
||||
{
|
||||
return array('sql' => "log.usrid = :usr_id_filter", 'params' => array(':usr_id_filter' => $id));
|
||||
return ['sql' => "log.usrid = :usr_id_filter", 'params' => [':usr_id_filter' => $id]];
|
||||
}
|
||||
|
||||
public function getDateFilter()
|
||||
@@ -136,13 +136,13 @@ class module_report_sqlfilter
|
||||
{
|
||||
$this->filter['date'] = false;
|
||||
if ($report->getDmin() && $report->getDmax()) {
|
||||
$this->filter['date'] = array(
|
||||
$this->filter['date'] = [
|
||||
'sql' => ' (log.date > :date_min_f AND log.date < :date_max_f) '
|
||||
, 'params' => array(
|
||||
, 'params' => [
|
||||
':date_min_f' => $report->getDmin()
|
||||
, ':date_max_f' => $report->getDmax()
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -154,15 +154,15 @@ class module_report_sqlfilter
|
||||
$f = $report->getTabFilter();
|
||||
|
||||
if (sizeof($f) > 0) {
|
||||
$filter = array();
|
||||
$params = array();
|
||||
$filter = [];
|
||||
$params = [];
|
||||
$n = 0;
|
||||
foreach ($f as $field => $value) {
|
||||
if (array_key_exists($value['f'], $this->cor_query))
|
||||
$value['f'] = $this->cor_query[$value['f']];
|
||||
|
||||
if ($value['o'] == 'LIKE') {
|
||||
$filter[] = $value['f'] . ' ' . $value['o'] . ' \'%' . str_replace(array("'", '%'), array("\'", '\%'), ' :user_filter' . $n) . '%\'';
|
||||
$filter[] = $value['f'] . ' ' . $value['o'] . ' \'%' . str_replace(["'", '%'], ["\'", '\%'], ' :user_filter' . $n) . '%\'';
|
||||
$params[':user_filter' . $n] = $value['v'];
|
||||
} elseif ($value['o'] == 'OR') {
|
||||
$filter[] = $value['f'] . ' ' . $value['o'] . ' :user_filter' . $n;
|
||||
@@ -174,7 +174,7 @@ class module_report_sqlfilter
|
||||
|
||||
$n ++;
|
||||
}
|
||||
$filter_user = array('sql' => implode(' AND ', $filter), 'params' => $params);
|
||||
$filter_user = ['sql' => implode(' AND ', $filter), 'params' => $params];
|
||||
|
||||
$this->filter['user'] = $filter_user;
|
||||
}
|
||||
@@ -185,7 +185,7 @@ class module_report_sqlfilter
|
||||
private function collectionFilter(module_report $report)
|
||||
{
|
||||
$this->filter['collection'] = false;
|
||||
$coll_filter = array();
|
||||
$coll_filter = [];
|
||||
|
||||
if ($report->getUserId() == '') {
|
||||
return;
|
||||
@@ -201,7 +201,7 @@ class module_report_sqlfilter
|
||||
}
|
||||
}
|
||||
|
||||
$this->filter['collection'] = array('sql' => ' (' . implode(' OR ', array_unique($coll_filter)) . ') ', 'params' => array());
|
||||
$this->filter['collection'] = ['sql' => ' (' . implode(' OR ', array_unique($coll_filter)) . ') ', 'params' => []];
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -210,7 +210,7 @@ class module_report_sqlfilter
|
||||
private function recordFilter(module_report $report)
|
||||
{
|
||||
$this->filter['record'] = false;
|
||||
$dl_coll_filter = $params = array();
|
||||
$dl_coll_filter = $params = [];
|
||||
$n = 0;
|
||||
if (($report->getUserId() != '')) {
|
||||
$tab = explode(",", $report->getListCollId());
|
||||
@@ -219,7 +219,7 @@ class module_report_sqlfilter
|
||||
$params[":record_fil" . $n] = phrasea::collFromBas($this->app, $val);
|
||||
$n ++;
|
||||
}
|
||||
$this->filter['record'] = array('sql' => implode(' OR ', $dl_coll_filter), 'params' => $params);
|
||||
$this->filter['record'] = ['sql' => implode(' OR ', $dl_coll_filter), 'params' => $params];
|
||||
}
|
||||
|
||||
return;
|
||||
|
@@ -21,8 +21,8 @@ class module_report_sqlquestion extends module_report_sql implements module_repo
|
||||
|
||||
public function buildSql()
|
||||
{
|
||||
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
|
||||
$this->params = array_merge(array(), $filter['params']);
|
||||
$filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false];
|
||||
$this->params = array_merge([], $filter['params']);
|
||||
|
||||
if ($this->groupby == false) {
|
||||
$this->sql ="
|
||||
@@ -65,8 +65,8 @@ class module_report_sqlquestion extends module_report_sql implements module_repo
|
||||
|
||||
public function sqlDistinctValByField($field)
|
||||
{
|
||||
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
|
||||
$this->params = array_merge(array(), $filter['params']);
|
||||
$filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false];
|
||||
$this->params = array_merge([], $filter['params']);
|
||||
|
||||
$this->sql = "
|
||||
SELECT DISTINCT(tt.val)
|
||||
@@ -79,6 +79,6 @@ class module_report_sqlquestion extends module_report_sql implements module_repo
|
||||
) as tt
|
||||
ORDER BY tt.val ASC";
|
||||
|
||||
return array('sql' => $this->sql, 'params' => $this->params);
|
||||
return ['sql' => $this->sql, 'params' => $this->params];
|
||||
}
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ use Alchemy\Phrasea\Application;
|
||||
|
||||
class module_report_validate extends module_report
|
||||
{
|
||||
protected $cor_query = array(
|
||||
protected $cor_query = [
|
||||
'user' => 'log.user',
|
||||
'site' => 'log.site',
|
||||
'societe' => 'log.societe',
|
||||
@@ -29,7 +29,7 @@ class module_report_validate extends module_report
|
||||
'final' => 'd.final',
|
||||
'comment' => 'd.comment',
|
||||
'size' => 's.size'
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* constructor
|
||||
@@ -72,7 +72,7 @@ class module_report_validate extends module_report
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
|
||||
foreach ($rs as $row) {
|
||||
$value = $row['val'];
|
||||
@@ -90,7 +90,7 @@ class module_report_validate extends module_report
|
||||
$caption = p4string::format_octets($value);
|
||||
}
|
||||
|
||||
$ret[] = array('val' => $caption, 'value' => $value);
|
||||
$ret[] = ['val' => $caption, 'value' => $value];
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
Reference in New Issue
Block a user