mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Fix CS
This commit is contained in:
@@ -17,41 +17,39 @@
|
||||
*/
|
||||
class module_report_sqlaction extends module_report_sql implements module_report_sqlReportInterface
|
||||
{
|
||||
private $action = 'add';
|
||||
|
||||
private $action = 'add';
|
||||
|
||||
public function __construct(module_report $report)
|
||||
{
|
||||
parent::__construct($report);
|
||||
}
|
||||
|
||||
public function setAction($action)
|
||||
{
|
||||
//possible action
|
||||
$a = array('edit', 'add', 'push', 'validate');
|
||||
if (in_array($action, $a))
|
||||
$this->action = $action;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAction()
|
||||
{
|
||||
return $this->action;
|
||||
}
|
||||
|
||||
public function buildSql()
|
||||
{
|
||||
if ($this->groupby == false)
|
||||
public function __construct(module_report $report)
|
||||
{
|
||||
$params = array(':action' => $this->action);
|
||||
$site_filter = $this->filter->getGvSitFilter()?: array('params' => array(), 'sql' => false);
|
||||
$report_filter = $this->filter->getReportFilter() ?: array('params' => array(), 'sql' => false);
|
||||
$record_filter = $this->filter->getRecordFilter() ?: array('params' => array(), 'sql' => false);
|
||||
$params = array_merge($params, $site_filter['params'], $report_filter['params'], $record_filter['params']);
|
||||
parent::__construct($report);
|
||||
}
|
||||
|
||||
$this->sql =
|
||||
"
|
||||
public function setAction($action)
|
||||
{
|
||||
//possible action
|
||||
$a = array('edit', 'add', 'push', 'validate');
|
||||
if (in_array($action, $a))
|
||||
$this->action = $action;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAction()
|
||||
{
|
||||
return $this->action;
|
||||
}
|
||||
|
||||
public function buildSql()
|
||||
{
|
||||
if ($this->groupby == false) {
|
||||
$params = array(':action' => $this->action);
|
||||
$site_filter = $this->filter->getGvSitFilter()? : array('params' => array(), 'sql' => false);
|
||||
$report_filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
|
||||
$record_filter = $this->filter->getRecordFilter() ? : array('params' => array(), 'sql' => false);
|
||||
$params = array_merge($params, $site_filter['params'], $report_filter['params'], $record_filter['params']);
|
||||
|
||||
$this->sql =
|
||||
"
|
||||
SELECT log.usrid, log.user , d.final as getter, d.record_id, d.date, s.*
|
||||
FROM (log_docs as d
|
||||
INNER JOIN log ON " . $site_filter['sql'] . "
|
||||
@@ -60,31 +58,29 @@ class module_report_sqlaction extends module_report_sql implements module_report
|
||||
LEFT JOIN subdef as s ON s.record_id=d.record_id and s.name='document')
|
||||
WHERE";
|
||||
|
||||
$this->sql .= $report_filter['sql'] . " AND (d.action = :action)";
|
||||
$this->sql .= $report_filter['sql'] . " AND (d.action = :action)";
|
||||
|
||||
$this->sql .= $record_filter['sql'] ? " AND (" . $record_filter['sql'] . ")" : "";
|
||||
$this->sql .= $record_filter['sql'] ? " AND (" . $record_filter['sql'] . ")" : "";
|
||||
|
||||
$this->sql .= $this->filter->getOrderFilter();
|
||||
$this->sql .= $this->filter->getOrderFilter();
|
||||
|
||||
$stmt = $this->getConnBas()->prepare($this->sql);
|
||||
$stmt = $this->getConnBas()->prepare($this->sql);
|
||||
|
||||
$this->total = $stmt->rowCount();
|
||||
$stmt->closeCursor();
|
||||
$this->total = $stmt->rowCount();
|
||||
$stmt->closeCursor();
|
||||
|
||||
$this->sql .= $this->filter->getLimitFilter() ?: '';
|
||||
$this->sql .= $this->filter->getLimitFilter() ? : '';
|
||||
|
||||
$this->params = $params;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->params = $params;
|
||||
} else {
|
||||
|
||||
$params = array(':action' => $this->action);
|
||||
$site_filter = $this->filter->getGvSitFilter()?: array('params' => array(), 'sql' => false);
|
||||
$report_filter = $this->filter->getReportFilter() ?: array('params' => array(), 'sql' => false);
|
||||
$record_filter = $this->filter->getRecordFilter() ?: array('params' => array(), 'sql' => false);
|
||||
$params = array_merge($params, $site_filter['params'], $report_filter['params'], $record_filter['params']);
|
||||
$params = array(':action' => $this->action);
|
||||
$site_filter = $this->filter->getGvSitFilter()? : array('params' => array(), 'sql' => false);
|
||||
$report_filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
|
||||
$record_filter = $this->filter->getRecordFilter() ? : array('params' => array(), 'sql' => false);
|
||||
$params = array_merge($params, $site_filter['params'], $report_filter['params'], $record_filter['params']);
|
||||
|
||||
$this->sql = "
|
||||
$this->sql = "
|
||||
SELECT TRIM(" . $this->getTransQuery($this->groupby) . ")
|
||||
as " . $this->groupby . ",
|
||||
SUM(1) as nombre
|
||||
@@ -95,34 +91,34 @@ class module_report_sqlaction extends module_report_sql implements module_report
|
||||
LEFT JOIN subdef as s ON s.record_id=d.record_id and s.name='document')
|
||||
WHERE ";
|
||||
|
||||
$this->sql .= $report_filter['sql'] . " AND (d.action = :action)";
|
||||
$this->sql .= $report_filter['sql'] . " AND (d.action = :action)";
|
||||
|
||||
$this->sql .= $record_filter['sql'] ? "AND (" . $record_filter['sql'] . ")" : "";
|
||||
$this->sql .= $record_filter['sql'] ? "AND (" . $record_filter['sql'] . ")" : "";
|
||||
|
||||
$this->sql .= " GROUP BY " . $this->groupby;
|
||||
$this->sql .= $this->filter->getOrderFilter();
|
||||
$this->sql .= " GROUP BY " . $this->groupby;
|
||||
$this->sql .= $this->filter->getOrderFilter();
|
||||
|
||||
$this->params = $params;
|
||||
$this->params = $params;
|
||||
|
||||
$stmt = $this->getConnBas()->prepare($this->sql);
|
||||
$stmt->execute($params);
|
||||
$this->total = $stmt->rowCount();
|
||||
$stmt->closeCursor();
|
||||
$stmt = $this->getConnBas()->prepare($this->sql);
|
||||
$stmt->execute($params);
|
||||
$this->total = $stmt->rowCount();
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
public function sqlDistinctValByField($field)
|
||||
{
|
||||
|
||||
public function sqlDistinctValByField($field)
|
||||
{
|
||||
$params = array();
|
||||
$site_filter = $this->filter->getGvSitFilter();
|
||||
$date_filter = $this->filter->getDateFilter();
|
||||
|
||||
$params = array();
|
||||
$site_filter = $this->filter->getGvSitFilter();
|
||||
$date_filter = $this->filter->getDateFilter();
|
||||
$params = array_merge($params, $site_filter['params'], $date_filter['params']); //, $record_filter ? $record_filter['params'] : array()
|
||||
|
||||
$params = array_merge($params, $site_filter['params'], $date_filter['params']);//, $record_filter ? $record_filter['params'] : array()
|
||||
|
||||
$sql = "
|
||||
$sql = "
|
||||
SELECT DISTINCT(" . $this->getTransQuery($field) . ") as val
|
||||
FROM (log_docs as d
|
||||
INNER JOIN log ON (" . $site_filter['sql'] . "
|
||||
@@ -132,16 +128,14 @@ class module_report_sqlaction extends module_report_sql implements module_report
|
||||
LEFT JOIN subdef as s ON (s.record_id=d.record_id AND s.name='document'))
|
||||
WHERE ";
|
||||
|
||||
if ($this->filter->getReportFilter())
|
||||
{
|
||||
$report_filter = $this->filter->getReportFilter();
|
||||
$sql .= $report_filter['sql'] . " AND (d.action = :action)";
|
||||
$params = array_merge($params, $report_filter['params'], array(':action' => $this->action));
|
||||
if ($this->filter->getReportFilter()) {
|
||||
$report_filter = $this->filter->getReportFilter();
|
||||
$sql .= $report_filter['sql'] . " AND (d.action = :action)";
|
||||
$params = array_merge($params, $report_filter['params'], array(':action' => $this->action));
|
||||
}
|
||||
$this->sql .= $this->filter->getOrderFilter();
|
||||
$this->params = $params;
|
||||
|
||||
return array('sql' => $sql, 'params' => $params);
|
||||
}
|
||||
$this->sql .= $this->filter->getOrderFilter();
|
||||
$this->params = $params;
|
||||
|
||||
return array('sql' => $sql, 'params' => $params);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user