/**
  * Adds an option to the selectmenu.
  * 
  * @param string $name The label
  * @param mixed $value The value
  * @param string $icon An image as icon
  * @return void
  */
 public function AddOption($name, $value, $icon = false)
 {
     $opt = new Control("option");
     $opt->value = $value;
     $opt->content($name);
     if ($icon) {
         $opt->class = $this->addIcon($icon);
     }
     $this->content($opt);
 }
 /**
  * @param int $defvalue Initial value (seconds)
  * @param string $onchange onChange JS code
  */
 function __initialize($defvalue = 0, $onchange = "")
 {
     parent::__initialize("div");
     $defvalue = intval($defvalue);
     $m = floor($defvalue / 60);
     $s = $defvalue % 60;
     $id = $this->id;
     $this->class = "timeinput ui-widget-content ui-widget ui-corner-all";
     $this->css("border", "1px solid transparent");
     $this->onmouseover = "\$(this).css({border:''});";
     $this->onmouseout = "\$(this).css({border:'1px solid transparent'});";
     $minutes = new uiSlider();
     $minutes->id = "{$id}_euro";
     $minutes->range = 'min';
     $minutes->min = 0;
     $minutes->max = 120;
     $minutes->value = $m;
     $minutes->css("margin-bottom", "8px");
     $minutes->onslide = "function(event, ui){ \$('#{$id}_euro_value').text(ui.value<10?'0'+ui.value:ui.value);";
     $minutes->onslide .= "\$('#{$id}_hidden').val( parseInt(\$('#{$id}_euro_value').text())*60 + parseInt(\$('#{$id}_cent_value').text()) ).change(); }";
     $minutes->onmouseover = "\$('#{$id}_euro_value').css({color:'red'});";
     $minutes->onmouseout = "\$('#{$id}_euro_value').css({color:'black'});";
     $seconds = new uiSlider();
     $seconds->id = "{$id}_cent";
     $seconds->range = 'min';
     $seconds->min = 0;
     $seconds->max = 59;
     $seconds->value = $s;
     $seconds->onslide = "function(event, ui){ \$('#{$id}_cent_value').text(ui.value<10?'0'+ui.value:ui.value); ";
     $seconds->onslide .= "\$('#{$id}_hidden').val( parseInt(\$('#{$id}_euro_value').text())*60 + parseInt(\$('#{$id}_cent_value').text()) ).change(); }";
     $seconds->onmouseover = "\$('#{$id}_cent_value').css({color:'red'});";
     $seconds->onmouseout = "\$('#{$id}_cent_value').css({color:'black'});";
     $container = new Control("div");
     $container->class = "container";
     $container->content($minutes);
     $container->content($seconds);
     $value = new Control("div");
     $value->class = "value";
     $minuteval = new Control("div");
     $minuteval->id = "{$id}_euro_value";
     $minuteval->css("float", "left");
     $minuteval->content($m < 9 ? "0{$m}" : $m);
     $secval = new Control("div");
     $secval->id = "{$id}_cent_value";
     $secval->css("float", "left");
     $secval->content($s < 9 ? "0{$s}" : $s);
     $value->content($minuteval);
     $value->content("<div style='float:left'>:</div>");
     $value->content($secval);
     $this->content($container);
     $this->content($value);
     $this->content("<input type='hidden' id='{$id}_hidden' name='{$id}' value='{$defvalue}' onchange='{$onchange}'/>");
     $this->content("<br style='clear:both; line-height:0'/>");
 }
Beispiel #3
0
 /**
  * @override
  */
 function PreRender($args = array())
 {
     if ($this->InitFunctionName) {
         $this->script("\$('#{$this->id}').{$this->InitFunctionName}(" . system_to_json($this->Options) . ");");
     }
     parent::PreRender($args);
 }
 /**
  * @param string $label A label text
  * @param string $src Source for the image
  */
 function __initialize($label, $src)
 {
     parent::__initialize("button");
     $img = new Image($src, $label);
     $this->content($img);
     $this->CloseTagNeeded();
 }
