provide a tag cloud for app categories and allow filtering apps from this

This commit is contained in:
redmatrix
2016-05-04 18:27:46 -07:00
parent 1b6bc5394b
commit 566667a263
6 changed files with 98 additions and 3 deletions

View File

@@ -370,12 +370,29 @@ function app_installed($uid,$app) {
}
function app_list($uid, $deleted = false) {
function app_list($uid, $deleted = false, $cat = '') {
if($deleted)
$sql_extra = " and app_deleted = 1 ";
else
$sql_extra = " and app_deleted = 0 ";
if($cat) {
$r = q("select oid from term where otype = %d and term = '%s'",
intval(TERM_OBJ_APP),
dbesc($cat)
);
if(! $r)
return $r;
$sql_extra .= " and app.id in ( ";
$s = '';
foreach($r as $rr) {
if($s)
$s .= ',';
$s .= intval($rr['oid']);
}
$sql_extra .= $s . ') ';
}
$r = q("select * from app where app_channel = %d $sql_extra order by app_name asc",
intval($uid)
);