. */ if (! defined('BASEPATH')) exit('No direct script access allowed'); class Lehre extends FHCAPI_Controller { /** * Object initialization */ public function __construct() { parent::__construct([ 'lvStudentenMail' => self::PERM_LOGGED, ]); } //------------------------------------------------------------------------------------------------------------------ // Public methods /** * constructs the emails of the groups from a lehrveranstaltung */ public function lvStudentenMail() { $lehreinheit_id = $this->input->get("lehreinheit_id",TRUE); // return early if the required parameter is missing if(!isset($lehreinheit_id)) { $this->terminateWithError('Missing required parameter', self::ERROR_TYPE_GENERAL); } $this->load->model('education/Lehreinheit_model', 'LehreinheitModel'); $studentenMails = $this->LehreinheitModel->getStudentenMail($lehreinheit_id); $studentenMails = $this->getDataOrTerminateWithError($studentenMails); //convert array of objects into array of strings $studentenMails = array_map(function($element){ return $element->mail; }, $studentenMails); $this->terminateWithSuccess($studentenMails); } }