Beispiel #5
0
 /**
  * @override Ensures that there's a valid href attribute, if not adds "javascript:{}" to it.
  */
 public function WdfRender()
 {
     if ($this->href == "") {
         $this->href = "javascript:{}";
     }
     return parent::WdfRender();
 }
Beispiel #6
0
 /**
  * @override Ensures that there's a valid href attribute, if not adds "#" to it.
  */
 public function WdfRender()
 {
     if ($this->href == "") {
         $this->href = "#";
     }
     return parent::WdfRender();
 }
 /**
  * @param mixed $content Some content to add
  * @param string $id an optional id
  */
 function __initialize($content, $id = "")
 {
     parent::__initialize("li");
     if (!empty($id)) {
         $this->id = $id;
     }
     $this->content($content);
 }
 /**
  * @param string $value The text
  * @param string $name The name
  * @param string $cid 
  */
 function __initialize($value = '', $name = false)
 {
     parent::__initialize("textarea");
     if ($name) {
         $this->name = $name;
     }
     $this->content($value);
 }
 /**
  * @param float $defvalue Initial value
  * @param string $onchange onChange JS code
  */
 function __initialize($defvalue = 0, $onchange = "")
 {
     parent::__initialize("div");
     $this->InitFunctionName = false;
     $defvalue = floatval(str_replace(",", ".", $defvalue));
     $e = floor($defvalue);
     $c = round($defvalue - $e, 2) * 100;
     $id = $this->id;
     $this->class = "currencyinput ui-widget-content ui-widget ui-corner-all";
     $this->css("border", "1px solid transparent");
     $this->onmouseover = "\$(this).css({border:''});";
     $this->onmouseout = "\$(this).css({border:'1px solid transparent'});";
     $euro = new uiSlider();
     $euro->id = "{$id}_euro";
     $euro->range = 'min';
     $euro->min = 0;
     $euro->max = 100;
     $euro->value = $e;
     $euro->css("margin-bottom", "8px");
     $euro->onslide = "function(event, ui){ \$('#{$id}_euro_value').text(ui.value); ";
     $euro->onslide .= "\$('#{$id}_hidden').val( \$('#{$id}_euro_value').text()+'.'+\$('#{$id}_cent_value').text() ).change(); }";
     $euro->onmouseover = "\$('#{$id}_euro_value').css({color:'red'});";
     $euro->onmouseout = "\$('#{$id}_euro_value').css({color:'black'});";
     $cent = new uiSlider();
     $cent->id = "{$id}_cent";
     $cent->range = 'min';
     $cent->min = 0;
     $cent->max = 99;
     $cent->value = $c;
     $cent->onslide = "function(event, ui){ \$('#{$id}_cent_value').text(ui.value<10?'0'+ui.value:ui.value); ";
     $cent->onslide .= "\$('#{$id}_hidden').val( \$('#{$id}_euro_value').text()+'.'+\$('#{$id}_cent_value').text() ).change(); }";
     $cent->onmouseover = "\$('#{$id}_cent_value').css({color:'red'});";
     $cent->onmouseout = "\$('#{$id}_cent_value').css({color:'black'});";
     $container = new Control("div");
     $container->class = "container";
     $container->content($euro);
     $container->content($cent);
     $value = new Control("div");
     $value->class = "value";
     $euroval = new Control("div");
     $euroval->id = "{$id}_euro_value";
     $euroval->css("float", "left");
     $euroval->content($e);
     $centval = new Control("div");
     $centval->id = "{$id}_cent_value";
     $centval->css("float", "left");
     $centval->content($c < 9 ? "0{$c}" : $c);
     $value->content("<div style='float:left'>€</div>");
     $value->content($euroval);
     $value->content("<div style='float:left'>,</div>");
     $value->content($centval);
     $this->content($container);
     $this->content($value);
     $this->content("<input type='hidden' id='{$id}_hidden' name='{$id}' value='{$defvalue}' onchange='{$onchange}'/>");
     $this->content("<br style='clear:both; line-height:0'/>");
 }
 /**
  * @param string $src value for the src attribute
  * @param string $title value for the title attribute
  * @param string $link value for the href attribute
  * @param string $margin Value for the margin (css)
  */
 function __initialize($src, $title, $link = "", $margin = "")
 {
     parent::__initialize('a');
     $this->href = $link;
     $this->css("text-decoration", "none");
     if ($margin != "") {
         $this->css("margin", "{$margin}");
     }
     $this->content(new Image($src, $title, 0));
 }
 /**
  * @param type $options SimplyScroll options (see http://logicbox.net/jquery/simplyscroll)
  */
 function __initialize($options = array())
 {
     parent::__initialize("ul");
     if (!isset($options['autoMode'])) {
         $options['autoMode'] = 'loop';
     }
     $this->Options = $options;
     $options = system_to_json($this->Options);
     $code = "\$('#{self}').simplyScroll({$options});";
     $this->script($code);
 }
