3
1

ProjectBrandingController.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php namespace Kanboard\Plugin\OMIProjectBranding\Controller;
  2. use Kanboard\Controller\BaseController;
  3. /**
  4. * ProjectBrandingController Controller
  5. *
  6. * @package Kanboard\Plugin\OMITemplateModder
  7. * @property \Kanboard\Plugin\OMIProjectBranding\Model\ProjectBrandingModel $projectBrandingModel
  8. * @property \Kanboard\Plugin\OMIProjectBranding\Helper\ProjectBrandingHelper $projectBrandingHelper
  9. * @author Dwayne @ OMI NZ
  10. */
  11. class ProjectBrandingController extends BaseController {
  12. public function show() {
  13. $project = $this->getProject();
  14. $values = $this->request->getValues();
  15. if ($this->request->isPost()) {
  16. $branding = [
  17. "project_id" => $project["id"],
  18. "logo_url" => $values["logo_url"],
  19. "foreground_color" => $values["foreground_color"],
  20. "background_color" => $values["background_color"],
  21. "second_background_color" => $values["second_background_color"],
  22. "enabled" => isset($values["enabled"]) ? 1 : 0,
  23. ];
  24. if ($this->projectBrandingModel->saveBranding($branding)) {
  25. $this->flash->success(t("Branding settings saved successfully."));
  26. } else {
  27. $this->flash->failure(t("Unable to save branding settings."));
  28. }
  29. return $this->response->redirect($this->helper->url->to("ProjectBrandingController", "show", ["project_id" => $project["id"], "plugin" => "OMIProjectBranding"]), true);
  30. }
  31. $branding = $this->projectBrandingModel->getBrandingByProjectId($project["id"]);
  32. $this->response->html($this->helper->layout->project("OMIProjectBranding:project_branding/show", [
  33. "project" => $project,
  34. "branding" => $branding,
  35. "title" => t("Project Branding"),
  36. ]));
  37. }
  38. }
  39. #-
  40. #plugins/OMIProjectBranding/Controller/ProjectBrandingController.php