本文整理汇总了PHP中MY_Model::count_by方法的典型用法代码示例。如果您正苦于以下问题:PHP MY_Model::count_by方法的具体用法?PHP MY_Model::count_by怎么用?PHP MY_Model::count_by使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MY_Model
的用法示例。
在下文中一共展示了MY_Model::count_by方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function is_subscribed($user_id, $topic_id)
{
if (parent::count_by(array('user_id' => $user_id, 'topic_id' => $topic_id)) > 0) {
return TRUE;
}
return FALSE;
}
示例2: check_name
/**
* Check name
*
* @access public
* @param string $name
* @param id $id
* @return bool
*/
public function check_name($name = '', $id = 0)
{
return (int) parent::count_by(array(
'id !=' => $id,
'name' => $name
)) > 0;
}
示例3: is_default
/**
* Is Default
*/
public function is_default($id = 0)
{
return parent::count_by(array(
'id' => $id,
'is_default >' => 0,
)) > 0;
}
示例4:
function check_slug($slug, $id = NULL)
{
if ($id) {
$this->db->where('id !=', $id);
}
return parent::count_by('slug', $slug) == 0;
}
示例5: exists
/**
* Exists
*
* Checks if a given file exists.
*
* @param int The file id
* @return bool If the file exists
*/
public function exists($file_id)
{
return (bool) (parent::count_by(array('id' => $file_id)) > 0);
}
示例6: _unique_slug
/**
* Check Slug for Uniqueness
*
* Slugs should be unique among sibling pages.
*
* @param string $slug The slug to check for.
* @param int $parent_id The parent_id if any.
* @param int $id The id of the page.
*
* @return bool
*/
public function _unique_slug($slug, $parent_id, $id = 0)
{
return (bool) parent::count_by(array('id !=' => $id, 'slug' => $slug, 'parent_id' => $parent_id)) > 0;
}
示例7: check_title
/**
* Callback method for validating the title
* @access public
* @param string $title The title to validate
* @return mixed
*/
public function check_title($title = '')
{
return parent::count_by('slug', url_title($title)) > 0;
}
示例8: has_children
/**
* Has Children
*
* Checks if a given folder has children or not.
*
* @access public
* @param int The folder id
* @return bool If the folder has children
*/
public function has_children($folder_id = 0)
{
return (bool) (parent::count_by(array('parent_id' => $folder_id)) > 0);
}
示例9: check_slug
/**
* Check Slug for Uniqueness
* @access public
* @param slug, parent id, this records id
* @return bool
*/
public function check_slug($slug, $parent_id, $id = 0)
{
return (int) parent::count_by(array('id !=' => $id, 'slug' => $slug, 'parent_id' => $parent_id)) > 0;
}
示例10: count_prior_posts
/**
* Count Prior Posts
*
* How many posts were before this one. Used for pagination.
*
* @access public
* @param int [$topic_id] Which topic
* @param int [$reply_time] Reply time o compair
* @return int
* @package forums
*/
public function count_prior_posts($topic_id, $reply_time)
{
return parent::count_by(array('parent_id' => $topic_id, 'created_on <' => $reply_time)) + 1;
}
示例11:
function check_name($id, $name = '')
{
return parent::count_by(array('id !=' => $id, 'name' => $name)) != 0;
}
示例12: _check_pt_slug
/**
* Validation callback to check the
* page type slug. We want page type slugs
* to be unique so we can use them as folder
* names when saving as files.
*
* @access public
* @param string $slug - the page slug
* @return bool
*/
public function _check_pt_slug($slug)
{
if (parent::count_by(array('slug' => $slug)) == 0) {
return true;
} else {
$this->form_validation->set_message('_check_pt_slug', lang('page_types:_check_pt_slug_msg'));
return false;
}
}
示例13:
function check_slug($slug = '')
{
return parent::count_by('slug', $slug) == 0;
}
示例14: check_slug
/**
* Callback method for validating the slug
* @access public
* @param string $slug The slug to validate
* @param int $id The id of gallery
* @return bool
*/
public function check_slug($slug = '', $id = 0)
{
return parent::count_by(array(
'id !=' => $id,
'slug' => $slug)
) > 0;
}
示例15: has_children
/**
* Does the page have children?
*
* @access public
* @param int $parent_id The ID of the parent page
* @return mixed
*/
public function has_children($parent_id)
{
return parent::count_by(array('parent_id' => $parent_id)) > 0;
}