Exemplo n.º 1
0
 /**
  * Retrieves code for embedding widget in current view.
  *
  * @throws http_exception on trying to access missing page
  * @return string code embeddable in view
  */
 public function getCode()
 {
     if ($this->mayEdit && $this->wantEdit) {
         return markup::h2(\de\toxa\txf\_L('Edit Page')) . $this->getEditor()->render();
     } else {
         $page = $this->getPage();
         if (!$page) {
             if ($this->mayEdit) {
                 return markup::block(markup::emphasize(\de\toxa\txf\_L('Selected page does not exist, yet!')), 'missing-page-content') . ($this->editorUrl ? $this->getLinkToEditor() : '');
             }
             throw new http_exception(404);
         }
         $content = markup::block($page->content, 'page-content');
         if ($this->editorUrl && $this->mayEdit) {
             $content .= $this->getLinkToEditor();
         }
         return $content;
     }
 }
Exemplo n.º 2
0
 public function formatValue($name, $value, model_editor $editor, model_editor_field $field)
 {
     if (is_null($value) || !count($value)) {
         return null;
     }
     if ($this->formatRenderer) {
         foreach ($value as $id => $label) {
             $value[$id] = call_user_func($this->formatRenderer, $id, $label);
         }
     }
     $classes = implode(' ', array_filter(array($this->class, 'related')));
     if ($this->maxCount > 1) {
         return markup::bullets($value, $classes);
     }
     return markup::inline(array_shift($value), $classes);
 }
Exemplo n.º 3
0
 public function renderStatic(html_form $form, $name, $input, $label, model_editor $editor, model_editor_field $field)
 {
     $classes = implode(' ', array_filter(array($this->class, 'texteditor')));
     $form->setRow($name, $label, markup::inline($input, 'static'), $this->isMandatory, null, null, $classes);
     return $this;
 }
Exemplo n.º 4
0
 /**
  * Retrieves code for embedding widget in current view.
  *
  * @return string code embeddable in view
  */
 public function getCode()
 {
     return strval($this->isListing() ? $this->getBrowser()->getCode() . markup::block(implode(' ', array_filter($this->panelControls)), 'panel') : $this->getForm()->getCode());
 }
Exemplo n.º 5
0
 public function getCode()
 {
     $code = markup::block($this->processInput()->code, 'view');
     if (count($this->panel)) {
         if (is_array($this->panelSorting)) {
             data::rearrangeArray($this->panel, $this->panelSorting, true);
         }
         $code .= markup::block(implode("\n", $this->panel), 'panel');
     }
     return $code;
 }
Exemplo n.º 6
0
 public function renderStatic(html_form $form, $name, $input, $label, model_editor $editor, model_editor_field $field)
 {
     $classes = implode(' ', array_filter(array($this->class, 'option')));
     $form->setRow($name, $label, markup::inline($input ? \de\toxa\txf\_L('yes') : \de\toxa\txf\_L('no'), 'static'), null, null, $classes);
     return $this;
 }
Exemplo n.º 7
0
Arquivo: url.php Projeto: cepharum/txf
 public function formatValue($name, $value, model_editor $editor, model_editor_field $field)
 {
     return $value ? markup::link($value, $value) : null;
 }
Exemplo n.º 8
0
 /**
  * Renders previously registered flash messages.
  */
 protected static function renderFlashes()
 {
     $session =& txf::session(\de\toxa\txf\session::SCOPE_GLOBAL);
     if (is_array(@$session['view']) && is_array(@$session['view']['flashes'])) {
         foreach ($session['view']['flashes'] as $context => $messages) {
             if (is_array($messages) && count($messages)) {
                 self::viewport('flash', \de\toxa\txf\markup::flash($context, $messages));
             }
         }
         unset($session['view']['flashes']);
     }
 }