Пример #1
0
 public function get_all()
 {
     $this->db->select('stories.id, type, headline, state, story, views, image, media, anonymous, user_id, upvote, downvote, date_created, date_modified, status, users.username, users.first_name, users.last_name');
     $this->db->join('users', 'stories.user_id = users.id', 'full');
     $this->db->order_by('stories.date_created desc');
     return parent::get_all();
 }
Пример #2
0
	/**
	 * Get all galleries along with the total number of photos in each gallery
	 *
	 * @author Yorick Peterse - PyroCMS Dev Team
	 * @access public
	 * @return mixed
	 */
	public function get_all()
	{
		$this->db
			->select('galleries.*, file_folders.slug as folder_slug, file_folders.name as folder_name')
			->join('file_folders', 'file_folders.id = galleries.folder_id', 'left');

		$galleries	= parent::get_all();
		$results	= array();

		// Loop through each gallery and add the count of photos to the results
		foreach ($galleries as $gallery)
		{
			$count = $this->db
				->select('files.id')
				->join('galleries', 'galleries.folder_id = files.folder_id', 'left')
				->where('files.type', 'i')
				->where('galleries.id', $gallery->id)
				->count_all_results('files');

			$gallery->photo_count = $count;
			$results[] = $gallery;
		}

		// Return the results
		return $results;
	}
Пример #3
0
 /**
  * Return an array of groups
  *
  * 
  * @param array $params Optional parameters
  * @return array
  */
 public function get_all($params = array())
 {
     if (isset($params['except'])) {
         $this->db->where_not_in('name', $params['except']);
     }
     return parent::get_all();
 }
Пример #4
0
 public function get_one()
 {
     $new = array();
     $this->db->limit(1);
     $this->db->order_by('create_date', 'desc');
     $new = parent::get_all();
     return $new[0];
 }
Пример #5
0
 public function get_all()
 {
     $this->db->select('comments.*');
     $this->db->select('IF(comments.user_id > 0, IF(u.last_name = "", u.first_name, CONCAT(u.first_name, " ", u.last_name)), comments.name) as name');
     $this->db->select('IF(comments.user_id > 0, u.email, comments.email) as email');
     $this->db->join('users u', 'comments.user_id = u.id', 'left');
     return parent::get_all();
 }
Пример #6
0
 public function get_all()
 {
     $result = parent::get_all();
     if ($result) {
         array_map(array($this, 'unserialize_fields'), $result);
     }
     return $result;
 }
Пример #7
0
 /**
  * Returns an array with currently all modules registered in database
  * @return array Array with module names
  */
 public function list_db_modules()
 {
     $modulesDb = parent::get_all();
     $dbModules = array();
     foreach ($modulesDb as $mod) {
         $dbModules[] = $mod->link;
     }
     return $dbModules;
 }
Пример #8
0
	function get_all()
    {
    	$this->db->select('profiles.*, users.*, g.description as group_name, IF(profiles.last_name = "", profiles.first_name, CONCAT(profiles.first_name, " ", profiles.last_name)) as full_name')
    			 ->join('groups g', 'g.id = users.group_id')
    			 ->join('profiles', 'profiles.user_id = users.id', 'left');
    		
        $this->db->group_by('users.id');
    	return parent::get_all();
    }    
Пример #9
0
 public function get_promokelas()
 {
     $this->db->select('promote.idpromo, class.title as "nmclass", class.price, promote.discount, promote.start_date, promote.end_date, promote.description as "desc", promote.title as "prom", foto_produk.thumb');
     $this->db->join('class', 'promote.idclass = class.idclass', 'left');
     $this->db->join('foto_produk', 'promote.idclass = foto_produk.idclass', 'left');
     $this->db->where('promote.end_date >=', date('Y-m-d'));
     $this->db->where('promote.status', 1);
     $this->db->group_by('promote.idpromo');
     return parent::get_all();
 }
Пример #10
0
    function get_all()
    {
    	$this->db
	    ->select($this->profile_table.'.*, g.description as group_name, users.*')
	    ->select('IF('.$this->profile_table.'.last_name = "", '.$this->profile_table.'.first_name, CONCAT('.$this->profile_table.'.first_name, " ", '.$this->profile_table.'.last_name)) as full_name', FALSE)
	    ->join('groups g', 'g.id = users.group_id')
	    ->join('profiles', 'profiles.user_id = users.id', 'left')
	    ->group_by('users.id');
	    
    	return parent::get_all();
    }
Пример #11
0
 /**
  * Get all members 
  *
  * @author Buonzz
  * @access public
  * @return mixed
  */
 public function get_all()
 {
     $members = parent::get_all();
     $results = array();
     // Loop through each member
     foreach ($members as $member) {
         $results[] = $member;
     }
     // Return the results
     return $results;
 }
