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

PHP tag_get函数代码示例

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

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



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

示例1: test_tag_set_get

 /**
  * Test the tag_set function.
  * This function was deprecated in 3.1
  */
 public function test_tag_set_get()
 {
     global $DB;
     // Create a course to tag.
     $course = $this->getDataGenerator()->create_course();
     // Create the tag and tag instance.
     tag_set('course', $course->id, array('A random tag'), 'core', context_course::instance($course->id)->id);
     $this->assertDebuggingCalled();
     // Get the tag instance that should have been created.
     $taginstance = $DB->get_record('tag_instance', array('itemtype' => 'course', 'itemid' => $course->id), '*', MUST_EXIST);
     $this->assertEquals('core', $taginstance->component);
     $this->assertEquals(context_course::instance($course->id)->id, $taginstance->contextid);
     $tagbyname = tag_get('name', 'A random tag');
     $this->assertDebuggingCalled();
     $this->assertEquals('A random tag', $tagbyname->rawname);
     $this->assertEmpty(tag_get('name', 'Non existing tag'));
     $this->assertDebuggingCalled();
     $tagbyid = tag_get('id', $tagbyname->id);
     $this->assertDebuggingCalled();
     $this->assertEquals('A random tag', $tagbyid->rawname);
     $tagid = $tagbyname->id;
     $this->assertEmpty(tag_get('id', $tagid + 1));
     $this->assertDebuggingCalled();
     tag_set('tag', $tagid, array('Some related tag'));
     $this->assertDebuggingCalled();
     $relatedtags = tag_get_related_tags($tagid);
     $this->assertDebuggingCalled();
     $this->assertCount(1, $relatedtags);
     $this->assertEquals('Some related tag', $relatedtags[0]->rawname);
     $tagids = tag_get_id(array('A random tag', 'Some related tag'));
     $this->assertDebuggingCalled();
     $this->assertCount(2, $tagids);
     $this->assertEquals($tagid, $tagids['a random tag']);
     $this->assertEquals($relatedtags[0]->id, $tagids['some related tag']);
 }
开发者ID:bewanyk,项目名称:moodle,代码行数:39,代码来源:taglib_test.php


示例2: action_attach_tags_validate

/**
 * Validates the Attach Tags group action.
 * Gets called for every bug, but performs the real tag validation only
 * the first time.  Any invalid tags will be skipped, as there is no simple
 * or clean method of presenting these errors to the user.
 * @param integer Bug ID
 * @return boolean True
 */
function action_attach_tags_validate($p_bug_id)
{
    global $g_action_attach_tags_valid;
    if (!isset($g_action_attach_tags_valid)) {
        $f_tag_string = gpc_get_string('tag_string');
        $f_tag_select = gpc_get_string('tag_select');
        global $g_action_attach_tags_attach, $g_action_attach_tags_create, $g_action_attach_tags_failed;
        $g_action_attach_tags_attach = array();
        $g_action_attach_tags_create = array();
        $g_action_attach_tags_failed = array();
        $t_tags = tag_parse_string($f_tag_string);
        $t_can_create = access_has_global_level(config_get('tag_create_threshold'));
        foreach ($t_tags as $t_tag_row) {
            if (-1 == $t_tag_row['id']) {
                if ($t_can_create) {
                    $g_action_attach_tags_create[] = $t_tag_row;
                } else {
                    $g_action_attach_tags_failed[] = $t_tag_row;
                }
            } elseif (-2 == $t_tag_row['id']) {
                $g_action_attach_tags_failed[] = $t_tag_row;
            } else {
                $g_action_attach_tags_attach[] = $t_tag_row;
            }
        }
        if (0 < $f_tag_select && tag_exists($f_tag_select)) {
            $g_action_attach_tags_attach[] = tag_get($f_tag_select);
        }
    }
    global $g_action_attach_tags_attach, $g_action_attach_tags_create, $g_action_attach_tags_failed;
    return true;
}
开发者ID:jin255ff,项目名称:company_website,代码行数:40,代码来源:bug_actiongroup_attach_tags_inc.php


