Skip to content

Instantly share code, notes, and snippets.

@chrisjdavis
Created October 23, 2012 20:48
Show Gist options
  • Save chrisjdavis/3941445 to your computer and use it in GitHub Desktop.
Save chrisjdavis/3941445 to your computer and use it in GitHub Desktop.
Quickchat Singular Class
<?php
class Quickchat extends Post
{
public static function get($paramarray = array()) {
$defaults = array(
'content_type' => 'quickchat',
'fetch_fn' => 'get_row',
'limit' => 1,
'fetch_class' => 'Quickchat',
);
$paramarray = array_merge($defaults, Utils::get_params($paramarray));
return Posts::get( $paramarray );
}
public static function lines($chat) {
return DB::get_results( "SELECT message from {quickchat_lines} WHERE chat_id = $chat ORDER BY date ASC" );
}
public function jsonSerialize() {
$array = array_merge( $this->fields, $this->newfields );
return json_encode($array);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment