/** * Export project checklists * * @param void * @return null */ function export() { $object_visibility = array_var($_GET, 'visibility', VISIBILITY_NORMAL); $exportable_modules = explode(',', array_var($_GET, 'modules', null)); if (!is_foreachable($exportable_modules)) { $exportable_modules = null; } // if require_once PROJECT_EXPORTER_MODULE_PATH . '/models/ProjectExporterOutputBuilder.class.php'; $output_builder = new ProjectExporterOutputBuilder($this->active_project, $this->smarty, $this->active_module, $exportable_modules); if (!$output_builder->createOutputFolder()) { $this->serveData($output_builder->execution_log, 'execution_log', null, FORMAT_JSON); } // if $output_builder->createAttachmentsFolder(); $completed_checklists = Checklists::findCompletedByProject($this->active_project, STATE_VISIBLE, $object_visibility); $active_checklists = Checklists::findActiveByProject($this->active_project, STATE_VISIBLE, $object_visibility); $checklists = array_merge((array) $completed_checklists, (array) $active_checklists); // export checklists front page $output_builder->setFileTemplate($this->active_module, $this->controller_name, 'index'); $output_builder->smarty->assign('active_objects', $active_checklists); $output_builder->smarty->assign('completed_objects', $completed_checklists); $output_builder->outputToFile('index'); if (is_foreachable($checklists)) { $output_builder->setFileTemplate($this->active_module, $this->controller_name, 'object'); foreach ($checklists as $checklist) { if (instance_of($checklist, 'Checklist')) { $output_builder->smarty->assign(array('object' => $checklist)); $output_builder->outputToFile('checklist_' . $checklist->getId()); } // if } // foreach } // if $this->serveData($output_builder->execution_log, 'execution_log', null, FORMAT_JSON); }
/** * List of checklists * */ function index() { $this->addBreadcrumb(lang('List')); $checklists = Checklists::findActiveByProject($this->active_project, STATE_VISIBLE, $this->logged_user->getVisibility()); $this->smarty->assign(array('checklists' => $checklists, 'page_back_url' => assemble_url('mobile_access_view_project', array('project_id' => $this->active_project->getId())))); }