/** * Return view for configuring preprocessing. */ public function getConfigure() { $URI = Input::get('URI'); if ($document = File::where('_id', $URI)->first()) { // Load which functions are available for display $functions = $this->getAvailableFunctions(); $newLine = "\n"; $docPreview = $document['content']; $project = $document['project']; $docPreview = explode($newLine, $docPreview); $docPreview = array_slice($docPreview, 0, $this->nLines); $docPreview = implode($newLine, $docPreview); $docTypes = Unit::select('documentType')->where('project', $document->project)->distinct()->get()->toArray(); // default preview of files $previewTable = $this->doPreviewTable($document, '"', ',', false); return View::make('media.preprocess.text.pages.configure')->with('URI', $URI)->with('docTitle', $document['title'])->with('docPreview', $docPreview)->with('functions', $functions)->with('project', $project)->with('previewTable', $previewTable)->with('docTypes', $docTypes); } else { return Redirect::back()->with('flashError', 'No valid URI given: ' . $URI); } }