| @@ 7-56 (lines=50) @@ | ||
| 4 | ||
| 5 | use App\Models\ProgramModel; |
|
| 6 | ||
| 7 | abstract class AProgramsControl extends BaseControl implements IProgramsControl |
|
| 8 | { |
|
| 9 | ||
| 10 | const TEMPLATE_NAME = ''; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * @var ProgramModel |
|
| 14 | */ |
|
| 15 | private $programModel; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @param ProgramModel $model |
|
| 19 | */ |
|
| 20 | public function __construct(ProgramModel $model) |
|
| 21 | { |
|
| 22 | $this->setProgramModel($model); |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @param integer $blockId |
|
| 27 | * @return void |
|
| 28 | */ |
|
| 29 | public function render($blockId) |
|
| 30 | { |
|
| 31 | $template = $this->getTemplate(); |
|
| 32 | $template->setFile($this->buildTemplatePath()); |
|
| 33 | $template->programs = $this->getProgramModel()->findByBlockId($blockId); |
|
| 34 | $template->render(); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * @return ProgramModel |
|
| 39 | */ |
|
| 40 | protected function getProgramModel() |
|
| 41 | { |
|
| 42 | return $this->programModel->setMeetingId($this->getMeetingId()); |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * @param ProgramModel $model |
|
| 47 | * @return $this |
|
| 48 | */ |
|
| 49 | protected function setProgramModel(ProgramModel $model) |
|
| 50 | { |
|
| 51 | $this->programModel = $model; |
|
| 52 | ||
| 53 | return $this; |
|
| 54 | } |
|
| 55 | ||
| 56 | } |
|
| 57 | ||
| @@ 7-55 (lines=49) @@ | ||
| 4 | ||
| 5 | use App\Models\ExportModel; |
|
| 6 | ||
| 7 | class MaterialsControl extends BaseControl |
|
| 8 | { |
|
| 9 | ||
| 10 | const TEMPLATE_NAME = 'Materials'; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * @var ExportModel |
|
| 14 | */ |
|
| 15 | private $exportModel; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @param ExportModel $model |
|
| 19 | */ |
|
| 20 | public function __construct(ExportModel $model) |
|
| 21 | { |
|
| 22 | $this->setExportModel($model); |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @return void |
|
| 27 | */ |
|
| 28 | public function render() |
|
| 29 | { |
|
| 30 | $template = $this->getTemplate(); |
|
| 31 | $template->setFile($this->buildTemplatePath()); |
|
| 32 | $template->materials = $this->getExportModel()->materials(); |
|
| 33 | $template->render(); |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @return ExportModel |
|
| 38 | */ |
|
| 39 | protected function getExportModel() |
|
| 40 | { |
|
| 41 | return $this->exportModel->setMeetingId($this->getMeetingId()); |
|
| 42 | } |
|
| 43 | ||
| 44 | /** |
|
| 45 | * @param ExportModel $model |
|
| 46 | * @return $this |
|
| 47 | */ |
|
| 48 | protected function setExportModel(ExportModel $model) |
|
| 49 | { |
|
| 50 | $this->exportModel = $model; |
|
| 51 | ||
| 52 | return $this; |
|
| 53 | } |
|
| 54 | ||
| 55 | } |
|
| 56 | ||
| @@ 7-58 (lines=52) @@ | ||
| 4 | ||
| 5 | use App\Models\ExportModel; |
|
| 6 | ||
| 7 | class MealControl extends BaseControl |
|
| 8 | { |
|
| 9 | ||
| 10 | const TEMPLATE_NAME = 'Meal'; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * @var ExportModel |
|
| 14 | */ |
|
| 15 | private $exportModel; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @param ExportModel $model |
|
| 19 | */ |
|
| 20 | public function __construct(ExportModel $model) |
|
| 21 | { |
|
| 22 | $this->setExportModel($model); |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @param string $mealColumn |
|
| 27 | * @param string $mealName |
|
| 28 | * @return void |
|
| 29 | */ |
|
| 30 | public function render($mealColumn, $mealName) |
|
| 31 | { |
|
| 32 | $template = $this->getTemplate(); |
|
| 33 | $template->setFile($this->buildTemplatePath()); |
|
| 34 | $template->mealCount = $this->getExportModel()->getMealCount($mealColumn); |
|
| 35 | $template->mealName = $mealName; |
|
| 36 | $template->render(); |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * @return ExportModel |
|
| 41 | */ |
|
| 42 | protected function getExportModel() |
|
| 43 | { |
|
| 44 | return $this->exportModel->setMeetingId($this->getMeetingId()); |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * @param ExportModel $model |
|
| 49 | * @return $this |
|
| 50 | */ |
|
| 51 | protected function setExportModel(ExportModel $model) |
|
| 52 | { |
|
| 53 | $this->exportModel = $model; |
|
| 54 | ||
| 55 | return $this; |
|
| 56 | } |
|
| 57 | ||
| 58 | } |
|
| 59 | ||
| @@ 7-56 (lines=50) @@ | ||
| 4 | ||
| 5 | use App\Models\ProgramModel; |
|
| 6 | ||
| 7 | class PublicProgramDetailControl extends BaseControl |
|
| 8 | { |
|
| 9 | ||
| 10 | const TEMPLATE_NAME = 'PublicProgramDetail'; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * @var ProgramModel |
|
| 14 | */ |
|
| 15 | private $programModel; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @param ProgramModel $model |
|
| 19 | */ |
|
| 20 | public function __construct(ProgramModel $model) |
|
| 21 | { |
|
| 22 | $this->setProgramModel($model); |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @return void |
|
| 27 | */ |
|
| 28 | public function render($programId) |
|
| 29 | { |
|
| 30 | $template = $this->getTemplate(); |
|
| 31 | $template->setFile($this->buildTemplatePath()); |
|
| 32 | $template->visitorsOnProgram = $this->getProgramModel()->countProgramVisitors($programId); |
|
| 33 | $template->program = $this->getProgramModel()->find($programId); |
|
| 34 | $template->render(); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * @return ProgramModel |
|
| 39 | */ |
|
| 40 | public function getProgramModel(): ProgramModel |
|
| 41 | { |
|
| 42 | return $this->programModel; |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * @param ProgramModel $programModel |
|
| 47 | * @return self |
|
| 48 | */ |
|
| 49 | public function setProgramModel(ProgramModel $programModel): self |
|
| 50 | { |
|
| 51 | $this->programModel = $programModel; |
|
| 52 | ||
| 53 | return $this; |
|
| 54 | } |
|
| 55 | ||
| 56 | } |
|
| 57 | ||