Beispiel #12
0
 /**
  * @param string $id Id to be set
  * @param string $listType Type of list (ol|ul)
  */
 function __initialize($id = "", $listType = "ul")
 {
     if ($listType != "ul" || $listType != "ol") {
         $listType = "ul";
     }
     parent::__initialize($listType);
     if (!empty($id)) {
         $this->id = $id;
     }
     store_object($this);
 }
 /**
  * @override
  */
 function PreRender($args = array())
 {
     // we register a new HOOK_PRE_RENDER handler here so that it will be executed when all others are
     // finished. so derivered classes can add their loader code in PreRender as usual.
     if (count($args) > 0) {
         $controller = $args[0];
         if ($controller instanceof HtmlPage) {
             if (!self::$_delayedHookAdded) {
                 self::$_delayedHookAdded = true;
                 register_hook(HOOK_PRE_RENDER, $this, 'AddLoaderCode');
             }
         }
     }
     return parent::PreRender($args);
 }
Beispiel #14
0
 /**
  * @param string $src value for the src attribute
  * @param string $title value for the title attribute
  * @param string $border value for the border attribute
  * @param string $style value for the style attribute
  * @param string $id optional value for the id attribute
  */
 function __initialize($src = null, $title = "", $border = "0", $style = "", $id = false)
 {
     parent::__initialize("img");
     if ($src != null) {
         $this->src = $src;
         if ($title == "") {
             // show filename (without extension) as alt
             $this->alt = basename($src, '.' . pathinfo($src, PATHINFO_EXTENSION));
         } else {
             $this->alt = $title;
             $this->title = $title;
         }
         $this->border = $border;
         if ($id) {
             $this->id = $id;
         }
         if ($style != "") {
             $this->style = $style;
         }
     }
 }
 /**
  * @override Prepares JS init code
  */
 public function WdfRender()
 {
     $script = "";
     $trigger = implode(",", $this->_triggers);
     if (count($this->_defaults) > 0) {
         $script .= "\$.contextMenu.defaults({" . $this->CreateDefaults() . "});";
     }
     if (count($this->_triggers) > 0) {
         $script .= "\$('" . $trigger . "').contextMenu('{$this->id}',{";
     } else {
         $script .= "\$(document).contextMenu('{$this->id}',{";
     }
     if (count($this->_bindings) > 0) {
         $script .= $this->CreateBindings();
     }
     $script .= "});";
     if ($trigger && $this->_leftclick) {
         $script .= "\$('{$trigger}').click(function(e){ e.type = 'contextmenu'; \$(this).trigger(e); });";
     }
     $script .= ";";
     $this->script($script);
     $this->_content[] = $this->CreateUL();
     return parent::WdfRender();
 }
