mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 06:53:15 +00:00
@@ -780,26 +780,24 @@ class module_report
|
||||
|
||||
foreach ($tab as $column => $row) {
|
||||
foreach ($row as $ind => $value) {
|
||||
$def = false;
|
||||
$title_text = "";
|
||||
if (array_key_exists($column, $this->cor)) {
|
||||
$title_text = $this->cor[$column];
|
||||
$def = true;
|
||||
}
|
||||
empty($row[0]) ? $title = $column : $title = $row[0];
|
||||
|
||||
$title = empty($row[0]) ? "" : $row[0];
|
||||
|
||||
$sort = $row[1];
|
||||
array_key_exists($column, $this->bound) ?
|
||||
$bound = $this->bound[$column] : $bound = $row[2];
|
||||
$bound = array_key_exists($column, $this->bound) ? $this->bound[$column] : $row[2];
|
||||
$filter = (isset($row[3]) ? $row[3] : 0);
|
||||
$groupby = $row[4];
|
||||
$config = array(
|
||||
'title' => $title,
|
||||
'title' => empty($title) ? (empty($title_text) ? $column : $title_text) : $title,
|
||||
'sort' => $sort,
|
||||
'bound' => $bound,
|
||||
'filter' => $filter,
|
||||
'groupby' => $groupby
|
||||
);
|
||||
$def ? $config['title'] = $title_text : "";
|
||||
|
||||
$this->display[$column] = $config;
|
||||
}
|
||||
|
127
lib/classes/module/report/sent.php
Normal file
127
lib/classes/module/report/sent.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2013 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
|
||||
class module_report_sent extends module_report
|
||||
{
|
||||
protected $cor_query = array(
|
||||
'user' => 'log.user',
|
||||
'site' => 'log.site',
|
||||
'societe' => 'log.societe',
|
||||
'pays' => 'log.pays',
|
||||
'activite' => 'log.activite',
|
||||
'fonction' => 'log.fonction',
|
||||
'usrid' => 'log.usrid',
|
||||
'getter' => 'd.final',
|
||||
'date' => "DATE(d.date)",
|
||||
'id' => 'd.id',
|
||||
'log_id' => 'd.log_id',
|
||||
'record_id' => 'd.record_id',
|
||||
'final' => 'd.final',
|
||||
'comment' => 'd.comment',
|
||||
'size' => 's.size'
|
||||
);
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param Application $app
|
||||
* @param string $arg1 start date of the report
|
||||
* @param string $arg2 end date of the report
|
||||
* @param integer $sbas_id id of the databox
|
||||
* @param string $collist
|
||||
*/
|
||||
public function __construct(Application $app, $arg1, $arg2, $sbas_id, $collist)
|
||||
{
|
||||
parent::__construct($app, $arg1, $arg2, $sbas_id, $collist);
|
||||
$this->title = _('Sent documents (mail)');
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc build the specified requete
|
||||
* @param $obj $conn the current connection to databox
|
||||
* @return string
|
||||
*/
|
||||
protected function buildReq($groupby = false, $on = false)
|
||||
{
|
||||
$sqlBuilder = $this->sqlBuilder('action')->setGroupBy($groupby)->setOn($on)
|
||||
->setAction('mail')->buildSql();
|
||||
$this->req = $sqlBuilder->getSql();
|
||||
$this->params = $sqlBuilder->getParams();
|
||||
$this->total = $sqlBuilder->getTotalRows();
|
||||
}
|
||||
|
||||
public function colFilter($field, $on = false)
|
||||
{
|
||||
$sqlBuilder = $this->sqlBuilder('action')->setAction('mail');
|
||||
$var = $sqlBuilder->sqlDistinctValByField($field);
|
||||
$sql = $var['sql'];
|
||||
$params = $var['params'];
|
||||
|
||||
$stmt = $sqlBuilder->getConnBas()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$ret = array();
|
||||
|
||||
foreach ($rs as $row) {
|
||||
$value = $row['val'];
|
||||
$caption = $value;
|
||||
if ($field == "getter") {
|
||||
try {
|
||||
$user = User_Adapter::getInstance($value, $this->app);
|
||||
$caption = $user->get_display_name();
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
} elseif ($field == 'date') {
|
||||
$caption = $this->app['date-formatter']->getPrettyString(new DateTime($value));
|
||||
} elseif ($field == 'size') {
|
||||
$caption = p4string::format_octets($value);
|
||||
}
|
||||
|
||||
$ret[] = array('val' => $caption, 'value' => $value);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
protected function buildResult(Application $app, $rs)
|
||||
{
|
||||
$i = 0;
|
||||
|
||||
foreach ($rs as $row) {
|
||||
if ($i >= $this->nb_record)
|
||||
break;
|
||||
foreach ($this->champ as $key => $value) {
|
||||
if ($row[$value]) {
|
||||
if ($value == 'date') {
|
||||
$this->result[$i][$value] = $this->pretty_string ?
|
||||
$this->app['date-formatter']->getPrettyString(new DateTime($row[$value])) :
|
||||
$row[$value];
|
||||
} elseif ($value == 'size') {
|
||||
$this->result[$i][$value] = p4string::format_octets($row[$value]);
|
||||
} else
|
||||
$this->result[$i][$value] = $row[$value];
|
||||
} else {
|
||||
if ($value == 'comment') {
|
||||
$this->result[$i][$value] = ' ';
|
||||
} else {
|
||||
$this->result[$i][$value] = '<i>' . _('report:: non-renseigne') . '</i>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
}
|
@@ -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');
|
||||
$a = array('edit', 'add', 'push', 'validate', 'mail');
|
||||
|
||||
if (in_array($action, $a)) {
|
||||
$this->action = $action;
|
||||
@@ -45,9 +45,9 @@ class module_report_sqlaction extends module_report_sql implements module_report
|
||||
|
||||
if ($this->groupby == false) {
|
||||
$this->sql = "
|
||||
SELECT tt.usrid, tt.user, tt.final AS getter, tt.record_id, tt.date, tt.mime, tt.file
|
||||
SELECT tt.usrid, tt.user, tt.final AS getter, tt.record_id, tt.date, tt.mime, tt.file, tt.comment
|
||||
FROM (
|
||||
SELECT DISTINCT(log.id), log.usrid, log.user, d.final, d.record_id, d.date, record.mime, record.originalname as file
|
||||
SELECT DISTINCT(log.id), log.usrid, log.user, d.final, d.comment, d.record_id, d.date, record.mime, record.originalname as file
|
||||
FROM (log_docs AS d)
|
||||
INNER JOIN log FORCE INDEX (date_site) ON (log.id = d.log_id)
|
||||
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
|
||||
@@ -63,6 +63,7 @@ class module_report_sqlaction extends module_report_sql implements module_report
|
||||
'd.date' => 'tt.date',
|
||||
'record.mime' => 'tt.mime',
|
||||
'file' => 'tt.file',
|
||||
'd.comment' => 'tt.comment'
|
||||
);
|
||||
|
||||
$stmt = $this->getConnBas()->prepare($this->sql);
|
||||
|
Reference in New Issue
Block a user