Пример #12
0
 /**
  * Gets all matches
  * @param  boolean $all If false gets all matches that are not upcoming
  * @return object       Object with match results
  */
 public function get_matches($all = TRUE)
 {
     if ($all) {
         parent::order_by('date', 'DESC');
         return parent::get_all();
     } else {
         parent::order_by('date', 'DESC');
         $this->db->select('*');
         $this->db->where('status !=', '1');
         return $this->db->get('matches')->result();
     }
 }
Пример #13
0
 public function get_active_forum_labels()
 {
     $this->_table = 'forum_forums';
     $labels = array();
     $forums = parent::get_all();
     foreach ($forums as $forum) {
         if (!in_array($forum->label, $labels)) {
             $labels[] = $forum->label;
         }
     }
     return $labels;
 }
Пример #14
0
 /**
  * Get Pam Module settings.
  * 
  * Takes the work out of grabbing the settings whenever
  * we need them. Will also return a single value if
  * needed.
  * 
  * @param str $field The settings field to retrieve.
  * @return array / str
  */
 public function get_settings($field = null)
 {
     // return value of a single setting
     if ($field) {
         $settings = parent::get_all();
         $settings = $settings[0];
         $result = property_exists($settings, $field) ? $settings->{$field} : 'Invalid field.';
     } else {
         $settings = parent::get_all();
         $result = $settings[0];
     }
     return $result;
 }
Пример #15
0
 /**
  * Get all galleries along with the total number of photos in each gallery
  *
  * @author Yorick Peterse - PyroCMS Dev Team
  * @access public
  * @return mixed
  */
 public function get_all()
 {
     $galleries = parent::get_all();
     $results = array();
     // Loop through each gallery and add the count of photos to the results
     foreach ($galleries as $gallery) {
         $count = $this->db->select('id')->where('gallery_id', $gallery->id)->count_all_results('gallery_images');
         $gallery->photo_count = $count;
         $results[] = $gallery;
     }
     // Return the results
     return $results;
 }
Пример #16
0
 public function get_all()
 {
     $this->db->order_by('slide_order');
     return parent::get_all();
 }
Пример #17
0
 public function get_slugs()
 {
     $this->db->select('comments.module, modules.name')->distinct()->join('modules', 'comments.module = modules.slug', 'left');
     $slugs = parent::get_all();
     $options = array();
     if (!empty($slugs)) {
         foreach ($slugs as $slug) {
             if (!$slug->name && ($pos = strpos($slug->module, '-')) !== FALSE) {
                 $slug->ori_module = $slug->module;
                 $slug->module = substr($slug->module, 0, $pos);
             }
             if (!$slug->name && ($module = $this->module_m->get_by('slug', plural($slug->module)))) {
                 $slug->name = $module->name;
             }
             //get the module name
             if ($slug->name and $module_names = unserialize($slug->name)) {
                 if (array_key_exists(CURRENT_LANGUAGE, $module_names)) {
                     $slug->name = $module_names[CURRENT_LANGUAGE];
                 } else {
                     $slug->name = $module_names['en'];
                 }
                 if (isset($slug->ori_module)) {
                     $options[$slug->ori_module] = $slug->name . " ({$slug->ori_module})";
                 } else {
                     $options[$slug->module] = $slug->name;
                 }
             } else {
                 if (isset($slug->ori_module)) {
                     $options[$slug->ori_module] = $slug->ori_module;
                 } else {
                     $options[$slug->module] = $slug->module;
                 }
             }
         }
     }
     asort($options);
     return $options;
 }
Пример #18
0
 public function get_all($book_id = null, $type = null, $category = null, $is_live = true, $version_datetime = null)
 {
     return parent::get_all($this->annotations_table, $book_id, $type, $category, $is_live, $version_datetime);
 }
Пример #19
0
 function get_all()
 {
     $this->db->select('users.*, pr.title as role_title, IF(last_name = "", first_name, CONCAT(first_name, " ", last_name)) as full_name')->join('permission_roles pr', 'pr.abbrev = users.role');
     return parent::get_all();
 }
Пример #20
0
 /**
  * Get all user objects
  *
  * @return object
  */
 public function get_all()
 {
     $this->db->select($this->profile_table . '.*, g.description as group_name, users.*')->join('groups g', 'g.id = users.group_id')->join('profiles', 'profiles.user_id = users.id', 'left')->group_by('users.id');
     return parent::get_all();
 }
Пример #21
0
 function get_all()
 {
     $this->db->select('profiles.*, users.*, pr.title as role_title, IF(profiles.last_name = "", profiles.first_name, CONCAT(profiles.first_name, " ", profiles.last_name)) as full_name')->join('groups pr', 'pr.id = users.group_id')->join('profiles', 'profiles.user_id = users.id', 'left');
     $this->db->group_by('users.id');
     return parent::get_all();
 }
Пример #22
0
 public function get_all($fields = '', $where = array())
 {
     $fields_hack = '*,(SELECT image_path FROM product_images pi WHERE pi.featured = 1 AND pi.product_id = products.product_id) featured_image';
     return parent::get_all($fields_hack, $where);
 }