示例#1
0
 public function &find_messages($fields_list = "", $clause = "", $ordering = "")
 {
     // cleaning (don't bother on errors)
     $this->clean();
     // vito, 26 settembre 2008
     // check if fields_list is a numeric value: in this case, it's a time interval
     // TODO: se e' un valore numerico, allora deve essere l'id dell'ultimo messaggio
     // ricevuto
     if (is_numeric($fields_list)) {
         return $this->new_find_messages($fields_list);
     }
     $id_chatroom = $this->id_chatroom;
     /*
     $user_id= $this->user_id;
     // getting the time that users joined the chatroom
     $et = "select tempo_entrata from utente_chatroom where id_utente=$user_id and id_chatroom=$id_chatroom";
     $entrance_time = $db->getOne($et);
     
     print_r($et);
     print_r($entrance_time);
     */
     // in this spool are retrieved all the messages of the chatroom where the user
     // takes part and are inserted after his entrance into the chatroom.
     $basic_clause = "id_group={$id_chatroom}";
     if ($clause == "") {
         $clause = $basic_clause;
     } else {
         $clause .= " and {$basic_clause}";
     }
     // call the parent's find_messages (without clean)
     $res = parent::find_messages($fields_list, $clause, $ordering);
     //    if (AMA_DataHandler::isError($res)) {
     //      // $res is an AMA_Error
     //      return $res;
     //    }
     // $res can be an AMA_Error object or the messages list
     return $res;
 }