本文整理匯總了PHP中MetabaseFetchResult函數的典型用法代碼示例。如果您正苦於以下問題:PHP MetabaseFetchResult函數的具體用法?PHP MetabaseFetchResult怎麽用?PHP MetabaseFetchResult使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了MetabaseFetchResult函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get
/**
* Checkin::get()
*
* This function returns a list of guests not checked in yet.
*
* @return array guests
* @access public
* @since 2003-09-02
* @author Christian Ehret <chris@uffbasse.de>
*/
function get()
{
global $gDatabase, $tbl_booking, $tbl_guest, $tbl_booking_detail, $tbl_booking_detail_guest, $errorhandler;
$guests = array();
$query = "SELECT pk_booking_id, fk_guest_id, firstname, lastname, " . "DATE_FORMAT({$tbl_booking}.start_date, '%d.%m.%Y'), " . "DATE_FORMAT({$tbl_booking}.end_date, '%d.%m.%Y'), " . "pk_booking_detail_id " . sprintf("FROM {$tbl_booking}, {$tbl_guest}, {$tbl_booking_detail} " . "WHERE checked_in = %s " . "AND {$tbl_booking}.start_date <= NOW() " . "AND pk_guest_id = fk_guest_id " . "AND pk_booking_id = fk_booking_id " . "AND ISNULL({$tbl_booking}.deleted_date) " . "ORDER BY lastname", MetabaseGetBooleanFieldValue($gDatabase, false));
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'Checkin::get()', $query);
} else {
$row = 0;
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
$color = 0;
if ($row % 2 != 0) {
$color = 1;
}
$guests[$row] = array('bookingid' => MetabaseFetchResult($gDatabase, $result, $row, 0), 'guestid' => MetabaseFetchResult($gDatabase, $result, $row, 1), 'firstname' => MetabaseFetchResult($gDatabase, $result, $row, 2), 'lastname' => MetabaseFetchResult($gDatabase, $result, $row, 3), 'startdate' => MetabaseFetchResult($gDatabase, $result, $row, 4), 'enddate' => MetabaseFetchResult($gDatabase, $result, $row, 5), 'bookingdetailid' => MetabaseFetchResult($gDatabase, $result, $row, 6), 'color' => $color);
}
}
return $guests;
}
示例2: getall
/**
* Category::getall()
*
* This function returns all users.
*
* @return array users
* @access public
* @since 2003-07-24
* @author Christian Ehret <chris@uffbasse.de>
*/
function getall()
{
global $gDatabase2, $tbl_user, $request, $errorhandler;
$user = array();
$query = sprintf("SELECT pk_user_id, lastname, firstname, login \n\t\t FROM {$tbl_user} \n\t\t\t\t\t\t WHERE fk_hotel_id = %s \n\t\t\t\t\t\t AND ISNULL(deleted_date)\n\t\t\t\t\t\t ORDER BY lastname ", $request->GetVar('hotelid', 'session'));
$result = MetabaseQuery($gDatabase2, $query);
if (!$result) {
$errorhandler->display('SQL', 'Guest::quickinsert()', $query);
} else {
$row = 0;
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase2, $result)) == 0; ++$row) {
$color = 0;
if ($row % 2 != 0) {
$color = 1;
}
$user[$row] = array('userid' => MetabaseFetchResult($gDatabase2, $result, $row, 0), 'lastname' => MetabaseFetchResult($gDatabase2, $result, $row, 1), 'firstname' => MetabaseFetchResult($gDatabase2, $result, $row, 2), 'login' => MetabaseFetchResult($gDatabase2, $result, $row, 3), 'color' => $color);
}
}
return $user;
}
示例3: getall
/**
* Category::getall()
*
* This function returns all categories.
*
* @return array
* @access public
* @since 2003-07-24
* @author Christian Ehret <chris@uffbasse.de>
*/
function getall()
{
global $gDatabase, $tbl_paycat, $errorhandler, $request;
$cat = array();
$query = "SELECT pk_paycat_id, paycat\n\t\t FROM {$tbl_paycat}\n\t\t\t\t WHERE ISNULL(fk_deleted_user_id) \n\t\t\t\t ORDER BY paycat";
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'PayCategory::getall()', $query);
} else {
$row = 0;
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
$color = 0;
if ($row % 2 != 0) {
$color = 1;
}
$cat[$row] = array('catid' => MetabaseFetchResult($gDatabase, $result, $row, 0), 'cat' => MetabaseFetchResult($gDatabase, $result, $row, 1), 'color' => $color);
}
}
return $cat;
}
示例4: get
/**
* bcat::get()
*
* get all categories
*
* @return array booking categories
* @access public
* @since 2003-07-24
* @author Christian Ehret <chris@uffbasse.de>
*/
function get()
{
global $gDatabase, $tbl_bookingcat, $errorhandler, $request;
$bcat = array();
$query = "SELECT pk_bookingcat_id, bookingcat, color, description, days \n\t\t\t\t FROM {$tbl_bookingcat} \n\t\t\t\t WHERE ISNULL(fk_deleted_user_id)\n\t\t\t\t ORDER BY bookingcat ";
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'BookingCategory::getall()', $query);
} else {
$row = 0;
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
$color = 0;
if ($row % 2 != 0) {
$color = 1;
}
$bcat[$row] = array('bcatid' => MetabaseFetchResult($gDatabase, $result, $row, 0), 'name' => MetabaseFetchResult($gDatabase, $result, $row, 1), 'catcolor' => MetabaseFetchResult($gDatabase, $result, $row, 2), 'description' => MetabaseFetchResult($gDatabase, $result, $row, 3), 'days' => MetabaseFetchResult($gDatabase, $result, $row, 4), 'color' => $color);
}
}
return $bcat;
}
示例5: getall
/**
* Barguestcat::getall()
*
* This function returns all barguestcategories.
*
* @return array articles
* @access public
* @since 2006-02-17
* @author Christian Ehret <chris@uffbasse.de>
*/
function getall()
{
global $gDatabase2, $tbl_barguestcat, $request, $errorhandler;
$barguestcat = array();
$query = "SELECT pk_barguestcat_id, barguestcat\n\t\t FROM {$tbl_barguestcat}\n\t\t\t\t\t\t WHERE ISNULL(deleted_date)\n\t\t\t\t\t\t ORDER BY barguestcat ";
$result = MetabaseQuery($gDatabase2, $query);
if (!$result) {
$errorhandler->display('SQL', 'Barguestcat::getall()', $query);
} else {
$row = 0;
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase2, $result)) == 0; ++$row) {
$color = 0;
if ($row % 2 != 0) {
$color = 1;
}
$barguestcat[$row] = array('barguestcatid' => MetabaseFetchResult($gDatabase2, $result, $row, 0), 'barguestcat' => MetabaseFetchResult($gDatabase2, $result, $row, 1), 'color' => $color);
}
}
return $barguestcat;
}
示例6: get
/**
* Archive::get()
*
* This function returns the archived sql and depending on the parameters deletes data.
*
* @param timestamp $thedate date till data should be archived
* @param boolean $delete deletes the data if true
* @return string $output
* @access public
* @since 2004-07-09
* @author Christian Ehret <chris@uffbasse.de>
*/
function get($thedate, $delete)
{
global $gDatabase, $tbl_bought, $tbl_bararticle, $tbl_barguest, $request, $errorhandler;
$output = "/*Archiv bis {$thedate}*/\n";
$output1 = "/*{$tbl_bought}*/\n";
$output2 = "/*{$tbl_bararticle}*/\n";
$output3 = "/*{$tbl_barguest}*/\n";
list($day, $month, $year) = split('[.]', $thedate);
$thedate = "{$year}-{$month}-{$day} 23:59:59";
$query = "SELECT pk_bought_id, fk_barguest_id, fk_bararticle_id, timestamp, num,\n\t\t paid, inserted_date, fk_inserted_user_id, updated_date, fk_updated_user_id\n\t\t FROM {$tbl_bought}\n\t\t WHERE timestamp <= '{$thedate}'";
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'Archive::get()', $query);
} else {
$guestids = array();
$articleids = array();
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
if (!in_array(MetabaseFetchResult($gDatabase, $result, $row, 1), $guestids)) {
array_push($guestids, MetabaseFetchResult($gDatabase, $result, $row, 1));
}
if (!in_array(MetabaseFetchResult($gDatabase, $result, $row, 2), $articleids)) {
array_push($articleids, MetabaseFetchResult($gDatabase, $result, $row, 2));
}
$output1 .= "\n";
$output1 .= "DELETE FROM {$tbl_bought} WHERE pk_bought_id = " . MetabaseFetchResult($gDatabase, $result, $row, 0) . ";";
$output1 .= "\n";
$output1 .= sprintf("INSERT INTO {$tbl_bought} (pk_bought_id, fk_barguest_id, fk_bararticle_id, timestamp, num, paid, inserted_date, fk_inserted_user_id, updated_date, fk_updated_user_id) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s);", $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 0), 'no'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 1), 'no'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 2), 'no'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 3), 'yesifnotnull'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 4), 'no'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 5), 'yes'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 6), 'yesifnotnull'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 7), 'no'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 8), 'yesifnotnull'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 9), 'no'));
if ($delete) {
$query = "DELETE FROM {$tbl_bought} WHERE pk_bought_id = " . MetabaseFetchResult($gDatabase, $result, $row, 0);
$result2 = MetabaseQuery($gDatabase, $query);
if (!$result2) {
$errorhandler->display('SQL', 'Archive::get()', $query);
}
}
}
for ($i = 0; $i < count($articleids); $i++) {
$query = "SELECT pk_bararticle_id, description, price, hotkey, inserted_date,\n\t\t\t\t fk_inserted_user_id, updated_date, fk_updated_user_id, deleted_date, fk_deleted_user_id\n\t\t\t\t\t\t FROM {$tbl_bararticle} WHERE pk_bararticle_id = {$articleids[$i]}";
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'Archive::get()', $query);
} else {
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
$output2 .= "\n";
$output2 .= "DELETE FROM {$tbl_bararticle} WHERE pk_bararticle_id = " . MetabaseFetchResult($gDatabase, $result, $row, 0) . ";";
$output2 .= "\n";
$output2 .= sprintf("INSERT INTO {$tbl_bararticle} (pk_bararticle_id, description, price, hotkey, inserted_date, fk_inserted_user_id, updated_date, fk_updated_user_id, deleted_date, fk_deleted_user_id) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s); ", $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 0), 'no'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 1), 'yes'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 2), 'yes'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 3), 'yes'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 4), 'yesifnotnull'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 5), 'no'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 6), 'yesifnotnull'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 7), 'no'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 8), 'yesifnotnull'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 9), 'no'));
}
}
}
for ($i = 0; $i < count($guestids); $i++) {
$query = "SELECT pk_barguest_id, firstname, lastname, inserted_date,\n\t\t\t\t fk_inserted_user_id, updated_date, fk_updated_user_id, deleted_date, fk_deleted_user_id\n\t\t\t\t\t\t FROM {$tbl_barguest} WHERE pk_barguest_id = {$guestids[$i]}";
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'Archive::get()', $query);
} else {
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
$output3 .= "\n";
$output3 .= "DELETE FROM {$tbl_barguest} WHERE pk_barguest_id = " . MetabaseFetchResult($gDatabase, $result, $row, 0) . ";";
$output3 .= "\n";
$output3 .= sprintf("INSERT INTO {$tbl_barguest} (pk_barguest_id, firstname, lastname, inserted_date, fk_inserted_user_id, updated_date, fk_updated_user_id, deleted_date, fk_deleted_user_id) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s); ", $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 0), 'no'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 1), 'yes'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 2), 'yes'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 3), 'yesifnotnull'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 4), 'no'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 5), 'yesifnotnull'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 6), 'no'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 7), 'yesifnotnull'), $this->nullifempty(MetabaseFetchResult($gDatabase, $result, $row, 8), 'no'));
}
}
}
$output .= $output2 . "\n\n" . $output3 . "\n\n" . $output1;
}
return $output;
}
示例7: getall2
/**
* Category::getall2()
*
* This function returns all employees from all hotels.
*
* @return array employees
* @access public
* @since 2004-10-03
* @author Christian Ehret <chris@uffbasse.de>
*/
function getall2()
{
global $gDatabase2, $tbl_employee, $request, $errorhandler;
$user = array();
$query = "SELECT pk_employee_id, lastname, firstname, login, salary \n\t\t FROM {$tbl_employee} \n\t\t\t\t\t\t WHERE ISNULL(deleted_date)\n\t\t\t\t\t\t ORDER BY login";
$result = MetabaseQuery($gDatabase2, $query);
if (!$result) {
$errorhandler->display('SQL', 'Employee::getall2()', $query);
} else {
$row = 0;
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase2, $result)) == 0; ++$row) {
$color = 0;
if ($row % 2 != 0) {
$color = 1;
}
$user[$row] = array('userid' => MetabaseFetchResult($gDatabase2, $result, $row, 0), 'lastname' => MetabaseFetchResult($gDatabase2, $result, $row, 1), 'firstname' => MetabaseFetchResult($gDatabase2, $result, $row, 2), 'login' => MetabaseFetchResult($gDatabase2, $result, $row, 3), 'salary' => MetabaseFetchResult($gDatabase2, $result, $row, 4), 'color' => $color);
}
}
return $user;
}
示例8: getname
/**
* room::getname()
*
* get the name of a room
*
* @param number $roomid room id
* @return string room name
* @access public
* @since 2003-07-24
* @author Christian Ehret <chris@uffbasse.de>
*/
function getname($roomid)
{
global $gDatabase, $request, $tbl_room, $errorhandler;
$query = sprintf("SELECT room FROM {$tbl_room} WHERE pk_room_id = %s", $roomid);
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'room::getname()', $query);
} else {
return MetabaseFetchResult($gDatabase, $result, 0, 0);
}
}
示例9: saveupdatePeriod
/**
* Article::saveupdatePeriod
*
* Save period as new or update existing one
*
* @access public
* @since 2004-12-13
* @author Christian Ehret <chris@uffbasse.de>
*/
function saveupdatePeriod()
{
global $gDatabase, $request, $tbl_period, $tbl_bararticle, $errorhandler;
$periodid = $request->GetVar('frm_theperiodid', 'post');
$active = false;
$auto_commit = false;
$success = MetabaseAutoCommitTransactions($gDatabase, $auto_commit);
if ($request->GetVar('frm_periodact', 'post') == 'true') {
$active = true;
$query = sprintf("UPDATE {$tbl_period} SET \n\t\t\t\t\t\t\t active = %s,\n\t\t\t\t\t\t\t updated_date = NOW(), \n\t\t\t\t\t\t\t fk_updated_user_id = %s ", MetabaseGetBooleanFieldValue($gDatabase, false), $request->GetVar('uid', 'session'));
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$success = MetabaseRollbackTransaction($gDatabase);
$errorhandler->display('SQL', 'Article::saveupdatePeriod()', $query);
}
}
// update
if ($periodid !== '-1') {
$query = sprintf("UPDATE {$tbl_period} SET \n\t\t\t period = %s, \n\t\t\t\t\t\t\t active = %s,\n\t\t\t\t\t\t\t updated_date = NOW(), \n\t\t\t\t\t\t\t fk_updated_user_id = %s \n\t\t\t\t\t\t\t WHERE pk_period_id = %s ", MetabaseGetTextFieldValue($gDatabase, $request->GetVar('frm_perioddesc', 'post')), MetabaseGetBooleanFieldValue($gDatabase, $active), $request->GetVar('uid', 'session'), $periodid);
} else {
// new
$name = "zvs_pk_period_id";
$sequence = MetabaseGetSequenceNextValue($gDatabase, $name, &$periodid);
$query = sprintf("INSERT INTO {$tbl_period}\n\t\t\t (pk_period_id, period, active, inserted_date, fk_inserted_user_id, updated_date, fk_updated_user_id)\n\t\t\t\t\t\t\t VALUES (%s, %s, %s, NOW(), %s, NULL, NULL )", $periodid, MetabaseGetTextFieldValue($gDatabase, $request->GetVar('frm_perioddesc', 'post')), MetabaseGetBooleanFieldValue($gDatabase, $active), $request->GetVar('uid', 'session'));
}
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$success = MetabaseRollbackTransaction($gDatabase);
$errorhandler->display('SQL', 'Article::saveupdatePeriod()', $query);
} else {
if ($request->GetVar('frm_cpyperiod', 'post') != -1) {
$query = "SELECT fk_bararticlecat_id, description, price, hotkey\n\t\t\t\t\t FROM {$tbl_bararticle} \n\t\t\t\t\t WHERE ISNULL(deleted_date) AND\n\t\t\t\t\t fk_period_id = " . $request->GetVar('frm_cpyperiod', 'post');
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$success = MetabaseRollbackTransaction($gDatabase);
$errorhandler->display('SQL', 'Article::saveupdatePeriod()', $query);
}
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
$name = "zvs_pk_bararticle_id";
$sequence = MetabaseGetSequenceNextValue($gDatabase, $name, &$bararticleid);
$query = sprintf("INSERT INTO {$tbl_bararticle} \n\t\t\t\t\t (pk_bararticle_id, fk_period_id, fk_bararticlecat_id,\n\t\t\t\t\t\t\t description, price, hotkey, inserted_date, \n\t\t\t\t\t\t\t fk_inserted_user_id)\n\t\t\t\t\t\t\t VALUES (%s, %s, %s, %s, %s, %s, NOW(), %s) ", $bararticleid, $periodid, MetabaseFetchResult($gDatabase, $result, $row, 0), MetabaseGetTextFieldValue($gDatabase, MetabaseFetchResult($gDatabase, $result, $row, 1)), MetabaseGetTextFieldValue($gDatabase, MetabaseFetchResult($gDatabase, $result, $row, 2)), MetabaseGetTextFieldValue($gDatabase, MetabaseFetchResult($gDatabase, $result, $row, 3)), $request->GetVar('uid', 'session'));
$result2 = MetabaseQuery($gDatabase, $query);
if (!$result2) {
$success = MetabaseRollbackTransaction($gDatabase);
$errorhandler->display('SQL', 'Article::saveupdatePeriod()', $query);
}
}
}
$success = MetabaseCommitTransaction($gDatabase);
// end transaction
$auto_commit = true;
$success = MetabaseAutoCommitTransactions($gDatabase, $auto_commit);
}
return $periodid;
}
示例10: sprintf
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Get a list of all guests with firstname beginning with a proper string
*
* Guest
*
* @since 2006-02-24
* @author Christian Ehret <chris@ehret.name>
*/
include_once "../includes/default.inc.php";
$auth->is_authenticated();
if ($_POST['autocomplete']) {
$entry = $_POST['autocomplete'];
echo '<ul>';
$query = sprintf("SELECT lastname, firstname, pk_guest_id FROM {$tbl_guest} \n\t\t WHERE firstname LIKE '%s%%' AND ISNULL(deleted_date)\n\t\t ORDER BY lastname LIMIT 25", $entry);
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
} else {
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
echo "<li id=\"" . MetabaseFetchResult($gDatabase, $result, $row, 0) . "\"><span class=\"informal\">" . MetabaseFetchResult($gDatabase, $result, $row, 0) . ", </span>" . MetabaseFetchResult($gDatabase, $result, $row, 1) . "</li>";
}
}
echo '</ul>';
}
?>
示例11: asearch
/**
* Guest::asearch()
*
* search adresses for a guest
*
* @param string $firstname firstname
* @param string $lastname lastname
* @return array guest data
* @access public
* @since 2003-07-24
* @author Christian Ehret <chris@uffbasse.de>
*/
function asearch($firstname, $lastname)
{
global $gDatabase, $tbl_guest, $tbl_address, $tbl_guest_address, $tbl_country, $tbl_booking, $tbl_booking_detail_guest, $tbl_booking_detail, $errorhandler, $request;
$guest = array();
$query = "SELECT g.pk_guest_id, \n\t\t\t\t IF ( g.firstname = '' OR g.firstname IS NULL , '-', g.firstname )firstname, \n\t\t\t\t g.lastname, \n\t\t\t\t IF ( g.company = '' OR g.company IS NULL , '-', g.company )company \n\t\t\t\t FROM {$tbl_guest} g ";
if ($firstname != "" or $lastname != "") {
$query .= "WHERE ";
}
if ($firstname != "") {
$query .= "firstname LIKE '%" . $firstname . "%' ";
}
if ($firstname != "" and $lastname != "") {
$query .= "AND ";
}
if ($lastname != "") {
$query .= "lastname LIKE '%" . $lastname . "%' ";
}
$query .= "GROUP BY g.pk_guest_id ";
$query .= "ORDER BY lastname, firstname ";
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'Guest::asearch()', $query);
} else {
$row = 0;
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
unset($addresses);
$query = "SELECT pk_fk_address_id, address_type FROM {$tbl_guest_address} WHERE pk_fk_guest_id = " . MetabaseFetchResult($gDatabase, $result, $row, 0);
$result2 = MetabaseQuery($gDatabase, $query);
if (!$result2) {
$errorhandler->display('SQL', 'Guest::asearch()', $query);
}
for ($row2 = 0; ($eor = MetabaseEndOfResult($gDatabase, $result2)) == 0; ++$row2) {
$addresses[$row2] = $this->getAddress(MetabaseFetchResult($gDatabase, $result2, $row2, 0), MetabaseFetchResult($gDatabase, $result2, $row2, 1));
}
$color = 0;
if ($row % 2 != 0) {
$color = 1;
}
$guest[$row] = array('guestid' => MetabaseFetchResult($gDatabase, $result, $row, 0), 'firstname' => MetabaseFetchResult($gDatabase, $result, $row, 1), 'lastname' => MetabaseFetchResult($gDatabase, $result, $row, 2), 'company' => MetabaseFetchResult($gDatabase, $result, $row, 3), 'addresses' => $addresses, 'color' => $color);
}
}
return $guest;
}
示例12: getall
/**
* price::getall()
*
* get all prices
*
* @param char $price_type price type 'N' normal 'A' advanced
* @access public
* @return array prices
* @since 2004-01-01
* @author Christian Ehret <chris@uffbasse.de>
*/
function getall($price_type)
{
global $gDatabase, $request, $tbl_price, $tbl_price2, $errorhandler;
$prices = array();
if ($price_type == 'N') {
$query = "SELECT fk_roomcat_id, fk_bookingcat_id, fk_season_id,\n\t\t\t\t price_person, price_children, price_absolute, price_type,\n\t\t\t\t price_person_short, price_children_short, price_absolute_short,\n\t\t\t\t price_children2, price_children2_short, price_children3, price_children3_short\n\t\t\t\t FROM {$tbl_price} ";
$result = MetabaseQuery($gDatabase, $query);
if ($result) {
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
$prices[MetabaseFetchResult($gDatabase, $result, $row, 2)][MetabaseFetchResult($gDatabase, $result, $row, 0)][MetabaseFetchResult($gDatabase, $result, $row, 1)]['person'] = MetabaseFetchResult($gDatabase, $result, $row, 3);
$prices[MetabaseFetchResult($gDatabase, $result, $row, 2)][MetabaseFetchResult($gDatabase, $result, $row, 0)][MetabaseFetchResult($gDatabase, $result, $row, 1)]['children'] = MetabaseFetchResult($gDatabase, $result, $row, 4);
$prices[MetabaseFetchResult($gDatabase, $result, $row, 2)][MetabaseFetchResult($gDatabase, $result, $row, 0)][MetabaseFetchResult($gDatabase, $result, $row, 1)]['absolute'] = MetabaseFetchResult($gDatabase, $result, $row, 5);
$prices[MetabaseFetchResult($gDatabase, $result, $row, 2)][MetabaseFetchResult($gDatabase, $result, $row, 0)][MetabaseFetchResult($gDatabase, $result, $row, 1)]['type'] = MetabaseFetchResult($gDatabase, $result, $row, 6);
$prices[MetabaseFetchResult($gDatabase, $result, $row, 2)][MetabaseFetchResult($gDatabase, $result, $row, 0)][MetabaseFetchResult($gDatabase, $result, $row, 1)]['person_short'] = MetabaseFetchResult($gDatabase, $result, $row, 7);
$prices[MetabaseFetchResult($gDatabase, $result, $row, 2)][MetabaseFetchResult($gDatabase, $result, $row, 0)][MetabaseFetchResult($gDatabase, $result, $row, 1)]['children_short'] = MetabaseFetchResult($gDatabase, $result, $row, 8);
$prices[MetabaseFetchResult($gDatabase, $result, $row, 2)][MetabaseFetchResult($gDatabase, $result, $row, 0)][MetabaseFetchResult($gDatabase, $result, $row, 1)]['absolute_short'] = MetabaseFetchResult($gDatabase, $result, $row, 9);
$prices[MetabaseFetchResult($gDatabase, $result, $row, 2)][MetabaseFetchResult($gDatabase, $result, $row, 0)][MetabaseFetchResult($gDatabase, $result, $row, 1)]['children2'] = MetabaseFetchResult($gDatabase, $result, $row, 10);
$prices[MetabaseFetchResult($gDatabase, $result, $row, 2)][MetabaseFetchResult($gDatabase, $result, $row, 0)][MetabaseFetchResult($gDatabase, $result, $row, 1)]['children2_short'] = MetabaseFetchResult($gDatabase, $result, $row, 11);
$prices[MetabaseFetchResult($gDatabase, $result, $row, 2)][MetabaseFetchResult($gDatabase, $result, $row, 0)][MetabaseFetchResult($gDatabase, $result, $row, 1)]['children3'] = MetabaseFetchResult($gDatabase, $result, $row, 12);
$prices[MetabaseFetchResult($gDatabase, $result, $row, 2)][MetabaseFetchResult($gDatabase, $result, $row, 0)][MetabaseFetchResult($gDatabase, $result, $row, 1)]['children3_short'] = MetabaseFetchResult($gDatabase, $result, $row, 13);
}
}
if ($request->GetVar('debug', 'get') == 'true') {
print $query;
print '<br><br>';
print '<pre>';
print_r($result);
print '</pre><br><br>';
print '<pre>';
print_r($prices);
print '</pre>';
}
} else {
$query = "SELECT fk_roomcat_id, fk_bookingcat_id, fk_season_id,\n\t\t\t\t price, price_short, persons_included, price_additional,\n\t\t\t\t price_short_additional\n\t\t\t\t FROM {$tbl_price2} ";
$result = MetabaseQuery($gDatabase, $query);
if ($result) {
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
$prices[MetabaseFetchResult($gDatabase, $result, $row, 2)][MetabaseFetchResult($gDatabase, $result, $row, 0)][MetabaseFetchResult($gDatabase, $result, $row, 1)]['price'] = MetabaseFetchResult($gDatabase, $result, $row, 3);
$prices[MetabaseFetchResult($gDatabase, $result, $row, 2)][MetabaseFetchResult($gDatabase, $result, $row, 0)][MetabaseFetchResult($gDatabase, $result, $row, 1)]['price_short'] = MetabaseFetchResult($gDatabase, $result, $row, 4);
$prices[MetabaseFetchResult($gDatabase, $result, $row, 2)][MetabaseFetchResult($gDatabase, $result, $row, 0)][MetabaseFetchResult($gDatabase, $result, $row, 1)]['person'] = MetabaseFetchResult($gDatabase, $result, $row, 5);
$prices[MetabaseFetchResult($gDatabase, $result, $row, 2)][MetabaseFetchResult($gDatabase, $result, $row, 0)][MetabaseFetchResult($gDatabase, $result, $row, 1)]['additional'] = MetabaseFetchResult($gDatabase, $result, $row, 6);
$prices[MetabaseFetchResult($gDatabase, $result, $row, 2)][MetabaseFetchResult($gDatabase, $result, $row, 0)][MetabaseFetchResult($gDatabase, $result, $row, 1)]['additional_short'] = MetabaseFetchResult($gDatabase, $result, $row, 7);
}
}
if ($request->GetVar('debug', 'get') == 'true') {
print $query;
print '<br><br>';
print '<pre>';
print_r($result);
print '</pre><br><br>';
print '<pre>';
print_r($prices);
print '</pre>';
}
}
return $prices;
}
示例13: getdates
/**
* Calendar::getdates()
*
* This function returns an array with all dates.
*
* @return array dates
* @access public
* @since 2005-01-11
* @author Christian Ehret <chris@uffbasse.de>
*/
function getdates()
{
global $gDatabase, $tbl_booking_detail, $request, $errorhandler;
$dates = array();
$j = 0;
$query = "SELECT DATE_FORMAT(min( start_date ) ,'%Y') \n\t\t FROM {$tbl_booking_detail} ";
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'Calendar::getdates()', $query);
} else {
$startyear = MetabaseFetchResult($gDatabase, $result, 0, 0);
$todaydate = getdate();
$todayyear = $todaydate['year'];
$i = 0;
for ($year = $startyear; $year <= $todayyear; ++$year) {
$dates[$i] = $year;
++$i;
}
for ($j = 0; $j <= 20; ++$j) {
$dates[$i] = $year + $j;
++$i;
}
}
return $dates;
}
示例14: send
/**
* Newsletter::send()
*
* This function sends eMail.
*
* @param array $cats categories
* @param string $sender sender
* @param string $senderemail sender email
* @param string $subject subject
* @param string $body body
* @param boolean $andop and operator
* @param boolean $salutation insert salutation
* @return number number of mails
* @access public
* @since 2004-07-10
* @author Christian Ehret <chris@uffbasse.de>
*/
function send($cats, $sender, $senderemail, $subject, $body, $andop, $salutation)
{
global $gDatabase, $tbl_guest, $tbl_guestcat, $tbl_guest_guestcat, $tbl_guest_address, $tbl_address, $errorhandler, $request;
set_time_limit(0);
$num = 0;
if ($andop) {
$query = "SELECT t0.pk_fk_guest_id, a.email, g.firstname, g.lastname\n\t\t\t\t FROM ";
for ($i = 0; $i < count($cats); $i++) {
$query .= "{$tbl_guest_guestcat} t{$i} ";
if ($i !== count($cats) - 1) {
$query .= ", ";
}
}
$query .= "LEFT JOIN {$tbl_guest_address} ga ON t0.pk_fk_guest_id = ga.pk_fk_guest_id AND\n\t\t\t\t \t\t\t\t\t\t\t ga.default_address = 'Y'\t\t\n\t\t\t\t LEFT JOIN {$tbl_address} a ON ga.pk_fk_address_id = a.pk_address_id \n\t\t\t\t\t LEFT JOIN {$tbl_guest} g ON t0.pk_fk_guest_id = g.pk_guest_id ";
$query .= "WHERE ";
for ($i = 0; $i < count($cats); $i++) {
$query .= "t{$i}.pk_fk_guestcat_id = {$cats[$i]} ";
if ($i > 0) {
$query .= "AND t0.pk_fk_guest_id = t{$i}.pk_fk_guest_id ";
}
if ($i !== count($cats) - 1) {
$query .= "AND ";
}
}
$query .= "AND NOT ISNULL( a.email ) ";
} else {
$query = "SELECT DISTINCT ggc.pk_fk_guest_id, a.email, g.firstname, g.lastname \n\t\t\t\t FROM {$tbl_guest_guestcat} ggc\n\t\t\t\t LEFT JOIN {$tbl_guest_address} ga ON ggc.pk_fk_guest_id = ga.pk_fk_guest_id AND\n\t\t\t\t \t\t\t\t\t\t\t ga.default_address = 'Y'\t\t\n\t\t\t\t LEFT JOIN {$tbl_address} a ON ga.pk_fk_address_id = a.pk_address_id \n\t\t\t\t LEFT JOIN {$tbl_guest} g ON ggc.pk_fk_guest_id = g.pk_guest_id\t\t \n\t\t\t\t WHERE (";
for ($i = 0; $i < count($cats); $i++) {
$query .= "ggc.pk_fk_guestcat_id = " . $cats[$i];
if ($i !== count($cats) - 1) {
$query .= " OR ";
}
}
$query .= ") AND NOT ISNULL( a.email ) ";
}
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'Newsletter::send()', $query);
} else {
$row = 0;
if ($salutation) {
include_once "guestclass.inc.php";
$guestclass = new Guest();
}
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
if ($salutation) {
$salutationtxt = $guestclass->getGreeting(MetabaseFetchResult($gDatabase, $result, $row, 0)) . "\n";
} else {
$salutationtxt = "";
}
$files = $_FILES;
$message = $salutationtxt;
$message .= $body;
$email = MetabaseFetchResult($gDatabase, $result, $row, 1);
$firstname = MetabaseFetchResult($gDatabase, $result, $row, 2);
$lastname = MetabaseFetchResult($gDatabase, $result, $row, 3);
$from = $sender . " <" . $senderemail . ">";
$recipient = $firstname . " " . $lastname . " <" . $email . ">";
$mime_boundary = "<<<:" . md5(uniqid(mt_rand(), 1));
$content = "";
$header = "From: {$from}\r\n";
$header .= "Reply-To: {$from}\r\n";
$header .= "X-Priority: 3 (Normal)\r\n";
$header .= "X-Mailer: PHP/" . phpversion() . "\r\n";
$header .= "MIME-Version: 1.0\r\n";
if (is_array($files)) {
$header .= "Content-Type: multipart/mixed;\r\n";
$header .= " boundary=\"" . $mime_boundary . "\"\r\n";
$content = "This is a multi-part message in MIME format.\r\n\r\n";
$content .= "--" . $mime_boundary . "\r\n";
}
$content .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\r\n";
$content .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$content .= "{$message}\r\n\r\n";
if (is_array($files)) {
$content .= "--" . $mime_boundary . "\r\n";
foreach ($files as $filename => $filelocation) {
$filename = $filelocation['name'];
$filelocation = $filelocation['tmp_name'];
if (is_readable($filelocation)) {
$data = chunk_split(base64_encode(implode("", file($filelocation))));
$content .= "Content-Disposition: attachment;\r\n";
if (!function_exists("mime_content_type")) {
//.........這裏部分代碼省略.........
示例15: getTimeline
/**
* Kassa::getTimeline()
*
* This function returns all bought articles for one guest.
*
* @param number $guestid guest id
* @param date $start start date
* @param date $end end date
* @param string $order order desc or asc
* @param array $cats categories
* @return array articles
* @access public
* @since 2004-01-06
* @author Christian Ehret <chris@uffbasse.de>
*/
function getTimeline($guestid, $start, $end, $order, $cats = array())
{
global $gDatabase2, $tbl_bararticle, $tbl_user, $tbl_bought, $tbl_barguest, $request, $errorhandler, $articlerows;
$article = array();
if (count($cats) > 0) {
$catstr = "AND ba.fk_bararticlecat_id IN (";
for ($i = 0; $i < count($cats); $i++) {
if ($i > 0) {
$catstr .= ", ";
}
$catstr .= $cats[$i];
}
$catstr .= ")";
} else {
return array();
}
list($day, $month, $year) = split('.', $start);
$query = "SELECT ba.pk_bararticle_id, ba.description, ba.price, DATE_FORMAT( b.timestamp, '%d.%m.%Y, %H:%i' ), num, pk_bought_id, paid,\n\t\t\t\t DATE_FORMAT( b.updated_date, '%d.%m.%Y, %H:%i Uhr' ), u2.firstname, u2.lastname,\n\t\t\t\t DATE_FORMAT( b.inserted_date, '%d.%m.%Y, %H:%i Uhr' ), u1.firstname, u1.lastname \n FROM {$tbl_bought} b\n\t\t\t\t \t\t LEFT JOIN {$tbl_barguest} bg ON bg.pk_barguest_id = b.fk_barguest_id\n\t\t\t\t \t LEFT JOIN {$tbl_bararticle} ba ON b.fk_bararticle_id = ba.pk_bararticle_id\n\t\t\t\t\t\t LEFT JOIN {$tbl_user} u1 ON b.fk_inserted_user_id = u1.pk_user_id\n\t\t\t\t\t\t LEFT JOIN {$tbl_user} u2 ON b.fk_updated_user_id = u2.pk_user_id\n\t\t\t\t\t\t WHERE bg.pk_barguest_id = {$guestid} \n\t\t\t\t\t\t {$catstr} ";
if ($start !== "") {
list($day, $month, $year) = split('[.]', $start);
$query .= "AND UNIX_TIMESTAMP(b.timestamp) >= " . mktime(0, 0, 0, $month, $day, $year) . " ";
}
if ($end !== "") {
list($day, $month, $year) = split('[.]', $end);
$query .= "AND UNIX_TIMESTAMP(b.timestamp) <= " . mktime(0, 0, 0, $month, $day + 1, $year) . " ";
}
$query .= "ORDER BY b.timestamp " . $order;
$result = MetabaseQuery($gDatabase2, $query);
if (!$result) {
$errorhandler->display('SQL', 'Kassa::getTimeline()', $query);
} else {
$row = 0;
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase2, $result)) == 0; ++$row) {
$color = 0;
if ($row % 2 != 0) {
$color = 1;
}
$total = MetabaseFetchResult($gDatabase2, $result, $row, 2) * MetabaseFetchResult($gDatabase2, $result, $row, 4);
// print "paid: ".MetabaseFetchBooleanResult($gDatabase2, $result, $row, 6);
if (MetabaseFetchBooleanResult($gDatabase2, $result, $row, 6)) {
$sum2 += $total;
$sum += $total;
$paid = $total;
} else {
$sum += $total;
$paid = "0.00";
}
$article[$row] = array('articleid' => MetabaseFetchResult($gDatabase2, $result, $row, 0), 'description' => MetabaseFetchResult($gDatabase2, $result, $row, 1), 'price' => MetabaseFetchResult($gDatabase2, $result, $row, 2), 'timestamp' => MetabaseFetchResult($gDatabase2, $result, $row, 3), 'num' => MetabaseFetchResult($gDatabase2, $result, $row, 4), 'boughtid' => MetabaseFetchResult($gDatabase2, $result, $row, 5), 'paid' => MetabaseFetchBooleanResult($gDatabase2, $result, $row, 6), 'updated' => MetabaseFetchResult($gDatabase2, $result, $row, 7), 'updateduser' => MetabaseFetchResult($gDatabase2, $result, $row, 8) . " " . MetabaseFetchResult($gDatabase2, $result, $row, 9), 'inserted' => MetabaseFetchResult($gDatabase2, $result, $row, 10), 'inserteduser' => MetabaseFetchResult($gDatabase2, $result, $row, 11) . " " . MetabaseFetchResult($gDatabase2, $result, $row, 12), 'total1' => number_format($total, 2, '.', ''), 'total2' => number_format($paid, 2, '.', ''), 'color' => $color);
}
$color = 0;
if ($row % 2 != 0) {
$color = 1;
}
$article[$row] = array('articleid' => 0, 'description' => "Summe:", 'price' => "", 'timestamp' => "", 'num' => "", 'boughtid' => "", 'paid' => "", 'updated' => "", 'total1' => number_format($sum, 2, '.', ''), 'total2' => number_format($sum2, 2, '.', ''), 'color' => $color);
$sum -= $sum2;
$article[$row + 1] = array('articleid' => 0, 'description' => "zu zahlen:", 'price' => "", 'timestamp' => "", 'num' => "", 'boughtid' => "", 'paid' => "", 'updated' => "", 'total1' => number_format($sum, 2, '.', ''), 'total2' => "", 'color' => $color);
}
return $article;
}