/** * Returns a list of commands for this renderer. * @return \COMMANDS */ public function make_commands() { $Result = new COMMANDS($this->context); if ($this->_comment_query->size() > 1) { $command = $Result->make_command(); $Result->append($command); switch ($this->comment_mode) { case Comment_render_flat: $command->caption = 'Show Threaded'; $command->link = $this->_obj->home_page() . "&comment_mode=threaded#comments"; break; case Comment_render_threaded: $command->caption = 'Show Flat'; $command->link = $this->_obj->home_page() . "&comment_mode=flat#comments"; break; } } return $Result; }
public function make_commands($context) { $Result = new COMMANDS($context); if ($this->enabled && $this->file_name) { $url = new URL($this->page->resolve_file($this->file_name, Force_root_on)); foreach ($this->formats as $format => $format_title) { foreach ($this->content_formats as $content => $content_texts) { $content_title = $content_texts[0]; $content_description = $content_texts[1]; $url->replace_argument('format', $format); $url->replace_argument('content', $content); $cmd = $Result->make_command(); $cmd->id = $format . '_' . $content; $cmd->caption = '<b>' . $content_title . '</b> (' . $format_title . ')'; if ($format == 'rss') { $cmd->icon = '{icons}indicators/newsfeed_rss'; } else { $cmd->icon = '{icons}indicators/newsfeed_atom'; $cmd->description = $content_description; } $cmd->link = $url->as_text(); $Result->append($cmd); } } } return $Result; }
/** * Add an item to the end of the menu. * @param string $title Title shown for the link. * @param string $url Action to execute. * @param string $icon Path to the optional icon. * @param bool $selected Renders as selected without the link if <c>True</c>. * @param $link_title string The title to use for the url if the command is not selected. * @return \COMMAND */ public function append($title, $url = '', $icon = '', $selected = false, $link_title = '') { $result = $this->_make_command($title, $url, $icon, $selected, $link_title); $this->commands->append($result); return $result; }
/** * Draw a single-line text control with a 'browse' button onto a separate row in the form. * * @param string $id The id of the field to render. * @param FORM_LIST_ITEM[] $items The items to include as options in the chooser. * @param FORM_TEXT_CONTROL_OPTIONS $options Override the default text control rendering; can be null. * @param string $css_class The class to apply to the overall container. * @return string */ public function text_line_with_chooser_as_html($id, $items, $options = null, $css_class = 'browse') { $result = '<span class="' . $css_class . '">'; $result .= $this->text_line_as_html($id, $options); $commands = new COMMANDS($this->context); foreach ($items as $item) { $cmd = $commands->make_command(); $cmd->id = $item->text; $cmd->caption = $item->title; $cmd->on_click = 'set_control_value(event, \'' . $id . '\', \'' . $item->value . '\')'; $cmd->link = '#'; $commands->append($cmd); } $menu_renderer = $this->context->make_menu_renderer(); $menu_renderer->set_size(Menu_size_minimal); $menu_renderer->menu_class .= ' chooser'; ob_start(); $menu_renderer->display($commands); $result .= ob_get_contents(); ob_end_clean(); $result .= '</span>'; return $result; }