mirror of
https://github.com/Karaka-Management/oms-Tasks.git
synced 2026-02-12 12:48:41 +00:00
Implement task navigation info
This commit is contained in:
parent
69767861c9
commit
89a7955297
|
|
@ -75,7 +75,9 @@ class Controller extends ModuleAbstract implements WebInterface
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static $providing = [];
|
protected static $providing = [
|
||||||
|
'Navigation'
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dependencies.
|
* Dependencies.
|
||||||
|
|
@ -183,6 +185,11 @@ class Controller extends ModuleAbstract implements WebInterface
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function openNav(int $account) : int
|
||||||
|
{
|
||||||
|
return TaskMapper::countUnread($account);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param RequestAbstract $request Request
|
* @param RequestAbstract $request Request
|
||||||
* @param ResponseAbstract $response Response
|
* @param ResponseAbstract $response Response
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,30 @@ class TaskMapper extends DataMapperAbstract
|
||||||
return $objId;
|
return $objId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function countUnread(int $user) : int
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$query = new Builder(self::$db);
|
||||||
|
|
||||||
|
$query->prefix(self::$db->getPrefix())
|
||||||
|
->count()
|
||||||
|
->from(self::$table)
|
||||||
|
->where(self::$table . '.task_created_by', '=', $user)
|
||||||
|
->where(self::$table . '.task_status', '=', TaskStatus::OPEN, 'and');
|
||||||
|
|
||||||
|
$sth = self::$db->con->prepare($query->toSql());
|
||||||
|
$sth->execute();
|
||||||
|
|
||||||
|
$count = $sth->fetchAll()[0][0] ?? 0;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $count;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find.
|
* Find.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user