Beispiel #16
0
 /**
  * Creates an option element.
  * 
  * @param mixed $value The value
  * @param mixed $label An optional label
  * @param bool $selected True if selected (hint: use <Select::SetCurrentValue> instead of evaluating selected state for each option)
  * @param Control $opt_group If given the option will be added to this optgroup element. Create one via <Select::CreateGroup>.
  * @return Select `$this`
  */
 function AddOption($value, $label = "", $selected = false, $opt_group = false)
 {
     $label = $label == "" ? $value : $label;
     $this->_options[$value] = $label;
     if (!$this->_first_option_value) {
         $this->_first_option_value = $value;
     }
     if (!$selected && $this->_current !== false) {
         $selected = $value == $this->_current;
     }
     $selected = $selected ? " selected='selected'" : "";
     //		$opt = "<option value='$value'$selected>".htmlspecialchars($label)."</option>\r\n";
     $opt = "<option ";
     if ($value !== '') {
         $opt .= "value='{$value}'";
     }
     $opt .= "{$selected}>" . $label . "</option>\r\n";
     if ($opt_group) {
         $opt_group->content($opt);
     } else {
         $this->content($opt);
     }
     return $this;
 }
Beispiel #17
0
 /**
  * @override
  */
 function WdfRender()
 {
     if (isset($this->options['oddclass']) && isset($this->options['evenclass'])) {
         if (!isset($this->_css['display']) || $this->_css['display'] != "none") {
             $this->class = $GLOBALS['TR_CURRENTLY_ODD'] ? $this->options['oddclass'] : $this->options['evenclass'];
             $GLOBALS['TR_CURRENTLY_ODD'] = !$GLOBALS['TR_CURRENTLY_ODD'];
         }
     }
     return parent::WdfRender();
 }
Beispiel #18
0
 function __initialize()
 {
     parent::__initialize("div");
     $this->class = "colgroup";
 }
 /**
  * @internal Will create a new sample based on changed settings.
  * 
  * @attribute[RequestParam('append_timezone','bool')]
  * @attribute[RequestParam('timezone','string')]
  * @attribute[RequestParam('dtf','string')]
  * @attribute[RequestParam('culture_code','string')]
  */
 public function RefreshSample($append_timezone, $timezone, $dtf, $culture_code)
 {
     $this->culture_code = $culture_code;
     $this->timezone = $timezone;
     $txt = $this->_sample($dtf);
     if ($append_timezone) {
         $txt .= " {$timezone}";
     }
     $sample = new Control('span');
     $sample->append("({$txt})")->css('color', 'gray');
     return AjaxResponse::Renderable($sample);
 }
Beispiel #20
0
 /**
  * @override
  */
 function WdfRender()
 {
     if ($this->options) {
         if (isset($this->options['collapsible']) && $this->options['collapsible']) {
             if (!isset($this->class)) {
                 $this->class = "";
             }
             $this->class .= " collapsible";
             $colcount = 0;
             foreach ($this->_content as &$row) {
                 $colcount = max($colcount, count($row->_content));
                 if (!isset($row->_content[0]->class)) {
                     $row->_content[0]->class = "";
                 }
                 $row->_content[0]->class .= " indent";
             }
             if (!$this->header) {
                 $this->header = new Tr($this->RowOptions);
                 $hc = $this->header->NewCell('&gt;&gt; Click to expand.');
                 $hc->colspan = $colcount;
             }
             if (!isset($this->header->onclick)) {
                 $this->header->onclick = "";
             }
             $speed = "500";
             $func = "function(){ \$('#{$this->table->id}').click(); wdf.debug('Click invoked'); }";
             $func = "setTimeout(unescape(" . json_encode("\$('#{$this->table->id}').click();") . "),{$speed}+10);";
             $this->header->onclick = "{$func} \$(this).siblings('tr').css('display') == 'none' ? \$(this).siblings('tr').fadeIn({$speed}) : \$(this).siblings('tr').fadeOut({$speed});" . $this->header->onclick;
             $this->header->css("cursor", "pointer");
             foreach ($this->_content as &$row) {
                 unset($row->options['oddclass']);
                 unset($row->options['evenclass']);
             }
         }
         if (isset($this->options['visible']) && !$this->options['visible']) {
             //$colcount = 0;
             foreach ($this->_content as &$row) {
                 //$colcount = max($colcount,count($row->_content));
                 $row->css("display", "none");
             }
         }
     }
     if ($this->header) {
         $this->_content = array_merge(array($this->header), $this->_content);
     }
     return parent::WdfRender();
 }
