/** * Get the rank where the level is positioned. * * <code> * $levelId = 1; * $level = new Gamification\Level\Level(\JFactory::getDbo()); * * $rank = $level->getRank(); * </code> * * @return null|Rank */ public function getRank() { if (!$this->rank_id) { return null; } if (!$this->rank) { $this->rank = Rank::getInstance($this->db, $this->rank_id); } return $this->rank; }
/** * Get the rank where the level is positioned. * * <code> * $keys = array( * "user_id" => 1, * "group_id" => 2 * ); * * $userLevel = new Gamification\User\Level(JFactory::getDbo()); * $userLevel->load($keys); * * $rank = $userLevel->getRank(); * </code> * * @return null|Rank */ public function getRank() { if (!$this->rank_id) { return null; } if (!$this->rank) { $this->rank = Rank::getInstance(\JFactory::getDbo(), $this->rank_id); } return $this->rank; }