Campustream 1.0
A social network MQP for WPI
application/models/userfacebook.php
Go to the documentation of this file.
00001 <?
00002 
00006 class Userfacebook_Model extends ActiveRecord {
00007         public $table_name = 'userfacebook';
00008         public $columns = array('id', 'user_id', 'fb_id', 'username', 'access_token', 'name', 'link', 'about', 'gender', 'import_enabled', 'export_enabled', 'last_status_id');
00009         public $cache_keys = array( 'userfacebook/#' => 'id', 'userfacebook/user:#' => 'user_id' );
00010         public $has_one = array('user');
00011         public $has_many = array();
00012         public $public_columns = array();
00013         
00014         public function save() {
00015                 ActiveCache::invalidate_keys_for($this);
00016                 
00017                 return parent::save();
00018         }
00019         
00020         public function __get($key) {
00021                 switch ($key) {
00022                         case 'website_formatted' :
00023                                 if(mb_strlen($this->website) > 0) {
00024                                         $website = '<a class="nav-link" rel="nofollow" target="_blank" href="'.str_replace(array('"', "'"), "", $this->website).'">';
00025                                         if(mb_strlen($this->website) > 30) {
00026                                                 $website .= mb_substr($this->website, 0, 30)."...";
00027                                         } else {
00028                                                 $website .= $this->website;
00029                                         }
00030                                         $website .= "</a>";
00031                                         return $website;
00032                                 } else {
00033                                         return '';
00034                                 }
00035                 }
00036                 
00037                 return parent::__get($key);
00038         }
00039 }