__get() 공개 메소드

--------------------- //
public __get ( $key )
예제 #1
0
 /**
  * Overload ORM::__get to support "parent" and "children" properties.
  *
  * @param   string  column name
  * @return  mixed
  */
 public function __get($column)
 {
     if ($column === 'parent') {
         if (empty($this->related[$column])) {
             // Load child model
             $model = ORM::factory(inflector::singular($this->children));
             if (array_key_exists($this->parent_key, $this->object)) {
                 // Find children of this parent
                 $model->where($model->primary_key, $this->object[$this->parent_key])->find();
             }
             $this->related[$column] = $model;
         }
         return $this->related[$column];
     } elseif ($column === 'children') {
         if (empty($this->related[$column])) {
             $model = ORM::factory(inflector::singular($this->children));
             if ($this->children === $this->table_name) {
                 // Load children within this table
                 $this->related[$column] = $model->where($this->parent_key, $this->object[$this->primary_key])->find_all();
             } else {
                 // Find first selection of children
                 $this->related[$column] = $model->where($this->foreign_key(), $this->object[$this->primary_key])->where($this->parent_key, NULL)->find_all();
             }
         }
         return $this->related[$column];
     }
     return parent::__get($column);
 }
예제 #2
0
 /**
  * Get the product name
  * @developer Brandon Hansen
  * @date Nov 1, 2010
  */
 public function __get($key)
 {
     if ($key == 'name') {
         return $this->product_name();
     }
     return parent::__get($key);
 }
예제 #3
0
 /**
  * Don't make the user type in anything more than pseudo property names
  * @developer Brandon Hansen
  * @date Nov 1, 2010
  */
 public function __get($key)
 {
     if ($key == 'name') {
         return $this->variant_title();
     }
     return parent::__get($key);
 }
예제 #4
0
 public function __get($prop)
 {
     if ('url' == $prop) {
         return url::site("subscribers/{$this->email}");
     }
     return parent::__get($prop);
 }
예제 #5
0
 public function __get($prop)
 {
     if ('url' == $prop) {
         return url::site("tags/{$this->name}");
     }
     return parent::__get($prop);
 }
예제 #6
0
 /**
  * Calls a function through the get param if one is available.
  * --could not add globally as some models won't work with it.
  * --(cool feature, though)
  * @author	Brent Allen
  * @param	Object	key	    the key sent by auto-calling __get
  * @return 	Object	The return of the function, or the parent __get
  */
 public function __get($key)
 {
     if (method_exists(Model_Background, $key)) {
         return $this->{$key}();
     }
     return parent::__get($key);
 }
예제 #7
0
 /**
  * Calls a function through the get param if one is available.
  * --could not add globally as some models won't work with it.
  * --(cool feature, though)
  * @author	Brent Allen
  * @param	Object	key	    the key sent by auto-calling __get
  * @return 	Object	The return of the function, or the parent __get
  */
 public function __get($key)
 {
     if (method_exists(Model_DLSliderPhoto, $key)) {
         return $this->{$key}();
     }
     return parent::__get($key);
 }
예제 #8
0
 public function __get($column)
 {
     switch ($column) {
         case 'compatible_versions' or 'incompatible_versions':
             return unserialize(parent::__get($column));
         default:
             return parent::__get($column);
     }
 }
예제 #9
0
 public function __get($column)
 {
     switch ($column) {
         case 'installer':
             return (bool) parent::__get('installer');
         default:
             return parent::__get($column);
     }
 }
예제 #10
0
 /**
  * Necessary override to enable per-column encryption.
  * @param  String $column 
  * @return mixed
  */
 public function __get($column)
 {
     if (in_array($column, $this->_encrypted_compressed_columns)) {
         return gzuncompress(Encrypt::instance()->decode(parent::__get($column)));
     }
     if (in_array($column, $this->_encrypted_columns)) {
         return Encrypt::instance()->decode(parent::__get($column));
     }
     return parent::__get($column);
 }
예제 #11
0
파일: snippet.php 프로젝트: ngonchan/Kooshy
 /**
  * Overrides ORM get magic method to allow for enabled
  * @param   string  name of column/relationship to return
  * @return  mixed
  */
 public function __get($column)
 {
     if ($column != 'enabled') {
         return parent::__get($column);
     } else {
         if ($this->_enabled === NULL) {
             $this->_enabled = ORM::factory('site_snippet')->where('site_id', '=', KMS::instance('site')->id)->where('snippet_id', '=', $this->id)->order_by('snippet_id', 'ASC')->find()->enabled;
         }
         return $this->_enabled;
     }
 }