示例3: get_videos_by_tag_and_category

 function get_videos_by_tag_and_category()
 {
     $tagid = optional_param('id', 0, PARAM_INT);
     // tag id - for backware compatibility
     $tag = optional_param('tag', '', PARAM_TAG);
     // tag
     if ($tag) {
         $tagobject = tag_get('name', $tag);
     } else {
         if ($tagid) {
             $tagobject = tag_get('id', $tagid);
         }
     }
     if (empty($tagobject)) {
         print_error('tagnotfound');
     }
     $querytag = urlencode($tagobject->name);
     if (isset($this->config->overridetag)) {
         $querytag = $this->config->overridetag;
     }
     $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={$querytag}";
     $request .= "&page=1";
     $request .= "&per_page={$numberofvideos}";
     return $this->fetch_request($request);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:32,代码来源:block_tag_youtube.php


示例4: tag_stats_related

/**
 * Get a list of related tags.
 * Returns a list of tags that are the most related to the given tag,
 * based on the number of times they have been attached to the same bugs.
 * Defaults to a list of five tags.
 * @param integer Tag ID
 * @param integer List size
 * @return array Array of tag rows, with share count added
 */
function tag_stats_related($p_tag_id, $p_limit = 5)
{
    $t_bug_table = db_get_table('bug');
    $t_tag_table = db_get_table('tag');
    $t_bug_tag_table = db_get_table('bug_tag');
    $t_project_user_list_table = db_get_table('project_user_list');
    $t_user_table = db_get_table('user');
    $c_tag_id = db_prepare_int($p_tag_id);
    $c_user_id = auth_get_current_user_id();
    $subquery = "SELECT b.id FROM {$t_bug_table} AS b\n\t\t\t\t\tLEFT JOIN {$t_project_user_list_table} AS p\n\t\t\t\t\t\tON p.project_id=b.project_id AND p.user_id=" . db_param() . "\n\t\t\t\t\tJOIN {$t_user_table} AS u\n\t\t\t\t\t\tON u.id=" . db_param() . "\n\t\t\t\t\tJOIN {$t_bug_tag_table} AS t\n\t\t\t\t\t\tON t.bug_id=b.id\n\t\t\t\t\tWHERE ( p.access_level>b.view_state OR u.access_level>b.view_state )\n\t\t\t\t\t\tAND t.tag_id=" . db_param();
    $query = "SELECT * FROM {$t_bug_tag_table}\n\t\t\t\t\tWHERE tag_id != " . db_param() . "\n\t\t\t\t\t\tAND bug_id IN ( {$subquery} ) ";
    $result = db_query_bound($query, array($c_tag_id, $c_user_id, $c_user_id, $c_tag_id));
    $t_tag_counts = array();
    while ($row = db_fetch_array($result)) {
        if (!isset($t_tag_counts[$row['tag_id']])) {
            $t_tag_counts[$row['tag_id']] = 1;
        } else {
            $t_tag_counts[$row['tag_id']]++;
        }
    }
    arsort($t_tag_counts);
    $t_tags = array();
    $i = 1;
    foreach ($t_tag_counts as $t_tag_id => $t_count) {
        $t_tag_row = tag_get($t_tag_id);
        $t_tag_row['count'] = $t_count;
        $t_tags[] = $t_tag_row;
        $i++;
        if ($i > $p_limit) {
            break;
        }
    }
    return $t_tags;
}
开发者ID:Kirill,项目名称:mantisbt,代码行数:43,代码来源:tag_api.php


示例5: add_tags_info

/**
 * function to attach tags into a post
 * @param int postid - id of the blog
 */
function add_tags_info($postid)
{
    $tags = array();
    if ($otags = optional_param('otags', '', PARAM_INT)) {
        foreach ($otags as $tagid) {
            // TODO : make this use the tag name in the form
            if ($tag = tag_get('id', $tagid)) {
                $tags[] = $tag->name;
            }
        }
    }
    $manual_tags = optional_param('ptags', '', PARAM_NOTAGS);
    $tags = array_merge($tags, explode(',', $manual_tags));
    tag_set('post', $postid, $tags);
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:19,代码来源:edit.php


示例6: test_cleanup

 /**
  * Test for function tag_cleanup() that is part of tag cron
  */
 public function test_cleanup()
 {
     global $DB;
     $user = $this->getDataGenerator()->create_user();
     // Setting tags will create non-official tags 'cat', 'dog' and 'fish'.
     tag_set('user', $user->id, array('cat', 'dog', 'fish'), 'core', context_user::instance($user->id)->id);
     $this->assertTrue($DB->record_exists('tag', array('name' => 'cat')));
     $this->assertTrue($DB->record_exists('tag', array('name' => 'dog')));
     $this->assertTrue($DB->record_exists('tag', array('name' => 'fish')));
     // Make tag 'dog' official.
     $dogtag = tag_get('name', 'dog');
     $fishtag = tag_get('name', 'fish');
     tag_type_set($dogtag->id, 'official');
     // Manually remove the instances pointing on tags 'dog' and 'fish'.
     $DB->execute('DELETE FROM {tag_instance} WHERE tagid in (?,?)', array($dogtag->id, $fishtag->id));
     // Call tag_cleanup().
     tag_cleanup();
     // Tag 'cat' is still present because it's used. Tag 'dog' is present because it's official.
     // Tag 'fish' was removed because it is not official and it is no longer used by anybody.
     $this->assertTrue($DB->record_exists('tag', array('name' => 'cat')));
     $this->assertTrue($DB->record_exists('tag', array('name' => 'dog')));
     $this->assertFalse($DB->record_exists('tag', array('name' => 'fish')));
     // Delete user without using API function.
     $DB->update_record('user', array('id' => $user->id, 'deleted' => 1));
     // Call tag_cleanup().
     tag_cleanup();
     // Tag 'cat' was now deleted too.
     $this->assertFalse($DB->record_exists('tag', array('name' => 'cat')));
     // Assign tag to non-existing record. Make sure tag was created in the DB.
     tag_set('course', 1231231, array('bird'), 'core', context_system::instance()->id);
     $this->assertTrue($DB->record_exists('tag', array('name' => 'bird')));
     // Call tag_cleanup().
     tag_cleanup();
     // Tag 'bird' was now deleted because the related record does not exist in the DB.
     $this->assertFalse($DB->record_exists('tag', array('name' => 'bird')));
     // Now we have a tag instance pointing on 'sometag' tag.
     $user = $this->getDataGenerator()->create_user();
     tag_set('user', $user->id, array('sometag'), 'core', context_user::instance($user->id)->id);
     $sometag = tag_get('name', 'sometag');
     $this->assertTrue($DB->record_exists('tag_instance', array('tagid' => $sometag->id)));
     // Some hacker removes the tag without using API.
     $DB->delete_records('tag', array('id' => $sometag->id));
     // Call tag_cleanup().
     tag_cleanup();
     // The tag instances were also removed.
     $this->assertFalse($DB->record_exists('tag_instance', array('tagid' => $sometag->id)));
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:50,代码来源:taglib_test.php


示例7: get_content

 function get_content()
 {
     global $CFG, $USER;
     //note: do NOT include files at the top of this file
     require_once $CFG->dirroot . '/tag/lib.php';
     require_once $CFG->libdir . '/filelib.php';
     if ($this->content !== NULL) {
         return $this->content;
     }
     $tagid = optional_param('id', 0, PARAM_INT);
     // tag id - for backware compatibility
     $tag = optional_param('tag', '', PARAM_TAG);
     // tag
     if ($tag) {
         $tagobject = tag_get('name', $tag);
     } else {
         if ($tagid) {
             $tagobject = tag_get('id', $tagid);
         }
     }
     if (empty($tagobject)) {
         $this->content = new stdClass();
         $this->content->text = '';
         $this->content->footer = '';
         return $this->content;
     }
     //include related tags in the photo query ?
     $tagscsv = $tagobject->name;
     if (!empty($this->config->includerelatedtags)) {
         $tagscsv .= ',' . tag_get_related_tags_csv(tag_get_related_tags($tagobject->id), TAG_RETURN_TEXT);
     }
     $tagscsv = urlencode($tagscsv);
     //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=' . $tagscsv;
         $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...
     //Accessibility: render the list of photos
     $text = '<ul class="inline-list">';
     foreach ($photos as $photo) {
         $text .= '<li><a href="http://www.flickr.com/photos/' . $photo['owner'] . '/' . $photo['id'] . '/" title="' . s($photo['title']) . '">';
         $text .= '<img alt="' . s($photo['title']) . '" class="flickr-photos" src="' . $this->build_photo_url($photo, 'square') . "\" /></a></li>\n";
     }
     $text .= "</ul>\n";
     $this->content = new stdClass();
     $this->content->text = $text;
     $this->content->footer = '';
     return $this->content;
 }
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:82,代码来源:block_tag_flickr.php


示例8: tag_rename

/**
 * Change the "value" of a tag, and update the associated 'name'.
 *
 * @param int $tagid the id of the tag to modify
 * @param string $newtag the new rawname
 * @return bool true on success, false otherwise
 */
function tag_rename($tagid, $newrawname)
{
    if (!($newrawname_clean = array_shift(tag_normalize($newrawname, TAG_CASE_ORIGINAL)))) {
        return false;
    }
    if (!($newname_clean = moodle_strtolower($newrawname_clean))) {
        return false;
    }
    // Prevent the rename if a tag with that name already exists
    if ($existing = tag_get('name', $newname_clean, 'id, name, rawname')) {
        if ($existing->id != $tagid) {
            // Another tag already exists with this name
            return false;
        }
    }
    if ($tag = tag_get('id', $tagid, 'id, name, rawname')) {
        $tag->rawname = addslashes($newrawname_clean);
        $tag->name = addslashes($newname_clean);
        $tag->timemodified = time();
        return update_record('tag', $tag);
    }
    return false;
}
开发者ID:r007,项目名称:PMoodle,代码行数:30,代码来源:lib.php


示例9: compress_enable

 */
/**
 * MantisBT Core API's
 */
require_once 'core.php';
/**
 * requires ajax_api
 */
require_once 'ajax_api.php';
/**
 * requires tag_api
 */
require_once 'tag_api.php';
compress_enable();
$f_tag_id = gpc_get_int('tag_id');
$t_tag_row = tag_get($f_tag_id);
$t_name = string_display_line($t_tag_row['name']);
$t_description = string_display($t_tag_row['description']);
if (!(access_has_global_level(config_get('tag_edit_threshold')) || auth_get_current_user_id() == $t_tag_row['user_id'] && access_has_global_level(config_get('tag_edit_own_threshold')))) {
    access_denied();
}
html_page_top(sprintf(lang_get('tag_update'), $t_name));
?>

<br />
<form method="post" action="tag_update.php">
<?php 
echo form_security_field('tag_update');
?>
<table class="width100" cellspacing="1">
开发者ID:nourchene-benslimane,项目名称:mantisV0,代码行数:30,代码来源:tag_update_page.php


示例10: tag_rename

/**
 * Change the "value" of a tag, and update the associated 'name'.
 *
 * @package  core_tag
 * @category tag
 * @access   public
 * @param    int      $tagid  the id of the tag to modify
 * @param    string   $newrawname the new rawname
 * @return   bool     true on success, false otherwise
 */
function tag_rename($tagid, $newrawname) {
    global $DB;

    $norm = tag_normalize($newrawname, TAG_CASE_ORIGINAL);
    if (! $newrawname_clean = array_shift($norm) ) {
        return false;
    }

    if (! $newname_clean = textlib::strtolower($newrawname_clean)) {
        return false;
    }

    // Prevent the rename if a tag with that name already exists
    if ($existing = tag_get('name', $newname_clean, 'id, name, rawname')) {
        if ($existing->id != $tagid) {  // Another tag already exists with this name
            return false;
        }
    }

    if ($tag = tag_get('id', $tagid, 'id, name, rawname')) {
        $tag->rawname      = $newrawname_clean;
        $tag->name         = $newname_clean;
        $tag->timemodified = time();
        return $DB->update_record('tag', $tag);
    }
    return false;
}
开发者ID:verbazend,项目名称:AWFA,代码行数:37,代码来源:lib.php


示例11: tag_stats_related

/**
 * Get a list of related tags.
 * Returns a list of tags that are the most related to the given tag,
 * based on the number of times they have been attached to the same bugs.
 * Defaults to a list of five tags.
 * @param integer $p_tag_id The tag ID to retrieve statistics on.
 * @param integer $p_limit  List size.
 * @return array Array of tag rows, with share count added
 */
function tag_stats_related($p_tag_id, $p_limit = 5)
{
    $c_user_id = auth_get_current_user_id();
    $t_subquery = 'SELECT b.id FROM {bug} b
					LEFT JOIN {project_user_list} p
						ON p.project_id=b.project_id AND p.user_id=' . db_param() . ' JOIN {user} u
						ON u.id=' . db_param() . ' JOIN {bug_tag} t
						ON t.bug_id=b.id
					WHERE ( p.access_level>b.view_state OR u.access_level>b.view_state )
						AND t.tag_id=' . db_param();
    # 4th Param
    $t_query = 'SELECT * FROM {bug_tag}
					WHERE tag_id != ' . db_param() . ' AND bug_id IN ( ' . $t_subquery . ' ) ';
    $t_result = db_query($t_query, array($p_tag_id, $c_user_id, $c_user_id, $p_tag_id));
    $t_tag_counts = array();
    while ($t_row = db_fetch_array($t_result)) {
        if (!isset($t_tag_counts[$t_row['tag_id']])) {
            $t_tag_counts[$t_row['tag_id']] = 1;
        } else {
            $t_tag_counts[$t_row['tag_id']]++;
        }
    }
    arsort($t_tag_counts);
    $t_tags = array();
    $i = 1;
    foreach ($t_tag_counts as $t_tag_id => $t_count) {
        $t_tag_row = tag_get($t_tag_id);
        $t_tag_row['count'] = $t_count;
        $t_tags[] = $t_tag_row;
        $i++;
        if ($i > $p_limit) {
            break;
        }
    }
    return $t_tags;
}
开发者ID:gtn,项目名称:mantisbt,代码行数:45,代码来源:tag_api.php


示例12: tag_get

    if (-1 == $t_tag_row['id']) {
        if ($t_can_create) {
            $t_tags_create[] = $t_tag_row;
        } else {
            $t_tags_failed[] = $t_tag_row;
        }
    } else {
        if (-2 == $t_tag_row['id']) {
            $t_tags_failed[] = $t_tag_row;
        } else {
            $t_tags_attach[] = $t_tag_row;
        }
    }
}
if (0 < $f_tag_select && tag_exists($f_tag_select)) {
    $t_tags_attach[] = tag_get($f_tag_select);
}
// failed to attach at least one tag
if (count($t_tags_failed) > 0) {
    html_page_top(lang_get('tag_attach_long') . ' ' . bug_format_summary($f_bug_id, SUMMARY_CAPTION));
    ?>
<br/>
<table class="width75">
	<tr class="row-category">
	<td colspan="2"><?php 
    echo lang_get('tag_attach_failed');
    ?>
</td>
	</tr>
	<tr class="spacer"><td colspan="2"></td></tr>
<?php 
开发者ID:N0ctrnl,项目名称:mantisbt,代码行数:31,代码来源:tag_attach.php


示例13: bookmarks_untag

/**
 * 
 * 
 */
function bookmarks_untag($itemid, $tagname)
{
    $tag = tag_get('name', $tagname);
    return tag_delete_instance('bookmark', $itemid, $tag->id);
}
开发者ID:laiello,项目名称:moodle-social-bookmarking,代码行数:9,代码来源:lib.php


示例14: filter_get_bug_rows


//.........这里部分代码省略.........
            array_push($t_where_clauses, "( {$t_table_name}.user_id in (" . implode(', ', $t_where_tmp) . ") )");
        } else {
            $t_where_params[] = $t_clauses[0];
            array_push($t_where_clauses, "( {$t_table_name}.user_id=" . db_param() . " )");
        }
    }
    # bug relationship
    $t_any_found = false;
    $c_rel_type = $t_filter[FILTER_PROPERTY_RELATIONSHIP_TYPE];
    $c_rel_bug = $t_filter[FILTER_PROPERTY_RELATIONSHIP_BUG];
    if (-1 == $c_rel_type || 0 == $c_rel_bug) {
        $t_any_found = true;
    }
    if (!$t_any_found) {
        # use the complementary type
        $t_comp_type = relationship_get_complementary_type($c_rel_type);
        $t_clauses = array();
        $t_table_name = 'relationship';
        array_push($t_join_clauses, "LEFT JOIN {$t_bug_relationship_table} {$t_table_name} ON {$t_table_name}.destination_bug_id = {$t_bug_table}.id");
        array_push($t_join_clauses, "LEFT JOIN {$t_bug_relationship_table} {$t_table_name}2 ON {$t_table_name}2.source_bug_id = {$t_bug_table}.id");
        // get reverse relationships
        $t_where_params[] = $t_comp_type;
        $t_where_params[] = $c_rel_bug;
        $t_where_params[] = $c_rel_type;
        $t_where_params[] = $c_rel_bug;
        array_push($t_clauses, "({$t_table_name}.relationship_type=" . db_param() . " AND {$t_table_name}.source_bug_id=" . db_param() . ')');
        array_push($t_clauses, "({$t_table_name}" . "2.relationship_type=" . db_param() . " AND {$t_table_name}" . "2.destination_bug_id=" . db_param() . ')');
        array_push($t_where_clauses, '(' . implode(' OR ', $t_clauses) . ')');
    }
    # tags
    $c_tag_string = trim($t_filter[FILTER_PROPERTY_TAG_STRING]);
    $c_tag_select = trim($t_filter[FILTER_PROPERTY_TAG_SELECT]);
    if (is_blank($c_tag_string) && !is_blank($c_tag_select) && $c_tag_select != 0) {
        $t_tag = tag_get($c_tag_select);
        $c_tag_string = $t_tag['name'];
    }
    if (!is_blank($c_tag_string)) {
        $t_tags = tag_parse_filters($c_tag_string);
        if (count($t_tags)) {
            $t_tags_all = array();
            $t_tags_any = array();
            $t_tags_none = array();
            foreach ($t_tags as $t_tag_row) {
                switch ($t_tag_row['filter']) {
                    case 1:
                        $t_tags_all[] = $t_tag_row;
                        break;
                    case 0:
                        $t_tags_any[] = $t_tag_row;
                        break;
                    case -1:
                        $t_tags_none[] = $t_tag_row;
                        break;
                }
            }
            if (0 < $t_filter[FILTER_PROPERTY_TAG_SELECT] && tag_exists($t_filter[FILTER_PROPERTY_TAG_SELECT])) {
                $t_tags_any[] = tag_get($t_filter[FILTER_PROPERTY_TAG_SELECT]);
            }
            $t_bug_tag_table = db_get_table('mantis_bug_tag_table');
            if (count($t_tags_all)) {
                $t_clauses = array();
                foreach ($t_tags_all as $t_tag_row) {
                    array_push($t_clauses, "{$t_bug_table}.id IN ( SELECT bug_id FROM {$t_bug_tag_table} WHERE {$t_bug_tag_table}.tag_id = {$t_tag_row['id']} )");
                }
                array_push($t_where_clauses, '(' . implode(' AND ', $t_clauses) . ')');
            }
开发者ID:nourchene-benslimane,项目名称:mantisV0,代码行数:67,代码来源:filter_api.php


示例15: required_param

require_once "../../config.php";
require_once "lib.php";
require_once $CFG->dirroot . '/tag/lib.php';
require_once $CFG->dirroot . '/tag/locallib.php';
$id = required_param('id', PARAM_INT);
$tagname = optional_param('tag', '', PARAM_TAG);
$url = new moodle_url('/mod/booking/tag.php', array('id' => $id, 'tag' => $tagname));
$PAGE->set_url($url);
if (!($cm = get_coursemodule_from_id('booking', $id))) {
    print_error('invalidcoursemodule');
}
if (!($course = $DB->get_record("course", array("id" => $cm->course)))) {
    print_error('coursemisconf');
}
require_course_login($course, false, $cm);
$tag = tag_get('name', $tagname, '*');
$PAGE->set_pagelayout('standard');
$tagname = tag_display_name($tag);
$title = get_string('tag', 'tag') . ' - ' . $tagname;
$PAGE->navbar->add($tagname);
$PAGE->set_heading($COURSE->fullname);
$PAGE->set_title($title);
echo $OUTPUT->header();
echo $OUTPUT->heading($tagname, 2);
$records = $DB->get_records('tag_instance', array('tagid' => $tag->id, 'itemtype' => 'booking'));
echo $OUTPUT->box_start('generalbox', 'tag-blogs');
//could use an id separate from tag-blogs, but would have to copy the css style to make it look the same
echo '<ul>';
foreach ($records as $record) {
    $booking = $DB->get_record('booking', array('id' => $record->itemid, 'course' => $cm->course));
    if ($booking) {
开发者ID:375michael40veit,项目名称:moodle-mod_booking,代码行数:31,代码来源:tag.php


示例16: process_url_edit


//.........这里部分代码省略.........
                    $bi->parentcontextid = $systemcontext->id;
                    $bi->showinsubcontexts = 1;

                } else { // The block doesn't want to be system-wide, so let's ensure that
                    if ($parentcontext->id == $systemcontext->id) {  // We need to move it to the front page
                        $frontpagecontext = get_context_instance(CONTEXT_COURSE, SITEID);
                        $bi->parentcontextid = $frontpagecontext->id;
                        $bi->pagetypepattern = '*';  // Just in case
                    }
                }
            }

            $bits = explode('-', $bi->pagetypepattern);
            // hacks for some contexts
            if (($parentcontext->contextlevel == CONTEXT_COURSE) && ($parentcontext->instanceid != SITEID)) {
                // For course context
                // is page type pattern is mod-*, change showinsubcontext to 1
                if ($bits[0] == 'mod' || $bi->pagetypepattern == '*') {
                    $bi->showinsubcontexts = 1;
                } else {
                    $bi->showinsubcontexts = 0;
                }
            } else  if ($parentcontext->contextlevel == CONTEXT_USER) {
                // for user context
                // subpagepattern should be null
                if ($bits[0] == 'user' or $bits[0] == 'my') {
                    // we don't need subpagepattern in usercontext
                    $bi->subpagepattern = null;
                }
            }

            $bi->defaultregion = $data->bui_defaultregion;
            $bi->defaultweight = $data->bui_defaultweight;
            $DB->update_record('block_instances', $bi);

            if (!empty($block->config)) {
                $config = clone($block->config);
            } else {
                $config = new stdClass;
            }
            foreach ($data as $configfield => $value) {
                if (strpos($configfield, 'config_') !== 0) {
                    continue;
                }
                $field = substr($configfield, 7);
                $config->$field = $value;
            }
            $block->instance_config_save($config);

            $bp = new stdClass;
            $bp->visible = $data->bui_visible;
            $bp->region = $data->bui_region;
            $bp->weight = $data->bui_weight;
            $needbprecord = !$data->bui_visible || $data->bui_region != $data->bui_defaultregion ||
                    $data->bui_weight != $data->bui_defaultweight;

            if ($block->instance->blockpositionid && !$needbprecord) {
                $DB->delete_records('block_positions', array('id' => $block->instance->blockpositionid));

            } else if ($block->instance->blockpositionid && $needbprecord) {
                $bp->id = $block->instance->blockpositionid;
                $DB->update_record('block_positions', $bp);

            } else if ($needbprecord) {
                $bp->blockinstanceid = $block->instance->id;
                $bp->contextid = $this->page->context->id;
                $bp->pagetype = $this->page->pagetype;
                if ($this->page->subpage) {
                    $bp->subpage = $this->page->subpage;
                } else {
                    $bp->subpage = '';
                }
                $DB->insert_record('block_positions', $bp);
            }

            redirect($this->page->url);

        } else {
            $strheading = get_string('blockconfiga', 'moodle', $block->get_title());
            $editpage->set_title($strheading);
            $editpage->set_heading($strheading);
            $bits = explode('-', $this->page->pagetype);
            if ($bits[0] == 'tag' && !empty($this->page->subpage)) {
                // better navbar for tag pages
                $editpage->navbar->add(get_string('tags'), new moodle_url('/tag/'));
                $tag = tag_get('id', $this->page->subpage, '*');
                // tag search page doesn't have subpageid
                if ($tag) {
                    $editpage->navbar->add($tag->name, new moodle_url('/tag/index.php', array('id'=>$tag->id)));
                }
            }
            $editpage->navbar->add($block->get_title());
            $editpage->navbar->add(get_string('configuration'));
            echo $output->header();
            echo $output->heading($strheading, 2);
            $mform->display();
            echo $output->footer();
            exit;
        }
    }
开发者ID:nottmoo,项目名称:moodle,代码行数:101,代码来源:blocklib.php


示例17: optional_param

require_once 'lib.php';
require_once 'edit_form.php';
$tag_id = optional_param('id', 0, PARAM_INT);
$tag_name = optional_param('tag', '', PARAM_TAG);
require_login();
if (empty($CFG->usetags)) {
    print_error('tagsaredisabled', 'tag');
}
//Editing a tag requires moodle/tag:edit capability
$systemcontext = context_system::instance();
require_capability('moodle/tag:edit', $systemcontext);
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;
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:edit.php


示例18: tag_rename

/**
 * Change the "value" of a tag, and update the associated 'name'.
 *
 * @package  core_tag
 * @category tag
 * @access   public
 * @param    int      $tagid  the id of the tag to modify
 * @param    string   $newrawname the new rawname
 * @return   bool     true on success, false otherwise
 */
function tag_rename($tagid, $newrawname)
{
    global $COURSE, $DB;
    $norm = tag_normalize($newrawname, TAG_CASE_ORIGINAL);
    if (!($newrawname_clean = array_shift($norm))) {
        return false;
    }
    if (!($newname_clean = core_text::strtolower($newrawname_clean))) {
        return false;
    }
    // Prevent the rename if a tag with that name already exists
    if ($existing = tag_get('name', $newname_clean, 'id, name, rawname')) {
        if ($existing->id != $tagid) {
            // Another tag already exists with this name
            return false;
        }
    }
    if ($tag = tag_get('id', $tagid, 'id, userid, name, rawname')) {
        // Store the name before we change it.
        $oldname = $tag->name;
        $tag->rawname = $newrawname_clean;
        $tag->name = $newname_clean;
        $tag->timemodified = time();
        $DB->update_record('tag', $tag);
        $event = \core\event\tag_updated::create(array('objectid' => $tag->id, 'relateduserid' => $tag->userid, 'context' => context_system::instance(), 'other' => array('name' => $newname_clean, 'rawname' => $newrawname_clean)));
        $event->set_legacy_logdata(array($COURSE->id, 'tag', 'update', 'index.php?id=' . $tag->id, $oldname . '->' . $tag->name));
        $event->trigger();
        return true;
    }
    return false;
}
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:41,代码来源:lib.php


示例19: process_url_edit


//.........这里部分代码省略.........
                             $bi->showinsubcontexts = true;
                             $bi->pagetypepattern = '*';
                             break;
                         case BUI_CONTEXTS_FRONTPAGE_ONLY:
                             // The user want to show the front page on the frontpage only
                             $bi->parentcontextid = $frontpagecontext->id;
                             $bi->showinsubcontexts = false;
                             $bi->pagetypepattern = 'site-index';
                             // This is the only relevant page type anyway but we'll set it explicitly just
                             // in case the front page grows site-index-* subpages of its own later
                             break;
                     }
                 }
             }
             $bits = explode('-', $bi->pagetypepattern);
             // hacks for some contexts
             if ($parentcontext->contextlevel == CONTEXT_COURSE && $parentcontext->instanceid != SITEID) {
                 // For course context
                 // is page type pattern is mod-*, change showinsubcontext to 1
                 if ($bits[0] == 'mod' || $bi->pagetypepattern == '*') {
                     $bi->showinsubcontexts = 1;
                 } else {
                     $bi->showinsubcontexts = 0;
                 }
             } else {
                 if ($parentcontext->contextlevel == CONTEXT_USER) {
                     // for user context
                     // subpagepattern should be null
                     if ($bits[0] == 'user' or $bits[0] == 'my') {
                         // we don't need subpagepattern in usercontext
                         $bi->subpagepattern = null;
                     }
                 }
             }
             $bi->defaultregion = $data->bui_defaultregion;
             $bi->defaultweight = $data->bui_defaultweight;
             $DB->update_record('block_instances', $bi);
             if (!empty($block->config)) {
                 $config = clone $block->config;
             } else {
                 $config = new stdClass();
             }
             foreach ($data as $configfield => $value) {
                 if (strpos($configfield, 'config_') !== 0) {
                     continue;
                 }
                 $field = substr($configfield, 7);
                 $config->{$field} = $value;
             }
             $block->instance_config_save($config);
             $bp = new stdClass();
             $bp->visible = $data->bui_visible;
             $bp->region = $data->bui_region;
             $bp->weight = $data->bui_weight;
             $needbprecord = !$data->bui_visible || $data->bui_region != $data->bui_defaultregion || $data->bui_weight != $data->bui_defaultweight;
             if ($block->instance->blockpositionid && !$needbprecord) {
                 $DB->delete_records('block_positions', array('id' => $block->instance->blockpositionid));
             } else {
                 if ($block->instance->blockpositionid && $needbprecord) {
                     $bp->id = $block->instance->blockpositionid;
                     $DB->update_record('block_positions', $bp);
                 } else {
                     if ($needbprecord) {
                         $bp->blockinstanceid = $block->instance->id;
                         $bp->contextid = $this->page->context->id;
                         $bp->pagetype = $this->page->pagetype;
                         if ($this->page->subpage) {
                             $bp->subpage = $this->page->subpage;
                         } else {
                             $bp->subpage = '';
                         }
                         $DB->insert_record('block_positions', $bp);
                     }
                 }
             }
             redirect($this->page->url);
         } else {
             $strheading = get_string('blockconfiga', 'moodle', $block->get_title());
             $editpage->set_title($strheading);
             $editpage->set_heading($strheading);
             $bits = explode('-', $this->page->pagetype);
             if ($bits[0] == 'tag' && !empty($this->page->subpage)) {
                 // better navbar for tag pages
                 $editpage->navbar->add(get_string('tags'), new moodle_url('/tag/'));
                 $tag = tag_get('id', $this->page->subpage, '*');
                 // tag search page doesn't have subpageid
                 if ($tag) {
                     $editpage->navbar->add($tag->name, new moodle_url('/tag/index.php', array('id' => $tag->id)));
                 }
             }
             $editpage->navbar->add($block->get_title());
             $editpage->navbar->add(get_string('configuration'));
             echo $output->header();
             echo $output->heading($strheading, 2);
             $mform->display();
             echo $output->footer();
             exit;
         }
     }
 }
开发者ID:Burick,项目名称:moodle,代码行数:101,代码来源:blocklib.php


示例20: filter_get_bug_rows


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP tag_get_field函数代码示例发布时间:2022-05-23
下一篇:
PHP tag_exists函数代码示例发布时间: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