Exemplo n.º 1
0
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->sortable(true, 'timereceived', SORT_DESC);
$table->no_sorting('checkbox');
$table->no_sorting('messagetext');
$table->no_sorting('options');
$table->no_sorting('tags');
$table->column_class('tags', 'tagDrop');
$table->show_download_buttons_at(array(TABLE_P_BOTTOM));
$table->setup();
// Output errors if necessary
if (!$table->is_downloading()) {
    // Drop in page header
    echo $output->header();
    $addTagListItems = '';
    $tagCloud = new moodletxt_message_tag_cloud(get_string('headertags', 'block_moodletxt'));
    $tagCloud->set_attribute('class', 'mdltxt_right');
    $tagCloud->set_attribute('style', 'text-align:right;');
    $maxCount = 1;
    // Find tag with largest number of messages assigned
    foreach ($tagList as $tag) {
        if ($tag->getTagCount() > $maxCount) {
            $maxCount = $tag->getTagCount();
        }
        $addTagListItems .= $output->render(new moodletxt_message_tag_link($tag->getName(), MoodletxtStringHelper::convertToValidCSSIdentifier($tag->getName()), 100, $tag->getColourCode()));
    }
    // @TODO Make these into widgets
    $tagListScroller = html_writer::tag('div', $addTagListItems, array('id' => 'mdltxtTagListScroller'));
    $inputBox = html_writer::empty_tag('input', array('type' => 'text', 'width' => '20', 'name' => 'trayNewTag'));
    $newTagContent = get_string('labelnewtag', 'block_moodletxt') . $inputBox . $output->render(new moodletxt_icon(moodletxt_icon::$ICON_ADD, get_string('altaddtag', 'block_moodletxt'), array('class' => 'mdltxtAddTagButton')));
    $newTagDiv = html_writer::tag('div', $newTagContent, array('id' => 'mdltxtNewTagForm'));
Exemplo n.º 2
0
 /**
  * Renders a message tag cloud 
  * @param moodletxt_message_tag_cloud $cloud The tag cloud to render 
  * @return string Rendered HTML for the tag cloud
  * @version 2012052801
  * @since 2012051401
  */
 protected function render_moodletxt_message_tag_cloud(moodletxt_message_tag_cloud $cloud)
 {
     $htmlAttributes = $cloud->get_attributes();
     $htmlAttributes['class'] = $cloud->get_attribute('class') . ' mtxtTagCloud';
     $tagHTML = '';
     foreach ($cloud->get_tag_widgets() as $widget) {
         $tagHTML .= $this->render_moodletxt_message_tag_link($widget);
     }
     $tagIcon = $this->render_moodletxt_icon(new moodletxt_icon(moodletxt_icon::$ICON_TAG, $cloud->get_title()));
     $header = html_writer::tag('h2', $tagIcon . $cloud->get_title());
     $header .= html_writer::tag('p', get_string('labeltagdraganddrop', 'block_moodletxt'));
     $para = html_writer::tag('p', $tagHTML, array('class' => 'tags'));
     $inputBox = html_writer::empty_tag('input', array('type' => 'text', 'width' => '20', 'name' => 'cloudNewTag'));
     $newTagContent = get_string('labelnewtag', 'block_moodletxt') . $inputBox . $this->render_moodletxt_icon(new moodletxt_icon(moodletxt_icon::$ICON_ADD, get_string('altaddtag', 'block_moodletxt'), array('class' => 'mdltxtAddTagButton')));
     $newTagDiv = html_writer::tag('div', $newTagContent, array('id' => 'cloudNewTagForm'));
     return html_writer::tag('div', $header . $para . $newTagDiv, $htmlAttributes);
 }