/** * Load multiple NoteDBO's from database * * @param string $filter A WHERE clause * @param string $sortby Field name to sort results by * @param string $sortdir Direction to sort in (ASEC or DESC) * @param int $limit Limit the number of results * @param int $start Record number to start the results at * @return array Array of NoteDBO's */ function &load_array_NoteDBO($filter = null, $sortby = null, $sortdir = null, $limit = null, $start = null) { $DB = DBConnection::getDBConnection(); // Build query $sql = $DB->build_select_sql("note", "*", $filter, $sortby, $sortdir, $limit, $start); // Run query if (!($result = @mysql_query($sql, $DB->handle()))) { // Query error throw new DBException(mysql_error($DB->handle())); } if (mysql_num_rows($result) == 0) { // No rows found throw new DBNoRowsFoundException(); } // Build an array of DBOs from the result set $dbo_array = array(); while ($data = mysql_fetch_array($result)) { // Create and initialize a new DBO with the data from the DB $dbo = new NoteDBO(); $dbo->load($data); // Add DomainServiceDBO to array $dbo_array[] = $dbo; } return $dbo_array; }
/** * Add Note * * Attach a note to this account */ function add_note() { // Extract UserDBO of client $user_dbo = $_SESSION['client']['userdbo']; // Create a new NoteDBO $note_dbo = new NoteDBO(); $note_dbo->setAccountID($this->get['account']->getID()); $note_dbo->setUsername($user_dbo->getUsername()); $note_dbo->setText($this->post['text']); // Add NoteDBO to database add_NoteDBO($note_dbo); // Account added - clear form data from session unset($this->session['view_account_note']); $this->setMessage(array("type" => "[NOTE_ADDED]")); $this->reload(); }