Example #1
0
 /**
  * get a list of all users data in the utente table
  * which verifies a given clause
  *
  * @access  public
  *
  * @param   $fields_list_ar - a list of fields to return
  * @param   $clause         - a clause to filter records
  *
  * @return  a refrerence to a 2-dim array,
  *           each row will have id_utente in the 0 element
  *           and the fields specified in the list in the others
  *          an AMA_Error object if something goes wrong
  *
  **/
 public function &find_users_list($fields_list_ar, $clause = "")
 {
     // logger("UserDataHandler::find_users_list entered", 3);
     $db =& parent::getConnection();
     if (AMA_DB::isError($db)) {
         return $db;
     }
     // build comma separated string out of $field_list_ar array
     $n_fields = count($fields_list_ar);
     if ($n_fields > 1) {
         $more_fields = ", " . implode(", ", $fields_list_ar);
     } elseif ($n_fields > 0) {
         $more_fields = ", " . $fields_list_ar[0];
     } else {
         $more_fields = "";
     }
     // add an 'and' on top of the clause
     // handle null clause, too
     if ($clause) {
         $clause = 'where ' . $clause;
     }
     // do the query
     $sql = "select id_utente{$more_fields} from utente {$clause}";
     // logger("performing query: $sql", 4);
     $users_ar = $db->getAll($sql);
     if (AMA_DB::isError($users_ar)) {
         //return $db;
         return new AMA_Error(AMA_ERR_GET);
     }
     // logger("query succeeded", 4);
     // return nested array in the form
     return $users_ar;
 }
Example #2
0
 function remove_allmessages_chatroom($id_chatroom)
 {
     $db =& parent::getConnection();
     if (AMA_DB::isError($db)) {
         return $db;
     }
     $sql1 = "delete from messaggi where id_chatroom={$id_chatroom}";
     $res = parent::executeCritical($sql1);
     if (AMA_DB::isError($res)) {
         return $res;
     }
 }
Example #3
0
 /**
  * (non-PHPdoc)
  * @see include/Abstract_AMA_DataHandler#__destruct()
  */
 public function __destruct()
 {
     parent::__destruct();
 }
     $videoroomObj->videoroom_info($sess_id_course_instance, $tempo_attuale);
     if ($videoroomObj->full) {
         $videoroomObj->serverLogin();
         if ($videoroomObj->login >= 0) {
             $videoroomObj->roomAccess($user_uname, $user_name, $user_surname, $user_mail, $sess_id_user, $id_profile);
             //            $videoroomObj->list_rooms();
         }
     } else {
         $status = addslashes(translateFN("Room not yet opened"));
         $options_Ar = array('onload_func' => "close_page('{$status}');");
     }
     break;
 case AMA_TYPE_TUTOR:
     $videoroomObj = videoroom::getVideoObj();
     $tempo_attuale = time();
     $creationDate = Abstract_AMA_DataHandler::ts_to_date($tempo_attuale);
     $videoroomObj->videoroom_info($sess_id_course_instance, $tempo_attuale);
     $videoroomObj->serverLogin();
     if ($videoroomObj->full) {
         if ($videoroomObj->login >= 0) {
             $videoroomObj->roomAccess($user_uname, $user_name, $user_surname, $user_mail, $sess_id_user, $id_profile, $sess_selected_tester);
             //            $videoroomObj->list_rooms();
         }
     } else {
         $room_name = $course_title . ' - ' . translateFN('Tutor') . ': ' . $user_uname . ' ' . translateFN('data') . ': ' . $creationDate;
         $comment = translateFN('inserimento automatico via') . ' ' . PORTAL_NAME;
         $numUserPerRoom = 4;
         $id_room = $videoroomObj->addRoom($room_name, $sess_id_course_instance, $sess_id_user, $comment, $numUserPerRoom, $course_title, $sess_selected_tester);
         if ($videoroomObj->login >= 0 && $id_room != false) {
             $videoroomObj->roomAccess($user_uname, $user_name, $user_surname, $user_mail, $sess_id_user, $id_profile);
         }
Example #5
0
 /**
  * remove permanently a message record from 'messaggi' table
  * or from 'destinatari_messaggi'
  * used in the rollback operations and in _clean_messages
  *
  * @access  private
  *
  * @param   $id  - id of the message to remove
  * @param   $rid - the recipient id
  *                 if the parameter is passed and not null, then
  *                 a row is removed from 'destinatari_messaggi' table
  *
  * @return  an AMA_Error object if something goes wrong
  *
  **/
 protected function _clean_message($id, $rid = 0)
 {
     // logger("entered Spool::_remove_message", 3);
     $db =& parent::getConnection();
     if (AMA_DB::isError($db)) {
         return $db;
     }
     if ($rid == 0) {
         // remove a row from table messaggi
         $sql = "delete from messaggi where id_messaggio={$id}";
         // logger("performing query: $sql", 4);
         /*
         $res = $db->query($sql);
         //           if (AMA_DB::isError($res) || $db->affectedRows()==0)  ??
         
         if (AMA_DB::isError($res) || $db->numCols()==0)
         return new AMA_Error(AMA_ERR_REMOVE);
         */
         $res = parent::executeCritical($sql);
         if (AMA_DB::isError($res)) {
             // $res is an AMA_Error object
             return $res;
         }
         // logger("query succeeded", 4);
     } else {
         // remove a row from table destinatari_messaggi
         $sql = "delete from destinatari_messaggi " . " where id_messaggio={$id} and id_utente={$rid}";
         // logger("performing query: $sql", 4);
         /*
         $res = $db->query($sql);
         if (AMA_DB::isError($res) || $db->affectedRows()==0)
         return new AMA_Error(AMA_ERR_REMOVE);
         */
         $res = parent::executeCritical($sql);
         if (AMA_DB::isError($res)) {
             // $res is an AMA_Error object
             return $res;
         }
         // logger("query succeeded", 4);
     }
 }