* delete of a collection
* sort by filter for collection display
* responsive and breakpoints
-* Advanced search. More options and searchable fields
+* DB query log and optimization
--- /dev/null
+TBD
+
+Bibliotheca provides a set of fields which can be used to define which data an entry in your collection
+can be saved.
+Those field definitions are stored in the DB itself and can currently only managed there. But only of
+you know how.
+
+Each collection can have there own set of fields. But at least the title field should be available.
+Fields can be managed after a collection has been created.
+
+
+# If you want to create new ones here is a explanation how they work
+A field is defined in the sys_fields table. It needs a _saveField and optinal _loadFieldValue method
+in manageentry.class and the _loadFieldValue also in mancubus.class
+HTML definitions are needed in view/UI_THEME/entry and view/UI_THEME/manageentry
+Modification on advancedsearch.php if search needs some special treatment for this field
+
+# Fields on sys_fields table
+Have a look into the table. Special ones are described here.
+
+identifier
+Unique string within the how sys_fields table.
+
+displayname
+Text which will be displayed for this field.
+
+type
+Specifies the type which then lets the code "know" what to do with this field.
+Needs a html definition in view/UI_THEME/entry and view/UI_THEME/manageentry.
+A _loadFieldValue_TYPE method in manageentry.class and mancubus.class if it needs special data process reading
+A _saveField_TYPE method in manageentry.class for data saving.
+Modification on advancedsearch.php if search needs some special treatment for this field
+
+searchtype
+- tag = releation to lookup2entry table
+- entryText = text col in entry table
+- entrySingleText = entry col in entry table. Single value
+- entrySingleNum = entry col in entry table. Number. Single value. Can be searched by with ><
+
+createstring
+The SQL create string which is run as you add it to your collection. Not everyone needs one!
+
+value
+The value which is displayed as a selection for the user. Needed for a selection type field
+
+apiinfo
+Text description what type of data the api expects if you want to fill this field.
--
INSERT INTO `#REPLACEME#_sys_fields` (`id`, `identifier`, `displayname`, `type`, `searchtype`, `createstring`, `value`, `apiinfo`, `created`, `modificationuser`, `owner`, `group`, `rights`) VALUES
-(1, 'title', 'Title', 'text', 'text', '`title` varchar(128) NOT NULL', NULL, 'string 128', '2019-09-01 18:26:33', 0, 1, 1, 'rw-r--r--'),
-(2, 'description', 'Description', 'text3', 'text', '`description` varchar(255) NULL DEFAULT NULL', NULL, 'string 64', '2019-09-01 18:28:35', 0, 1, 1, 'rw-r--r--'),
-(3, 'content', 'Main content', 'textarea', 'text', 'content` text NULL DEFAULT NULL,', NULL, 'mysql text', '2019-09-01 18:28:35', 0, 1, 1, 'rw-r--r--'),
-(4, 'releasedate', 'Release date', 'date', 'text', '`releasedate` timestamp NULL DEFAULT NULL', NULL, 'mysql timestamp', '2019-09-01 19:01:39', 0, 1, 1, 'rw-r--r--'),
+(1, 'title', 'Title', 'text', 'entryText', '`title` varchar(128) NOT NULL, ADD FULLTEXT (`title`)', NULL, 'string 128', '2019-09-01 18:26:33', 0, 1, 1, 'rw-r--r--'),
+(2, 'description', 'Description', 'text3', 'entryText', '`description` varchar(255) NULL DEFAULT NULL, ADD FULLTEXT (`description`)', NULL, 'string 255', '2019-09-01 18:28:35', 0, 1, 1, 'rw-r--r--'),
+(3, 'content', 'Main content', 'textarea', 'entryText', '`content` text NULL DEFAULT NULL, ADD FULLTEXT (`content`)', NULL, 'mysql text', '2019-09-01 18:28:35', 0, 1, 1, 'rw-r--r--'),
(5, 'tag', 'Tag', 'lookupmultiple', 'tag', NULL, NULL, 'string 64', '2019-09-01 19:11:18', 0, 1, 1, 'rw-r--r--'),
(6, 'category', 'Category', 'lookupmultiple', 'tag', NULL, NULL, 'string 64', '2019-09-01 19:11:18', 0, 1, 1, 'rw-r--r--'),
(7, 'publisher', 'Publisher', 'lookupmultiple', 'tag', NULL, NULL, 'string 64', '2019-09-01 19:17:51', 0, 1, 1, 'rw-r--r--'),
(8, 'developer', 'Developer', 'lookupmultiple', 'tag', NULL, NULL, 'string 64', '2019-09-01 19:17:51', 0, 1, 1, 'rw-r--r--'),
(9, 'platform', 'Platform', 'selection', 'tag', '`platform` varchar(32) NULL DEFAULT NULL', 'PC,Xbox,Playstation,Nintendo,Nintendo Switch', 'One of PC,Xbox,Playstation,Nintendo,Nintendo Switch', '2019-09-01 19:18:33', 0, 1, 1, 'rw-r--r--'),
(10, 'storage', 'Storage', 'lookupmultiple', 'tag', NULL, NULL, 'string 64', '2019-09-01 19:18:33', 0, 1, 1, 'rw-r--r--'),
-(13, 'rating', 'Rating', 'selection', 'tag', '`rating` varchar(16) NULL DEFAULT NULL', '0/10,2/10,3/10,4/10,5/10,6/10,7/10,8/10,9/10,10/10', 'One of 0/10,2/10,3/10,4/10,5/10,6/10,7/10,8/10,9/10,10/10', '2019-09-01 19:25:35', 0, 1, 1, 'rw-r--r--'),
-(14, 'year', 'Year', 'year', 'tag', '`year` year NULL DEFAULT NULL', NULL, 'mysql year', '2019-09-01 19:30:11', 0, 1, 1, 'rw-r--r--'),
+(13, 'rating', 'Rating', 'selection', 'entrySingleText', '`rating` varchar(16) NULL DEFAULT NULL', '0/10,2/10,3/10,4/10,5/10,6/10,7/10,8/10,9/10,10/10', 'One of 0/10,2/10,3/10,4/10,5/10,6/10,7/10,8/10,9/10,10/10', '2019-09-01 19:25:35', 0, 1, 1, 'rw-r--r--'),
+(14, 'year', 'Year', 'year', 'entrySingleText', '`year` year NULL DEFAULT NULL', NULL, 'mysql year', '2019-09-01 19:30:11', 0, 1, 1, 'rw-r--r--'),
(15, 'coverimage', 'Cover image', 'upload', NULL, NULL, NULL, 'One file in $_FILES[uploads] of post', '2019-09-01 19:48:44', 0, 1, 1, 'rw-r--r--'),
(16, 'attachment', 'Attachments', 'upload_multiple', NULL, NULL, NULL, 'Multiple in $_FILES[uploads] of post', '2019-09-01 19:48:44', 0, 1, 1, 'rw-r--r--'),
(17, 'os', 'Operating system and version', 'selection', 'tag', '`os` varchar(32) NULL DEFAULT NULL', 'Windows 10,Windows 95, Windows 99,Windows XP, Windows ME, Windows 2000,Windows Vista,Windows 8', 'One of Windows 10,Windows 95, Windows 99,Windows XP, Windows ME, Windows 2000,Windows Vista,Windows 8', '2019-09-01 19:55:13', 0, 1, 1, 'rw-r--r--'),
(20, 'directors', 'Directors', 'lookupmultiple', 'tag', NULL, NULL, 'string 64', '2020-07-26 07:17:59', NULL, 1, 1, 'rw-r--r--'),
(21, 'genres', 'Genres', 'lookupmultiple', 'tag', NULL, NULL, 'string 64', '2020-07-26 07:18:55', NULL, 1, 1, 'rw-r--r--'),
(22, 'languages', 'Languages', 'lookupmultiple', 'tag', NULL, NULL, 'string 64', '2020-07-26 07:20:45', NULL, 1, 1, 'rw-r--r--'),
-(23, 'runtime', 'Runtime', 'text', 'text', '`runtime` varchar(128) NULL DEFAULT NULL', NULL, 'string 128', '2020-07-26 07:22:24', NULL, 1, 1, 'rw-r--r--'),
-(24, 'imdbrating', 'IMDB Rating', 'text', 'text', '`imdbrating` varchar(128) NULL DEFAULT NULL', NULL, 'string 128', '2020-12-27 10:00:33', 0, 1, 1, 'rw-r--r--'),
-(25, 'viewcount', 'View counter', 'text', 'text', '`viewcount` varchar(128) NULL DEFAULT NULL', NULL, 'string 128', '2020-12-27 10:41:10', 0, 1, 1, 'rw-r--r--');
+(23, 'runtime', 'Runtime (min)', 'number', 'entrySingleNum', '`runtime` int(10) NULL, ADD INDEX (`runtime`)', NULL, 'int 10', '2020-07-26 07:22:24', NULL, 1, 1, 'rw-r--r--'),
+(24, 'imdbrating', 'IMDB Rating', 'text', 'entrySingleText', '`imdbrating` varchar(128) NULL DEFAULT NULL', NULL, 'string 128', '2020-12-27 10:00:33', 0, 1, 1, 'rw-r--r--'),
+(25, 'viewcount', 'View counter', 'number', 'entrySingleNum', '`viewcount` int(10) NULL, ADD INDEX (`viewcount`)', NULL, 'int 10', '2020-12-27 10:41:10', 0, 1, 1, 'rw-r--r--');
-- --------------------------------------------------------
*/
# path settings
-define('PATH_ABSOLUTE','/home/banana/code/bibliotheca/webclient');
+define('PATH_ABSOLUTE','/home/some/path/bibliotheca/webclient');
define('PATH_SYSTEMOUT',PATH_ABSOLUTE.'/systemout');
define('PATH_STORAGE',PATH_ABSOLUTE.'/storage');
define('PATH_WEB_STORAGE','storage');
return $this->_saveField_text($data, $queryData);
}
+ /**
+ * Create part of the insert statement for field type number
+ * @param array $data
+ * @param array $queryData
+ * @return mixed
+ */
+ private function _saveField_number($data, $queryData) {
+ $queryData['init'][] = "`".$data['identifier']."` = ".$this->_DB->real_escape_string($data['valueToSave'])."";
+ return $queryData;
+ }
+
/**
* Create part of the insert statement for field type lookupmultiple
*
require_once 'lib/trite.class.php';
$_colObj = new Trite($this->_DB,$this->_User);
$_colObj->load($result['id']);
-
- $result['entries'] = $_mObj->getEntries($_colObj->param('defaultSearchField'),$search,true);
+ $_fd = $_colObj->getCollectionFields();
+
+ $result['entries'] = $_mObj->getEntries(
+ array(
+ 0 => array(
+ 'colName' => $_colObj->param('defaultSearchField'),
+ 'colValue' => $search,
+ 'fieldData' => $_fd[$_colObj->param('defaultSearchField')]
+ )
+ )
+ );
}
else {
$result['entries'] = $_mObj->getEntries();
}
/**
- * Get entries for loaded collection limited by search in
- * given colName and colValue
+ * Get entries for loaded collection limited by search
+ * and already set query options
+ *
+ * array[0] => array(
+ * 'colName' => 'column name to search in',
+ * 'colValue' => 'Value to search for',
+ * 'fieldData' => field data from Trite->getCollectionFields()
+ * )
*
- * @param string $colName Table col to search
- * @param string $colValue Value to search in col
- * @param bool $fulltext If col has a fulltext index use it.
+ * @param array $searchData
* @return array
*/
- public function getEntries($colName='', $colValue='',$fulltext=false) {
+ public function getEntries($searchData=array()) {
$ret = array();
if(!empty($this->_collectionId)) {
// split since part of it is used later
$querySelect = "SELECT *";
$queryFrom = " FROM `".DB_PREFIX."_collection_entry_".$this->_DB->real_escape_string($this->_collectionId)."` AS t";
+ $queryJoin = '';
$queryWhere = " WHERE ".$this->_User->getSQLRightsString("read", "t")."";
- if(!empty($colName) && !empty($colValue)) {
- if($fulltext === true) {
- $queryWhere .= " AND MATCH (`t`.`".$this->_DB->real_escape_string($colName)."`)
- AGAINST ('".$this->_DB->real_escape_string($colValue)."' IN BOOLEAN MODE)";
- }
- else {
- $queryWhere .= " AND `t`.`" . $this->_DB->real_escape_string($colName) . "` = '" . $this->_DB->real_escape_string($colValue) . "'";
+ $_isFulltext = false;
+ if(!empty($searchData)) {
+ // this search supports fulltext search and number <> search.
+ // also can search in the entry2lookup table.
+ // not perfect but works really well
+ foreach($searchData as $k=>$sd) {
+ if(!isset($sd['colName']) || !isset($sd['colValue']) || empty($sd['colValue'])) continue;
+
+ if($sd['fieldData']['searchtype'] == "tag") {
+ $_isFulltext = true;
+
+ $queryJoin = " LEFT JOIN `".DB_PREFIX."_collection_entry2lookup_".$this->_DB->real_escape_string($this->_collectionId)."` AS e2l ON e2l.fk_entry=t.id";
+
+ $queryWhere .= " AND e2l.fk_field = '".$this->_DB->real_escape_string($sd['fieldData']['id'])."'";
+ $queryWhere .= " AND MATCH (e2l.value) AGAINST ('".$this->_DB->real_escape_string($sd['colValue'])."' IN BOOLEAN MODE)";
+ }
+ elseif ($sd['fieldData']['searchtype'] == "entrySingleNum" && strstr($sd['colValue'],'<')) {
+ $_s = str_replace('<','',$sd['colValue']);
+ $queryWhere .= " AND `t`.`".$this->_DB->real_escape_string($sd['colName'])."` < ".(int)$_s."";
+ }
+ elseif ($sd['fieldData']['searchtype'] == "entrySingleNum" && strstr($sd['colValue'],'>')) {
+ $_s = str_replace('>','',$sd['colValue']);
+ $queryWhere .= " AND `t`.`".$this->_DB->real_escape_string($sd['colName'])."` > ".(int)$_s."";
+ }
+ elseif($sd['fieldData']['searchtype'] == "entryText") {
+ $_isFulltext = true;
+ $queryWhere .= " AND MATCH (`t`.`".$this->_DB->real_escape_string($sd['colName'])."`)
+ AGAINST ('".$this->_DB->real_escape_string($sd['colValue'])."' IN BOOLEAN MODE)";
+ }
+ else {
+ $queryWhere .= " AND `t`.`".$this->_DB->real_escape_string($sd['colName'])."` = '".$this->_DB->real_escape_string($sd['colValue'])."'";
+ }
}
}
- $queryOrder = " ORDER BY";
- if(!empty($this->_queryOptions['sort'])) {
- $queryOrder .= ' t.'.$this->_queryOptions['sort'];
- }
- else {
- $queryOrder .= " t.created";
- }
- if(!empty($this->_queryOptions['sortDirection'])) {
- $queryOrder .= ' '.$this->_queryOptions['sortDirection'];
- }
- else {
- $queryOrder .= " DESC";
+ $queryOrder = '';
+ if(!$_isFulltext) { // fulltext do not order. Which results in ordering be relevance of the match
+ $queryOrder = " ORDER BY";
+ if (!empty($this->_queryOptions['sort'])) {
+ $queryOrder .= ' t.' . $this->_queryOptions['sort'];
+ } else {
+ $queryOrder .= " t.created";
+ }
+ if (!empty($this->_queryOptions['sortDirection'])) {
+ $queryOrder .= ' ' . $this->_queryOptions['sortDirection'];
+ } else {
+ $queryOrder .= " DESC";
+ }
}
$queryLimit = '';
}
}
- if(DEBUG) error_log("[DEBUG] ".__METHOD__." data: ".$querySelect.$queryFrom.$queryWhere.$queryOrder.$queryLimit);
+ if(DEBUG) error_log("[DEBUG] ".__METHOD__." data: ".$querySelect.$queryFrom.$queryJoin.$queryWhere.$queryOrder.$queryLimit);
- $query = $this->_DB->query($querySelect.$queryFrom.$queryWhere.$queryOrder.$queryLimit);
+ $query = $this->_DB->query($querySelect.$queryFrom.$queryJoin.$queryWhere.$queryOrder.$queryLimit);
if($query !== false && $query->num_rows > 0) {
$_entryFields = $this->_getEntryFields();
$ret['results'][$result['id']] = $result;
}
- $query = $this->_DB->query("SELECT COUNT(t.id) AS amount ".$queryFrom.$queryWhere);
+ $query = $this->_DB->query("SELECT COUNT(t.id) AS amount ".$queryFrom.$queryJoin.$queryWhere);
$result = $query->fetch_assoc();
$ret['amount'] = $result['amount'];
}
if(!empty($this->_collectionId) && !empty($entryId)) {
$queryStr = "SELECT *
FROM `".DB_PREFIX."_collection_entry_".$this->_DB->real_escape_string($this->_collectionId)."`
- WHERE ".$this->_User->getSQLRightsString("read")."
+ WHERE ".$this->_User->getSQLRightsString()."
AND `id` = '".$this->_DB->real_escape_string($entryId)."'";
$query = $this->_DB->query($queryStr);
$ret = array();
$fieldData = array();
- $queryStr = "SELECT `identifier`, `type` FROM `".DB_PREFIX."_sys_fields`
+ $queryStr = "SELECT `identifier`, `type`, `id`, `searchtype` FROM `".DB_PREFIX."_sys_fields`
WHERE `id` = '".$this->_DB->real_escape_string($fieldId)."'";
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
if(empty($fieldData)) return $ret;
if($fieldData['type'] !== "lookupmultiple") {
- return $this->getEntries($fieldData['identifier'], $fieldValue);
+ return $this->getEntries(
+ array(
+ 0 => array(
+ 'colName' => $fieldData['identifier'],
+ 'colValue' => $fieldValue,
+ 'fieldData' => $fieldData
+ )
+ )
+ );
+
}
$querySelect = "SELECT `fk_entry`";
public function getCollectionFields() {
$ret = array();
- $queryStr = "SELECT `cf`.`fk_field_id` AS id, `sf`.`type`, `sf`.`displayname`, `sf`.`identifier`
+ $queryStr = "SELECT `cf`.`fk_field_id` AS id, `sf`.`type`, `sf`.`displayname`, `sf`.`identifier`,
+ `sf`.`searchtype`
FROM `".DB_PREFIX."_collection_fields_".$this->_id."` AS cf
LEFT JOIN `".DB_PREFIX."_sys_fields` AS sf ON `cf`.`fk_field_id` = `sf`.`id`
ORDER BY `cf`.`sort`";
try {
if($query !== false && $query->num_rows > 0) {
while(($result = $query->fetch_assoc()) != false) {
- $ret[$result['id']] = $result;
+ $ret[$result['identifier']] = $result;
}
}
} catch (Exception $e) {
<?php if(!empty($TemplateData['loadedCollection'])) { ?>
-<div class="uk-grid-small uk-grid-row-small uk-grid-row-small" uk-grid>
+
+<?php if(!empty($TemplateData['search'])) { ?>
+<div uk-alert id="searchNotice">
+ <button class="uk-alert-close" type="button" uk-close></button>
+ <p>Display result for: <b><?php echo $TemplateData['search']; ?></b> (Max. result of 60)</p>
+</div>
+<script type="text/javascript">
+ UIkit.util.on('#searchNotice', 'hide', function () {
+ window.location.href="index.php?p=advancedsearch&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>";
+ });
+</script>
+<button class="uk-button uk-button-default uk-button-small"
+ type="button" uk-toggle="target: #searchFrame; animation: uk-animation-scale-down; cls: uk-hidden">Toggle search</button>
+<?php } ?>
+
+<div class="uk-grid-small uk-grid-row-small uk-grid-row-small <?php if(!empty($TemplateData['search'])) { ?>uk-hidden<?php } ?>"
+ uk-grid id="searchFrame">
<div class="uk-width-1-2">
<form class="uk-form-horizontal uk-margin-small" method="post">
<h4>Syntax</h4>
<p>To search within the collection default search field, like the ordinary search, just type the search term and go.</p>
<p>To search within the possible fields of a collection type the field identifier followed by : and then a space.</p>
- eg.: <code>title: starwars</code>
+ eg.: <code>title: bourne</code>
<p>Available fields in <b><?php echo Summoner::ifset($TemplateData['loadedCollection'], 'name'); ?></b> are:</p>
<pre style="white-space: normal">
<?php
<p>+ = A leading plus sign indicates that this word must be present in each row that is returned.</p>
<p>- = A leading minus sign indicates that this word must not be present in any of the rows that are returned.</p>
<p>" = A phrase that is enclosed within double quote (") characters matches only rows that contain the phrase literally, as it was typed.</p>
+ <p>> = A leading greater than sign indicates that rows greater than the number will be returned.</p>
+ <p>< = A leading less than sign indicates that rows smaller than the number will be returned.</p>
</div>
</div>
+
+<?php if(!empty($TemplateData['entries'])) { ?>
+<div class="uk-grid-small uk-grid-match" uk-grid>
+ <?php foreach($TemplateData['entries']['results'] as $entryK=>$entry) { ?>
+ <div class="uk-width-1-4@s uk-width-1-6@l">
+ <div class="uk-card uk-card-default uk-card-small">
+ <div class="uk-card-media-top">
+ <?php if(Summoner::ifset($entry['fields'], 'coverimage')) { ?>
+ <img src="<?php echo $TemplateData['storagePath'].'/'.$entryK.'/'.$entry['fields']['coverimage']['value']; ?>"
+ alt="<?php echo $entry['fields']['coverimage']['displayname']; ?>">
+
+ <?php } ?>
+ </div>
+ <div class="uk-card-body uk-visible@l">
+ <?php if(Summoner::ifset($entry['fields'], 'title')) { ?>
+ <h3 class="uk-card-title"><?php echo $entry['fields']['title']['value']; ?></h3>
+ <?php } ?>
+
+ <?php if(Summoner::ifset($entry['fields'], 'description')) { ?>
+ <p><?php echo $entry['fields']['description']['value']; ?></p>
+ <?php } ?>
+ </div>
+ <div class="uk-card-footer">
+ <a href="<?php echo $TemplateData['entryLinkPrefix']; ?>&id=<?php echo $entryK; ?>" class="uk-button uk-button-text">View</a>
+ </div>
+ </div>
+ </div>
+ <?php } ?>
+</div>
+<?php } ?>
+
<?php } else { ?>
<h3 class="uk-h3">Collection overview</h3>
<div class="uk-grid-small uk-grid-row-small uk-grid-row-small" uk-grid>
require_once 'lib/trite.class.php';
$Trite = new Trite($DB,$Doomguy);
+require_once 'lib/mancubus.class.php';
+$Mancubus = new Mancubus($DB,$Doomguy);
$_collection = false;
if(isset($_GET['collection']) && !empty($_GET['collection'])) {
$TemplateData['loadedCollection'] = array();
$TemplateData['collections'] = array();
$TemplateData['collectionFields'] = array();
+$TemplateData['search'] = false;
+
+//
if(!empty($_collection)) {
$TemplateData['loadedCollection'] = $Trite->load($_collection);
if(!empty($TemplateData['loadedCollection'])) {
$TemplateData['collectionFields'] = $Trite->getCollectionFields();
+ $Mancubus->setCollection($Trite->param('id'));
+ $Mancubus->setQueryOptions(array('limit' => 60));
+
+ $TemplateData['storagePath'] = PATH_WEB_STORAGE . '/' . $Trite->param('id');
+ $TemplateData['entryLinkPrefix'] = "index.php?p=entry&collection=".$Trite->param('id');
+
+ if(isset($_POST['submitForm'])) {
+ $fdata = $_POST['fdata'];
+ if (!empty($fdata)) {
+ $_search = trim($fdata['search']);
+
+ if (!empty($_search) && Summoner::validate($_search)) {
+ if (strstr($_search, ':')) { // field search
+ $_matches = array();
+ if(preg_match_all("/(\p{L}+:)(?(?!\p{L}+:).)*/u",$_search, $_matches) !== false && !empty($_matches[0])) {
+ // $matches[0] has the identifier: and text
+ // $matches[1] has only the identifier:
+ // $matches[0][0] belongs to $matches[1][0] and so on
+
+ $_sData = array();
+ $_ms = count($_matches[0]);
+ for($i=0;$i<$_ms;$i++) {
+ $_cn = trim(str_replace(':','',$_matches[1][$i]));
+ $_sData[$i]['colName'] = $_cn;
+ $_sData[$i]['colValue'] = trim(str_replace($_matches[1][$i],'',$_matches[0][$i]));
+ $_sData[$i]['fieldData'] = $TemplateData['collectionFields'][$_cn];
+ }
+
+ $TemplateData['entries'] = $Mancubus->getEntries($_sData);
+ $TemplateData['search'] = $_search;
+ }
+ else {
+ $TemplateData['message']['content'] = "Wrong input format.";
+ $TemplateData['message']['status'] = "error";
+ }
+ } else { // ordinary search within default field
+ $TemplateData['entries'] = $Mancubus->getEntries(
+ array(
+ 0 => array(
+ 'colName' => $Trite->param('defaultSearchField'),
+ 'colValue' => $_search,
+ 'fieldData' => $TemplateData['collectionFields'][$Trite->param('defaultSearchField')]
+ )
+ )
+ );
+ $TemplateData['search'] = $_search;
+ }
+ }
+ }
+ }
}
else {
$TemplateData['message']['content'] = "Can not load given collection.";
if(!empty($TemplateData['loadedCollection'])) {
$Mancubus->setCollection($Trite->param('id'));
$Mancubus->setQueryOptions($_queryOptions); // this comes from pagination_before!
- $TemplateData['storagePath'] = PATH_WEB_STORAGE . '/' . $_collection;
- $TemplateData['entryLinkPrefix'] = "index.php?p=entry&collection=".$_collection;
- $TemplateData['searchAction'] = 'index.php?p=collections&collection='.$_collection;
+ $TemplateData['storagePath'] = PATH_WEB_STORAGE . '/' . $Trite->param('id');
+ $TemplateData['entryLinkPrefix'] = "index.php?p=entry&collection=".$Trite->param('id');
+ $TemplateData['searchAction'] = 'index.php?p=collections&collection='.$Trite->param('id');
if (!empty($_fv) && !empty($_fid)) {
$TemplateData['entries'] = $Mancubus->getEntriesByFieldValue($_fid, $_fv);
$TemplateData['pagination']['currentGetParameters']['fid'] = $_fid;
$TemplateData['pagination']['currentGetParameters']['fv'] = $_fv;
} else {
- $TemplateData['entries'] = $Mancubus->getEntries($Trite->param('defaultSearchField'),$_search,true);
+ $_fd = $Trite->getCollectionFields();
+ $TemplateData['entries'] = $Mancubus->getEntries(
+ array(
+ 0 => array(
+ 'colName' => $Trite->param('defaultSearchField'),
+ 'colValue' => $_search,
+ 'fieldData' =>$_fd[$Trite->param('defaultSearchField')]
+ )
+ )
+ );
if (!empty($_search)) {
$TemplateData['search'] = $_search;
}
--- /dev/null
+<p data-field-name="number" data-field-id="<?php echo $field['identifier']; ?>">
+ <span class="uk-text-muted"><?php echo $field['displayname']; ?>:</span>
+ <a href="index.php?p=collections&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>&fid=<?php echo $field['id']; ?>&fv=<?php echo urlencode(Summoner::ifset($field, 'value')); ?>"><?php echo Summoner::ifset($field, 'value'); ?></a>
+</p>
--- /dev/null
+<div class="uk-margin">
+ <label class="uk-form-label" for="<?php echo $field['identifier']; ?>"><?php echo $field['displayname']; ?></label>
+ <div class="uk-form-controls">
+ <input class="uk-input" id="<?php echo $field['identifier']; ?>" type="number" autocomplete="off"
+ name="fdata[<?php echo $field['identifier']; ?>]"
+ value="<?php echo Summoner::ifset($TemplateData['editData'], $field['identifier']); ?>"
+ >
+ </div>
+</div>