$rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : '')); return replace_macros(get_markup_template('categories_widget.tpl'),array( '$title' => t('Categories'), '$desc' => '', '$sel_all' => (($selected == '') ? 'selected' : ''), '$all' => t('Everything'), '$terms' => $terms, '$base' => $baseurl, )); } return ''; } static function cardcategories_widget($baseurl,$selected = '') { if(! Apps::system_app_installed(App::$profile['profile_uid'],'Categories')) return ''; $sql_extra = item_permissions_sql(App::$profile['profile_uid']); $item_normal = "and item.item_hidden = 0 and item.item_type = 6 and item.item_deleted = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_pending_remove = 0 and item.item_blocked = 0 "; $terms = array(); $r = q("select distinct(term.term) from term join item on term.oid = item.id where item.uid = %d and term.uid = item.uid and term.ttype = %d and term.otype = %d and item.owner_xchan = '%s' $item_normal $sql_extra order by term.term asc", intval(App::$profile['profile_uid']), intval(TERM_CATEGORY), intval(TERM_OBJ_POST), dbesc(App::$profile['channel_hash']) ); if($r && count($r)) { foreach($r as $rr) $terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : '')); return replace_macros(get_markup_template('categories_widget.tpl'),array( '$title' => t('Categories'), '$desc' => '', '$sel_all' => (($selected == '') ? 'selected' : ''), '$all' => t('Everything'), '$terms' => $terms, '$base' => $baseurl, )); } return ''; } static function categories_widget($baseurl,$selected = '') { if(! Apps::system_app_installed(App::$profile['profile_uid'],'Categories')) return ''; require_once('include/security.php'); $sql_extra = item_permissions_sql(App::$profile['profile_uid']); $item_normal = item_normal(); $terms = array(); $r = q("select distinct(term.term) from term join item on term.oid = item.id where item.uid = %d and term.uid = item.uid and term.ttype = %d and term.otype = %d and item.owner_xchan = '%s' and item.item_wall = 1 and item.verb != '%s' $item_normal $sql_extra order by term.term asc", intval(App::$profile['profile_uid']), intval(TERM_CATEGORY), intval(TERM_OBJ_POST), dbesc(App::$profile['channel_hash']), dbesc(ACTIVITY_UPDATE) ); if($r && count($r)) { foreach($r as $rr) $terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : '')); return replace_macros(get_markup_template('categories_widget.tpl'),array( '$title' => t('Categories'), '$desc' => '', '$sel_all' => (($selected == '') ? 'selected' : ''), '$all' => t('Everything'), '$terms' => $terms, '$base' => $baseurl, )); } return ''; } }