|
|
@@ -3,29 +3,38 @@
|
|
|
class tags
|
|
|
{
|
|
|
|
|
|
- public static function getAll() {
|
|
|
- db::query("SELECT "
|
|
|
+ public static function getAll(float $_idTag = NULL) {
|
|
|
+
|
|
|
+ if($_idTag == NULL){
|
|
|
+ db::query("SELECT "
|
|
|
. "* "
|
|
|
. "FROM " . DB_T_TAGS);
|
|
|
+ } else {
|
|
|
+ db::query("SELECT "
|
|
|
+ . "* "
|
|
|
+ . "FROM " . DB_T_TAGS
|
|
|
+ . " WHERE id_type = :idTag");
|
|
|
+ db::bind(':idTag', $_idTag);
|
|
|
+ }
|
|
|
return db::resultset();
|
|
|
}
|
|
|
|
|
|
- public static function getJquery() {
|
|
|
+ public static function getJquery(float $_idTag = NULL) {
|
|
|
$tmp = "[";
|
|
|
- foreach (self::getAll() as $tags) {
|
|
|
+ foreach (self::getAll($_idTag) as $tags) {
|
|
|
$tmp .= "'".$tags["label"]."', ";
|
|
|
}
|
|
|
$tmp .= "]";
|
|
|
return $tmp;
|
|
|
}
|
|
|
|
|
|
- public static function textToId(string $_tags = NULL) {
|
|
|
+ public static function textToId(string $_tags = NULL, float $_idTag = NULL) {
|
|
|
$return = NULL;
|
|
|
if($_tags != NULL) {
|
|
|
$find = [];
|
|
|
$tmp = explode(",", $_tags);
|
|
|
|
|
|
- $allTags = self::getAll();
|
|
|
+ $allTags = self::getAll($_idTag);
|
|
|
|
|
|
foreach ($allTags as $f) {
|
|
|
$find[$f["id"]] = $f["label"];
|
|
|
@@ -40,13 +49,13 @@ class tags
|
|
|
return $return;
|
|
|
}
|
|
|
|
|
|
- public static function idToTtext(string $_ids = NULL) {
|
|
|
+ public static function idToTtext(string $_ids = NULL, float $_idTag = NULL) {
|
|
|
$return = NULL;
|
|
|
if($_ids != NULL) {
|
|
|
|
|
|
$tmp = explode(",", $_ids);
|
|
|
|
|
|
- $allTags = self::getAll();
|
|
|
+ $allTags = self::getAll($_idTag);
|
|
|
|
|
|
foreach ($allTags as $f) {
|
|
|
$find[$f["label"]] = $f["id"];
|