예제 #12
0
 public function __get($key)
 {
     switch ($key) {
         case 'site':
             return $this->_site;
             break;
         default:
             return ORM::__get($key);
             break;
     }
 }
예제 #13
0
파일: log.php 프로젝트: b263/kohana-dblog
 public function __get($column)
 {
     switch ($column) {
         case 'tstamp':
             $val = strftime(self::$time_format, parent::__get('tstamp'));
             break;
         default:
             $val = parent::__get($column);
     }
     return $val;
 }
예제 #14
0
 /**
  * Decrypt the data when taking it out of the database
  * @Developer brandon
  * @Date May 18, 2010
  */
 public function __get($key)
 {
     $value = parent::__get($key);
     if (in_array($key, array('content', 'title'))) {
         if ($value) {
             $encrypt = new Encrypt();
             $value = $encrypt->decode($value);
         }
     }
     return $value;
 }
예제 #15
0
 /**
  * Allows us to get the unqiue value of regardless of what 'username|}email' type is selected. 
  * @param $value
  */
 public function __get($value)
 {
     if ($value === 'unique') {
         if (!count($this->config)) {
             $this->config = Kohana::config($this->config_name);
         }
         // return the unique field whether it is
         $value = $this->config['columns']['unique'];
     }
     return parent::__get($value);
 }
예제 #16
0
 /**
  * Reading data from inaccessible properties
  *
  * @param   string  $field
  * @return  mixed
  *
  * @uses  Route::get
  * @uses  Route::uri
  * @uses  System::icons
  */
 public function __get($field)
 {
     switch ($field) {
         case 'edit_url':
             return Route::get('admin/widget')->uri(array('id' => $this->id, 'action' => 'edit'));
             break;
         case 'icons':
             return System::icons();
             break;
     }
     return parent::__get($field);
 }
예제 #17
0
 /**
  * will over ride the name property with one created, if none exists. 
  * @todo : see if there is a better way to store the information requiiring less lookups, ir as a property so a very least we only have to do the look ups once. 
  * 
  * @param string $name the name of the property we are trying to retreive
  * @return string $value
  */
 public function __get($property)
 {
     if ($property == 'padded' && is_null($this->padded)) {
         $value = $this->pad()->padded;
     } else {
         $value = parent::__get($property);
         if ($property == 'name' && is_null($value)) {
             $value = $this->collection->paper->name . ' ' . $this->collection->finish->name . ' ' . ucwords($this->color);
         }
     }
     return $value;
 }
예제 #18
0
 public function __get($column)
 {
     if ($column == 'user_billing_info' || $column == 'user_shipping_info') {
         if (isset($this->related[$column])) {
             return $this->related[$column];
         }
         $model = ORM::factory($column);
         $model->where('user_id', $this->id);
         $model->orderby('id', 'DESC');
         return $this->related[$column] = $model->find();
     }
     return parent::__get($column);
 }
예제 #19
0
 public function __get($field)
 {
     if ($field === 'url') {
         return Route::get('oauth2/client')->uri(array('id' => $this->id, 'action' => 'view'));
     }
     if ($field === 'edit_url') {
         return Route::get('oauth2/client')->uri(array('id' => $this->id, 'action' => 'edit'));
     }
     if ($field === 'delete_url') {
         return Route::get('oauth2/client')->uri(array('id' => $this->id, 'action' => 'delete'));
     }
     return parent::__get($field);
 }
예제 #20
0
 /**
  * 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 'user':
             return $this->getUser();
             break;
         case 'following':
             return $this->getFollower();
             break;
         default:
             return ORM::__get($key);
             break;
     }
 }
예제 #21
0
파일: log.php 프로젝트: CardinS2U/gallery3
 /**
  * @see ORM::__get()
  */
 public function __get($column)
 {
     if ($column == "user") {
         // This relationship depends on an outside module, which may not be present so handle
         // failures gracefully.
         try {
             return user::lookup($this->user_id);
         } catch (Exception $e) {
             return null;
         }
     } else {
         return parent::__get($column);
     }
 }
