• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP tag_display_name函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中tag_display_name函数的典型用法代码示例。如果您正苦于以下问题:PHP tag_display_name函数的具体用法?PHP tag_display_name怎么用?PHP tag_display_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了tag_display_name函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: print_header

 function print_header()
 {
     global $USER, $CFG;
     $tagname = tag_display_name($this->tag_object);
     $navlinks = array();
     $navlinks[] = array('name' => get_string('tags', 'tag'), 'link' => "{$CFG->wwwroot}/tag/search.php", 'type' => '');
     $navlinks[] = array('name' => $tagname, 'link' => '', 'type' => '');
     $navigation = build_navigation($navlinks);
     $title = get_string('tag', 'tag') . ' - ' . $tagname;
     $button = '';
     if ($this->user_allowed_editing()) {
         $button = update_tag_button($this->id);
     }
     print_header_simple($title, '', $navigation, '', '', '', $button);
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:15,代码来源:pagelib.php


示例2: get_videos_by_tag_and_category

 function get_videos_by_tag_and_category()
 {
     $tagid = optional_param('id', 0, PARAM_INT);
     // tag id
     $query_tag = tag_display_name(tag_by_id($tagid));
     $query_tag = urlencode($query_tag);
     $numberofvideos = DEFAULT_NUMBER_OF_VIDEOS;
     if (!empty($this->config->numberofvideos)) {
         $numberofvideos = $this->config->numberofvideos;
     }
     $request = 'http://www.youtube.com/api2_rest?method=youtube.videos.list_by_category_and_tag';
     $request .= '&category_id=' . $this->config->category;
     $request .= '&dev_id=' . YOUTUBE_DEV_KEY;
     $request .= "&tag={$query_tag}";
     $request .= "&page=1";
     $request .= "&per_page={$numberofvideos}";
     return $this->fetch_request($request);
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:18,代码来源:block_tag_youtube.php


示例3: tag_get_related_tags_csv

/** 
 * Get a comma-separated list of tags related to another tag.
 *
 * @param array $related_tags the array returned by tag_get_related_tags
 * @param int $html either TAG_RETURN_HTML (default) or TAG_RETURN_TEXT : return html links, or just text.
 * @return string comma-separated list
 */
function tag_get_related_tags_csv($related_tags, $html = TAG_RETURN_HTML)
{
    global $CFG;
    $tags_names = array();
    foreach ($related_tags as $tag) {
        if ($html == TAG_RETURN_TEXT) {
            $tags_names[] = tag_display_name($tag, TAG_RETURN_TEXT);
        } else {
            // TAG_RETURN_HTML
            $tags_names[] = '<a href="' . $CFG->wwwroot . '/tag/index.php?tag=' . rawurlencode($tag->name) . '">' . tag_display_name($tag) . '</a>';
        }
    }
    return implode(', ', $tags_names);
}
开发者ID:r007,项目名称:PMoodle,代码行数:21,代码来源:lib.php


示例4: tag_get

if ($tag_name) {
    $tag = tag_get('name', $tag_name, '*');
} else {
    if ($tag_id) {
        $tag = tag_get('id', $tag_id, '*');
    }
}
if (empty($tag)) {
    redirect($CFG->wwwroot . '/tag/search.php');
}
$PAGE->set_url('/tag/index.php', array('id' => $tag->id));
$PAGE->set_subpage($tag->id);
$PAGE->set_context($systemcontext);
$PAGE->set_blocks_editing_capability('moodle/tag:editblocks');
$PAGE->set_pagelayout('base');
$tagname = tag_display_name($tag);
// set the relatedtags field of the $tag object that will be passed to the form
$tag->relatedtags = tag_get_related_tags_csv(tag_get_related_tags($tag->id, TAG_RELATED_MANUAL), TAG_RETURN_TEXT);
$options = new stdClass();
$options->smiley = false;
$options->filter = false;
// convert and remove any XSS
$tag->description = format_text($tag->description, $tag->descriptionformat, $options);
$tag->descriptionformat = FORMAT_HTML;
$errorstring = '';
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG->maxbytes, 'trusttext' => false, 'context' => $systemcontext, 'subdirs' => file_area_contains_subdirs($systemcontext, 'tag', 'description', $tag->id));
$tag = file_prepare_standard_editor($tag, 'description', $editoroptions, $systemcontext, 'tag', 'description', $tag->id);
$tagform = new tag_edit_form(null, compact('editoroptions'));
if ($tag->tagtype == 'official') {
    $tag->tagtype = '1';
} else {
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:edit.php


示例5: get_content

 function get_content()
 {
     global $CFG, $SITE, $USER, $DB, $OUTPUT;
     if (empty($CFG->usetags) || empty($CFG->bloglevel)) {
         $this->content->text = '';
         if ($this->page->user_is_editing()) {
             $this->content->text = get_string('tagsaredisabled', 'tag');
         }
         return $this->content;
     }
     if (empty($this->config->timewithin)) {
         $this->config->timewithin = BLOGDEFAULTTIMEWITHIN;
     }
     if (empty($this->config->numberoftags)) {
         $this->config->numberoftags = BLOGDEFAULTNUMBEROFTAGS;
     }
     if (empty($this->config->sort)) {
         $this->config->sort = BLOGDEFAULTSORT;
     }
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     /// Get a list of tags
     $timewithin = time() - $this->config->timewithin * 24 * 60 * 60;
     /// convert to seconds
     $context = $this->page->context;
     // admins should be able to read all tags
     $type = '';
     if (!has_capability('moodle/user:readuserblogs', get_context_instance(CONTEXT_SYSTEM))) {
         $type = " AND (p.publishstate = 'site' or p.publishstate='public')";
     }
     $sql = "SELECT t.id, t.tagtype, t.rawname, t.name, COUNT(DISTINCT ti.id) AS ct\n                   FROM {tag} t, {tag_instance} ti, {post} p, {blog_association} ba\n                  WHERE t.id = ti.tagid AND p.id = ti.itemid\n                        {$type}\n                        AND ti.itemtype = 'post'\n                        AND ti.timemodified > {$timewithin}";
     if ($context->contextlevel == CONTEXT_MODULE) {
         $sql .= " AND ba.contextid = {$context->id} AND p.id = ba.blogid ";
     } else {
         if ($context->contextlevel == CONTEXT_COURSE) {
             $sql .= " AND ba.contextid = {$context->id} AND p.id = ba.blogid ";
         }
     }
     $sql .= "\n               GROUP BY t.id, t.tagtype, t.name, t.rawname\n               ORDER BY ct DESC, t.name ASC";
     if ($tags = $DB->get_records_sql($sql, null, 0, $this->config->numberoftags)) {
         /// There are 2 things to do:
         /// 1. tags with the same count should have the same size class
         /// 2. however many tags we have should be spread evenly over the
         ///    20 size classes
         $totaltags = count($tags);
         $currenttag = 0;
         $size = 20;
         $lasttagct = -1;
         $etags = array();
         foreach ($tags as $tag) {
             $currenttag++;
             if ($currenttag == 1) {
                 $lasttagct = $tag->ct;
                 $size = 20;
             } else {
                 if ($tag->ct != $lasttagct) {
                     $lasttagct = $tag->ct;
                     $size = 20 - (int) (($currenttag - 1) / $totaltags * 20);
                 }
             }
             $tag->class = "{$tag->tagtype} s{$size}";
             $etags[] = $tag;
         }
         /// Now we sort the tag display order
         $CFG->tagsort = $this->config->sort;
         usort($etags, "blog_tags_sort");
         /// Finally we create the output
         /// Accessibility: markup as a list.
         $this->content->text .= "\n<ul class='inline-list'>\n";
         foreach ($etags as $tag) {
             $blogurl = new moodle_url('/blog/index.php');
             switch ($CFG->bloglevel) {
                 case BLOG_USER_LEVEL:
                     $blogurl->param('userid', $USER->id);
                     break;
                 default:
                     if ($context->contextlevel == CONTEXT_MODULE) {
                         $blogurl->param('modid', $context->instanceid);
                     } else {
                         if ($context->contextlevel == CONTEXT_COURSE) {
                             $blogurl->param('courseid', $context->instanceid);
                         }
                     }
                     break;
             }
             $blogurl->param('tagid', $tag->id);
             $link = html_writer::link($blogurl, tag_display_name($tag), array('class' => $tag->class, 'title' => get_string('numberofentries', 'blog', $tag->ct)));
             $this->content->text .= '<li>' . $link . '</li> ';
         }
         $this->content->text .= "\n</ul>\n";
     }
     return $this->content;
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:97,代码来源:block_blog_tags.php


示例6: list

list($where, $params) = $table->get_sql_where();
if ($where) {
    $where = 'WHERE ' . $where;
}
$query = "\n        SELECT tg.id, tg.name, tg.rawname, tg.tagtype, tg.flag, tg.timemodified,\n               u.id AS owner, u.firstname, u.lastname,\n               COUNT(ti.id) AS count\n          FROM {tag} tg\n     LEFT JOIN {tag_instance} ti ON ti.tagid = tg.id\n     LEFT JOIN {user} u ON u.id = tg.userid\n               {$where}\n      GROUP BY tg.id, tg.name, tg.rawname, tg.tagtype, tg.flag, tg.timemodified,\n               u.id, u.firstname, u.lastname\n         {$sort}";
$totalcount = $DB->count_records_sql("\n        SELECT COUNT(DISTINCT(tg.id))\n          FROM {tag} tg\n     LEFT JOIN {user} u ON u.id = tg.userid\n        {$where}", $params);
$table->initialbars(true);
// always initial bars
$table->pagesize($perpage, $totalcount);
echo '<form class="tag-management-form" method="post" action="' . $CFG->wwwroot . '/tag/manage.php"><div>';
//retrieve tags from DB
if ($tagrecords = $DB->get_records_sql($query, $params, $table->get_page_start(), $table->get_page_size())) {
    //populate table with data
    foreach ($tagrecords as $tag) {
        $id = $tag->id;
        $name = '<a href="' . $CFG->wwwroot . '/tag/index.php?id=' . $tag->id . '">' . tag_display_name($tag) . '</a>';
        $owner = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $tag->owner . '">' . fullname($tag) . '</a>';
        $count = $tag->count;
        $flag = $tag->flag;
        $timemodified = format_time(time() - $tag->timemodified);
        $checkbox = '<input type="checkbox" name="tagschecked[]" value="' . $tag->id . '" />';
        $text = html_writer::label(get_string('newname', 'tag'), 'newname_' . $tag->id, false, array('class' => 'accesshide'));
        $text .= '<input type="text" id="newname_' . $tag->id . '" name="newname[' . $tag->id . ']" />';
        $tagtype = html_writer::label(get_string('tagtype', 'tag'), 'menutagtypes' . $tag->id, false, array('class' => 'accesshide'));
        $tagtype .= html_writer::select($existing_tagtypes, 'tagtypes[' . $tag->id . ']', $tag->tagtype, false, array('id' => 'menutagtypes' . $tag->id));
        //if the tag if flagged, highlight it
        if ($tag->flag > 0) {
            $id = '<span class="flagged-tag">' . $id . '</span>';
            $name = '<span class="flagged-tag">' . $name . '</span>';
            $owner = '<span class="flagged-tag">' . $owner . '</span>';
            $count = '<span class="flagged-tag">' . $count . '</span>';
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:31,代码来源:manage.php


示例7: define

/**
 * @package    core
 * @subpackage tag
 * @copyright  2007 Luiz Cruz <[email protected]>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
define('AJAX_SCRIPT', true);
require_once '../config.php';
require_once 'lib.php';
if (empty($CFG->usetags)) {
    // Tags are disabled.
    die;
}
require_login(0, false);
if (isguestuser()) {
    // Guests should not be using this.
    die;
}
// If a user cannot edit tags, they cannot add related tags which is what this auto complete is for.
require_capability('moodle/tag:edit', context_system::instance());
$query = optional_param('query', '', PARAM_TAG);
echo $OUTPUT->header();
// Limit the query to a minimum of 3 characters.
$similartags = array();
if (core_text::strlen($query) >= 3) {
    $similartags = tag_autocomplete($query);
}
foreach ($similartags as $tag) {
    echo clean_param($tag->name, PARAM_TAG) . "\t" . tag_display_name($tag) . "\n";
}
echo $OUTPUT->footer();
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:tag_autocomplete.php


示例8: get_all_user_name_fields

$allusernames = get_all_user_name_fields(true, 'u');
$query = "\n        SELECT tg.id, tg.name, tg.rawname, tg.tagtype, tg.flag, tg.timemodified,\n               u.id AS owner, {$allusernames},\n               COUNT(ti.id) AS count\n          FROM {tag} tg\n     LEFT JOIN {tag_instance} ti ON ti.tagid = tg.id\n     LEFT JOIN {user} u ON u.id = tg.userid\n               {$where}\n      GROUP BY tg.id, tg.name, tg.rawname, tg.tagtype, tg.flag, tg.timemodified,\n               u.id, u.firstname, u.lastname\n         {$sort}";
$totalcount = $DB->count_records_sql("\n        SELECT COUNT(DISTINCT(tg.id))\n          FROM {tag} tg\n     LEFT JOIN {user} u ON u.id = tg.userid\n        {$where}", $params);
$table->initialbars(true);
// always initial bars
$table->pagesize($perpage, $totalcount);
//@todo MDL-35474 convert to mform
echo '<form class="tag-management-form" method="post" action="' . $CFG->wwwroot . '/tag/manage.php"><div>';
//retrieve tags from DB
if ($tagrecords = $DB->get_records_sql($query, $params, $table->get_page_start(), $table->get_page_size())) {
    //populate table with data
    foreach ($tagrecords as $tag) {
        $id = $tag->id;
        $params = array('id' => $tag->id);
        $taglink = new moodle_url($CFG->wwwroot . '/tag/index.php', $params);
        $name = html_writer::link($taglink, tag_display_name($tag));
        $params = array('id' => $tag->owner);
        $ownerlink = new moodle_url($CFG->wwwroot . '/user/view.php', $params);
        $owner = html_writer::link($ownerlink, fullname($tag));
        $count = $tag->count;
        $flag = $tag->flag;
        $timemodified = format_time(time() - $tag->timemodified);
        $checkbox = html_writer::tag('input', '', array('type' => 'checkbox', 'name' => 'tagschecked[]', 'value' => $tag->id));
        $attrs = array('type' => 'text', 'id' => 'newname_' . $tag->id, 'name' => 'newname[' . $tag->id . ']');
        $text = html_writer::label(get_string('newname', 'tag'), 'newname_' . $tag->id, false, array('class' => 'accesshide'));
        $text .= html_writer::empty_tag('input', $attrs);
        $tagtype = html_writer::label(get_string('tagtype', 'tag'), 'menutagtypes' . $tag->id, false, array('class' => 'accesshide'));
        $tagtype .= html_writer::select($existing_tagtypes, 'tagtypes[' . $tag->id . ']', $tag->tagtype, false, array('id' => 'menutagtypes' . $tag->id));
        //if the tag if flagged, highlight it
        if ($tag->flag > 0) {
            $id = html_writer::tag('span', $id, array('class' => 'flagged-tag'));
开发者ID:eamador,项目名称:moodle-course-custom-fields,代码行数:31,代码来源:manage.php


示例9: require_login

<?php

// $Id: tag_autocomplete.php,v 1.3 2007/09/16 21:24:13 skodak Exp $
require_once '../config.php';
require_once 'lib.php';
require_login();
if (empty($CFG->usetags)) {
    error(get_string('tagsaredisabled', 'tag'));
}
$query = optional_param('query', '', PARAM_TAG);
if ($similar_tags = similar_tags($query)) {
    foreach ($similar_tags as $tag) {
        echo tag_display_name($tag) . "\t" . $tag->id . "\n";
    }
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:15,代码来源:tag_autocomplete.php


示例10: require_login

//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * @package    core
 * @subpackage tag
 * @copyright  2007 Luiz Cruz <[email protected]>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once '../config.php';
require_once 'lib.php';
require_login();
if (empty($CFG->usetags)) {
    print_error('tagsaredisabled', 'tag');
}
$query = optional_param('query', '', PARAM_RAW);
if ($similar_tags = tag_autocomplete($query)) {
    foreach ($similar_tags as $tag) {
        echo $tag->name . "\t" . tag_display_name($tag) . "\n";
    }
}
开发者ID:vuchannguyen,项目名称:web,代码行数:31,代码来源:tag_autocomplete.php


示例11: get_content

 function get_content()
 {
     global $CFG, $USER, $PAGE;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $tagid = optional_param('id', 0, PARAM_INT);
     // tag id
     //include related tags in the photo query ?
     $tags_csv = tag_display_name(tag_by_id($tagid));
     if (!empty($this->config->includerelatedtags)) {
         $tags_csv .= ',' . tag_names_csv(get_item_tags('tag', $tagid));
     }
     $tags_csv = urlencode($tags_csv);
     //number of photos to display
     $numberofphotos = DEFAULT_NUMBER_OF_PHOTOS;
     if (!empty($this->config->numberofphotos)) {
         $numberofphotos = $this->config->numberofphotos;
     }
     //sort search results by
     $sortby = 'relevance';
     if (!empty($this->config->sortby)) {
         $sortby = $this->config->sortby;
     }
     //pull photos from a specific photoset
     if (!empty($this->config->photoset)) {
         $request = 'http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos';
         $request .= '&api_key=' . FLICKR_DEV_KEY;
         $request .= '&photoset_id=' . $this->config->photoset;
         $request .= '&per_page=' . $numberofphotos;
         $request .= '&format=php_serial';
         $response = $this->fetch_request($request);
         $search = unserialize($response);
         foreach ($search['photoset']['photo'] as $p) {
             $p['owner'] = $search['photoset']['owner'];
         }
         $photos = array_values($search['photoset']['photo']);
     } else {
         $request = 'http://api.flickr.com/services/rest/?method=flickr.photos.search';
         $request .= '&api_key=' . FLICKR_DEV_KEY;
         $request .= '&tags=' . $tags_csv;
         $request .= '&per_page=' . $numberofphotos;
         $request .= '&sort=' . $sortby;
         $request .= '&format=php_serial';
         $response = $this->fetch_request($request);
         $search = unserialize($response);
         $photos = array_values($search['photos']['photo']);
     }
     if (strcmp($search['stat'], 'ok') != 0) {
         return;
     }
     //if no results were returned, exit...
     //render the list of photos
     $text = '';
     foreach ($photos as $photo) {
         $text .= '<a href="http://www.flickr.com/photos/' . $photo['owner'] . '/' . $photo['id'] . '/">';
         $text .= '<img title="' . s($photo['title']) . '" alt="' . s($photo['title']) . '" class="flickr-photos" src="' . $this->build_photo_url($photo, 'square') . '" /></a>';
     }
     $this->content = new stdClass();
     $this->content->text = $text;
     $this->content->footer = '';
     return $this->content;
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:63,代码来源:block_tag_flickr.php


示例12: tag_get

// tag id
if ($tagid) {
    $tag = tag_get('id', $tagid, '*');
} else {
    redirect($CFG->wwwroot . '/tag/search.php');
}
/// Print the page header
if ($course->category) {
    $navigation = "<a href=\"../../course/view.php?id={$course->id}\">{$course->shortname}</a> ->";
} else {
    $navigation = '';
}
$navlinks = array();
$navlinks[] = array('name' => get_string('tags'), 'link' => $CFG->wwwroot . '/tag/search.php', 'type' => 'misc');
$navlinks[] = array('name' => format_string(tag_display_name($tag)), 'link' => $CFG->wwwroot . '/mod/wiki/tags/view.php?;amp;cid=' . $cid . '&amp;tagid=' . $tagid, 'type' => 'misc');
$navigation = build_navigation($navlinks);
$title = get_string('tag', 'tag') . ' - ' . tag_display_name($tag);
print_header($title, $course->fullname, $navigation);
$modcontext = get_context_instance(CONTEXT_MODULE, $cmid);
if (has_capability('moodle/tag:manage', $modcontext)) {
    //echo '<div class="managelink"><a href="'.$CFG->wwwroot.
    echo '<div style="text-align:right; padding:10px;"><a href="' . $CFG->wwwroot . '/tag/manage.php">' . get_string('managetags', 'tag') . '</a></div>';
}
/// Print the page content
echo '<br/>';
print_heading(tag_display_name($tag), '', 2, 'headingblock header tag-heading');
tag_print_management_box($tag);
tag_print_description_box($tag);
wiki_tags_print_wikipages($tag);
//// Print the page footer
print_footer($course);
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:view.php


示例13: get_content

 function get_content()
 {
     global $CFG, $SITE, $USER, $DB;
     if (empty($CFG->usetags) || empty($CFG->bloglevel)) {
         $this->content->text = '';
         return $this->content;
     }
     if (empty($this->config->timewithin)) {
         $this->config->timewithin = BLOGDEFAULTTIMEWITHIN;
     }
     if (empty($this->config->numberoftags)) {
         $this->config->numberoftags = BLOGDEFAULTNUMBEROFTAGS;
     }
     if (empty($this->config->sort)) {
         $this->config->sort = BLOGDEFAULTSORT;
     }
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     /// Get a list of tags
     $timewithin = time() - $this->config->timewithin * 24 * 60 * 60;
     /// convert to seconds
     // admins should be able to read all tags
     $type = '';
     if (!has_capability('moodle/user:readuserblogs', get_context_instance(CONTEXT_SYSTEM))) {
         $type = " AND (p.publishstate = 'site' or p.publishstate='public')";
     }
     $sql = "SELECT t.id, t.tagtype, t.rawname, t.name, COUNT(DISTINCT ti.id) AS ct\n                   FROM {tag} t, {tag_instance} ti, {post} p\n                  WHERE t.id = ti.tagid AND p.id = ti.itemid\n                        {$type}\n                        AND ti.itemtype = 'post'\n                        AND ti.timemodified > {$timewithin}\n               GROUP BY t.id, t.tagtype, t.name, t.rawname\n               ORDER BY ct DESC, t.name ASC";
     if ($tags = $DB->get_records_sql($sql, null, 0, $this->config->numberoftags)) {
         /// There are 2 things to do:
         /// 1. tags with the same count should have the same size class
         /// 2. however many tags we have should be spread evenly over the
         ///    20 size classes
         $totaltags = count($tags);
         $currenttag = 0;
         $size = 20;
         $lasttagct = -1;
         $etags = array();
         foreach ($tags as $tag) {
             $currenttag++;
             if ($currenttag == 1) {
                 $lasttagct = $tag->ct;
                 $size = 20;
             } else {
                 if ($tag->ct != $lasttagct) {
                     $lasttagct = $tag->ct;
                     $size = 20 - (int) (($currenttag - 1) / $totaltags * 20);
                 }
             }
             $tag->class = "{$tag->tagtype} s{$size}";
             $etags[] = $tag;
         }
         /// Now we sort the tag display order
         $CFG->tagsort = $this->config->sort;
         usort($etags, "blog_tags_sort");
         /// Finally we create the output
         /// Accessibility: markup as a list.
         $this->content->text .= "\n<ul class='inline-list'>\n";
         foreach ($etags as $tag) {
             switch ($CFG->bloglevel) {
                 case BLOG_USER_LEVEL:
                     $filtertype = 'user';
                     $filterselect = $USER->id;
                     break;
                 default:
                     if ($this->page->course->id != SITEID) {
                         $filtertype = 'course';
                         $filterselect = $this->page->course->id;
                     } else {
                         $filtertype = 'site';
                         $filterselect = SITEID;
                     }
                     break;
             }
             $link = blog_get_blogs_url(array($filtertype => $filterselect, 'tag' => $tag->id));
             $this->content->text .= '<li><a href="' . $link . '" ' . 'class="' . $tag->class . '" ' . 'title="' . get_string('numberofentries', 'blog', $tag->ct) . '">' . tag_display_name($tag) . '</a></li> ';
         }
         $this->content->text .= "\n</ul>\n";
     }
     return $this->content;
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:84,代码来源:block_blog_tags.php


示例14: get_set_tags

 /**
  * Call to get forum wide 'set' tags.
  *
  * @param int $forumid used to get context id
  * @param int $groupid used to specify group that we require set tags for
  * @param boolean $grouponly used to specify whether we are returning set tags for a single specified group
  * @return array set tags for that forum
  */
 public static function get_set_tags($forumid, $groupid = self::ALL_GROUPS, $grouponly = false)
 {
     global $DB, $CFG;
     require_once $CFG->dirroot . '/tag/lib.php';
     $forum = self::get_from_id($forumid, self::CLONE_DIRECT);
     $forumid = $forum->get_id();
     $context = $forum->get_context(true);
     if ($groupid == self::ALL_GROUPS || $groupid == self::NO_GROUPS) {
         $groupid = 0;
     }
     $conditionparams = array();
     $conditions = '';
     if ($grouponly && $groupid) {
         $conditions .= " (ti.component = ? AND ti.itemtype = ? AND ti.contextid = ? AND ti.itemid = ?)";
         $conditionparams[] = 'mod_forumng';
         $conditionparams[] = 'groups';
         $conditionparams[] = $context->id;
         $conditionparams[] = $groupid;
     } else {
         // Check to see whether tags have been set at forumng level.
         $conditions = "(ti.component = ? AND ti.itemtype = ? AND ti.contextid = ? AND ti.itemid = ?)";
         $conditionparams[] = 'mod_forumng';
         $conditionparams[] = 'forumng';
         $conditionparams[] = $context->id;
         $conditionparams[] = $forumid;
         if ($groupid) {
             $conditions .= " OR (ti.component = ? AND ti.itemtype = ? AND ti.contextid = ? AND ti.itemid = ?)";
             $conditionparams[] = 'mod_forumng';
             $conditionparams[] = 'groups';
             $conditionparams[] = $context->id;
             $conditionparams[] = $groupid;
         }
     }
     $rs = $DB->get_records_sql("\n            SELECT DISTINCT t.*\n              FROM {tag} t\n        INNER JOIN {tag_instance} ti\n                ON t.id = ti.tagid\n             WHERE {$conditions}\n          ORDER BY t.name", $conditionparams);
     // Create tags associative array with tagid as key and tag name as value.
     $tags = array();
     foreach ($rs as $tag) {
         $tags[$tag->id] = strtolower(tag_display_name($tag, TAG_RETURN_TEXT));
     }
     return $tags;
 }
开发者ID:ULCC-QMUL,项目名称:moodle-mod_forumng,代码行数:49,代码来源:mod_forumng.php


示例15: tag_print_search_results

/**
 * Prints the tag search results
 *
 * @param string $query text that tag names will be matched against
 * @param int $page current page
 * @param int $perpage nr of users displayed per page
 * @param $return if true return html string
 */
function tag_print_search_results($query, $page, $perpage, $return = false)
{
    global $CFG, $USER;
    $query = array_shift(tag_normalize($query, TAG_CASE_ORIGINAL));
    $count = sizeof(tag_find_tags($query, false));
    $tags = array();
    if ($found_tags = tag_find_tags($query, true, $page * $perpage, $perpage)) {
        $tags = array_values($found_tags);
    }
    $baseurl = $CFG->wwwroot . '/tag/search.php?query=' . rawurlencode($query);
    $output = '';
    // link "Add $query to my interests"
    $addtaglink = '';
    if (!tag_record_tagged_with('user', $USER->id, $query)) {
        $addtaglink = '<a href="' . $CFG->wwwroot . '/tag/user.php?action=addinterest&amp;sesskey=' . sesskey() . '&amp;tag=' . rawurlencode($query) . '">';
        $addtaglink .= get_string('addtagtomyinterests', 'tag', htmlspecialchars($query)) . '</a>';
    }
    if (!empty($tags)) {
        // there are results to display!!
        $output .= print_heading(get_string('searchresultsfor', 'tag', htmlspecialchars($query)) . " : {$count}", '', 3, 'main', true);
        //print a link "Add $query to my interests"
        if (!empty($addtaglink)) {
            $output .= print_box($addtaglink, 'box', 'tag-management-box', true);
        }
        $nr_of_lis_per_ul = 6;
        $nr_of_uls = ceil(sizeof($tags) / $nr_of_lis_per_ul);
        $output .= '<ul id="tag-search-results">';
        for ($i = 0; $i < $nr_of_uls; $i++) {
            $output .= '<li>';
            foreach (array_slice($tags, $i * $nr_of_lis_per_ul, $nr_of_lis_per_ul) as $tag) {
                $tag_link = ' <a href="' . $CFG->wwwroot . '/tag/index.php?id=' . $tag->id . '">' . tag_display_name($tag) . '</a>';
                $output .= '&#8226;' . $tag_link . '<br/>';
            }
            $output .= '</li>';
        }
        $output .= '</ul>';
        $output .= '<div>&nbsp;</div>';
        // <-- small layout hack in order to look good in Firefox
        $output .= print_paging_bar($count, $page, $perpage, $baseurl . '&amp;', 'page', false, true);
    } else {
        //no results were found!!
        $output .= print_heading(get_string('noresultsfor', 'tag', htmlspecialchars($query)), '', 3, 'main', true);
        //print a link "Add $query to my interests"
        if (!empty($addtaglink)) {
            $output .= print_box($addtaglink, 'box', 'tag-management-box', true);
        }
    }
    if ($return) {
        return $output;
    } else {
        echo $output;
    }
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:61,代码来源:locallib.php


示例16: bookmarks_print_tag_cloud

/**
 *
 *
 */
function bookmarks_print_tag_cloud($tagcloud, $cmid, $options = 'view', $shuffle = true, $max_size = 180, $min_size = 80, $return = false)
{
    global $CFG;
    if (empty($tagcloud)) {
        return;
    }
    if ($shuffle) {
        shuffle($tagcloud);
    } else {
        ksort($tagcloud);
    }
    $count = array();
    foreach ($tagcloud as $key => $value) {
        if (!empty($value->count)) {
            $count[$key] = log10($value->count);
        } else {
            $count[$key] = 0;
        }
    }
    $max = max($count);
    $min = min($count);
    $spread = $max - $min;
    if (0 == $spread) {
        // we don't want to divide by zero
        $spread = 1;
    }
    $step = ($max_size - $min_size) / $spread;
    $systemcontext = get_context_instance(CONTEXT_SYSTEM);
    $can_manage_tags = has_capability('moodle/tag:manage', $systemcontext);
    //prints the tag cloud
    $output = '<ul id="tag-cloud-list">';
    foreach ($tagcloud as $key => $tag) {
        $size = $min_size + (log10($tag->count) - $min) * $step;
        $size = ceil($size);
        $style = 'style="font-size: ' . $size . '%"';
        $title = 'title="' . s(get_string('thingstaggedwith', 'tag', $tag)) . '"';
        //highlight tags that have been flagged as inappropriate for those who can manage them
        $tagname = tag_display_name($tag);
        $href = 'href="' . $CFG->wwwroot . '/mod/bookmarks/view.php?id=' . $cmid . '&action=search&query=tag' . urlencode(':' . $tagname) . '"';
        $onclick = '';
        if ($options == 'edit') {
            $onclick = 'class="clickable-label" onclick="selectTag(this); return false;"';
            $href = 'href="#"';
        }
        if ($tag->flag > 0 && $can_manage_tags) {
            $tagname = '<span class="flagged-tag">' . tag_display_name($tag) . '</span>';
        }
        $tag_link = '<li><a ' . $onclick . ' ' . $href . ' ' . $title . ' ' . $style . '>' . $tagname . '</a></li> ';
        $output .= $tag_link;
    }
    $output .= '</ul>';
    if ($return) {
        return $output;
    } else {
        echo $output;
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:61,代码来源:locallib.php


示例17: coursetag_print_cloud

/**
 * Prints a tag cloud
 *
 * @param array $tagcloud array of tag objects (fields: id, name, rawname, count and flag)
 * @param int $max_size maximum text size, in percentage
 * @param int $min_size minimum text size, in percentage
 * @param $return if true return html string
 */
function coursetag_print_cloud($tagcloud, $return=false, $max_size=180, $min_size=80) {

    global $CFG;

    if (empty($tagcloud)) {
        return;
    }

    ksort($tagcloud);

    $count = array();
    foreach ($tagcloud as $key => $value) {
        if(!empty($value->count)) {
            $count[$key] = log10($value->count);
        } else {
            $count[$key] = 0;
        }
    }

    $max = max($count);
    $min = min($count);

    $spread = $max - $min;
    if (0 == $spread) { // we don't want to divide by zero
        $spread = 1;
    }

    $step = ($max_size - $min_size)/($spread);

    $systemcontext   = get_context_instance(CONTEXT_SYSTEM);
    $can_manage_tags = has_capability('moodle/tag:manage', $systemcontext);

    //prints the tag cloud
    $output = '<ul class="tag-cloud inline-list">';
    foreach ($tagcloud as $key => $tag) {

        $size = $min_size + ((log10($tag->count) - $min) * $step);
        $size = ceil($size);

        $style = 'style="font-size: '.$size.'%"';

        if ($tag->count > 1) {
            $title = 'title="'.s(get_string('thingstaggedwith','tag', $tag)).'"';
        } else {
            $title = 'title="'.s(get_string('thingtaggedwith','tag', $tag)).'"';
        }

        $href = 'href="'.$CFG->wwwroot.'/tag/index.php?id='.$tag->id.'"';

        //highlight tags that have been flagged as inappropriate for those who can manage them
        $tagname = tag_display_name($tag);
        if ($tag->flag > 0 && $can_manage_tags) {
            $tagname =  '<span class="flagged-tag">' . tag_display_name($tag) . '</span>';
        }

        $tag_link = '<li><a '.$href.' '.$title.' '. $style .'>'.$tagname.'</a></li> ';

        $output .= $tag_link;

    }
    $output .= '</ul>'."\n";

    if ($return) {
        return $output;
    } else {
        echo $output;
    }
}
开发者ID:rolandovanegas,项目名称:moodle,代码行数:76,代码来源:coursetagslib.php


示例18: blog_print_entry

/**
 * This function is in lib and not in BlogInfo because entries being searched
 * might be found in any number of blogs rather than just one.
 *
 * This function builds an array which can be used by the included
 * template file, making predefined and nicely formatted variables available
 * to the template. Template creators will not need to become intimate
 * with the internal objects and vars of moodle blog nor will they need to worry
 * about properly formatting their data
 *
 *   @param BlogEntry blogEntry - a hopefully fully populated BlogEntry object
 *   @param string viewtype Default is 'full'. If 'full' then display this blog entry
 *     in its complete form (eg. archive page). If anything other than 'full'
 *     display the entry in its abbreviated format (eg. index page)
 */
function blog_print_entry($blogEntry, $viewtype = 'full', $filtertype = '', $filterselect = '', $mode = 'loud')
{
    global $USER, $CFG, $COURSE, $ME;
    $template['body'] = format_text($blogEntry->summary, $blogEntry->format);
    //$template['title'] = '<a name="'. $blogEntry->subject .'"></a>';
    //enclose the title in nolink tags so that moodle formatting doesn't autolink the text
    $template['title'] = '<span class="nolink">' . $blogEntry->subject . '</span>';
    $template['userid'] = $blogEntry->userid;
    $template['author'] = fullname(get_record('user', 'id', $blogEntry->userid));
    $template['lastmod'] = userdate($blogEntry->lastmodified);
    $template['created'] = userdate($blogEntry->created);
    $template['publishstate'] = $blogEntry->publishstate;
    /// preventing user to browse blogs that they aren't supposed to see
    /// This might not be too good since there are multiple calls per page
    /*
            if (!blog_user_can_view_user_post($template['userid'])) {
                error ('you can not view this post');
            }*/
    $stredit = get_string('edit');
    $strdelete = get_string('delete');
    $user = get_record('user', 'id', $template['userid']);
    /// Start printing of the blog
    echo '<table cellspacing="0" class="forumpost blogpost blog' . $template['publishstate'] . '" width="100%">';
    echo '<tr class="header"><td class="picture left">';
    print_user_picture($template['userid'], SITEID, $user->picture);
    echo '</td>';
    echo '<td class="topic starter"><div class="subject">' . $template['title'] . '</div><div class="author">';
    $fullname = fullname($user, $template['userid']);
    $by = new object();
    $by->name = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&amp;course=' . $COURSE->id . '">' . $fullname . '</a>';
    $by->date = $template['lastmod'];
    print_string('bynameondate', 'forum', $by);
    echo '</div></td></tr>';
    echo '<tr><td class="left side">';
    /// Actual content
    echo '</td><td class="content">' . "\n";
    if ($blogEntry->attachment) {
        echo '<div class="attachments">';
        $attachedimages = blog_print_attachments($blogEntry);
        echo '</div>';
    } else {
        $attachedimages = '';
    }
    switch ($template['publishstate']) {
        case 'draft':
            $blogtype = get_string('publishtonoone', 'blog');
            break;
        case 'site':
            $blogtype = get_string('publishtosite', 'blog');
            break;
        case 'public':
            $blogtype = get_string('publishtoworld', 'blog');
            break;
        default:
            $blogtype = '';
            break;
    }
    echo '<div class="audience">' . $blogtype . '</div>';
    // Print whole message
    echo format_text($template['body']);
    /// Print attachments
    echo $attachedimages;
    /// Links to tags
    /*
    if ($blogtags = get_records_sql('SELECT t.* FROM '.$CFG->prefix.'tags t, '.$CFG->prefix.'blog_tag_instance ti
                                 WHERE t.id = ti.tagid
                                 AND ti.entryid = '.$blogEntry->id)) {
    */
    if (!empty($CFG->usetags) && ($blogtags = get_item_tags('blog', $blogEntry-> 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP tag_end函数代码示例发布时间:2022-05-23
下一篇:
PHP tag_description函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap