本文整理汇总了PHP中Tag::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::count方法的具体用法?PHP Tag::count怎么用?PHP Tag::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::count方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin
private function admin()
{
$today = strtotime('today');
$month = strtotime('first day of this month');
$last30 = strtotime('-30 days');
// Users statistics
$users['today'] = number_format(User::whereGt('reg_date', $today)->count());
$users['month'] = number_format(User::whereGt('reg_date', $month)->count());
$users['last30'] = number_format(User::whereGt('reg_date', $last30)->count());
$users['total'] = number_format(User::count());
View::set('users', $users);
// Playlists statistics
$playlists['today'] = number_format(Playlist::whereGt('date', $today)->count());
$playlists['month'] = number_format(Playlist::whereGt('date', $month)->count());
$playlists['last30'] = number_format(Playlist::whereGt('date', $last30)->count());
$playlists['total'] = number_format(Playlist::count());
View::set('playlists', $playlists);
// Tracks statistics
$tracks = number_format(Track::count());
View::set('tracks', $tracks);
// Tags statistics
$tags = number_format(Tag::count());
View::set('tags', $tags);
// Comments statistics
$comments = number_format(Comment::count());
View::set('comments', $comments);
// Likes
$likes = number_format(PlaylistLike::count());
View::set('likes', $likes);
// Reports
$reports = number_format(Report::count());
View::set('reports', $reports);
View::show('admin/admin');
}
示例2: run
public function run()
{
$model = new Tag();
//条件
$criteria = new CDbCriteria();
$tag_name = trim(Yii::app()->request->getParam('tag_name'));
$tag_name && $criteria->addSearchCondition('tag_name', $tag_name);
$criteria->order = 't.id ASC';
$count = $model->count($criteria);
//分页
$pages = new CPagination($count);
$pages->pageSize = 20;
$pages->applyLimit($criteria);
//查询
$result = $model->findAll($criteria);
$this->controller->render('index', array('model' => $model, 'datalist' => $result, 'pagebar' => $pages));
}
示例3: actionIndex
/**
* 标签管理
*
*/
public function actionIndex()
{
$model = new Tag();
$criteria = new CDbCriteria();
$condition = '1';
$tagName = $this->_request->getParam('tagName');
$tagName && ($condition .= ' AND tag_name LIKE \'%' . $tagName . '%\'');
$criteria->condition = $condition;
$criteria->order = 't.id DESC';
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 13;
$pageParams = $this->buildCondition($_GET, array('tagName'));
$pages->params = is_array($pageParams) ? $pageParams : array();
$criteria->limit = $pages->pageSize;
$criteria->offset = $pages->currentPage * $pages->pageSize;
$result = $model->findAll($criteria);
$this->render('index', array('datalist' => $result, 'pagebar' => $pages));
}
示例4: get_index
/**
* Show general application stats
* /administration
*
* @return View
*/
public function get_index()
{
$issues = Project\Issue::count_issues();
return $this->layout->with('active', 'dashboard')->nest('content', 'administration.index', array('users' => User::where('deleted', '=', 0)->count(), 'active_projects' => Project::where('status', '=', 1)->count(), 'archived_projects' => Project::where('status', '=', 0)->count(), 'issues' => $issues, 'tags' => Tag::count()));
}
示例5: tags
/**
* tags
*
* This returns tags to the user, in a pretty xml document with the information
*
* @param array $tags (description here...)
* @return string return xml
*/
public static function tags($tags)
{
if (count($tags) > self::$limit or self::$offset > 0) {
$tags = array_splice($tags, self::$offset, self::$limit);
}
$string = '';
foreach ($tags as $tag_id) {
$tag = new Tag($tag_id);
$counts = $tag->count();
$string .= "<tag id=\"{$tag_id}\">\n" . "\t<name><![CDATA[{$tag->name}]]></name>\n" . "\t<albums>" . intval($counts['album']) . "</albums>\n" . "\t<artists>" . intval($counts['artist']) . "</artists>\n" . "\t<songs>" . intval($counts['song']) . "</songs>\n" . "\t<videos>" . intval($counts['video']) . "</videos>\n" . "\t<playlists>" . intval($counts['playlist']) . "</playlists>\n" . "\t<stream>" . intval($counts['live_stream']) . "</stream>\n" . "</tag>\n";
}
// end foreach
$final = self::_header() . $string . self::_footer();
return $final;
}
示例6: run
public function run()
{
if (Tag::count() == 0) {
$this->generate();
}
}
示例7: addGenres
public static function addGenres($xml, $tags)
{
$xgenres = $xml->addChild('genres');
foreach ($tags as $tag) {
$otag = new Tag($tag['id']);
$xgenre = $xgenres->addChild('genre', htmlspecialchars($otag->name));
$counts = $otag->count('', $GLOBALS['user']->id);
$xgenre->addAttribute("songCount", $counts['song']);
$xgenre->addAttribute("albumCount", $counts['album']);
}
}