|
|
@@ -2,6 +2,25 @@
|
|
|
|
|
|
class FeatureAttrSelected {
|
|
|
|
|
|
+ static function getSelectState($typeName, array $listPrimaryKeys) {
|
|
|
+ $idUser = User::getID();
|
|
|
+ self::prepareUserTable($typeName, $idUser);
|
|
|
+ $tableName = self::getAttributeTableName($typeName, $idUser);
|
|
|
+ if (empty($listPrimaryKeys)) return [];
|
|
|
+ $dbQuote = [ DB::getPDO(), 'quote' ];
|
|
|
+ $sqlPks = implode(", ", array_map(function ($pk) use ($dbQuote) {
|
|
|
+ return $dbQuote($pk);
|
|
|
+ }, $listPrimaryKeys));
|
|
|
+ $selected = DB::getPDO()->fetchValuesListByKey("
|
|
|
+ select primaryKey
|
|
|
+ from `{$tableName}`
|
|
|
+ where primaryKey in ( {$sqlPks} )
|
|
|
+ ", $key = 'primaryKey');
|
|
|
+ return array_combine($listPrimaryKeys, array_map(function ($pk) use ($selected) {
|
|
|
+ return in_array($pk, $selected);
|
|
|
+ }, $listPrimaryKeys));
|
|
|
+ }
|
|
|
+
|
|
|
static function select($typeName, array $listPrimaryKeys) {
|
|
|
$idUser = User::getID();
|
|
|
self::prepareUserTable($typeName, $idUser);
|