. */ if (! defined('BASEPATH')) exit('No direct script access allowed'); /** * This controller operates between (interface) the JS (GUI) and the SearchBarLib (back-end) * Provides data to the ajax get calls about the searchbar component * This controller works with JSON calls on the HTTP GET and the output is always JSON */ class Ort extends FHCAPI_Controller { /** * Object initialization */ public function __construct() { // NOTE(chris): additional permission checks will be done in SearchBarLib parent::__construct([ 'ContentID' => self::PERM_LOGGED ]); $this->load->model('ressource/Ort_model', 'OrtModel'); } //------------------------------------------------------------------------------------------------------------------ // Public methods /** * Gets a JSON body via HTTP POST and provides the parameters */ public function ContentID() { // if error //$this->terminateWithError(SearchBarLib::ERROR_WRONG_JSON, self::ERROR_TYPE_GENERAL); $ort_kurzbz = $this->input->get('ort_kurzbz',TRUE); if(!$ort_kurzbz){ $this->terminateWithError("missing ort_kurzbz parameter", self::ERROR_TYPE_GENERAL); } $result = $this->OrtModel->getContentID($ort_kurzbz); if(isError($result)){ $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); } $result = hasData($result) ? current(getData($result)) : null; $this->terminateWithSuccess($result->content_id ?? NULL); } }