Beispiel #21
0
 function __initialize($type = "MSColumnLine3D", $title = "", $width = 1000, $height = 450, $plotColors = false)
 {
     if ($type === null) {
         $type = "MSColumnLine3D";
     }
     parent::__initialize("div");
     if ($plotColors) {
         $this->arPlotColors = $plotColors;
     }
     $this->style = 'display:block; float:left';
     $this->content("The chart is currently loading. Please stand by...<br/>");
     $this->content('FusionCharts needs Adobe Flash Player to run. If you\'re unable to see the chart here, it means that your browser does not seem to have the Flash Player Installed. You can downloaded it <a href="http://www.adobe.com/products/flashplayer/" target="_blank"><u>here</u></a> for free.');
     $this->Type = $type;
     $this->Title = $title;
     $this->Width = $width;
     $this->Height = $height;
     $this->Prepare();
 }
Beispiel #22
0
 function __initialize()
 {
     parent::__initialize("input");
 }
Beispiel #23
0
 function CreateOption($value, $label = "", $selected = false, $opt_group = false)
 {
     $label = $label == "" ? $value : $label;
     $this->_options[$value] = $label;
     if (!$this->_first_option_value) {
         $this->_first_option_value = $value;
     }
     if (!$selected && $this->_current !== false) {
         $selected = $value == $this->_current;
     }
     $opt = Control::Make('option')->append($label !== "" ? $label : $value);
     if ($selected) {
         $opt->attr("selected", "selected");
     }
     if ($value !== '') {
         $opt->attr("value", $value);
     }
     if ($opt_group) {
         return $opt_group->content($opt);
     }
     return $this->content($opt);
 }
Beispiel #24
0
 function __initialize()
 {
     parent::__initialize("form");
     $this->method = 'post';
 }
 /**
  * @internal Entry point for translation admin.
  * @attribute[RequestParam('lang','string',false)]
  * @attribute[RequestParam('offset','int',0)]
  * @attribute[RequestParam('search','text','')]
  * @attribute[RequestParam('untranslated','bool',false)]
  */
 function Translate($lang, $offset, $search, $untranslated)
 {
     global $CONFIG;
     if ($untranslated) {
         $search = '';
     }
     $lang = $lang ? $lang : $CONFIG['localization']['default_language'];
     $_SESSION['trans_admin_lang'] = $lang;
     $_SESSION['trans_admin_offset'] = $offset;
     $_SESSION['trans_admin_search'] = $search;
     $form = $this->content(new Form());
     $form->css('margin-bottom', '20px')->action = buildQuery('TranslationAdmin', 'Translate');
     $form->content("Select language: ");
     $form->content($this->_languageSelect($lang))->script("\$('#{self}').change(function(){ \$('#{$form->id}').submit(); });")->name = 'lang';
     $form->content("&nbsp;&nbsp;&nbsp;And/Or search: ");
     $form->AddText('search', $search);
     $form->AddHidden('offset', 0);
     $form->AddSubmit('Search');
     $form->content("<span style='color:gray'>(?:=single char, *:=any/no char)</span>");
     if ($lang != $CONFIG['localization']['default_language']) {
         $form->content("&nbsp;&nbsp;&nbsp;Or ");
         $form->AddHidden('untranslated', 0)->id = 'untranslated';
         Button::Make("Show untranslated", "\$('#untranslated').val('1').closest('form').submit();")->appendTo($form);
     }
     $tab = Table::Make()->addClass('translations')->SetHeader('Term', 'Default', 'Content', '', '')->setData('lang', $lang)->appendTo($this);
     $rs = $this->_searchQuery($offset, $lang, $search, $untranslated);
     foreach ($rs as $term) {
         $def = nl2br(htmlspecialchars($term['def']));
         $ta = new TextArea($untranslated ? '' : $term['trans']);
         $ta->class = $term['id'];
         $ta->rows = count(explode('<br />', $def)) + 1;
         $btn = new Button('Save');
         $btn->addClass('save')->setData('term', $term['id']);
         $tab->AddNewRow($term['id'], $def, $ta, $btn, '');
         $c = $tab->GetCurrentRow()->GetCell(4);
         $c->css('white-space', 'nowrap');
         $c->content(Control::Make("span"))->addClass('term_action rename')->setData('term', $term['id'])->content('rename');
         $c->content("&nbsp;");
         $c->content(Control::Make("span"))->addClass('term_action remove')->setData('term', $term['id'])->content('remove');
     }
     if ($tab->GetCurrentRow()) {
         $tab->GetCurrentRow()->GetCell(1)->style = 'width: 40%';
     }
     $pi = $rs->GetPagingInfo();
     for ($page = 1; $page <= $pi['total_pages']; $page++) {
         $offset = ($page - 1) * $pi['rows_per_page'];
         $label = $offset + 1 . "-" . $page * $pi['rows_per_page'];
         $label = "{$page}";
         if ($page == $pi['current_page']) {
             $this->content("<b>{$label}</b>");
         } else {
             $this->content(new Anchor(buildQuery('TranslationAdmin', 'Translate', "lang={$lang}&offset={$offset}&search={$search}&untranslated=" . ($untranslated ? 1 : 0)), "{$label}"));
         }
         $this->content("&nbsp;");
     }
 }
