Source for file SysMessage.class.php

Documentation is available at SysMessage.class.php

  1. <?php
  2. /**
  3.  * Class SysMessage, just a method to set sys messages
  4.  *
  5.  * LICENSE: CREATIVE COMMONS PUBLIC LICENSE  "Namensnennung — Nicht-kommerziell 2.0"
  6.  *
  7.  * @copyright  2009 <SEDesign />
  8.  * @license    http://creativecommons.org/licenses/by-nc/2.0/de/
  9.  * @version    $3.0.6$
  10.  * @link       http://www.sedesign.de/de_produkte_chat-v3.html
  11.  * @since      File available since Alpha 1.0
  12.  */
  13.  
  14. class SysMessage extends EtChatConfig
  15. {
  16.     
  17.     /**
  18.     * DB-Connection Obj
  19.     * @var ConnectDB 
  20.     */
  21.     protected $dbObj;
  22.     
  23.     /**
  24.     * Last ID from an inserted message into db
  25.     * @var int 
  26.     */
  27.     public $lastInsertedId;
  28.     
  29.     /**
  30.     * Constructor
  31.     *
  32.     * @param  ConnectDB $dbObj, Obj with the db connection handler
  33.     * @param  string $message, message text
  34.     * @param  int $room_fid, room id (0= at all rooms)
  35.     * @param  int $privat, user id (0= at all user in this room)
  36.     * @uses ConnectDB::sqlSet()
  37.     * @uses ConnectDB::$lastId
  38.     * @return int, the inserted message dataset id from db
  39.     */
  40.     public function __construct ($dbObj$message$room_fid$privat){    
  41.         
  42.         // call parent Constructor from class EtChatConfig
  43.         parent::__construct();
  44.         
  45.         $dbObj->sqlSet("INSERT INTO {$this->_prefix}etchat_messages ( etchat_user_fid, etchat_text, etchat_text_css, etchat_timestamp, etchat_fid_room, etchat_privat)
  46.         VALUES ( 1, '".$message."', 'color:#".$_SESSION['etchat_'.$this->_prefix.'syscolor'].";font-weight:normal;font-style:normal;', '".date('U')."', ".$room_fid.", ".$privat.")");
  47.         
  48.         // unfortunately the PDO::lastInsertId() just works on MySQL and SQLITE, but not on PGSQL
  49.         if (!empty($dbObj->lastId)) $this->lastInsertedId = $dbObj->lastId;
  50.         else {
  51.             $lastID = $dbObj->sqlGet("SELECT max(etchat_id) from {$this->_prefix}etchat_messages");
  52.             $this->lastInsertedId = $lastID[0][0];
  53.         }
  54.     }

Documentation generated on Tue, 22 Dec 2009 09:42:52 +0100 by phpDocumentor 1.4.1