mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 08:34:29 +00:00
make tagsArrayAC a computed and rename it to availableTags
This commit is contained in:
@@ -31,8 +31,7 @@ class Bookmark extends FHCAPI_Controller
|
||||
'delete' => self::PERM_LOGGED,
|
||||
'insert' => self::PERM_LOGGED,
|
||||
'update' => self::PERM_LOGGED,
|
||||
'changeOrder' => self::PERM_LOGGED,
|
||||
'getAllBookmarkTags' => self::PERM_LOGGED,
|
||||
'changeOrder' => self::PERM_LOGGED
|
||||
]);
|
||||
|
||||
$this->load->model('dashboard/Bookmark_model', 'BookmarkModel');
|
||||
@@ -169,20 +168,5 @@ class Bookmark extends FHCAPI_Controller
|
||||
|
||||
$this->terminateWithSuccess($update_result);
|
||||
}
|
||||
|
||||
/**
|
||||
* get all the bookmark tags associated to a user
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getAllBookmarkTags()
|
||||
{
|
||||
$this->BookmarkModel->addOrder("sort");
|
||||
$result = $this->BookmarkModel->getAllBookmarkTags($this->uid);
|
||||
|
||||
$bookmarks = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithSuccess(current($bookmarks));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,21 +11,4 @@ class Bookmark_model extends DB_Model
|
||||
$this->dbTable = 'dashboard.tbl_bookmark';
|
||||
$this->pk = 'bookmark_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* returns all bookmark tags of a user
|
||||
*/
|
||||
public function getAllBookmarkTags($uid)
|
||||
{
|
||||
$qry = "
|
||||
SELECT array_agg(DISTINCT tag) AS data
|
||||
FROM (
|
||||
SELECT jsonb_array_elements_text(tag) AS tag
|
||||
FROM dashboard.tbl_bookmark
|
||||
WHERE uid = ?
|
||||
) t;
|
||||
";
|
||||
|
||||
return $this->execQuery($qry, array('uid' => $uid));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user