/** * Render event handler. * * @param Zikula_Form_View $view Reference to Zikula_Form_View object. * * @return string The rendered output */ public function render(Zikula_Form_View $view) { $idHtml = $this->getIdHtml(); $fullName = $this->id . '_' . $this->commandName; $onclickHtml = ''; if ($this->confirmMessage != null) { $msg = $view->translateForDisplay($this->confirmMessage) . '?'; $onclickHtml = " onclick=\"return confirm('{$msg}');\""; } $text = $view->translateForDisplay($this->text); $imageUrl = $this->imageUrl; $attributes = $this->renderAttributes($view); $result = "<input{$idHtml} name=\"{$fullName}\" type=\"image\" alt=\"{$text}\" value=\"{$text}\" src=\"{$imageUrl}\"{$onclickHtml}{$attributes} />"; return $result; }
/** * Render event handler. * * @param Zikula_Form_View $view Reference to Zikula_Form_View object. * * @return string The rendered output */ public function render(Zikula_Form_View $view) { $idHtml = $this->getIdHtml(); $nameHtml = " name=\"{$this->inputName}\""; $text = DataUtil::formatForDisplay($this->text); $class = $this->getStyleClass(); if (isset($this->toolTip)) { $this->attributes['title'] = $view->translateForDisplay($this->toolTip); } if (isset($this->readOnly) && $this->readOnly) { $this->attributes['readonly'] = 'readonly'; $this->attributes['tabindex'] = '-1'; } if ($this->size > 0) { $this->attributes['size'] = $this->size; } if ($this->maxLength > 0) { $this->attributes['maxlength'] = $this->maxLength; } $attributes = $this->renderAttributes($view); $requiredFlag = $this->mandatory ? ' required="required"' : ''; switch (strtolower($this->textMode)) { case 'singleline': $this->textMode = 'text'; case 'text': case 'url': case 'password': case 'number': case 'email': $result = "<input type=\"{$this->textMode}\"{$idHtml}{$nameHtml} class=\"{$class}\" value=\"{$text}\"{$requiredFlag}{$attributes} />"; if ($this->mandatory && $this->mandatorysym) { $result .= '<span class="z-form-mandatory-flag">*</span>'; } break; case 'multiline': $colsrowsHtml = ''; if ($this->cols != null) { $colsrowsHtml .= " cols=\"{$this->cols}\""; } if ($this->rows != null) { $colsrowsHtml .= " rows=\"{$this->rows}\""; } $result = "<textarea{$idHtml}{$nameHtml}{$colsrowsHtml} class=\"{$class}\"{$requiredFlag}{$attributes}>{$text}</textarea>"; if ($this->mandatory && $this->mandatorysym) { $result .= '<span class="z-form-mandatory-flag">*</span>'; } break; case 'hidden': $result = "<input type=\"hidden\"{$idHtml}{$nameHtml} class=\"{$class}\" value=\"{$text}\" />"; break; default: $result = __f('Unknown value [%1$s] for \'%2$s\'.', array($this->textMode, 'textMode')); } return $result; }
/** * RenderContent event handler. * * @param Zikula_Form_View $view Reference to Zikula_Form_View object. * @param string $content The content to handle. * * @return string The (optionally) modified content. */ public function renderContent(Zikula_Form_View $view, $content) { $html = "<ul id=\"{$this->id}\" class=\"nav nav-tabs formtabbedpanelset {$this->cssClass}\">\n"; for ($i = 1, $titleCount = count($this->titles); $i <= $titleCount; ++$i) { $title = $this->titles[$i - 1]; $title = $view->translateForDisplay($title); if ($this->selectedIndex == $i) { $cssClass = 'class="active"'; } else { $cssClass = ''; } $link = "<a href=\"#{$this->id}-tab{$i}\" data-toggle=\"tab\" onclick=\"jQuery('#{$this->id}SelectedIndex').val({$i})\">{$title}</a>"; $html .= "<li {$cssClass}>{$link}</li>\n"; } $html .= "</ul>\n"; $html .= "<input type=\"hidden\" name=\"{$this->id}SelectedIndex\" id=\"{$this->id}SelectedIndex\" value=\"{$this->selectedIndex}\" />\n"; return $html . '<div class="tab-content">' . $content . '</div>'; }
/** * Render event handler. * * @param Zikula_Form_View $view Reference to Form render object. * * @return string The rendered output */ public function render(Zikula_Form_View $view) { $idHtml = $this->getIdHtml(); $nameHtml = " name=\"{$this->inputName}\""; $titleHtml = $this->toolTip != null ? ' title="' . $view->translateForDisplay($this->toolTip) . '"' : ''; $readOnlyHtml = $this->readOnly ? " disabled=\"disabled\"" : ''; $checkedHtml = $this->checked ? " checked=\"checked\"" : ''; $class = $this->getStyleClass(); $attributes = $this->renderAttributes($view); $result = "<input{$idHtml}{$nameHtml}{$titleHtml} type=\"checkbox\" value=\"1\" class=\"{$class}\"{$readOnlyHtml}{$checkedHtml}{$attributes} />"; if ($this->mandatory && $this->mandatorysym) { $result .= '<span class="z-form-mandatory-flag">*</span>'; } return $result; }
/** * PostRender event handler. * * @param Zikula_Form_View $view Reference to Zikula_Form_View object. * * @return void */ function postRender(Zikula_Form_View $view) { $plugin = $view->getPluginById($this->for); if ($plugin != null) { $plugin->myLabel = $view->translateForDisplay($this->text, $this->html == 1 ? false : true); } }
/** * Render event handler. * * @param Zikula_Form_View $view Reference to Zikula_Form_View object. * * @return string The rendered output */ function render(Zikula_Form_View $view) { $idHtml = $this->getIdHtml(); $nameHtml = " name=\"{$this->inputName}\""; $titleHtml = $this->toolTip != null ? ' title="' . $view->translateForDisplay($this->toolTip) . '"' : ''; $readOnlyHtml = $this->readOnly ? ' readonly="readonly" tabindex="-1"' : ''; $sizeHtml = $this->size > 0 ? " size=\"{$this->size}\"" : ''; $maxLengthHtml = $this->maxLength > 0 ? " maxlength=\"{$this->maxLength}\"" : ''; $text = DataUtil::formatForDisplay($this->text); $class = $this->getStyleClass(); $attributes = $this->renderAttributes($view); switch (strtolower($this->textMode)) { case 'singleline': $result = "<input type=\"text\"{$idHtml}{$nameHtml}{$titleHtml}{$sizeHtml}{$maxLengthHtml}{$readOnlyHtml} class=\"{$class}\" value=\"{$text}\"{$attributes} />"; if ($this->mandatory && $this->mandatorysym) { $result .= '<span class="z-form-mandatory-flag">*</span>'; } break; case 'password': $result = "<input type=\"password\"{$idHtml}{$nameHtml}{$titleHtml}{$maxLengthHtml}{$readOnlyHtml} class=\"{$class}\" value=\"{$text}\"{$attributes} />"; if ($this->mandatory && $this->mandatorysym) { $result .= '<span class="z-form-mandatory-flag">*</span>'; } break; case 'multiline': $colsrowsHtml = ''; if ($this->cols != null) { $colsrowsHtml .= " cols=\"{$this->cols}\""; } if ($this->rows != null) { $colsrowsHtml .= " rows=\"{$this->rows}\""; } $result = "<textarea{$idHtml}{$nameHtml}{$titleHtml}{$readOnlyHtml}{$colsrowsHtml} class=\"{$class}\"{$attributes}>{$text}</textarea>"; if ($this->mandatory && $this->mandatorysym) { $result .= '<span class="z-form-mandatory-flag">*</span>'; } break; case 'hidden': $result = "<input type=\"hidden\"{$idHtml}{$nameHtml} class=\"{$class}\" value=\"{$text}\" />"; break; default: $result = __f('Unknown value [%1$s] for \'%2$s\'.', array($this->textMode, 'textMode')); } return $result; }
/** * Render event handler. * * @param Zikula_Form_View $view Reference to Zikula_Form_View object. * * @return string The rendered output */ public function render(Zikula_Form_View $view) { $idHtml = $this->getIdHtml(); $text = $view->translateForDisplay($this->text); $onclickHtml = ''; if ($this->confirmMessage != null) { $msg = $view->translateForDisplay($this->confirmMessage) . '?'; $onclickHtml = " onclick=\"return confirm('{$msg}');\""; } $imageHtml = ''; if (isset($this->attributes['imgsrc']) && !empty($this->attributes['imgsrc'])) { if (!isset($this->attributes['imgset']) || empty($this->attributes['imgset'])) { $this->attributes['imgset'] = 'icons/extrasmall'; } // we're going to make use of pnimg for path searching require_once $view->_get_plugin_filepath('function', 'img'); // call the pnimg plugin and work out the src from the assigned template vars $args = array('src' => $this->attributes['imgsrc'], 'set' => $this->attributes['imgset'], 'title' => $text, 'alt' => $text, 'modname' => 'core'); $imageHtml = smarty_function_img($args, $view); $imageHtml .= !empty($imageHtml) ? ' ' : ''; } if (isset($this->attributes['imgsrc'])) { unset($this->attributes['imgsrc']); } if (isset($this->attributes['imgset'])) { unset($this->attributes['imgset']); } $attributes = $this->renderAttributes($view); $carg = serialize(array('cname' => $this->commandName, 'carg' => $this->commandArgument)); $href = $view->getPostBackEventReference($this, $carg); $href = htmlspecialchars($href); $result = "<a{$idHtml} href=\"javascript:{$href}\"{$onclickHtml}{$attributes}>{$imageHtml}{$text}</a>"; return $result; }
/** * Renders the confirmation action. * * @param Zikula_Form_View $view Reference to Form render object. * @param string $script JavaScript code to run. * * @return string The rendered output. */ public function renderConfirm(Zikula_Form_View $view, $script) { if (!empty($this->confirmMessage)) { $msg = $view->translateForDisplay($this->confirmMessage) . '?'; return "if (confirm('{$msg}')) { {$script} }"; } else { return $script; } }
/** * RenderContent event handler. * * @param Zikula_Form_View $view Reference to Zikula_Form_View object. * @param string $content The content to handle. * * @return string The (optionally) modified content. */ public function renderContent(Zikula_Form_View $view, $content) { // Beware - working on 1-based offset! static $firstTime = true; if ($firstTime) { PageUtil::addVar('javascript', 'javascript/ajax/prototype.js'); PageUtil::addVar('javascript', 'system/Theme/javascript/form/form_tabbedpanelset.js'); PageUtil::addVar('footer', "<script type=\"text/javascript\">\$\$('.tabsToHide').invoke('hide')</script>"); } $firstTime = false; $idHtml = $this->getIdHtml(); $html = "<div class=\"{$this->cssClass}\"{$idHtml}><ul><li> </li>\n"; for ($i = 1, $titleCount = count($this->titles); $i <= $titleCount; ++$i) { $title = $this->titles[$i - 1]; $cssClass = 'linktab'; $selected = $i == $this->selectedIndex; $title = $view->translateForDisplay($title); if ($selected) { $cssClass .= ' selected'; } $link = "<a href=\"#\" onclick=\"return FormTabbedPanelSet.handleTabClick({$i},{$titleCount},'{$this->id}')\">{$title}</a>"; $html .= "<li id=\"{$this->id}Tab_{$i}\" class=\"{$cssClass}\">{$link}</li><li> </li>\n"; } $html .= "</ul></div><div style=\"clear: both\"></div>\n"; $html .= "<input type=\"hidden\" name=\"{$this->id}SelectedIndex\" id=\"{$this->id}SelectedIndex\" value=\"{$this->selectedIndex}\" />\n"; return $html . $content; }