Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
- better currency support
- view urls for date/datetime fields in index
- api fixes
  • Loading branch information
Praesidiarius committed Mar 11, 2020
1 parent 5b43863 commit 9e1f8b5
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 27 deletions.
4 changes: 3 additions & 1 deletion module/Application/data/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ INSERT INTO `settings` (`settings_key`, `settings_value`) VALUES ('app-vendors',
--
INSERT INTO `settings` (`settings_key`, `settings_value`) VALUES
('app-currency-decpoint', ','),
('app-currency-thousandsep', '.');
('app-currency-thousandsep', '.'),
('app-currency-sign', ''),
('app-currency-sign-position', 'after');
69 changes: 51 additions & 18 deletions module/Application/src/Controller/CoreApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,25 +139,57 @@ public function listAction() {
$bPaginated = false;
$aWhere = [];
if(isset($_REQUEST['filter'])) {
switch($_REQUEST['filter']) {
case 'highlights':
$aWhere['web_highlight_idfs'] = 2;
break;
case 'category':
$aWhere['multi_tag'] = $_REQUEST['filtervalue'];
break;
// Date Filter
case 'onlycurrent':
// Set Minimum Date
$aWhere[$_REQUEST['filtervalue'].'-greaterthanequalto'] = date('Y-m-d H:i:s',time());
// If provided - set maximum date
if(isset($_REQUEST['filterlimit'])) {
$aWhere[$_REQUEST['filtervalue'].'-lessthanequalto'] = $_REQUEST['filterlimit'];
$aFilters = json_decode($_REQUEST['filter']);

if(is_array($aFilters)) {
$aFilterValues = json_decode($_REQUEST['filtervalue']);
$i = 0;
foreach($aFilters as $sFilter) {
$sFilterValue = $aFilterValues[$i];
switch($sFilter) {
case 'highlights':
$aWhere['web_spotlight_idfs'] = 2;
break;
case 'category':
$aWhere['multi_tag'] = $sFilterValue;
break;
// Date Filter
case 'onlycurrent':
// Set Minimum Date
$aWhere[$sFilterValue.'-greaterthanequalto'] = date('Y-m-d H:i:s',time());
// If provided - set maximum date
if(isset($_REQUEST['filterlimit'])) {
$aWhere[$sFilterValue.'-lessthanequalto'] = $_REQUEST['filterlimit'];
}
break;
default:
break;
}
break;
default:
break;
$i++;
}
} else {
$sFilter = $_REQUEST['filter'];
switch($sFilter) {
case 'highlights':
$aWhere['web_spotlight_idfs'] = 2;
break;
case 'category':
$aWhere['multi_tag'] = $_REQUEST['filtervalue'];
break;
// Date Filter
case 'onlycurrent':
// Set Minimum Date
$aWhere[$_REQUEST['filtervalue'].'-greaterthanequalto'] = date('Y-m-d H:i:s',time());
// If provided - set maximum date
if(isset($_REQUEST['filterlimit'])) {
$aWhere[$_REQUEST['filtervalue'].'-lessthanequalto'] = $_REQUEST['filterlimit'];
}
break;
default:
break;
}
}

}

if(isset($_REQUEST['listmodefilter'])) {
Expand All @@ -179,6 +211,7 @@ public function listAction() {
if(count($oItemsDB) > 0) {
# Loop all items
foreach($oItemsDB as $oItem) {
$oRoot = false;
// Event Fix
// todo: create hook here and move code to hook
if(isset($oItem->root_event_idfs)) {
Expand Down Expand Up @@ -256,7 +289,7 @@ public function listAction() {
$sImg = $oItem->getTextField('featured_image');
if($sImg != '') {
$iID = $oItem->getID();
if(isset($oRoot)) {
if($oRoot) {
$iID = $oRoot->getID();
}
$aPublicItem['featured_image'] = '/data/'.$sEntityType.'/' . $iID . '/' . $sImg;
Expand Down
3 changes: 2 additions & 1 deletion module/Application/src/Model/CoreEntityTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ public function fetchAll($bPaginated = false,$aWhere = [],$sSort = 'created_date
$oWh->equalTo('modified_by',$aWhere['modified_by']);
}
if(array_key_exists('multi_tag',$aWhere)) {
$oSel->join(['category_tag'=>'core_entity_tag_entity'],'category_tag.entity_idfs = article.Article_ID');
$sEntityType = explode('-',$this->sSingleForm)[0];
$oSel->join(['category_tag'=>'core_entity_tag_entity'],'category_tag.entity_idfs = '.$sEntityType.'.'.ucfirst($sEntityType).'_ID');
$oWh->equalTo('category_tag.entity_tag_idfs',$aWhere['multi_tag']);
$oWh->like('category_tag.entity_type',explode('-',$this->sSingleForm)[0]);
}
Expand Down
22 changes: 20 additions & 2 deletions module/Application/view/partial/indextablecell.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,33 @@
case 'date':
$sDate = $this->oItem->getTextField($this->oCol->fieldkey);
if($sDate != '0000-00-00 00:00:00' && !empty($sDate)) {
echo date('d.m.Y',strtotime($sDate));
if($this->oCol->url_view != '') {
$sFinalURL = str_replace(['##ID##'],[$this->oItem->getID()],$this->oCol->url_view);
echo '<a href="'.$sFinalURL.'">';
echo date('d.m.Y',strtotime($sDate));
echo '</a>';
} else {
echo date('d.m.Y',strtotime($sDate));
}
} else {
echo '-';
}
break;
case 'datetime':
$sDate = $this->oItem->getTextField($this->oCol->fieldkey);
if($sDate != '0000-00-00 00:00:00' && !empty($sDate)) {
echo date('d.m.Y H:i',strtotime($sDate));
if($sDate != '0000-00-00 00:00:00' && !empty($sDate)) {
if($this->oCol->url_view != '') {
$sFinalURL = str_replace(['##ID##'],[$this->oItem->getID()],$this->oCol->url_view);
echo '<a href="'.$sFinalURL.'">';
echo date('d.m.Y H:i',strtotime($sDate));
echo '</a>';
} else {
echo date('d.m.Y H:i',strtotime($sDate));
}
} else {
echo '-';
}
} else {
echo '-';
}
Expand Down
5 changes: 0 additions & 5 deletions module/Application/view/partial/viewform.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,13 @@
FilePondPluginFileValidateType,
FilePondPluginImageExifOrientation,
FilePondPluginImagePreview,
FilePondPluginImageCrop,
FilePondPluginImageResize,
FilePondPluginImageTransform
);
FilePond.create(
fieldsetElement,
{
labelIdle: `Drag & Drop your picture or <span class="filepond--label-action">Browse</span>`,
imagePreviewHeight: 170,
imageCropAspectRatio: '1:1',
imageResizeTargetWidth: 200,
imageResizeTargetHeight: 200,
stylePanelLayout: 'compact circle',
styleLoadIndicatorPosition: 'center bottom',
styleProgressIndicatorPosition: 'right bottom',
Expand Down

0 comments on commit 9e1f8b5

Please sign in to comment.