public function execute() { return; // go through each project that has reportgeneration = true $projects = $this->projectService->getProjects(array('enablereports=' => 1)); $userProjectMapping = new ArrayObject(); foreach ($projects as $project) { /* @var $project Project */ // Create the status report and notify the manager to go and check it out $report = $this->projectService->getProjectStatus($project); $report->title = "Report generated " . date('Y-m-d'); $report->completednotes = "TO BE FILLED IN BY " . $project->manager; $report->todonotes = "TO BE FILLED IN BY " . $project->manager; $this->projectService->saveStatus($report); // email the manager! $userProjects = ifset($userProjectMapping, $project->manager, array()); $userProjects[] = $project; $userProjectMapping[$project->manager] = $userProjects; } foreach ($userProjectMapping as $user => $projects) { $msg = new TemplatedMessage('status-report-created.php', array('projects' => $projects)); $this->notificationService->notifyUser('Project status reports reminder', $user, $msg); } }
/** * creates the 'status' view of a project. */ public function statusAction() { $project = $this->byId(); $view = new CompositeView(); $projectStatus = $this->_getParam('projectstatus', null); $status = null; if ($projectStatus) { $status = $this->projectService->getStatus($projectStatus); } else { $status = $this->projectService->getProjectStatus($project, $this->_getParam('period', 7)); } $view->project = $project; $view->status = $status; $content = $view->render('project/status.php'); if ($this->_getParam('pdf')) { ini_set('memory_limit', '32M'); include_once "dompdf/dompdf_config.inc.php"; include_once "dompdf/include/dompdf.cls.php"; include_once "dompdf/include/frame_tree.cls.php"; include_once "dompdf/include/stylesheet.cls.php"; include_once "dompdf/include/frame.cls.php"; include_once "dompdf/include/style.cls.php"; include_once "dompdf/include/attribute_translator.cls.php"; include_once "dompdf/include/frame_factory.cls.php"; include_once "dompdf/include/frame_decorator.cls.php"; include_once "dompdf/include/positioner.cls.php"; include_once "dompdf/include/block_positioner.cls.php"; include_once "dompdf/include/block_frame_decorator.cls.php"; include_once "dompdf/include/frame_reflower.cls.php"; include_once "dompdf/include/block_frame_reflower.cls.php"; include_once "dompdf/include/frame_reflower.cls.php"; include_once "dompdf/include/text_frame_reflower.cls.php"; include_once "dompdf/include/canvas_factory.cls.php"; include_once "dompdf/include/canvas.cls.php"; include_once "dompdf/include/abstract_renderer.cls.php"; include_once "dompdf/include/renderer.cls.php"; include_once "dompdf/include/cpdf_adapter.cls.php"; include_once "dompdf/include/font_metrics.cls.php"; include_once "dompdf/include/block_renderer.cls.php"; include_once "dompdf/include/text_renderer.cls.php"; include_once "dompdf/include/image_cache.cls.php"; include_once "dompdf/include/text_frame_decorator.cls.php"; include_once "dompdf/include/inline_positioner.cls.php"; include_once "dompdf/include/page_frame_reflower.cls.php"; include_once "dompdf/include/list_bullet_frame_decorator.cls.php"; include_once "dompdf/include/list_bullet_positioner.cls.php"; include_once "dompdf/include/list_bullet_frame_reflower.cls.php"; include_once "dompdf/include/list_bullet_image_frame_decorator.cls.php"; include_once "dompdf/include/list_bullet_renderer.cls.php"; include_once "dompdf/include/page_frame_decorator.cls.php"; include_once "dompdf/include/table_frame_decorator.cls.php"; include_once "dompdf/include/cellmap.cls.php"; include_once "dompdf/include/table_frame_reflower.cls.php"; include_once "dompdf/include/table_row_frame_decorator.cls.php"; include_once "dompdf/include/null_positioner.cls.php"; include_once "dompdf/include/table_row_frame_reflower.cls.php"; include_once "dompdf/include/table_cell_frame_decorator.cls.php"; include_once "dompdf/include/table_cell_positioner.cls.php"; include_once "dompdf/include/table_cell_frame_reflower.cls.php"; include_once "dompdf/include/table_row_group_frame_decorator.cls.php"; include_once "dompdf/include/table_row_group_frame_reflower.cls.php"; include_once "dompdf/include/table_cell_renderer.cls.php"; include_once "dompdf/include/inline_frame_decorator.cls.php"; include_once "dompdf/include/inline_frame_reflower.cls.php"; include_once "dompdf/include/image_frame_decorator.cls.php"; include_once "dompdf/include/image_frame_reflower.cls.php"; include_once "dompdf/include/inline_renderer.cls.php"; include_once "dompdf/include/image_renderer.cls.php"; include_once "dompdf/include/dompdf_exception.cls.php"; $dompdf = new DOMPDF(); $dompdf->load_html($content); $dompdf->render(); $date = date('Y-m-d'); if ($status->created) { $date = date('Y-m-d', strtotime($status->created)); } $name = $project->title . ' status-' . $date . '.pdf'; $dompdf->stream($name); } else { echo $content; } }