Update SQL

Update SQLs & remove doc blocks

Update SQL

Update SQL

Update SQL

Update SQL

Update SQL
This commit is contained in:
Nicolas Le Goff
2012-11-19 20:00:17 +01:00
parent 3c318c5c6e
commit 88ac202a49
26 changed files with 528 additions and 895 deletions

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report
{
/**

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_activity extends module_report
{
/**
@@ -100,28 +94,22 @@ class module_report_activity extends module_report
$this->title = _('report:: activite par heure');
$s = new module_report_sql($this->app, $this);
$filter = $s->getFilters();
$conn = $s->getConnBas();
$params = array();
$date_filter = $filter->getDateFilter();
$params = array_merge($params, $date_filter['params']);
$coll_filter = $filter->getCollectionFilter();
$params = array_merge($params, $coll_filter['params']);
$site_filter = $filter->getGvSitFilter();
$params = array_merge($params, $site_filter['params']);
$filter = $s->getFilters()->getReportFilter();
$params = array_merge(array(), $filter['params']);
$sql = "
SELECT DATE_FORMAT( log.date, '%k' ) AS heures, SUM(1) AS nb
SELECT tt.heures, SUM(1) AS nb
FROM (
SELECT DISTINCT(log.id), DATE_FORMAT( log.date, '%k' ) AS heures
FROM log FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE " . $date_filter['sql'] . "
AND " . $coll_filter['sql'] . "
AND " . $site_filter['sql'] . "
GROUP BY heures
ORDER BY heures ASC";
WHERE (" . $filter['sql'] . ")
) AS tt
GROUP BY tt.heures
ORDER BY tt.heures ASC";
$stmt = $conn->prepare($sql);
$stmt = $s->getConnBas()->prepare($sql);
$stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -133,22 +121,23 @@ class module_report_activity extends module_report
foreach ($rs as $row) {
$row['heures'] = (string) $row['heures'];
$res[$row['heures']] = round(($row['nb'] / 24), 2);
if ($res[$row['heures']] < 1)
if ($res[$row['heures']] < 1) {
$res[$row['heures']] = number_format($res[$row['heures']], 2);
else
} else {
$res[$row['heures']] = (int) $res[$row['heures']];
}
}
$this->result[] = $res;
//calculate prev and next page
$this->calculatePages($rs);
//do we display navigator ?
//display navigator
$this->setDisplayNav();
//set report
$this->setReport();
$this->report['legend'] = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23);
$this->report['legend'] = range(0, 23);
return $this->report;
}
@@ -164,37 +153,28 @@ class module_report_activity extends module_report
$result = array();
$s = new module_report_sql($this->app, $this);
$filter = $s->getFilters();
$conn = $s->getConnBas();
$params = array(':main_value' => $value);
$date_filter = $filter->getDateFilter();
$params = array_merge($params, $date_filter['params']);
$coll_filter = $filter->getCollectionFilter();
$params = array_merge($params, $coll_filter['params']);
$site_filter = $filter->getGvSitFilter();
$params = array_merge($params, $site_filter['params']);
$filter = $s->getFilters()->getReportFilter();
$params = array_merge(array(), $filter['params']);
$sql = "
SELECT DATE_FORMAT(log_search.date,'%Y-%m-%d %H:%i:%S') as date ,
SELECT DATE_FORMAT(log_search.date,'%Y-%m-%d %H:%i:%S') AS date ,
log_search.search ,log_search.results
FROM (log_search)
INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_search.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE log_search.date > " . $date_filter['sql'] . "
WHERE (" . $filter['sql'] . ")
AND log.`" . $what . "` = :main_value
AND " . $site_filter['sql'] . "
AND " . $coll_filter['sql'] . "
ORDER BY date";
ORDER BY date ";
$stmt = $conn->prepare($sql);
$stmt = $s->getConnBas()->prepare($sql);
$stmt->execute($params);
$s->setTotalrows($stmt->rowCount());
$sql->setTotalrows($stmt->rowCount());
$stmt->closeCursor();
$sql .= $filter->getLimitFilter();
$stmt = $conn->prepare($sql);
$stmt = $s->getConnBas()->prepare($sql);
$stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -204,9 +184,10 @@ class module_report_activity extends module_report
$i = 0;
foreach ($rs as $row) {
foreach ($this->champ as $key => $value)
foreach ($this->champ as $value) {
$result[$i][$value] = $row[$value];
$i ++;
}
$i++;
}
$this->title = _('report:: questions');
@@ -226,39 +207,28 @@ class module_report_activity extends module_report
$this->report['value2'] = array();
$s = new module_report_sql($this->app, $this);
$filter = $s->getFilters();
$conn = $s->getConnBas();
$filter = $s->getFilters()->getReportFilter();
$params = array_merge(array(), $filter['params']);
$i = 0;
($no_answer) ? $this->title = _('report:: questions sans reponses') :
$this->title = _('report:: questions les plus posees');
$params = array();
$date_filter = $filter->getDateFilter();
$params = array_merge($params, $date_filter['params']);
$coll_filter = $filter->getCollectionFilter();
$params = array_merge($params, $coll_filter['params']);
($no_answer) ? $this->title = _('report:: questions sans reponses') : $this->title = _('report:: questions les plus posees');
$sql = "
SELECT TRIM(log_search.search) as search,
SUM(1) as nb,
ROUND(avg(results)) as nb_rep
SELECT TRIM(tt.search) AS search, SUM(1) AS nb, ROUND(avg(tt.results)) AS nb_rep
FROM (
SELECT DISTINCT(log.id), log_search.search AS search, results
FROM (log_search)
INNER JOIN log FORCE INDEX (date_site) ON (log_search.log_id = log.id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE " . $date_filter['sql'] . "
AND log_search.search != 'all'
AND (" . $coll_filter['sql'] . ")";
($no_answer) ? $sql .= " AND log_search.results = 0 " : "";
$sql .= "
GROUP BY log_search.search
WHERE (" . $filter['sql'] . ")
AND log_search.search != 'all' " .
($no_answer ? ' AND log_search.results = 0 ' : '') . "
) AS tt
GROUP BY tt.search
ORDER BY nb DESC";
( ! $no_answer) ? $sql .= " LIMIT 0," . $this->nb_top : "";
$sql .= !$no_answer ? ' LIMIT ' . $this->nb_top : '';
$stmt = $conn->prepare($sql);
$stmt = $s->getConnBas()->prepare($sql);
$stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -266,10 +236,14 @@ class module_report_activity extends module_report
$this->setChamp($rs);
$this->setDisplay($tab);
$i = 0;
foreach ($rs as $row) {
foreach ($this->champ as $key => $value)
foreach ($this->champ as $value) {
$this->result[$i][$value] = $row[$value];
$i ++;
}
$i++;
$this->report['legend'][] = $row['search'];
$this->report['value'][] = $row['nb'];
$this->report['value2'][] = $row['nb_rep'];
@@ -296,44 +270,27 @@ class module_report_activity extends module_report
{
$result = array();
$s = new module_report_sql($this->app, $this);
$filter = $s->getFilters();
$conn = $s->getConnBas();
$filter = $s->getFilters()->getReportFilter();
$params = array_merge(array(), $filter['params']);
$databox = $this->app['phraseanet.appbox']->get_databox($this->sbas_id);
$params = array();
$date_filter = $filter->getDateFilter();
$params = array_merge($params, $date_filter['params']);
$coll_filter = $filter->getCollectionFilter();
$params = array_merge($params, $coll_filter['params']);
$site_filter = $filter->getGvSitFilter();
$params = array_merge($params, $site_filter['params']);
$user_filter = $filter->getUserIdFilter($usr);
$params = array_merge($params, $user_filter['params']);
$sql = "
SELECT log_docs.record_id,
log_docs.date, log_docs.final as objets
SELECT log_docs.record_id, log_docs.date, log_docs.final AS objets
FROM (`log_docs`)
INNER JOIN log FORCE INDEX (date_site) ON (log_docs.log_id = log.id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
INNER JOIN record ON (log_docs.record_id = record.record_id)
WHERE log_docs.action = 'download'
AND " . $date_filter['sql'] . "
AND " . $user_filter['sql'] . "
AND " . $site_filter['sql'] . "
AND (" . $coll_filter['sql'] . ")";
WHERE (". $filter['sql'] .") AND log_docs.action = 'download'
ORDER BY date DESC";
$stmt = $conn->prepare($sql);
$stmt = $s->getConnBas()->prepare($sql);
$stmt->execute($params);
$s->setTotalrows($stmt->rowCount());
$sql->setTotalrows($stmt->rowCount());
$stmt->closeCursor();
$sql .= "
ORDER BY date DESC";
$sql .= $filter->getLimitFilter();
$sql .= $filter->getLimitFilter() ?: '';
$stmt = $conn->prepare($sql);
$stmt = $s->getConnBas()->prepare($sql);
$stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -341,22 +298,23 @@ class module_report_activity extends module_report
$login = User_Adapter::getInstance($usr, $this->app)->get_display_name();
$this->setChamp($rs);
($config) ? $this->setConfigColumn($config) :
$this->initDefaultConfigColumn($this->champ);
$i = 0;
$config ? $this->setConfigColumn($config) : $this->initDefaultConfigColumn($this->champ);
$i = 0;
foreach ($rs as $row) {
$record = $databox->get_record($row['record_id']);
foreach ($this->champ as $key => $value) {
foreach ($this->champ as $value) {
$result[$i][$value] = $row[$value];
}
$result[$i]['titre'] = $record->get_title();
$i ++;
}
$this->title = sprintf(_('report:: Telechargement effectue par l\'utilisateur %s'), $login);
$this->setResult($result);
return $this->result;
@@ -372,39 +330,27 @@ class module_report_activity extends module_report
$this->title = _('report:: telechargements par jour');
$s = new module_report_sql($this->app, $this);
$filter = $s->getFilters();
$conn = $s->getConnBas();
$params = array();
$date_filter = $filter->getDateFilter();
$params = array_merge($params, $date_filter['params']);
$coll_filter = $filter->getCollectionFilter();
$params = array_merge($params, $coll_filter['params']);
$site_filter = $filter->getGvSitFilter();
$params = array_merge($params, $site_filter['params']);
$record_filter = $filter->getUserFilter();
if ($record_filter)
$params = array_merge($params, $record_filter['params']);
$filter = $s->getFilters()->getReportFilter();
$params = array_merge(array(), $filter['params']);
$sql = "
SELECT
log_docs.date
AS ddate,
final
SELECT tt.record_id, DATE_FORMAT(tt.the_date, GET_FORMAT(DATE, 'INTERNAL')) AS ddate, tt.final, SUM(1) AS nb
FROM (
SELECT DISTINCT(log.id), log_docs.date AS the_date, log_docs.final, log_docs.record_id
FROM (log_docs)
INNER JOIN record ON (record.record_id = log_docs.record_id)
INNER JOIN log FORCE INDEX (date_site) ON (" . $site_filter['sql'] . " AND log.id = log_docs.log_id)
INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_docs.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
LEFT JOIN subdef AS s ON (s.record_id = log_docs.record_id AND s.name = log_docs.final)
WHERE " . $date_filter['sql'] . "
AND (log_docs.final != 'caption')
AND log_docs.action = 'download'
AND (" . $coll_filter['sql'] . ")";
if ($record_filter['sql'])
$sql .= "AND (" . $record_filter['sql'] . ")";
$sql .= ' ORDER BY log_docs.date DESC';
WHERE (" . $filter['sql'] . ")
AND (log_docs.action = 'download' OR log_docs.action = 'mail')
AND (log_docs.final = 'preview' OR log_docs.final = 'document')
) AS tt
LEFT JOIN subdef AS s ON (s.record_id = tt.record_id)
WHERE s.name = tt.final
GROUP BY tt.final, ddate
ORDER BY tt.the_date DESC";
$stmt = $conn->prepare($sql);
$stmt = $s->getConnBas()->prepare($sql);
$stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -431,16 +377,16 @@ class module_report_activity extends module_report
}
if ($row['final'] == 'document') {
$this->result[$i]['document'] += 1;
$total['tot_doc'] += 1;
$this->result[$i]['document'] += $row['nb'];
$total['tot_doc'] += $row['nb'];
} else {
$this->result[$i]['preview'] += 1;
$total['tot_prev'] += 1;
$this->result[$i]['preview'] += $row['nb'];
$total['tot_prev'] += $row['nb'];
}
$this->result[$i]['total'] += 1;
$this->result[$i]['total'] += $row['nb'];
$total['tot_dl'] += 1;
$total['tot_dl'] += $row['nb'];
}
$nb_row = $i + 1;
@@ -473,39 +419,31 @@ class module_report_activity extends module_report
}
$s = new module_report_sql($this->app, $this);
$filter = $s->getFilters();
$conn = $s->getConnBas();
$filter = $s->getFilters()->getReportFilter();
$params = array_merge(array(), $filter['params']);
$params = array();
$date_filter = $filter->getDateFilter();
$params = array_merge($params, $date_filter['params']);
$coll_filter = $filter->getCollectionFilter();
$params = array_merge($params, $coll_filter['params']);
$site_filter = $filter->getGvSitFilter();
$params = array_merge($params, $site_filter['params']);
$this->req = "
SELECT DISTINCT(log." . $on . ") as " . $on . ",
usrid,
SUM(1) as connexion
SELECT SUM(1) AS connexion, tt.user, tt.usrid FROM (
SELECT
DISTINCT(log.id),
log." . $on . " AS " . $on . ",
log.usrid
FROM log FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE log.user != 'API'
AND " . $site_filter['sql'] . "
AND " . $date_filter['sql'] . "
AND " . $coll_filter['sql'] . "
GROUP BY " . $on . "
AND (" . $filter['sql'] . ")
) AS tt
GROUP BY tt.usrid
ORDER BY connexion DESC ";
$stmt = $conn->prepare($this->req);
$stmt = $s->getConnBas()->prepare($this->req);
$stmt->execute($params);
$s->setTotalrows($stmt->rowCount());
$stmt->closeCursor();
$this->enable_limit ? $this->req .= "LIMIT 0," . $this->nb_record : "";
$stmt = $conn->prepare($this->req);
$stmt = $s->getConnBas()->prepare($this->req);
$stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -565,44 +503,30 @@ class module_report_activity extends module_report
{
empty($on) ? $on = "user" : ""; //by default always report on user
$s = new module_report_sql($this->app, $this);
$filter = $s->getFilters();
$conn = $s->getConnBas();
//set title
$this->title = _('report:: Detail des telechargements');
$params = array();
$date_filter = $filter->getDateFilter();
$params = array_merge($params, $date_filter['params']);
$coll_filter = $filter->getCollectionFilter();
$params = array_merge($params, $coll_filter['params']);
$site_filter = $filter->getGvSitFilter();
$params = array_merge($params, $site_filter['params']);
$record_filter = $filter->getRecordFilter();
$params = array_merge($params, $record_filter['params']);
$s = new module_report_sql($this->app, $this);
$filter = $s->getFilters()->getReportFilter();
$params = array_merge(array(), $filter['params']);
$sql = "
SELECT
usrid,
TRIM(" . $on . ") as " . $on . ",
final, sum(1) as nb,
sum(size) as poid
FROM (log_docs as d)
INNER JOIN log FORCE INDEX (date_site) ON (" . $site_filter['sql'] . "
AND log.id = d.log_id
AND " . $date_filter['sql'] . ")
SELECT tt.usrid, TRIM(" . $on . ") AS " . $on . ", tt.final, sum(1) AS nb, sum(size) AS poid
FROM (
SELECT DISTINCT(log.id), TRIM(" . $on . ") AS " . $on . ", log_docs.record_id, log_docs.final, log.usrid
FROM log_docs
INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_docs.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
INNER JOIN record ON record.record_id = d.record_id
LEFT JOIN subdef as s on ((d.action = 'download' OR d.action = 'mail')
AND s.record_id=d.record_id and s.name=d.final
)
WHERE (" . $coll_filter['sql'] . ")
AND (" . $record_filter['sql'] . ")
GROUP BY " . $on . ", final, usrid
WITH rollup";
INNER JOIN record ON (record.record_id = log_docs.record_id)
WHERE (" . $filter['sql'] . ")
AND (log_docs.action = 'download' OR log_docs.action = 'mail')
) AS tt
LEFT JOIN subdef FORCE INDEX (unicite) ON (tt.record_id = subdef.record_id)
WHERE subdef.name = tt.final
GROUP BY " . $on . ", usrid
ORDER BY nb DESC;";
$stmt = $conn->prepare($sql);
$stmt = $s->getConnBas()->prepare($sql);
$stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -692,75 +616,6 @@ class module_report_activity extends module_report
return $this->report;
}
public function getPush($tab = false)
{
$s = new module_report_sql($this->app, $this);
$filter = $s->getFilters();
$conn = $s->getConnBas();
$push = array();
$params = array();
$date_filter = $filter->getDateFilter();
$params = array_merge($params, $date_filter['params']);
$coll_filter = $filter->getCollectionFilter();
$params = array_merge($params, $coll_filter['params']);
$site_filter = $filter->getGvSitFilter();
$params = array_merge($params, $site_filter['params']);
$record_filter = $filter->getRecordFilter();
$params = array_merge($params, $record_filter['params']);
$sql = "
SELECT log.usrid, log.user , d.final as getter, d.record_id, d.date, s.*
FROM (log_docs as d)
INNER JOIN log FORCE INDEX (date_site) ON (" . $site_filter['sql'] . "
AND log.id = d.log_id
AND " . $date_filter['sql'] . ")
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
INNER JOIN record ON (record.record_id = d.record_id)
LEFT JOIN subdef as s ON (s.record_id=d.record_id and s.name='document')
WHERE ((" . $coll_filter['sql'] . ") AND " . $record_filter['sql'] . " AND d.action='push')
";
$stmt = $conn->prepare($sql);
$stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
$this->setChamp($rs);
$this->initDefaultConfigColumn($this->champ);
$i = 0;
foreach ($rs as $row) {
foreach ($this->champ as $key => $value) {
$this->result[$i][$value] = $row[$value];
if ($value == "getter") {
try {
$user = User_Adapter::getInstance($row[$value], $this->app);
$this->result[$i][$value] = $user->get_display_name();
} catch (Exception $e) {
}
} elseif ($value == "size") {
$this->result[$i][$value] = p4string::format_octets($row[$value]);
} elseif ($value == "date") {
$date_obj = new DateTime($row[$value]);
$this->result[$i][$value] = $this->app['date-formatter']->getPrettyString($date_obj);
}
}
$i ++;
}
$this->total = sizeof($this->result);
//calculate prev and next page
$this->calculatePages($rs);
//do we display navigator ?
$this->setDisplayNav();
//set report
$this->setReport();
return($this->report);
}
public static function topTenUser(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{
$conn = connection::getPDOConnection($app, $sbas_id);
@@ -778,19 +633,20 @@ class module_report_activity extends module_report
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
$params = array_merge($params, $collfilter['params']);
$sql = "
SELECT log.usrid, user, final, sum(1) AS nb, sum(size) AS poid
$sql = "SELECT tt.usrid, tt.user, tt.final, tt.record_id, SUM(1) AS nb, SUM(size) AS poid
FROM (
SELECT DISTINCT(log.id), log.usrid, user, final, log_date.record_id
FROM (log_docs AS log_date)
INNER JOIN log FORCE INDEX (date_site) ON (log.site = :site_id
AND log.id = log_date.log_id
AND " . $datefilter['sql'] . ")
INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_date.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
LEFT JOIN subdef AS s ON (log_date.action = 'download'
AND s.record_id = log_date.record_id
AND s.name = log_date.final
AND (" . $collfilter['sql'] . "))
GROUP BY user, final
WITH rollup";
WHERE log.site = :site_id
AND log_date.action = 'download'
AND (" . $datefilter['sql'] . ")
AND (" . $collfilter['sql'] . ")
) AS tt
LEFT JOIN subdef AS s ON (s.record_id = tt.record_id)
WHERE s.name = tt.final
GROUP BY tt.user, tt.final";
$stmt = $conn->prepare($sql);
$stmt->execute($params);
@@ -855,12 +711,15 @@ class module_report_activity extends module_report
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
$sql = "
SELECT log_date.id, HOUR(log_date.date) as heures
FROM log as log_date FORCE INDEX (date_site)
SELECT tt.id, HOUR(tt.heure) AS heures
FROM (
SELECT DISTINCT(log_date.id), log_date.date AS heures
FROM log AS log_date FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
WHERE " . $datefilter['sql'] . "
AND " . $collfilter['sql'] . "
AND log_date.site = :site_id";
AND log_date.site = :site_id
) AS tt";
$stmt = $conn->prepare($sql);
$stmt->execute($params);
@@ -896,15 +755,16 @@ class module_report_activity extends module_report
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
$sql = "
SELECT DISTINCT (
DATE_FORMAT( log_date.date, '%Y-%m-%d' )
) AS ddate, COUNT( DATE_FORMAT( log_date.date, '%d' ) ) AS activity
FROM log as log_date FORCE INDEX (date_site) INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
SELECT tt.ddate, COUNT( DATE_FORMAT( tt.ddate, '%d' ) ) AS activity
FROM (
SELECT DISTINCT(log_date.id), DATE_FORMAT( log_date.date, '%Y-%m-%d' ) AS ddate
FROM log AS log_date FORCE INDEX (date_site) INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
WHERE " . $datefilter['sql'] . "
AND log_date.site = :site_id
AND (" . $collfilter['sql'] . ")
GROUP by ddate
ORDER BY ddate ASC";
) AS tt
GROUP by tt.ddate
ORDER BY tt.ddate ASC";
$stmt = $conn->prepare($sql);
$stmt->execute($params);
@@ -936,14 +796,17 @@ class module_report_activity extends module_report
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
$sql = "
SELECT log_date.usrid, log_date.user, sum(1) AS nb
SELECT tt.usrid, tt.user, sum(1) AS nb
FROM (
SELECT DISTINCT(log_date.id), log_date.usrid, log_date.user
FROM (`log_search`)
INNER JOIN log as log_date FORCE INDEX (date_site) ON (log_search.log_id = log_date.id)
INNER JOIN log AS log_date FORCE INDEX (date_site) ON (log_search.log_id = log_date.id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
WHERE " . $datefilter['sql'] . "
AND log_date.site = :site_id
AND (" . $collfilter['sql'] . ")
GROUP BY log_date.usrid
) AS tt
GROUP BY tt.usrid
ORDER BY nb DESC";
$stmt = $conn->prepare($sql);
@@ -973,18 +836,17 @@ class module_report_activity extends module_report
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
$sql = "
SELECT
TRIM(log_search.search) as question,
log_date.usrid,
log_date.user,
sum(1) AS nb
SELECT TRIM(tt.search) AS question, tt.usrid, tt.user, SUM(1) AS nb
FROM (
SELECT DISTINCT(log_date.id), log_search.search, log_date.usrid, log_date.user
FROM (`log_search`)
INNER JOIN log as log_date FORCE INDEX (date_site) ON (log_search.log_id = log_date.id)
INNER JOIN log AS log_date FORCE INDEX (date_site) ON (log_search.log_id = log_date.id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
WHERE " . $datefilter['sql'] . "
AND log_date.site = :site_id
AND (" . $collfilter['sql'] . ")
GROUP BY log_search.search
) AS tt
GROUP BY tt.search
ORDER BY nb DESC";
$stmt = $conn->prepare($sql);
@@ -1015,12 +877,15 @@ class module_report_activity extends module_report
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
$sql = "
SELECT referrer, COUNT(referrer) as nb_view
SELECT tt.referrer, SUM(1) AS nb_view
FROM (
SELECT DISTINCT(log_date.id), referrer
FROM (log_view)
INNER JOIN log as log_date FORCE INDEX (date_site) ON (log_view.log_id = log_date.id)
INNER JOIN log AS log_date FORCE INDEX (date_site) ON (log_view.log_id = log_date.id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
WHERE " . $datefilter['sql'] . "
AND (" . $collfilter['sql'] . ")
) AS tt
GROUP BY referrer
ORDER BY nb_view DESC ";
@@ -1055,15 +920,16 @@ class module_report_activity extends module_report
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
$sql = "
SELECT DISTINCT (
DATE_FORMAT( log_date.date, '%Y-%m-%d' )
) AS ddate, COUNT( DATE_FORMAT( log_date.date, '%d' ) ) AS activity
FROM (log_docs as log_date)
SELECT tt.ddate, COUNT( DATE_FORMAT( tt.ddate, '%d' ) ) AS activity
FROM (
SELECT DISTINCT(log.id), DATE_FORMAT(log_date.date, '%Y-%m-%d') AS ddate
FROM (log_docs AS log_date)
INNER JOIN log FORCE INDEX (date_site) ON (log_date.log_id = log.id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE " . $datefilter['sql'] . " AND log_date.action = 'add'
AND (" . $collfilter['sql'] . ")
GROUP BY ddate
) AS tt
GROUP BY tt.ddate
ORDER BY activity ASC ";
$stmt = $conn->prepare($sql);
@@ -1089,15 +955,16 @@ class module_report_activity extends module_report
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
$sql = "
SELECT DISTINCT (
DATE_FORMAT( log_date.date, '%Y-%m-%d' )
) AS ddate, COUNT( DATE_FORMAT( log_date.date, '%d' ) ) AS activity
FROM (log_docs as log_date)
INNER JOIN log FORCE INDEX (date_sit) ON log_date.log_id = log.id
SELECT tt.ddate, COUNT( DATE_FORMAT( tt.ddate, '%d' ) ) AS activity
FROM (
SELECT DISTINCT(log.id), DATE_FORMAT( log_date.date, '%Y-%m-%d') AS ddate
FROM (log_docs AS log_date)
INNER JOIN log FORCE INDEX (date_site) ON (log_date.log_id = log.id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE " . $datefilter['sql'] . " AND log_date.action = 'edit'
AND (" . $collfilter['sql'] . ")
GROUP BY ddate
) AS tt
GROUP BY tt.ddate
ORDER BY activity ASC ";
$stmt = $conn->prepare($sql);
@@ -1124,13 +991,16 @@ class module_report_activity extends module_report
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
$sql = "
SELECT log.usrid, log.user, sum( 1 ) AS nb
FROM (log_docs as log_date)
SELECT tt.usrid, tt.user, sum( 1 ) AS nb
FROM (
SELECT DISTINCT(log.id), log.usrid, log.user
FROM (log_docs AS log_date)
INNER JOIN log FORCE INDEX (date_site) ON (log_date.log_id = log.id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE " . $datefilter['sql'] . " AND log_date.action = 'add'
AND (" . $collfilter['sql'] . ")
GROUP BY log.usrid
) AS tt
GROUP BY tt.usrid
ORDER BY nb ASC ";
$stmt = $conn->prepare($sql);

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_add extends module_report
{
protected $cor_query = array(

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_connexion extends module_report
{
protected $cor_query = array(
@@ -151,9 +145,9 @@ class module_report_connexion extends module_report
$finalfilter .= $collfilter['sql'] . ' AND ';
$finalfilter .= 'log_date.site = :site_id';
$sql = "SELECT COUNT(usrid) as nb
$sql = "SELECT COUNT(DISTINCT(log_date.id)) as nb
FROM log as log_date FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
WHERE " . $finalfilter;
$stmt = $conn->prepare($sql);

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_dashboard implements module_report_dashboard_componentInterface
{
/**

View File

@@ -9,12 +9,6 @@
* file that was distributed with this source code.
*/
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
interface module_report_dashboard_componentInterface
{

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_dashboard_feed implements module_report_dashboard_componentInterface
{
/**

View File

@@ -9,12 +9,6 @@
* file that was distributed with this source code.
*/
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_dashboard_group implements module_report_dashboard_componentInterface
{
public $group_dash;

View File

@@ -9,12 +9,6 @@
* file that was distributed with this source code.
*/
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_dashboard_merge implements module_report_dashboard_componentInterface
{
public $sort = array();

View File

@@ -9,12 +9,6 @@
* file that was distributed with this source code.
*/
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_dashboard_sort implements module_report_dashboard_componentInterface
{
public $arrayToSort = array();

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_download extends module_report
{
protected $cor_query = array(
@@ -118,7 +112,11 @@ class module_report_download extends module_report
}
if (array_key_exists('record_id', $row)) {
try {
$record = new \record_adapter($app, $this->sbas_id, $row['record_id']);
} catch (Exception_Record_AdapterNotFound $e) {
continue;
}
foreach ($pref as $field) {
try {
@@ -187,16 +185,17 @@ class module_report_download extends module_report
$sql = '
SELECT SUM(1) AS nb
FROM (
SELECT DISTINCT(log.id)
FROM log FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
INNER JOIN log_docs as log_date ON (log.id = log_date.log_id)
INNER JOIN record ON (log_date.record_id = record.record_id)
WHERE ' . $finalfilter . '
AND (
log_date.action = \'download\'
OR log_date.action = \'mail\'
)
ORDER BY log_date.date DESC
) AS tt
';
$stmt = $conn->prepare($sql);
$stmt->execute($params);
@@ -227,11 +226,13 @@ class module_report_download extends module_report
$finalfilter .= 'log.site = :site_id';
$sql = '
SELECT record.record_id as id, SUM(1) AS nb, subdef.name
SELECT tt.id, tt.name, SUM(1) AS nb
FROM (
SELECT DISTINCT(log.id) AS log_id, log_date.record_id as id, subdef.name
FROM ( log )
INNER JOIN log_docs as log_date (ON log.id = log_date.log_id)
INNER JOIN record ON (log_date.record_id = record.record_id)
INNER JOIN subdef ON (subdef.record_id = record.record_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
INNER JOIN log_docs as log_date ON (log.id = log_date.log_id)
INNER JOIN subdef ON (log_date.record_id = subdef.record_id)
WHERE (
' . $finalfilter . '
)
@@ -239,8 +240,8 @@ class module_report_download extends module_report
OR log_date.action = \'mail\'
)
AND subdef.name = log_date.final
) AS tt
GROUP BY id, name
ORDER BY nb DESC
';
$stmt = $conn->prepare($sql);

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_edit extends module_report
{
protected $cor_query = array(

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_filter
{
private $app;

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_nav extends module_report
{
/**
@@ -55,36 +49,30 @@ class module_report_nav extends module_report
public function __construct(Application $app, $arg1, $arg2, $sbas_id, $collist)
{
parent::__construct($app, $arg1, $arg2, $sbas_id, $collist);
$this->total_pourcent = $this->setTotalPourcent();
}
private function setTotalPourcent()
{
$x = $this->getTransQueryString();
$s = new module_report_sql($this->app, $this);
$filter = $s->getFilters();
$params = array();
$report_filter = $filter->getReportFilter();
$coll_filter = $filter->getCollectionFilter();
$site_filter = $filter->getGvSitFilter();
$params = array_merge($report_filter['params']);
$params = array_merge(array(), $report_filter['params']);
$sql = '
SELECT
SUM(1) AS total
SELECT SUM(1) AS total FROM (
SELECT DISTINCT (log.id)
FROM log FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE ' . $report_filter['sql'] . ' AND nav != ""
';
) AS tt';
$stmt = $s->getConnBas()->prepare($sql);
$stmt->execute($params);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
return $row['total'];
return (int) $row['total'];
}
/**
@@ -101,16 +89,6 @@ class module_report_nav extends module_report
$this->display = array();
}
/**
* @desc return the filter to generate the good request
* @param object $conn the current connexion to appbox
* @return string
*/
private function getFilter()
{
return;
}
/**
* @desc report the browser used by users
* @param array $tab config for the html table
@@ -124,24 +102,25 @@ class module_report_nav extends module_report
$filter = $s->getFilters();
$this->title = _('report:: navigateur');
$this->total_pourcent = $this->setTotalPourcent();
if (is_null($this->total_pourcent)) {
return $this->report;
}
$params = array();
$report_filter = $filter->getReportFilter();
$params = array_merge($params, $report_filter['params']);
$params = array_merge(array(), $report_filter['params']);
$sql = '
SELECT
nav,
COUNT(nav) AS nb,
ROUND((COUNT(nav) / ' . $this->total_pourcent . ' * 100), 1) AS pourcent
SELECT tt.nav, SUM(1) AS nb, ROUND((SUM(1) / ' . $this->total_pourcent . ' * 100), 1) AS pourcent
FROM (
SELECT DISTINCT(log.id), nav
FROM log FORCE INDEX (date_site, nav)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE ' . $report_filter['sql'] . ' AND nav != ""
GROUP BY nav
ORDER BY pourcent DESC';
) AS tt
GROUP BY tt.nav
ORDER BY nb DESC';
$this->initialize();
@@ -182,24 +161,25 @@ class module_report_nav extends module_report
$i = 0;
$this->title = _('report:: Plateforme');
$this->total_pourcent = $this->setTotalPourcent();
if (is_null($this->total_pourcent)) {
return $this->report;
}
$params = array();
$report_filter = $filter->getReportFilter();
$params = array_merge($params, $report_filter['params']);
$params = array_merge(array(), $report_filter['params']);
$sql = '
SELECT
os,
COUNT(os) AS nb,
ROUND((COUNT(os)/' . $this->total_pourcent . '*100),1) AS pourcent
SELECT tt.os, COUNT(os) AS nb, ROUND((COUNT(os)/' . $this->total_pourcent . '*100),1) AS pourcent
FROM (
SELECT DISTINCT(log.id), os
FROM log FORCE INDEX (date_site, os)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE '. $report_filter['sql'] . ' AND os != ""
GROUP BY os
ORDER BY pourcent DESC';
) AS tt
GROUP BY tt.os
ORDER BY nb DESC';
$this->initialize();
@@ -238,24 +218,26 @@ class module_report_nav extends module_report
$filter = $s->getFilters();
$this->title = _('report:: resolution');
$i = 0;
$this->total_pourcent = $this->setTotalPourcent();
if (is_null($this->total_pourcent)) {
return($this->report);
}
$params = array();
$report_filter = $filter->getReportFilter();
$params = array_merge($params, $report_filter['params']);
$params = array_merge(array(), $report_filter['params']);
$sql = '
SELECT
res,
COUNT(res) AS nb,
ROUND((COUNT(res)/ ' . $this->total_pourcent . '*100),1) AS pourcent
SELECT tt.res, COUNT(res) AS nb, ROUND((COUNT(res)/ ' . $this->total_pourcent . '*100),1) AS pourcent
FROM (
SELECT DISTINCT(log.id), res
FROM log FORCE INDEX (date_site, res)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE '. $report_filter['sql'] . ' AND res != ""
GROUP BY res
ORDER BY pourcent DESC
) AS tt
GROUP BY tt.res
ORDER BY nb DESC
LIMIT 0, 10';
$this->initialize();
@@ -296,26 +278,25 @@ class module_report_nav extends module_report
$filter = $s->getFilters();
$this->title = _('report:: navigateurs et plateforme');
$i = 0;
$this->total_pourcent = $this->setTotalPourcent();
if (is_null($this->total_pourcent)) {
return($this->report);
}
$params = array();
$report_filter = $filter->getReportFilter();
$params = array_merge($params, $report_filter['params']);
$params = array_merge(array(), $report_filter['params']);
$sql = "
SELECT
CONCAT( nav, '-', os ) AS combo,
COUNT( CONCAT( nav, '-', os ) ) AS nb,
ROUND(
(COUNT( CONCAT( nav ,'-', os ))/" . $this->total_pourcent . "*100),
1) AS pourcent
SELECT tt.combo, COUNT( tt.combo ) AS nb, ROUND((COUNT(tt.combo)/" . $this->total_pourcent . "*100), 1) AS pourcent
FROM (
SELECT DISTINCT(log.id), CONCAT( nav, '-', os ) AS combo
FROM log FORCE INDEX (date_site, os_nav)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE ". $report_filter['sql'] ." AND nav != ''
AND os != ''
GROUP BY combo
WHERE ". $report_filter['sql'] ." AND nav != '' AND os != ''
) AS tt
GROUP BY tt.combo
ORDER BY nb DESC
LIMIT 0 , 10";
@@ -360,22 +341,24 @@ class module_report_nav extends module_report
$x = array();
$tab_appli = array();
$this->total_pourcent = $this->setTotalPourcent();
if (is_null($this->total_pourcent)) {
return($this->report);
}
$params = array();
$report_filter = $filter->getReportFilter();
$params = array_merge($params, $report_filter['params']);
$params = array_merge(array(), $report_filter['params']);
$sql = '
SELECT appli
SELECT tt.appli
FROM (
SELECT DISTINCT(log.id), appli
FROM log FORCE INDEX (date_site, appli)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE ' . $report_filter['sql'] . ' AND appli != \'a:0:{}\'
GROUP BY appli
ORDER BY NULL
';
) AS tt
GROUP BY tt.appli';
$this->initialize();
@@ -430,8 +413,7 @@ class module_report_nav extends module_report
$this->initialize();
empty($on) ? $on = false : "";
$filter_id_apbox = $filter_id_datbox = array();
$conn = connection::getPDOConnection($this->app);
$conn2 = connection::getPDOConnection($this->app, $this->sbas_id);
$conn = $this->app['phraseanet.appbox']->get_connection();
$datefilter = array();
@@ -444,7 +426,7 @@ class module_report_nav extends module_report
if ($on) {
if ( ! empty($req)) {
$stmt = $conn2->prepare($req);
$stmt = $this->app['phraseanet.appbox']->get_databox($this->sbas_id)->get_connection()->prepare($req);
$stmt->execute($params);
$rsu = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -520,7 +502,12 @@ class module_report_nav extends module_report
{
$this->initialize();
$sbas_id = phrasea::sbasFromBas($this->app, $bid);
try {
$record = new record_adapter($this->app, $sbas_id, $rid);
} catch (Exception_Record_AdapterNotFound $e) {
return $this->report;
}
$this->setDisplay($tab);
$this->champ = array(
@@ -564,12 +551,16 @@ class module_report_nav extends module_report
$params = array(':browser' => $navigator);
$report_filter = $filter->getReportFilter();
$sql = "SELECT DISTINCT(version) as version, COUNT(version) as nb
$sql = "
SELECT DISTINCT(version), COUNT(version) as nb
FROM (
SELECT DISTINCT (log.id)
FROM log FORCE INDEX (date_site, nav, version)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE ". $report_filter['sql'] . "
WHERE nav = :browser
GROUP BY version
) AS tt
GROUP BY tt.version
ORDER BY nb DESC";
$stmt = $conn->prepare($sql);

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_push extends module_report
{
protected $cor_query = array(

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_question extends module_report
{
protected $cor_query = array(

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_sql
{
/**

View File

@@ -9,13 +9,7 @@
* file that was distributed with this source code.
*/
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
interface module_report_sqlReportInterface
interface module_report_sqlReportinterface
{
public function buildSql();

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_sqlaction extends module_report_sql implements module_report_sqlReportInterface
{
private $action = 'add';
@@ -28,10 +22,11 @@ class module_report_sqlaction extends module_report_sql implements module_report
public function setAction($action)
{
//possible action
$a = array('edit', 'add', 'push', 'validate');
if (in_array($action, $a))
if (in_array($action, $a)) {
$this->action = $action;
}
return $this;
}
@@ -43,67 +38,46 @@ class module_report_sqlaction extends module_report_sql implements module_report
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']);
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$this->params = array_merge(array(':action' => $this->action), $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 FORCE INDEX (date_site) ON (" . $site_filter['sql'] . " AND log.id = d.log_id)
if ($this->groupby == false) {
$this->sql = "
SELECT tt.usrid, tt.user, tt.final AS getter, tt.record_id, tt.date, tt.mime, tt.file
FROM (
SELECT DISTINCT(log.id), log.usrid, log.user , d.final, 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)
INNER JOIN record ON (record.record_id = d.record_id)
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 .= $record_filter['sql'] ? " AND (" . $record_filter['sql'] . ")" : "";
$this->sql .= $this->filter->getOrderFilter();
WHERE (" . $filter['sql'] . ") AND (d.action = :action)
) AS tt";
$stmt = $this->getConnBas()->prepare($this->sql);
$stmt->execute($this->params);
$this->total = $stmt->rowCount();
$stmt->closeCursor();
$this->sql .= $this->filter->getOrderFilter() ? : '';
$this->sql .= $this->filter->getLimitFilter() ? : '';
$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']);
$this->sql = "
SELECT TRIM(" . $this->getTransQuery($this->groupby) . ")
as " . $this->groupby . ",
SUM(1) as nombre
SELECT " . $this->groupby . ", SUM(1) AS nombre
FROM (
SELECT DISTINCT(log.id), TRIM(" . $this->getTransQuery($this->groupby) . ") AS " . $this->groupby . " , log.usrid, log.user , d.final, d.record_id, d.date
FROM (log_docs as d)
INNER JOIN log FORCE INDEX (date_site) ON (" . $site_filter['sql'] . " AND log.id = d.log_id)
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)
INNER JOIN record ON (record.record_id = d.record_id)
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 .= $record_filter['sql'] ? "AND (" . $record_filter['sql'] . ")" : "";
$this->sql .= " GROUP BY " . $this->groupby;
$this->sql .= $this->filter->getOrderFilter();
$this->params = $params;
WHERE (" . $filter['sql'] . ") AND (d.action = :action)
) AS tt
LEFT JOIN subdef AS s ON (s.record_id=tt.record_id)
WHERE s.name='document'
GROUP BY " . $this->groupby . "
ORDER BY nombre";
$stmt = $this->getConnBas()->prepare($this->sql);
$stmt->execute($params);
$stmt->execute($this->params);
$this->total = $stmt->rowCount();
$stmt->closeCursor();
}
@@ -113,32 +87,22 @@ 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']);
$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()
$sql = "
SELECT DISTINCT(" . $this->getTransQuery($field) . ") as val
$this->sql = "
SELECT DISTINCT(val)
FROM (
SELECT DISTINCT(log.id), " . $this->getTransQuery($field) . " AS val
FROM (log_docs as d)
INNER JOIN log FORCE INDEX (date_site) ON (" . $site_filter['sql'] . "
AND log.id = d.log_id
AND " . $date_filter['sql'] . ")
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)
INNER JOIN record ON (record.record_id = d.record_id)
LEFT JOIN subdef as s ON (s.record_id=d.record_id AND s.name='document')
WHERE ";
WHERE (" . $filter['sql'] . ")
AND (d.action = :action)
) AS tt " . ($this->filter->getOrderFilter() ? $this->filter->getOrderFilter() : '');
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);
return array('sql' => $this->sql, 'params' => $this->params);
}
}

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_sqlconnexion extends module_report_sql implements module_report_sqlReportInterface
{
@@ -27,51 +21,52 @@ class module_report_sqlconnexion extends module_report_sql implements module_rep
public function buildSql()
{
$report_filter = $this->filter->getReportFilter();
$params = $report_filter['params'];
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$this->params = array_merge(array(), $filter['params']);
$this->params = $params;
if ($this->groupby == false) {
$this->sql = "
SELECT
user,
usrid,
DISTINCT(log_colls.log_id),
log.user,
log.usrid,
log.date as ddate,
log.societe,
log.pays,
log.activite,
log.fonction,
site,
sit_session,
appli,
ip
log.site,
log.sit_session,
log.appli,
log.ip
FROM log FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)";
$this->sql .= " WHERE " . $report_filter['sql'];
$this->sql .= $this->filter->getOrderFilter() ? : '';
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE (" . $filter['sql'] .")";
$stmt = $this->connbas->prepare($this->sql);
$stmt->execute($params);
$stmt->execute($this->params);
$this->total_row = $stmt->rowCount();
$stmt->closeCursor();
if ($this->enable_limit)
$this->sql .= $this->filter->getLimitFilter() ? : '';
} else {
$this->sql = "
SELECT TRIM(" . $this->getTransQuery($this->groupby) . ")
as " . $this->groupby . ", SUM(1) as nb
FROM log FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)";
if ($report_filter['sql'])
$this->sql .= " WHERE " . $report_filter['sql'];
$this->sql .= " GROUP BY " . $this->groupby;
$this->sql .= $this->filter->getOrderFilter() ? : '';
if ($this->enable_limit) {
$this->sql .= $this->filter->getLimitFilter() ? : '';
}
} else {
$this->sql = "
SELECT " . $this->groupby . ", SUM(1) as nb
FROM (
SELECT DISTINCT(log.id), TRIM(" . $this->getTransQuery($this->groupby) . ") AS " . $this->groupby . "
FROM log FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE (" . $filter['sql'] .")
) AS tt
GROUP BY " . $this->groupby. "
ORDER BY nb DESC";
$stmt = $this->connbas->prepare($this->sql);
$stmt->execute($params);
$stmt->execute($this->params);
$this->total_row = $stmt->rowCount();
$stmt->closeCursor();
}
@@ -81,19 +76,18 @@ class module_report_sqlconnexion extends module_report_sql implements module_rep
public function sqlDistinctValByField($field)
{
$report_filter = $this->filter->getReportFilter();
$params = $report_filter['params'];
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$this->params = array_merge(array(), $filter['params']);
$sql = '
SELECT DISTINCT(' . $this->getTransQuery($field) . ') as val
$this->sql = '
SELECT DISTINCT(val)
FROM (
SELECT DISTINCT(log.id), ' . $this->getTransQuery($field) . ' AS val
FROM log FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)';
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE (' . $filter['sql'] . ')
) AS tt ORDER BY val ASC';
if ($report_filter['sql'])
$sql .= ' WHERE ' . $report_filter['sql'];
$sql .= ' ORDER BY val ASC';
return array('sql' => $sql, 'params' => $params);
return array('sql' => $this->sql, 'params' => $this->params);
}
}

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_sqldownload extends module_report_sql implements module_report_sqlReportInterface
{
protected $restrict = false;
@@ -31,144 +25,97 @@ class module_report_sqldownload extends module_report_sql implements module_repo
public function buildSql()
{
$report_filters = $this->filter->getReportFilter();
$record_filters = $this->filter->getRecordFilter() ? : array('sql' => '', 'params' => array());
$this->params = array_merge($report_filters['params'], $record_filters['params']);
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$this->params = array_merge(array(), $filter['params']);
if ($this->groupby == false) {
$this->sql = "
SELECT
log.user,
log.site,
log.societe,
log.pays,
log.activite,
log.fonction,
log.usrid,
record.coll_id,
log_docs.date AS ddate,
log_docs.id,
log_docs.log_id,
log_docs.record_id,
log_docs.final,
log_docs.comment
FROM log FORCE INDEX (date_site)
INNER JOIN log_docs ON (log.id = log_docs.log_id)
SELECT DISTINCT(log.log_id), log.user, log.societe, log.pays, log.activite,
log.fonction, log.usrid, log_docs.date AS ddate, log_docs.record_id, log_docs.final, log_docs.comment
FROM log_docs
INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_docs.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
INNER JOIN record ON (log_docs.record_id = record.record_id)
WHERE ";
WHERE (" .$filter['sql'] . ") AND (log_docs.action = 'download' OR log_docs.action = 'mail')";
$this->sql .= $report_filters['sql'] ? : '';
$this->sql .= ' AND ( log_docs.action = \'download\' OR log_docs.action = \'mail\')';
if ($this->restrict)
$this->sql .= ' AND ( log_docs.final = "document" OR log_docs.final = "preview")';
$this->sql .= empty($record_filters['sql']) ? '' : ' AND ( ' . $record_filters['sql'] . ' )';
$this->sql .= $this->filter->getOrderFilter() ? : '';
$stmt = $this->connbas->prepare($this->sql);
$stmt->execute($this->params);
$this->total_row = $stmt->rowCount();
$stmt->closeCursor();
$this->sql .= $this->filter->getLimitFilter() ? : '';
if ($this->restrict) {
$this->sql .= ' AND (log_docs.final = "document" OR log_docs.final = "preview")';
}
} else {
$name = $this->groupby;
$field = $this->getTransQuery($this->groupby);
if ($name == 'record_id' && $this->on == 'DOC') {
$this->sql = '
SELECT
TRIM( ' . $field . ' ) AS ' . $name . ',
SUM(1) AS telechargement,
record.coll_id,
log_docs.final,
log_docs.comment,
subdef.size,
subdef.file,
subdef.mime
SELECT ' . $name . ', SUM(1) AS telechargement, tt.comment, tt.size, tt.file, tt.mime, tt.final
FROM (
SELECT DISTINCT(log.id), TRIM( ' . $field . ' ) AS ' . $name . ', log_docs.comment, subdef.size, subdef.file, subdef.mime, log_docs.final
FROM log FORCE INDEX (date_site)
INNER JOIN log_docs ON (log.id = log_docs.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
INNER JOIN record ON (log_docs.record_id = record.record_id)
INNER JOIN subdef ON (log_docs.record_id = subdef.record_id AND subdef.name = log_docs.final)
WHERE
';
INNER JOIN subdef ON (log_docs.record_id = subdef.record_id)';
} elseif ($this->on == 'DOC') {
$this->sql = '
SELECT
TRIM(' . $field . ') AS ' . $name . ',
SUM(1) AS telechargement
SELECT ' . $name . ', SUM(1) AS telechargement
FROM (
SELECT DISTINCT(log.id), TRIM(' . $field . ') AS ' . $name . '
FROM log FORCE INDEX (date_site)
INNER JOIN log_docs ON (log.id = log_docs.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
INNER JOIN record ON (log_docs.record_id = record.record_id)
INNER JOIN subdef ON ( log_docs.record_id = subdef.record_id AND subdef.name = log_docs.final)
WHERE';
INNER JOIN subdef ON ( log_docs.record_id = subdef.record_id)';
} else {
$this->sql = '
SELECT
TRIM( ' . $this->getTransQuery($this->groupby) . ') AS ' . $name . ',
SUM(1) AS nombre
SELECT ' . $name . ', SUM(1) AS nombre
FROM (
SELECT DISTINCT(log.id), TRIM( ' . $this->getTransQuery($this->groupby) . ') AS ' . $name . '
FROM log FORCE INDEX (date_site)
INNER JOIN log_docs ON (log.id = log_docs.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
INNER JOIN record ON (log_docs.record_id = record.record_id)
INNER JOIN subdef ON (record.record_id = subdef.record_id AND subdef.name = "document")
WHERE ';
INNER JOIN subdef ON (record.record_id = subdef.record_id)';
}
$this->sql .= $report_filters['sql'];
$this->sql .= ' AND ( log_docs.action = \'download\' OR log_docs.action = \'mail\')';
$this->sql .= empty($record_filters['sql']) ? '' : ' AND ( ' . $record_filters['sql'] . ' )';
$this->sql .= ' WHERE (subdef.name = log_docs.final) AND ' . $filter['sql'] . ' ';
$this->sql .= 'AND ( log_docs.action = \'download\' OR log_docs.action = \'mail\') ';
$this->sql .= $this->on == 'DOC' ? 'AND subdef.name = \'document\' ' : '';
$this->sql .= ' GROUP BY ' . $this->groupby;
$this->sql .= ( $name == 'record_id' && $this->on == 'DOC') ? ' , final' : '';
if ($this->filter->getOrderFilter())
$this->sql .= $this->filter->getOrderFilter();
$this->sql .= ') as tt';
$this->sql .= ' GROUP BY ' . $name . ' ' . ($name == 'record_id' && $this->on == 'DOC' ? ', final' : '');
}
$stmt = $this->connbas->prepare($this->sql);
$stmt->execute($this->params);
$this->total = $stmt->rowCount();
$stmt->closeCursor();
$this->sql .= $this->filter->getOrderFilter() ? : '';
$this->sql .= $this->filter->getLimitFilter() ? : '';
}
return $this;
}
public function sqlDistinctValByField($field)
{
$report_filters = $this->filter->getReportFilter();
$params = array_merge($report_filters['params']);
$this->params = $params;
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$this->params = array_merge(array(), $filter['params']);
$sql = '
SELECT DISTINCT( ' . $this->getTransQuery($field) . ' ) AS val
$this->sql = '
SELECT DISTINCT(tt.val)
FROM (
SELECT DISTINCT(log.id), ' . $this->getTransQuery($field) . ' AS val
FROM log FORCE INDEX (date_site)
INNER JOIN log_docs ON (log.id = log_docs.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
INNER JOIN record ON (log_docs.record_id = record.record_id)
INNER JOIN subdef ON (log_docs.record_id = subdef.record_id)
WHERE ';
WHERE (' . $filter['sql'] . ')
AND (log_docs.action = "download" OR log_docs.action = "mail")' .
($this->on == 'DOC' ? ' AND subdef.name = "document"' : '') .
') AS tt';
$sql .= $report_filters['sql'];
$sql .= ' AND (log_docs.action = ' .
'\'download\'OR log_docs.action = \'mail\')';
$this->sql .= $this->filter->getOrderFilter() ? : '';
$this->sql .= $this->filter->getLimitFilter() ? : '';
$sql .= $this->on == 'DOC' ? 'AND subdef.name = \'document\'' : '';
$sql .= $this->filter->getOrderFilter() ? : '';
$sql .= $this->filter->getLimitFilter() ? : '';
return array('sql' => $sql, 'params' => $params);
return array('sql' => $this->sq, 'params' => $this->params);
}
}

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_sqlfilter
{
public $conn;

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_sqlquestion extends module_report_sql implements module_report_sqlReportInterface
{
@@ -27,52 +21,38 @@ class module_report_sqlquestion extends module_report_sql implements module_repo
public function buildSql()
{
$params = array();
$report_filter = $this->filter->getReportFilter();
$params = array_merge($params, $report_filter['params']);
$this->params = $params;
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$this->params = array_merge(array(), $filter['params']);
if ($this->groupby == false) {
$this->sql ="
SELECT
log_search.date ddate,
search,
usrid,
user,
pays,
societe,
activite,
fonction
FROM (`log_search`)
SELECT DISTINCT(log.id), log_search.date ddate, log_search.search, log.usrid, log.user, log.pays, log.societe, log.activite, log.fonction
FROM log_search
INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_search.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)";
$this->sql .= " WHERE " . $report_filter['sql'];
$this->sql .= $this->filter->getOrderFilter() ? : '';
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) WHERE (" . $filter['sql'] .")";
$stmt = $this->connbas->prepare($this->sql);
$stmt->execute($params);
$stmt->execute($this->params);
$this->total_row = $stmt->rowCount();
$stmt->closeCursor();
$this->sql .= $this->filter->getOrderFilter() ? : '';
$this->sql .= $this->filter->getLimitFilter() ? : '';
} else {
$this->sql = "
SELECT
TRIM(" . $this->getTransQuery($this->groupby) . ") as " . $this->groupby . ",
SUM(1) as nb
SELECT " . $this->groupby . ", SUM(1) AS nb
FROM (
SELECT DISTINCT(log.id), TRIM(" . $this->getTransQuery($this->groupby) . ") AS " . $this->groupby . "
FROM (`log_search`)
INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_search.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
";
$this->sql .= " WHERE " . $report_filter['sql'];
$this->sql .= " GROUP BY " . $this->groupby;
$this->sql .= " ORDER BY nb DESC";
WHERE (" . $filter['sql'] .")
) AS tt
GROUP BY " . $this->groupby ."
ORDER BY nb DESC";
$stmt = $this->connbas->prepare($this->sql);
$stmt->execute($params);
$stmt->execute($this->params);
$this->total_row = $stmt->rowCount();
$stmt->closeCursor();
}
@@ -82,22 +62,20 @@ class module_report_sqlquestion extends module_report_sql implements module_repo
public function sqlDistinctValByField($field)
{
$params = array();
$report_filter = $this->filter->getReportFilter();
$params = array_merge($params, $report_filter['params']);
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$this->params = array_merge(array(), $filter['params']);
$sql = "
SELECT DISTINCT(" . $this->getTransQuery($field) . ") as val
$this->sql = "
SELECT DISTINCT(tt.val)
FROM (
SELECT DISTINCT(log.id), " . $this->getTransQuery($field) . " AS val
FROM (`log_search`)
INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_search.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
";
WHERE (" . $filter['sql'] . ")
) as tt
ORDER BY tt.val ASC";
if ($report_filter['sql'])
$sql .= ' WHERE ' . $report_filter['sql'];
$sql .= " ORDER BY " . $this->getTransQuery($field) . " ASC";
return array('sql' => $sql, 'params' => $params);
return array('sql' => $this->sql, 'params' => $this->params);
}
}

View File

@@ -11,12 +11,6 @@
use Alchemy\Phrasea\Application;
/**
*
* @package module_report
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class module_report_validate extends module_report
{
protected $cor_query = array(

View File

@@ -121,12 +121,6 @@ class activityTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $detailDl);
}
public function push($report)
{
$push = $report->getPush();
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $push);
}
public function topTenUser($report, $sbasid, $colllist)
{
$result = $report->topTenUser(self::$DI['app'], $this->dmin, $this->dmax, $sbasid, $colllist);

View File

@@ -876,7 +876,6 @@ function pushDoc(Application $app, $param, $twig)
'record_id' => array("", 1, 1, 1, 1),
'file' => array("", 1, 0, 1, 1),
'mime' => array("", 1, 0, 1, 1),
'size' => array("", 1, 0, 1, 1)
);
$dl = new module_report_push($app, $param['dmin'], $param['dmax'], $param['sbasid'], $param['collection']);
@@ -899,7 +898,6 @@ function addDoc(Application $app, $param, $twig)
'record_id' => array("", 1, 1, 1, 1),
'file' => array("", 1, 0, 1, 1),
'mime' => array("", 1, 0, 1, 1),
'size' => array("", 1, 0, 1, 1)
);
$dl = new module_report_add($app, $param['dmin'], $param['dmax'], $param['sbasid'], $param['collection']);
@@ -922,7 +920,6 @@ function ediDoc(Application $app, $param, $twig)
'record_id' => array("", 1, 1, 1, 1),
'file' => array("", 1, 0, 1, 1),
'mime' => array("", 1, 0, 1, 1),
'size' => array("", 1, 0, 1, 1)
);
$dl = new module_report_edit($app, $param['dmin'], $param['dmax'], $param['sbasid'], $param['collection']);
@@ -946,7 +943,6 @@ function validDoc(Application $app, $param, $twig)
'record_id' => array("", 1, 1, 1, 1),
'file' => array("", 1, 0, 1, 1),
'mime' => array("", 1, 0, 1, 1),
'size' => array("", 1, 0, 1, 1)
);
$dl = new module_report_validate($app, $param['dmin'], $param['dmax'], $param['sbasid'], $param['collection']);