/** * Render header * * @param string $name Element name * @return string HTML code */ public function renderHeader($name) { if ($this->getOption('tabbed')) { return strtr('<ul><li><a onclick="blur()" href="#%id%-1">%label_associated%</a></li><li>' . '<a onclick="blur()" href="#%id%-2">%label_unassociated%</a></li></ul>', array('%id%' => $this->generateId($name), '%label_associated%' => I18n::__($this->parent->getFormFormatter()->getTranslationCatalogue() . '.' . $this->getOption('label_associated')), '%label_unassociated%' => I18n::__($this->parent->getFormFormatter()->getTranslationCatalogue() . '.' . $this->getOption('label_unassociated')))); } return ''; }
/** * Render field * @param string $name Element name * @param string $value Field value [optional] * @param array $attributes HTML attributes [optional] * @param array $errors Field errors [optional] * @return string XHTML compliant tag */ public function render($name, $value = null, $attributes = array(), $errors = array()) { $textarea = parent::render($name, $value, $attributes, $errors); $genId = $this->generateId($name); $init[] = "tinyMCE.init({mode:'none',elements:'" . $genId . "',"; $init[] = "theme:'" . $this->getOption('theme') . "',"; $init[] = $this->getOption('width') ? "width:'" . $this->getOption('width') . "px'," : ''; $init[] = $this->getOption('height') ? "height:'" . $this->getOption('height') . "px'," : ''; $init[] = "theme_advanced_toolbar_location:'top',theme_advanced_toolbar_align:'left',"; $init[] = "theme_advanced_statusbar_location:'bottom',theme_advanced_resizing:true"; $init[] = $this->getOption('config') ? "," . $this->getOption('config') : ''; $init[] = "});"; $fix[] = "if(tinyMCE.get('" . $genId . "'))tinyMCE.remove(tinyMCE.get('" . $genId . "'));"; $fix[] = "setTimeout('tinyMCE.execCommand(\\'mceAddControl\\',false,\\'" . $genId . "\\');', 100);"; // remove this shit if (!$this->getOption('activate')) { $ext[] = '<a id="tmcAct' . $genId . '" class="tinymce_activation" '; $ext[] = 'href="javascript:void(0)" onclick="tmcActivation' . $genId . '()" title="'; $ext[] = I18n::__('admin.labels.tmcActivation') . '"></a>'; } $ext[] = '<script type="text/javascript">'; if (!$this->getOption('activate')) { $ext[] = 'if(typeof jQuery!=\'undefined\'){'; $ext[] = '$(\'#tmcAct' . $genId . "').button({icons:{primary:'ui-icon-contact'},text:false});"; $ext[] = "function tmcActivation" . $genId . '(){$(\'#tmcAct' . $genId . "').hide();"; $ext[] = implode($init) . implode($fix) . '}}'; } else { $ext[] = implode($init) . implode($fix); } $ext[] = "</script>"; return $textarea . implode($ext); }
/** * Render range block * * @return string XHTML compliant */ protected function renderRange($name, $value = null, $attributes = array(), $errors = array()) { //TODO: add no i18n way $values = array_merge(array('min' => '', 'max' => ''), is_array($value) ? $value : array()); $dict = $this->parent->getFormFormatter()->getTranslationCatalogue(); return strtr($this->getOption('template'), array('%min_label%' => I18n::__($dict . '.labels.min'), '%max_label%' => I18n::__($dict . '.labels.max'), '%min%' => $this->getOption('min')->render($name . '[min]', $value['min'], $attributes), '%max%' => $this->getOption('max')->render($name . '[max]', $value['max'], $attributes))); }
?> <li class="item<?php echo isset($item['class']) ? ' ' . $item['class'] : ''; ?> "> <?php echo Url::link('<sub></sub>' . I18n::__('menu.labels.item.' . $title), $item['url'], array('ajax' => 'action', 'onfocus' => 'blur()')); ?> </li> <?php } ?> </ul> </li> <?php } else { ?> <li class="node"> <?php echo Url::link(I18n::__('menu.labels.category.' . $name), $category['url'], array('ajax' => 'action')); ?> </li> <?php } ?> <?php } ?> </ul> <?php }
/** * Set title part * * @param string $name Name of title part * @param string $value Value of title part * @param boolean $isI18n Is part need to translate [optional, default false] * @return dinWebResponse */ public function setTitlePart($name, $value, $isI18n = false) { $this->titleParts['%' . $name . '%'] = $isI18n ? I18n::__($value) : $value; return $this; }
?> <?php if ($sf_user->isAuthenticated()) { ?> <div id="logout"> [<?php echo Url::link(I18n::__('messages.labels.logout'), '@logout', array('ajax' => 'action', 'dest' => 'logout')); ?> ] <?php echo $sf_user->getNickname(); ?> </div> <?php } ?> <div class="clear"></div> </div> <?php if (sfConfig::get('app_admin_include_path', true)) { ?> <div id="sf_admin_path" class="ui-widget"> <strong><?php echo Url::link(I18n::__('messages.labels.home'), '@homepage'); ?> </strong> <div id="breadcrumbs"></div> </div> <?php } }
</tr> <?php } ?> <?php } ?> </tbody> </table> </div> <div id="dialog-del-obj" style="display:none" title="<?php echo I18n::__('admin.label.deleteObjectConfirm'); ?> "> <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span><?php echo I18n::__('admin.text.deleteObjectConfirm'); ?> </p> </div> <script type="text/javascript"> function checkAll(){var boxes=document.getElementsByTagName('input');for(var index=0;index<boxes.length;index++){box=boxes[index];if(box.type=='checkbox'&&box.className=='sf_admin_batch_checkbox')box.checked=document.getElementById('sf_admin_list_batch_checkbox').checked}return true;} $(document).ready(function(){ $('#tree_list').treeTable({treeColumn:1,indent:16,initialState:'expanded'}); $('table#tree_list tbody tr').mousedown(function(){$('tr.ui-state-hover').removeClass('ui-state-hover');$(this).addClass('ui-state-hover');}); $('table#tree_list tbody tr span').mousedown(function(){$($(this).parents('tr')[0]).trigger('mousedown');}); }); </script>
/** * Link to save and add * * @param object $object Object * @param array $params Params for generation * @return string Generated xhtml compliant */ public function linkToSaveAndAdd($object, $params) { if (!$object->isNew()) { return ''; } return '<li class="sf_admin_action_save_and_add"><script type="text/javascript">if(typeof jQuery!=\'undefined\'){$(function(){' . '$(".sf_admin_action_save_and_add button").button({icons:{primary:\'ui-icon-copy\'}})' . '});$(".sf_admin_action_save_and_add button").click(function(){$(".sf_admin_action_save_and_add")' . '.prepend(\'<input type="hidden" name="_save_and_add" value="1" />\');});}</script>' . '<button type="submit" name="_save_and_add">' . I18n::__($this->dictionary . 'labels.saveAndAdd') . '</button></li>'; }
/** * Render field * * @param string $name Element name * @param string $value Field value [optional] * @param array $attributes HTML attributes [optional] * @param array $errors Field errors [optional] * @return string XHTML compliant tag */ public function render($name, $value = null, $attributes = array(), $errors = array()) { $values = array_merge(array('from' => '', 'to' => '', 'is_empty' => ''), is_array($value) ? $value : array()); $dict = $this->parent->getFormFormatter()->getTranslationCatalogue(); return strtr($this->getOption('template'), array('%from%' => I18n::__($dict . '.labels.fromDate'), '%to%' => I18n::__($dict . '.labels.toDate'), '%from_date%' => $this->getOption('from_date')->render($name . '[from]', $value['from'], $attributes), '%to_date%' => $this->getOption('to_date')->render($name . '[to]', $value['to'], $attributes))); }