Files
catc/inc/course.php
2019-09-04 23:09:39 +02:00

35 lines
984 B
PHP

<?php
class Course extends PhpObject {
const WS_TABLE = 'workshops';
const COURSE_TABLE = 'courses';
/**
* DB
* @var Db
*/
private $oDb;
public function __construct(Db &$oDb)
{
parent::__construct(__CLASS__, Settings::DEBUG);
$this->oDb = &$oDb;
}
public function getWorkshops() {
$asCourses = $this->oDb->selectRows(array(
'select'=> array(Db::getId(self::WS_TABLE), 'dates', Db::getId(self::COURSE_TABLE), 'description', 'timeslot'),
'from' => self::COURSE_TABLE,
'join' => array(self::WS_TABLE => Db::getId(self::WS_TABLE)))
);
$asWorkshops = array();
foreach($asCourses as $asCourse) {
$asWorkshops[$asCourse[Db::getId(self::WS_TABLE)]]['dates'] = $asCourse['dates'];
$asWorkshops[$asCourse[Db::getId(self::WS_TABLE)]]['courses'][$asCourse[Db::getId(self::COURSE_TABLE)]] = array('description'=>$asCourse['description'], 'timeslot'=>$asCourse['timeslot']);
}
return $asWorkshops;
}
}