public function render(Controller $controller, ArrayData $data) { // Require js library Requirements::javascript(CONSULTATION_MODULE_DIR . '/js/justGage/raphael.2.1.0.min.js'); Requirements::javascript(CONSULTATION_MODULE_DIR . '/js/justGage/justgage.1.0.1.min.js'); // Customise data $data->setField('jsData', $this->jsData($data)); // Perform rendering return $controller->customise($data)->renderWith($this->template); }
public function render(Controller $controller, ArrayData $data) { // Require js library Requirements::javascript(CONSULTATION_MODULE_DIR . '/js/chart.js'); Requirements::javascript(CONSULTATION_MODULE_DIR . '/js/doughnut.init.js'); Requirements::css(CONSULTATION_MODULE_DIR . '/css/doughnut_report.css'); // Customise data $data->setField('jsData', $this->jsData($data)); // Perform rendering return $controller->customise($data)->renderWith($this->template); }
/** * Renders the search results into a template. Either * the search results template or the Atom feed */ public function renderResults() { if (!$this->results) { $this->performSearch(); } if (!$this->outputController) { return user_error('Call renderResults() on a DocumentationViewer instance.', E_USER_ERROR); } $request = $this->outputController->getRequest(); $data = $this->getSearchResults($request); $templates = array('DocumentationViewer_results', 'DocumentationViewer'); if ($request->requestVar('format') && $request->requestVar('format') == "atom") { // alter the fields for the opensearch xml. $title = ($title = $this->getTitle()) ? ' - ' . $title : ""; $link = Controller::join_links($this->outputController->Link(), 'DocumentationOpenSearch_Controller/description/'); $data->setField('Title', $data->Title . $title); $data->setField('DescriptionURL', $link); array_unshift($templates, 'OpenSearchResults'); } return $this->outputController->customise($data)->renderWith($templates); }
/** * In calse of validation errors the form will be returned with error * messages * * @param SS_HTTPRequest $data submit data * @param Form $form form object * * @return ViewableData * * @author Sascha Koehler <*****@*****.**> * @since 25.10.2010 */ public function submitFailure($data, $form) { $formFields = $this->getFormFields(); // fill in the form foreach ($formFields as $fieldName => $fieldDefinition) { if (isset($data[$fieldName])) { $this->formFields[$fieldName][$this->getFormFieldValueLabel($fieldName)] = Convert::raw2xml($data[$fieldName]); } } $this->SSformFields = $this->getForm(); if (empty($form)) { $form = $this->class; } if (class_exists('CommunityPage') && method_exists('CommunityPage', 'addErrorMessage')) { foreach ($this->errorMessages as $fieldName => $errorMessage) { CommunityPage::addErrorMessage($errorMessage['message'], $errorMessage['fieldname']); } } // prepare validation errors for template $data = array('errorMessages' => new ArrayList($this->errorMessages), 'messages' => new ArrayList($this->messages), $this->SSformFields['fields'], $this->SSformFields['actions'], 'CustomHtmlFormErrorMessages' => $this->CustomHtmlFormErrorMessages()); parent::__construct($this->controller, $this->name, $this->SSformFields['fields'], $this->SSformFields['actions']); // fill in form with validation results and render it $outputForm = $this->customise($data)->renderWith(array($this->class)); // pass rendered form to the controller if ($this->controller instanceof CustomHtmlFormStepPage_Controller) { $output = $this->controller->customise(array($form => $outputForm))->renderWith(array($this->controller->ClassName, 'Page')); } else { $output = $this->controller->customise(array($form => $outputForm)); } return $output; }