method getSlist documentation in bbn\Appui\Task
function($search, $order = 'last', $dir = 'DESC', $limit = 1000, $start = 0)
{
'id' => 'bbn_tasks.id',
'last' => 'last',
'first' => 'first',
'duration' => 'duration',
'num_children' => 'num_children',
'title' => 'notevers.title',
'content' => 'notevers.content',
'num_notes' => 'num_notes',
'role' => 'role',
'state' => 'state',
'priority' => 'priority'
];
if ( !isset($orders_ok[$order]) || !bbn\Str::isInteger($limit, $start) ){
return false;
}
$dir = strtolower($dir) === 'asc' ? 'ASC' : 'DESC';
$sql = "
SELECT bbn_tasks.*, role,
notevers.title AS title,
notevers.content AS content,
FROM_UNIXTIME(MAX(bbn_tasks_logs.chrono)) AS `last_action`,
{$this->references_select}
COUNT(children.id) AS num_children,
COUNT(DISTINCT bbn_tasks_notes.id_note) AS num_notes,
IF(bbn_tasks.`state`=".$this->idState('closed').", MAX(bbn_tasks_logs.chrono), UNIX_TIMESTAMP()) - MIN(bbn_tasks_logs.chrono) AS duration
FROM bbn_tasks
JOIN bbn_notes_versions AS notevers
ON notevers.id_note = bbn_tasks.id_note
AND notevers.latest = 1
JOIN bbn_tasks_logs
ON bbn_tasks_logs.id_task = bbn_tasks.id
LEFT JOIN bbn_tasks_notes
ON bbn_tasks_notes.id_task = bbn_tasks.id
LEFT JOIN bbn_tasks_roles
ON bbn_tasks_roles.id_task = bbn_tasks.id
AND bbn_tasks_roles.id_user = {$this->id_user}
LEFT JOIN bbn_notes_versions
ON bbn_notes_versions.id_note = bbn_tasks_notes.id_note
AND bbn_tasks_notes.active =1
LEFT JOIN bbn_tasks AS children
ON children.id = bbn_tasks.id
AND children.active = 1
{$this->references_join}
WHERE (notevers.title LIKE ?
OR notevers.content LIKE ?
OR bbn_notes_versions.content LIKE ?)
AND bbn_tasks.active = 1
GROUP BY bbn_tasks.id
LIMIT $start, $limit";
$opt = bbn\Appui\Option::getInstance();
$res = $this->db->getRows($sql, "%$search%");
/*
foreach ( $res as $i => $r ){
$res[$i]['type'] = $opt->itext($r['type']);
$res[$i]['state'] = $opt->itext($r['state']);
$res[$i]['role'] = $opt->itext($r['role']);
$res[$i]['hasChildren'] = $r['num_children'] ? true : false;
}
foreach ( $res as $i => $r ){
$res[$i]['details'] = $this->info($r['id']);
}
*/
X::sortBy($res, $order, $dir);
return [
'data' => $res,
'total' => \count($res)
];
}
BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2023
BBN Solutions