Translations of this page?:

BaseChats.class.php

<?php
abstract class BaseChats extends ProjectDataObjects {
 
	static private $columns = array(
		'id' => DATA_TYPE_INTEGER,
		'name' => DATA_TYPE_STRING,
		'start_date' => DATA_TYPE_DATETIME,
		'end_date' => DATA_TYPE_DATETIME,
 
		'created_on' => DATA_TYPE_DATETIME,
		'created_by_id' => DATA_TYPE_INTEGER,
		'updated_on' => DATA_TYPE_DATETIME,
		'updated_by_id' => DATA_TYPE_INTEGER,
		'trashed_on' => DATA_TYPE_DATETIME,
		'trashed_by_id' => DATA_TYPE_INTEGER,
	);
 
	function __construct() {
		parent::__construct('Chat', 'chats', true);
	} // __construct
 
	// -------------------------------------------------------
	//  Description methods
	// -------------------------------------------------------
 
	function getColumns() {
		return array_keys(self::$columns);
	} // getColumns
 
	function getColumnType($column_name) {
		if(isset(self::$columns[$column_name])) {
			return self::$columns[$column_name];
		} else {
			return DATA_TYPE_STRING;
		} // if
	} // getColumnType
 
	function getPkColumns() {
		return 'id';
	} // getPkColumns
 
	function getAutoIncrementColumn() {
		return 'id';
	} // getAutoIncrementColumn
 
	// -------------------------------------------------------
	//  Finders
	// -------------------------------------------------------
 
	function find($arguments = null) {
		if(isset($this) && instance_of($this, 'Chats')) {
			return parent::find($arguments);
		} else {
			return Chats::instance()->find($arguments);
		} // if
	} // find
 
	function findAll($arguments = null) {
		if(isset($this) && instance_of($this, 'Chats')) {
			return parent::findAll($arguments);
		} else {
			return Chats::instance()->findAll($arguments);
		} // if
	} // findAll
 
	function findOne($arguments = null) {
		if(isset($this) && instance_of($this, 'Chats')) {
			return parent::findOne($arguments);
		} else {
			return Chats::instance()->findOne($arguments);
		} // if
	} // findOne
 
	function findById($id, $force_reload = false) {
		if(isset($this) && instance_of($this, 'Chats')) {
			return parent::findById($id, $force_reload);
		} else {
			return Chats::instance()->findById($id, $force_reload);
			//$instance =& Chats::instance();
			//return $instance->findById($id, $force_reload);
		} // if
	} // findById
 
	function count($condition = null) {
		if(isset($this) && instance_of($this, 'Chats')) {
			return parent::count($condition);
		} else {
			return Chats::instance()->count($condition);
		} // if
	} // count
 
	function delete($condition = null) {
		if(isset($this) && instance_of($this, 'Chats')) {
			return parent::delete($condition);
		} else {
			return Chats::instance()->delete($condition);
		} // if
	} // delete
 
	function paginate($arguments = null, $items_per_page = 10, $current_page = 1) {
		if(isset($this) && instance_of($this, 'Chats')) {
			return parent::paginate($arguments, $items_per_page, $current_page);
		} else {
			return Chats::instance()->paginate($arguments, $items_per_page, $current_page);
		} // if
	} // paginate
 
	function instance() {
		static $instance;
		if(!instance_of($instance, 'Chats')) {
			$instance = new Chats();
		} // if
		return $instance;
	} // instance
 
} // BaseChats
?>

BaseChatLines.class.php

<?php
abstract class BaseChatLines extends ProjectDataObjects {
 
	static private $columns = array(
		'id' => DATA_TYPE_INTEGER,
		'chat_id' => DATA_TYPE_INTEGER,
		'sender_id' => DATA_TYPE_INTEGER,
		'text' => DATA_TYPE_STRING,
		'date' => DATA_TYPE_DATETIME,
 
		'created_on' => DATA_TYPE_DATETIME,
		'created_by_id' => DATA_TYPE_INTEGER,
		'updated_on' => DATA_TYPE_DATETIME,
		'updated_by_id' => DATA_TYPE_INTEGER,
		'trashed_on' => DATA_TYPE_DATETIME,
		'trashed_by_id' => DATA_TYPE_INTEGER,
	);
 
	function __construct() {
		parent::__construct('ChatLine', 'chat_lines', true);
	} // __construct
 
	// -------------------------------------------------------
	//  Description methods
	// -------------------------------------------------------
 
	function getColumns() {
		return array_keys(self::$columns);
	} // getColumns
 
	function getColumnType($column_name) {
		if(isset(self::$columns[$column_name])) {
			return self::$columns[$column_name];
		} else {
			return DATA_TYPE_STRING;
		} // if
	} // getColumnType
 
	function getPkColumns() {
		return 'id';
	} // getPkColumns
 
	function getAutoIncrementColumn() {
		return 'id';
	} // getAutoIncrementColumn
 
	// -------------------------------------------------------
	//  Finders
	// -------------------------------------------------------
 
	function find($arguments = null) {
		if(isset($this) && instance_of($this, 'ChatLines')) {
			return parent::find($arguments);
		} else {
			return ChatLines::instance()->find($arguments);
		} // if
	} // find
 