Beispiel #26
0
 protected function RenderPager()
 {
     $pages = ceil($this->TotalItems / $this->ItemsPerPage);
     if ($pages < 2) {
         return;
     }
     log_debug("RenderPager: {$this->CurrentPage}/{$pages}");
     $ui = new Control('div');
     $ui->addClass("pager");
     if ($this->CurrentPage > 1) {
         $ui->content(new Anchor("javascript: \$('#{$this->id}').gotoPage(1)", "|&lt;"));
         $ui->content(new Anchor("javascript: \$('#{$this->id}').gotoPage(" . ($this->CurrentPage - 1) . ")", "&lt;"));
     }
     $start = 1;
     while ($pages > $this->MaxPagesToShow && $this->CurrentPage > $start + $this->MaxPagesToShow / 2) {
         $start++;
     }
     for ($i = $start; $i <= $pages && $i < $start + $this->MaxPagesToShow; $i++) {
         if ($i == $this->CurrentPage) {
             $ui->content("<span class='current'>{$i}</span>");
         } else {
             $ui->content(new Anchor("javascript: \$('#{$this->id}').gotoPage({$i})", $i));
         }
     }
     if ($this->CurrentPage < $pages) {
         $ui->content(new Anchor("javascript: \$('#{$this->id}').gotoPage(" . ($this->CurrentPage + 1) . ")", "&gt;"));
         $ui->content(new Anchor("javascript: \$('#{$this->id}').gotoPage({$pages})", "&gt;|"));
     }
     return $ui;
 }
 /**
  * @override
  */
 function WdfRender()
 {
     if ($this->sub) {
         $this->sub->content('<li class="page_item"><span class="subclsr">&nbsp;</span></li>');
     }
     return parent::WdfRender();
 }
Beispiel #28
0
 /**
  * @param array $options No valid options defined yet
  */
 function __initialize($options = false)
 {
     parent::__initialize("div");
     $this->class = "td";
     $this->options = $options;
 }
 /**
  * No need to call this manually, use <uiTreeView::AddRootNode>() instead.
  * @param string $text Node label text
  */
 function __initialize($text)
 {
     parent::__initialize("li");
     $this->class = "ui-treeview-node";
     $this->content($text);
 }
Beispiel #30
0
 /**
  * @param string $name The actual text
  * @param mixed $for Can be <Control> or string holding an id
  */
 function __initialize($name, $for = "")
 {
     parent::__initialize("label");
     $this->content($name);
     $this->for = $for instanceof Control ? $for->id : $for;
 }