/** * Produces readable properties for the class object * @author Brent Allen * @param string key name of the variable to get * @return * returns the value of the get variable */ public function __get($key) { switch ($key) { case 'items': return $this->_items->find_all(); break; case 'data': return $this->_data; break; case 'title': return $this->_data->title; break; case 'desc': case 'description': return $this->_data->description; break; case 'exp': case 'expiration_date': case 'expiration': return $this->_data->expiration; break; case 'type': return 'award'; break; default: return parent::__get($key); break; } }
/** * Produces readable properties for the class object * @author Brent Allen * @param string key name of the variable to get * @return * returns the value of the get variable */ public function __get($key) { switch ($key) { case 'items': return $this->_items->find_all(); break; case 'rules': if ($this->_rules_ == null) { $this->_rules_ = ORM::factory("game_Rule")->where('badge_id', '=', $this->id)->find_all(); } return $this->_rules_; //return $this->_rules->find_all(); break; case 'winnable': $winnable = $this->enabled && !$this->deleted; if ($winnable) { if ($this->available != null && $this->available != '') { $winnable = strtotime($this->available) < time() ? $winnable : false; } if ($this->expiration != null && $this->expiration != '') { $winnable = strtotime($this->expiration) > time() ? $winnable : false; } } return $winnable; break; case 'showable': return $this->display && !$this->deleted; break; case 'type': return 'badge'; break; default: return parent::__get($key); break; } }