	function findAll($arguments = null) {
		if(isset($this) && instance_of($this, 'ChatLines')) {
			return parent::findAll($arguments);
		} else {
			return ChatLines::instance()->findAll($arguments);
		} // if
	} // findAll
 
	function findOne($arguments = null) {
		if(isset($this) && instance_of($this, 'ChatLines')) {
			return parent::findOne($arguments);
		} else {
			return ChatLines::instance()->findOne($arguments);
		} // if
	} // findOne
 
	function findById($id, $force_reload = false) {
		if(isset($this) && instance_of($this, 'ChatLines')) {
			return parent::findById($id, $force_reload);
		} else {
			return ChatLines::instance()->findById($id, $force_reload);
			//$instance =& ChatLines::instance();
			//return $instance->findById($id, $force_reload);
		} // if
	} // findById
 
	function count($condition = null) {
		if(isset($this) && instance_of($this, 'ChatLines')) {
			return parent::count($condition);
		} else {
			return ChatLines::instance()->count($condition);
		} // if
	} // count
 
	function delete($condition = null) {
		if(isset($this) && instance_of($this, 'ChatLines')) {
			return parent::delete($condition);
		} else {
			return ChatLines::instance()->delete($condition);
		} // if
	} // delete
 
	function paginate($arguments = null, $items_per_page = 10, $current_page = 1) {
		if(isset($this) && instance_of($this, 'ChatLines')) {
			return parent::paginate($arguments, $items_per_page, $current_page);
		} else {
			return ChatLines::instance()->paginate($arguments, $items_per_page, $current_page);
		} // if
	} // paginate
 
	function instance() {
		static $instance;
		if(!instance_of($instance, 'ChatLines')) {
			$instance = new ChatLines();
		} // if
		return $instance;
	} // instance
 
} // BaseChatLines
?>

BaseChat

<?php
 
abstract class BaseChat extends ProjectDataObject {
	protected $objectTypeIdentifier = 'ch';
 
	function getId() {
		return $this->getColumnValue('id');
	} // getId()
 
	function setId($value) {
		return $this->setColumnValue('id', $value);
	} // setId()
 
	function getName() {
		return $this->getColumnValue('name');
	} // getName()
 
	function setName($value) {
		return $this->setColumnValue('name', $value);
	} // setName()
 
	function getStartDate() {
		return $this->getColumnValue('start_date');
	} // getStartDate()
 
	function setStartDate($value) {
		return $this->setColumnValue('start_date', $value);
	} // setStartDate()
 
	function getEndDate() {
		return $this->getColumnValue('end_date');
	} // getEndDate()
 
	function setEndDate($value) {
		return $this->setColumnValue('end_date', $value);
	} // setEndDate()
 
	function manager() {
		if(!($this->manager instanceof Chats)) $this->manager = Chats::instance();
		return $this->manager;
	} // manager
 
} // BaseChat
?>

BaseChatLine

<?php
 
abstract class BaseChatLine extends ProjectDataObject {
 
	function getId() {
		return $this->getColumnValue('id');
	} // getId()
 
	function setId($value) {
		return $this->setColumnValue('id', $value);
	} // setId()
 
	function getChatId() {
		return $this->getColumnValue('chat_id');
	} // getChatId()
 
	function setChatId($value) {
		return $this->setColumnValue('chat_id', $value);
	} // setChatId()
 
	function getSenderId() {
		return $this->getColumnValue('sender_id');
	} // getSenderId()
 
	function setSenderId($value) {
		return $this->setColumnValue('sender_id', $value);
	} // setSenderId()
 
	function getText() {
		return $this->getColumnValue('text');
	} // getText()
 
	function setText($value) {
		return $this->setColumnValue('text', $value);
	} // setText()
 
	function getDate() {
		return $this->getColumnValue('date');
	} // getDate()
 
	function setDate($value) {
		return $this->setColumnValue('date', $value);
	} // setDate()
 
	function manager() {
		if(!($this->manager instanceof ChatLines)) $this->manager = ChatLines::instance();
		return $this->manager;
	} // manager
 
} // BaseChatLine
?>

Chats.class.php

<?php
class Chats extends BaseChats {
 
	function getOngoingChats() {
		$chats = $this->findAll(array(
			'condition' => array('`end_date` = ?',
				EMPTY_DATETIME
			),
			'orderby' => '`start_date` DESC'
		));
		if (is_array($chats)) {
			return $chats;
		} else {
			return array();
		}
	}
 
} // Chats
?>

Discussion

PLEASE NOTE: Comments to the wiki should only contain suggestions and questions that help us to improve the manual (and not the software). These comments will be deleted as soon as the information has been integrated into the manual.

Posts that do not contribute to the DOCUMENTATION of the project will be DELETED.

Ask QUESTIONS on the product here.
Report BUGS here.
Propose NEW FEATURES here.


Enter your comment
 
chat_application_source.txt · Last modified: 2013-02-27 18:06 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported


Terms of Service | Privacy and Security policies | Copyright © 2018 fengoffice.com