/** * Extract values from database and set them to object properties * @param integer $id ID of record to be instantiated ** @return void DB record's fields are loaded into object properties */ private function Get($id) { $query = 'SELECT * FROM ' . DB_PREFIX . self::$table . ' WHERE ' . self::$id_name . "= {$id}"; $result = $this->db->Query($query); $row = $this->db->FetchAssoc($result); foreach ($row as $key => $value) { $this->{$key} = $value; } $this->date_created = Functions::GmtToLocal($this->date_created); Plugin::Trigger('rating.get'); }
/** * Extract values from database and set them to object properties * @param integer $id ID of record to be instantiated * @return void */ private function Get($id) { $query = "SELECT " . DB_PREFIX . self::$table . ".*, " . DB_PREFIX . "users.username FROM " . DB_PREFIX . self::$table . " INNER JOIN " . DB_PREFIX . "users ON " . DB_PREFIX . self::$table . ".user_id = " . DB_PREFIX . "users.user_id WHERE " . self::$id_name . "= {$id}"; $result = $this->db->Query($query); $row = $this->db->FetchAssoc($result); foreach ($row as $key => $value) { $this->{$key} = $value; } $this->date_created = Functions::GmtToLocal($this->date_created); Plugin::Trigger('message.get'); }
/** * Extract values from database and set them to object properties * @param integer $id ID of record to be instantiated * @return void DB record's fields are loaded into object properties */ private function Get($id) { $query = "SELECT " . DB_PREFIX . self::$table . ".*, username FROM " . DB_PREFIX . self::$table . " INNER JOIN " . DB_PREFIX . "users on " . DB_PREFIX . self::$table . ".user_id = " . DB_PREFIX . "users.user_id WHERE " . self::$id_name . "= {$id}"; $result = $this->db->Query($query); $row = $this->db->FetchAssoc($result); foreach ($row as $key => $value) { $this->{$key} = $value; } // Video Specific values $this->tags = preg_split('/\\s?,\\s?/', $this->tags); $this->duration = substr($this->duration, 0, 3) == '00:' ? substr($this->duration, 3) : $this->duration; $this->slug = Functions::CreateSlug($this->title); $this->date_created = Functions::GmtToLocal($this->date_created); $this->url = HOST . '/videos/' . $this->video_id . (!empty($this->slug) ? '/' . $this->slug : ''); Plugin::Trigger('video.get'); }
/** * Extract values from database and set them to object properties * @param integer $id ID of record to be instantiated * @return void DB record's fields are loaded into object properties */ private function Get($id) { $query = 'SELECT * FROM ' . DB_PREFIX . self::$table . ' WHERE ' . self::$id_name . "= {$id}"; $result = $this->db->Query($query); $row = $this->db->FetchAssoc($result); foreach ($row as $key => $value) { $this->{$key} = $value; } // User specific values View::InitView(); $this->role = empty($this->role) ? 'user' : $this->role; $this->avatar_url = empty($this->avatar) ? View::GetFallbackUrl('images/avatar.gif') : HOST . "/cc-content/uploads/avatars/{$this->avatar}"; $this->date_created = Functions::GmtToLocal($this->date_created); $this->last_login = Functions::GmtToLocal($this->last_login); $this->video_count = $this->GetVideoCount(); Plugin::Trigger('user.get'); }
/** * Extract values from database and set them to object properties * @param integer $id ID of record to be instantiated * @return void */ private function Get($id) { $query = 'SELECT * FROM ' . DB_PREFIX . self::$table . ' WHERE ' . self::$id_name . "= {$id}"; $result = $this->db->Query($query); $row = $this->db->FetchAssoc($result); foreach ($row as $key => $value) { $this->{$key} = $value; } // Custom Vars $this->date_created = Functions::GmtToLocal($this->date_created); $this->comments_display = nl2br($row['comments']); if ($this->user_id != 0) { $user = new User($this->user_id); $this->name = $user->username; $this->email = $user->email; $this->website = HOST . '/members/' . $user->username . '/'; $this->avatar_url = $user->avatar_url; } else { View::InitView(); $this->avatar_url = View::GetFallbackUrl('images/avatar.gif'); } Plugin::Trigger('comment.get'); }