public function render(Renderable $ren, $standard = False) { //Proper error Handling would be nice (Exceptions?) ob_start(); $ren->render(); echo $standard ? $this->addBanners(ob_get_clean()) : ob_get_clean(); }
/** * Process * * @param Renderable $object Object to render * @param string $view Path to view * @return string Rendered output * @throws ViewNotFoundException if view does not exists */ public function process(Renderable $object, $view) { try { return $object->render($this, $view); } catch (ViewNotFoundException $ex) { throw $ex; } }
/** * Render an object to HTML based on its format identifier * * @param \Stecman\Passnote\Object\Renderable $renderable * @param string $content * @throws \RuntimeException * @return string - html */ public function render(Renderable $renderable, $content) { $format = $renderable->getFormatIdentifier(); if ($this->hasRenderer($format)) { return $this->renderers[$format]->render($content); } else { throw new \RuntimeException("No renderer available for format '{$format}'"); } }
public function getFieldGroupMarkup($fieldGroup, $args = null) { if ($args == null) { $args = $this->getFieldValues(); } $grpTemplate = $this->groupTemplate; $fieldTemplate = $this->fieldTemplate; $grpHead = ''; if (isset($this->fieldGroups[$fieldGroup])) { $grpDesc = $this->fieldGroups[$fieldGroup]; $grpTemplate = $grpDesc['template'] ? $grpDesc['template'] : $grpTemplate; $fieldTemplate = $grpDesc['field_template'] ? $grpDesc['field_template'] : $fieldTemplate; $grpHead = $grpDesc['group_name']; //echo $fieldTemplate; } $renderedFields = array(); foreach ($this->fields as $field) { if (is_array($this->values)) { $this->applyFormRules($field, array_merge($this->values, $args)); } else { $this->applyFormRules($field, $args); } if (!$field['field_group'] || $field['field_group'] != $fieldGroup) { continue; } $fieldMarkup = OJGenerator::getField($field, $this->fieldPrefix, $fieldTemplate, $this->formRules[$field['name']])->getMarkup(); $renderedFields[] = array('field' => $fieldMarkup); } $r = new Renderable($grpTemplate); $fGroupParams = array('group_name' => $grpHead, 'fields' => $renderedFields, 'group_id' => $fieldGroup); return $r->getMarkup($fGroupParams); }
/** * getDetailForm * * @access private * * @return mixed Value. */ public function getFooter() { $r = new Renderable($this->footerTemplate); $vars = array('is_wizzard' => $this->model->usesWizzard(), 'is_form' => !$this->model->usesWizzard()); //Mustache is logicless templating... if ($vars['is_wizzard']) { $vars['has_prev_btn'] = $this->form->hasPrevStep(); $vars['has_next_btn'] = $this->form->hasNextStep(); $vars['has_finish_btn'] = $this->form->canFinishAtThisStep(); $vars['prev_btn_name'] = $this->form->getPrevButtonName(); $vars['next_btn_name'] = $this->form->getNextButtonName(); $vars['finish_btn_name'] = $this->form->getFinishButtonName(); } else { $vars['has_finish_btn'] = true; $vars['finish_btn_name'] = $this->form->getSubmitButtonName(); } $vars['listURL'] = view::url($this->listURL); $retStr = $r->getMarkup($vars); return $retStr . '</form>'; }
/** * getFooter * * @access public * * @return mixed Value. */ public function getFooter() { $m = new Renderable($this->footerTemplate); return $m->getMarkup($this->_pagination); }
public function getMarkup() { $this->initialize(); return parent::getMarkup(); }