method getList documentation in bbn\Appui\Task

function($parent = NULL, $status = 'opened|ongoing|holding', $id_user = false, $order = 'priority', $dir = 'ASC', $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) || (!\is_null($parent) && !bbn\Str::isInteger($parent)) ){ return false; } $dir = strtolower($dir) === 'asc' ? 'ASC' : 'DESC'; if ( !$id_user ){ $id_user = $this->id_user; } $where = []; if ( !empty($status) ){ $statuses = []; $tmp = explode("|", $status); foreach ( $tmp as $s ){ if ( $t = $this->idState($s) ){ array_push($statuses, $t); array_push($where, "`bbn_tasks`.`state` = $t"); } } } $where = \count($where) ? implode( " OR ", $where) : ''; $sql = " SELECT `role`, bbn_tasks.*, notevers.title AS title, notevers.content AS content, FROM_UNIXTIME(MIN(bbn_tasks_logs.chrono)) AS `first`, FROM_UNIXTIME(MAX(bbn_tasks_logs.chrono)) AS `last`, {$this->references_select} COUNT(children.id) AS num_children, COUNT(DISTINCT bbn_tasks_notes.id_note) AS num_notes, MAX(bbn_tasks_logs.chrono) - MIN(bbn_tasks_logs.chrono) AS duration FROM bbn_tasks_roles JOIN bbn_tasks ON bbn_tasks_roles.id_task = bbn_tasks.id 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_roles.id_task LEFT JOIN bbn_tasks_notes ON bbn_tasks_notes.id_task = bbn_tasks_roles.id_task AND bbn_tasks_notes.active = 1 LEFT JOIN bbn_tasks AS children ON bbn_tasks.id = children.id_parent AND bbn_tasks.active = 1 {$this->references_join} WHERE bbn_tasks_roles.id_user = ?". (empty($where) ? '' : " AND ($where)")." AND bbn_tasks.active = 1 AND bbn_tasks.id_alias IS NULL AND bbn_tasks.id_parent ".( \is_null($parent) ? "IS NULL" : "= $parent" )." GROUP BY bbn_tasks_roles.id_task LIMIT $start, $limit"; $opt = bbn\Appui\Option::getInstance(); $res = $this->db->getRows($sql, $id_user); foreach ( $res as $i => $r ){ $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 $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.