Skip to content

Commit

Permalink
api update
Browse files Browse the repository at this point in the history
  • Loading branch information
Praesidiarius committed Jan 31, 2020
1 parent 6f2f88c commit b916163
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 14 additions & 0 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@
],
],
],
'tag-api-list' => [
'type' => Segment::class,
'options' => [
'route' => '/tag/api/list[/:form[/:tagtype]]',
'constraints' => [
'form' => '[a-zA-Z][a-zA-Z0-9_-]*',
'tagtype' => '[a-zA-Z][a-zA-Z0-9_-]+',
],
'defaults' => [
'controller' => Controller\ApiController::class,
'action' => 'list',
],
],
],
],
],

Expand Down
14 changes: 10 additions & 4 deletions src/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,18 @@ public function listAction() {

$aItems = [];

$aFilter = explode('_',$this->params()->fromRoute('filter','none_0'));
$sForm = $aFilter[0];
$iFilterID = (int)$aFilter[1];
$sForm = $this->params()->fromRoute('form','none');
$sTag = $this->params()->fromRoute('tagtype','none');

$oTag = CoreController::$aCoreTables['core-tag']->select(['tag_key'=>$sTag]);
if(count($oTag) == 0) {
echo 'tag not found';
return false;
}
$oTag = $oTag->current();

# Get All Tag Entities from Database
$oItemsDB = $this->oTableGateway->fetchAll(false,['entity_form_idfs'=>$sForm,'tag_idfs'=>$iFilterID]);
$oItemsDB = $this->oTableGateway->fetchAll(false,['entity_form_idfs'=>$sForm,'tag_idfs'=>$oTag->Tag_ID]);
if(count($oItemsDB) > 0) {
foreach($oItemsDB as $oItem) {
if($bSelect2) {
Expand Down

0 comments on commit b916163

Please sign in to comment.