Skip to content

Instantly share code, notes, and snippets.

@atsu666
Created July 25, 2017 02:17
Show Gist options
  • Save atsu666/2bfa510b33751d55d44f58bcc27c8777 to your computer and use it in GitHub Desktop.
Save atsu666/2bfa510b33751d55d44f58bcc27c8777 to your computer and use it in GitHub Desktop.
<?php
class ACMS_User_POST_Api_GetEntries extends ACMS_POST
{
function post()
{
$eids = $this->Post->get('entry_ids');
$eids = explode(',', $eids);
if ( !is_array($eids) ) {
return false;
}
$DB = DB::singleton(dsn());
$SQL = SQL::newSelect('entry');
ACMS_Filter::entrySession($SQL);
$SQL->addWhereIn('entry_id', $eids);
$SQL->setFieldOrder('entry_id', $eids);
$all = $DB->query($SQL->get(dsn()), 'all');
$items = array();
foreach ( $all as $item ) {
$eid = $item['entry_id'];
$field = loadEntryField($eid);
$items[] = array(
'title' => $item['entry_title'],
'link' => acmsLink(array(
'eid' => $item['entry_id'],
)),
'image' => $field->get('bookCover_url'),
);
}
$json = json_encode(array(
"items" => $items
));
die($json);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment