示例#1
0
文件: editor.php 项目: cepharum/txf
 /**
  * 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;
     }
 }
示例#2
0
文件: related.php 项目: cepharum/txf
 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);
 }
示例#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;
 }
示例#4
0
文件: manager.php 项目: cepharum/txf
 /**
  * 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());
 }
示例#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;
 }
示例#6
0
文件: option.php 项目: cepharum/txf
 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;
 }
示例#7
0
文件: url.php 项目: cepharum/txf
 public function formatValue($name, $value, model_editor $editor, model_editor_field $field)
 {
     return $value ? markup::link($value, $value) : null;
 }
示例#8
0
文件: manager.php 项目: cepharum/txf
 /**
  * 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']);
     }
 }