/**
  * delete ListTableDescription object from database
  * this function also deletes the ListTable that is connected to current object
  * @param string $title title of ListTableDescription
  * @return bool indicates if ListTableDescription has been deleted
  */
 function delete($title)
 {
     $this->_log->trace("deleting ListTableDescription from database (title=" . $title . ")");
     # create encoded_key_string
     $encoded_key_string = parent::_encode_key_string(LISTTABLEDESCRIPTION_TITLE_FIELD_NAME . "='" . $title . "'");
     if (parent::delete($encoded_key_string) == FALSE) {
         return FALSE;
     }
     # create key string for user_list_permissions
     $permission_key_string = USERLISTTABLEPERMISSIONS_LISTTABLE_TITLE_FIELD_NAME . "='" . $title . "'";
     if ($this->_user_list_permissions->delete($permission_key_string) == FALSE) {
         # copy error strings from user_list_permissions
         $this->error_message_str = $this->_user_list_permissions->get_error_message_str();
         $this->error_log_str = $this->_user_list_permissions->get_error_log_str();
         $this->error_str = $this->_user_list_permissions->get_error_str();
         return FALSE;
     }
     $this->_log->trace("deleted ListTableDescription (title=" . $title . ")");
     return TRUE;
 }
Ejemplo n.º 2
0
 /**
  * delete an existing ListTableItem from database
  * delete all connected ListTableNote objects
  * @param $encoded_key_string string unique identifier of ListTableItem to be deleted
  * @return bool indicates if ListTableItem has been deleted
  */
 function delete($encoded_key_string)
 {
     global $list_table_description;
     $this->_log->trace("deleting record from ListTable (encoded_key_string=" . $encoded_key_string . ")");
     # get the id of this record
     $record = self::select_record($encoded_key_string);
     if (count($record) == 0) {
         return FALSE;
     }
     $record_id = $record[DB_ID_FIELD_NAME];
     # delete all notes for all fields
     foreach ($this->db_field_names as $db_field_name) {
         if ($this->fields[$db_field_name][1] == FIELD_TYPE_DEFINITION_NOTES_FIELD) {
             if ($this->_list_table_note->delete_record_notes($record_id) == FALSE) {
                 # copy error strings from list_table_note
                 $this->error_message_str = $this->_list_table_note->get_error_message_str();
                 $this->error_log_str = $this->_list_table_note->get_error_log_str();
                 $this->error_str = $this->_list_table_note->get_error_str();
                 return FALSE;
             }
         }
     }
     # delete all attachments for this record
     if ($this->_list_table_attachment->delete_record_attachments($record_id) == FALSE) {
         # copy error strings from list_table_note
         $this->error_message_str = $this->_list_table_attachment->get_error_message_str();
         $this->error_log_str = $this->_list_table_attachment->get_error_log_str();
         $this->error_str = $this->_list_table_attachment->get_error_str();
         return FALSE;
     }
     # delete record
     if (parent::delete($encoded_key_string) == FALSE) {
         return FALSE;
     }
     # update list table description
     if ($this->_update_list_table_description_statistics() == FALSE) {
         return FALSE;
     }
     $this->_log->trace("deleted record from ListTable");
     return TRUE;
 }
Ejemplo n.º 3
0
 /**
  * delete a user from database
  * @param $encoded_key_string string unique identifier of user
  * @return bool indicates if user has been deleted
  */
 function delete($encoded_key_string)
 {
     $this->_log->trace("delete user (encoded_key_string=" . $encoded_key_string . ")");
     # first get the user name
     $user_array = $this->select_record($encoded_key_string);
     if (count($user_array) == 0) {
         return FALSE;
     }
     $user_name = $user_array[USER_NAME_FIELD_NAME];
     # delete the user
     if (parent::delete($encoded_key_string) == FALSE) {
         return FALSE;
     }
     # create key string for user_list_permissions
     $permission_key_string = USERLISTTABLEPERMISSIONS_USER_NAME_FIELD_NAME . "='" . $user_name . "'";
     if ($this->_user_list_permissions->delete($permission_key_string) == FALSE) {
         # copy error strings from user_list_permissions
         $this->error_message_str = $this->_user_list_permissions->get_error_message_str();
         $this->error_log_str = $this->_user_list_permissions->get_error_log_str();
         $this->error_str = $this->_user_list_permissions->get_error_str();
         return FALSE;
     }
     $this->_log->info("user deleted (encoded_key_string=" . $encoded_key_string . ")");
     return TRUE;
 }
 /**
  * delete specific user permissions
  * this function is used to check if a user has list permissions
  * @param $key_string string permissions key string
  * @return bool indicates if record has been deleted
  */
 function delete($key_string)
 {
     $this->_log->trace("delete user list permissions (key_string={$key_string})");
     # rerurn TRUE when database has not yet been created
     if (!$this->_database->table_exists($this->table_name)) {
         $this->_log->warn("table does not exist");
         return TRUE;
     }
     # call parent delete
     if (parent::delete($key_string) == FALSE) {
         return FALSE;
     }
     $this->_log->trace("deleted user list permissions");
     return TRUE;
 }