예제 #22
0
 public function __get($key)
 {
     switch ($key) {
         case 'site':
             return $this->_site;
             break;
         case 'relatedBadges':
             return $this->getRelatedBadges();
             break;
         default:
             return ORM::__get($key);
             break;
     }
 }
예제 #23
0
파일: rule.php 프로젝트: natgeo/kids-myshot
 public function __get($key)
 {
     switch ($key) {
         case 'event':
             return ORM::factory("game_Event")->where('id', '=', $this->event_id)->find();
             break;
         case 'badge':
             return $this->_badge;
             break;
         default:
             return ORM::__get($key);
             break;
     }
 }
예제 #24
0
 public function __get($key)
 {
     try {
         $value = parent::__get($key);
     } catch (Exception $e) {
         $metadata = ORM::factory('document_metadata')->where('document_id', $this->id)->where('key', $key)->find();
         if ($metadata->loaded) {
             $value = $metadata->value;
         } else {
             throw new Documents_No_Such_Metadata_Exception($this, $key);
         }
     }
     return $value;
 }
예제 #25
0
 public function __get($key)
 {
     switch ($key) {
         case '_type':
             return ORM::factory('game_ImageType', $this->image_type_id)->find();
             break;
         case 'type':
             return ORM::factory('game_ImageType', $this->image_type_id);
             break;
         default:
             return parent::__get($key);
             break;
     }
 }
예제 #26
0
파일: user.php 프로젝트: jimktrains/rccms
 public function __get($column)
 {
     $this->load_prefs();
     if (!count($this->_prefs) and strlen($this->prefs)) {
         $this->prefs = json_decode($this->prefs);
     }
     try {
         return parent::__get($column);
     } catch (Kohana_Exception $e) {
         if (array_key_exists($column, $this->_prefs)) {
             return $this->_prefs[$column];
         }
         throw $e;
     }
 }
예제 #27
0
 public function __get($prop)
 {
     if ('local_url' == $prop) {
         return url::site("projects/{$this->id}");
     }
     if ('image_url' == $prop) {
         $image_url = $this->has_image();
         return url::site($image_url ? $image_url : 'media/images/project_thumb.png');
     }
     if ('tiny_image_url' == $prop) {
         $image_url = $this->has_image('tiny');
         return url::site($image_url ? $image_url : 'media/images/ferta_logo.png');
     }
     return parent::__get($prop);
 }
예제 #28
0
파일: log.php 프로젝트: JasonWiki/docs
 /**
  * @see ORM::__get()
  */
 public function __get($column)
 {
     if ($column == "user") {
         // This relationship depends on an outside module, which may not be present so handle
         // failures gracefully.
         try {
             return identity::lookup_user($this->user_id);
         } catch (Exception $e) {
             Kohana_Log::add("alert", "Unable to load user with id {$this->user_id}");
             return null;
         }
     } else {
         return parent::__get($column);
     }
 }
예제 #29
0
 public function __get($name)
 {
     // Are we trying to get the gsms
     if ($name == 'gsms') {
         // if the gsms are not set ... set them and then return
         if (is_null($this->gsms)) {
             $this->gsms = $this->db->select('gsms.name')->from('gsms')->where('collections.paper_id', $this->id)->join('sheets', 'sheets.id', 'gsms.sheet_id')->join('pigments', 'sheets.pigment_id', 'pigments.id')->join('collections', 'collections.id', 'pigments.collection_id')->orderby('gsms.name')->groupby('gsms.name')->get();
         }
         return $this->gsms;
     } elseif ($name == 'technicals') {
         $technicals = orm::factory('technical')->where('foreign_id', $this->id)->where('type', 'technical');
         return $technicals->find_all();
     } else {
         return parent::__get($name);
     }
 }
예제 #30
0
 public function __get($col)
 {
     if ('top' == $col) {
         return intval(date('G', strtotime($this->start_date)) * 60 + intval(preg_replace('/^0/', '', date('i', strtotime($this->start_date)))));
     }
     if ('height' == $col) {
         return intval(date('G', strtotime($this->end_date)) * 60 + intval(preg_replace('/^0/', '', date('i', strtotime($this->end_date))))) - $this->top;
     }
     if ('start_time' == $col) {
         return date('H:i', strtotime($this->start_date));
     }
     if ('end_time' == $col) {
         return date('H:i', strtotime($this->end_date));
     }
     return parent::__get($col);
 }