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; }
/** * 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; }
/** * Is Default */ public function is_default($id = 0) { return parent::count_by(array( 'id' => $id, 'is_default >' => 0, )) > 0; }
function check_slug($slug, $id = NULL) { if ($id) { $this->db->where('id !=', $id); } return parent::count_by('slug', $slug) == 0; }
/** * 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); }
/** * 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; }
/** * 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; }
/** * 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); }
/** * 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; }
/** * 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; }
function check_name($id, $name = '') { return parent::count_by(array('id !=' => $id, 'name' => $name)) != 0; }
/** * 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; } }
function check_slug($slug = '') { return parent::count_by('slug', $slug) == 0; }
/** * 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; }
/** * 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; }
function check_exists($field, $value = '', $id = 0) { if (is_array($field)) { $params = $field; $id = $value; } else { $params[$field] = $value; } $params['id !='] = (int) $id; return parent::count_by($params) == 0; }
/** * Check if specific user ID or IP has result in the database * @param int $ip IP converted to long * @param int $userID UserID * @return boolean */ private function has_viewed($ip, $userID = NULL) { $this->_table = 'site_views'; if (!isset($userID)) { $query = parent::count_by('ip', $ip); } else { $query = parent::count_by('user', $userID); } if ($query > 0) { return TRUE; } return FALSE; }