public function executeIndex(sfWebRequest $request) { /** @var Roadmap $roadmap */ $this->roadmap = RoadmapTable::getInstance()->createQuery('r')->where('token = ?', $request->getParameter('token', false))->andWhere('active = ?', true)->fetchOne(); $this->forward404Unless(is_object($this->roadmap)); if ($this->roadmap->getWorkspaceMode() == 'list') { $this->prepareDataForListView(); } else { $this->prepareDataForTimelineView(); } }
/** * @param $event */ public function preInsert($event) { if (!$this->user_id) { $this->user_id = sfContext::getInstance()->getUser()->getGuardUser()->id; } $token = substr(md5(uniqid()), 0, 6); while (RoadmapTable::getInstance()->findOneBy('token', $token)) { $token = substr(md5(uniqid()), 0, 6); } $this->token = $token; }
public function executeExport(sfWebRequest $request) { $roadmap = RoadmapTable::getInstance()->getRoadmapForUser($this->getUser()->getGuardUser(), $request->getParameter('id')); $this->forward404Unless(is_object($roadmap)); header('Content-type: application/force-download'); header('Content-Disposition: attachment; filename="' . $roadmap->name . '.pptx"'); $exporter = new RoadmapPowerPointExporter(); $exporter->setRoadmap($roadmap); $exporter->export(); exit; }
/** * Get all user roadmaps for top menu **/ public function executeTopMenu() { $this->roadmaps = RoadmapTable::getInstance()->getForUser($this->getUser()->getGuardUser()); }