* Better error handling and display while adding / update and delete
** Maybe some message "store"
-* query optimization and default indexes on columns
* make documentation markdown to be nicer
* change multiple-attachment to a field which tells it is used for a image gallery
* update JS and remove deprecations
-* complete profile view. Groups still missing.
* minimal theme
** https://watercss.kognise.dev/
* create a real fallback theme, which does not depend on any styling/css
/**
* Bibliotheca
*
- * Copyright 2018-2023 Johannes Keßler
+ * Copyright 2018-2024 Johannes Keßler
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
# reset the menu
$this->_menuData = array();
- $queryStr = "SELECT id, text, action, icon, category, contextaction
+ $queryStr = "SELECT `id`, `text`, `action`, `icon`, `category`, `contextaction`
FROM `".DB_PREFIX."_menu`
WHERE ".$this->_User->getSQLRightsString()."
ORDER BY position";
return $ret;
}
- /**
- * Get entries for loaded collection by looking for the given value in given field
- *
- * @TODO: unused?
- *
- * @param string $fieldId Number ID of the field to search in
- * @param string $fieldValue Value of the field
- * @return array
- */
- public function getEntriesByFieldValue(string $fieldId, string $fieldValue): array {
- $ret = array();
-
- $_entryFields = $this->_getEntryFields();
- if(isset($_entryFields[$fieldId])) {
- $fieldData = $_entryFields[$fieldId];
- }
-
- if(empty($fieldData)) return $ret;
-
- if($fieldData['type'] !== "lookupmultiple") {
- return $this->getEntries(
- array(
- 0 => array(
- 'colName' => $fieldData['identifier'],
- 'colValue' => $fieldValue,
- 'fieldData' => $fieldData
- )
- )
- );
-
- }
-
- $querySelect = "SELECT `fk_entry`";
- $queryFrom = " FROM `".DB_PREFIX."_collection_entry2lookup_".$this->_DB->real_escape_string($this->_collectionId)."` AS t";
- $queryWhere = " WHERE t.fk_field = '".$this->_DB->real_escape_string($fieldId)."'
- AND t.value = '".$this->_DB->real_escape_string($fieldValue)."'";
-
- $queryOrder = " ORDER BY";
- if(!empty($this->_queryOptions['sort'])) {
- $queryOrder .= ' t.'.$this->_queryOptions['sort'];
- }
- else {
- $queryOrder .= " t.value";
- }
- if(!empty($this->_queryOptions['sortDirection'])) {
- $queryOrder .= ' '.$this->_queryOptions['sortDirection'];
- }
- else {
- $queryOrder .= " ASC";
- }
-
- $queryLimit = '';
- if(!empty($this->_queryOptions['limit'])) {
- $queryLimit .= " LIMIT ".$this->_queryOptions['limit'];
- # offset can be 0
- if($this->_queryOptions['offset'] !== false) {
- $queryLimit .= " OFFSET ".$this->_queryOptions['offset'];
- }
- }
-
- $queryStr = $querySelect.$queryFrom.$queryWhere.$queryOrder.$queryLimit;
- if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
- try {
- $query = $this->_DB->query($queryStr);
-
- if($query !== false && $query->num_rows > 0) {
- while(($result = $query->fetch_assoc()) != false) {
- $_r = $this->getEntry($result['fk_entry']);
- $ret['results'][$_r['id']] = $_r;
- }
-
- $queryCountStr = "SELECT COUNT(t.value) AS amount ".$queryFrom.$queryWhere;
- if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryCountStr));
- $query = $this->_DB->query($queryCountStr);
- $result = $query->fetch_assoc();
- $ret['amount'] = $result['amount'];
- }
- }
- catch (Exception $e) {
- Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
- }
-
- return $ret;
- }
-
- /**
+ /**
* Return the storage info for loaded collection
* Used by API
*