本文整理匯總了PHP中MetabaseEndOfResult函數的典型用法代碼示例。如果您正苦於以下問題:PHP MetabaseEndOfResult函數的具體用法?PHP MetabaseEndOfResult怎麽用?PHP MetabaseEndOfResult使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了MetabaseEndOfResult函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: SearchCompleteValues
function SearchCompleteValues(&$form, $text, &$found)
{
$error = '';
$found = array();
if (strlen($complete_expression = MetabaseBeginsWith($this->connection, $text)) == 0) {
return 'it was not possible to build the complete query expression: ' . MetabaseError($this->connection);
}
if (!strcmp($complete_values_query = str_replace('{BEGINSWITH}', $complete_expression, $this->complete_values_query), $this->complete_values_query)) {
return 'the complete values query does not contain the {BEGINSWITH} mark to insert the complete expression';
}
if (strlen($text) && $this->complete_values_limit) {
MetabaseSetSelectedRowRange($this->connection, 0, $this->complete_values_limit);
}
if ($r = MetabaseQuery($this->connection, $complete_values_query)) {
for ($l = 0; !MetabaseEndOfResult($this->connection, $r); $l++) {
if (!MetabaseFetchResultArray($this->connection, $r, $d, $l)) {
$error = 'Could not retrieve the complete values: ' . MetabaseError($this->connection);
break;
}
$found[$d[0]] = $this->FormatCompleteValue($d);
}
MetabaseFreeResult($this->connection, $r);
} else {
$error = 'Complete values query execution failed: ' . MetabaseError($this->connection);
}
return $error;
}
示例2: getlist
/**
* roomchangelist::getlist()
*
* This function returns a list of room changes.
*
* @param date $start start date
* @param date $end end date
* @return array guests
* @access public
* @since 2004-06-12
* @author Christian Ehret <chris@uffbasse.de>
*/
function getlist($start, $end)
{
global $gDatabase, $tbl_booking, $tbl_room, $tbl_guest, $tbl_booking_detail, $tbl_bookingcat, $tbl_booking_detail_guest, $errorhandler;
$bookings = array();
//$start = $start -1;
$end = $end - 1;
$query = "SELECT bd.end_date, DATE_FORMAT(bd.end_date, '%d.%m.%Y'), \n\t\t\t\t\t\t r.room, bd.fk_room_id " . sprintf("FROM {$tbl_booking} b, {$tbl_booking_detail} bd\n\t\t\t\t \t\t LEFT JOIN {$tbl_room} r ON r.pk_room_id = bd.fk_room_id\n\t\t\t\t\t\t WHERE (UNIX_TIMESTAMP(bd.end_date) BETWEEN %s AND %s) \n\t\t\t\t\t\t AND b.pk_booking_id = bd.fk_booking_id \n\t\t\t\t\t\t AND ISNULL(b.deleted_date) \n\t\t\t\t\t\t ORDER BY bd.end_date, r.room", MetabaseGetTextFieldValue($gDatabase, $start), MetabaseGetTextFieldValue($gDatabase, $end));
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'Roomchangelist::getlist()', $query);
} else {
$row = 0;
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
$color = 0;
if ($row % 2 != 0) {
$color = 1;
}
$enddate = MetabaseFetchResult($gDatabase, $result, $row, 0);
$roomid = MetabaseFetchResult($gDatabase, $result, $row, 3);
$query = "SELECT \n\t\t DATE_FORMAT(bd.start_date, '%d.%m.%Y'), \n\t\t\t\t \t\t bc.bookingcat,\n\t\t\t\t\t\t b.persons, b.children, b.children2, b.children3, b.booking_type,\n\t\t\t\t\t\t g.firstname, g.lastname, b.additional_info, DATE_FORMAT(bd.end_date, '%d.%m.%Y'),\n\t\t\t\t\t\t b.children0\n FROM {$tbl_booking} b, {$tbl_booking_detail} bd\n\t\t\t\t\t\t LEFT JOIN {$tbl_guest} g ON b.fk_guest_id = g.pk_guest_id\n\t\t\t\t \t\t LEFT JOIN {$tbl_room} r ON r.pk_room_id = bd.fk_room_id\n\t\t\t\t\t\t LEFT JOIN {$tbl_bookingcat} bc ON b.fk_bookingcat_id = bc.pk_bookingcat_id\n\t\t\t\t\t\t WHERE bd.fk_room_id = {$roomid} AND bd.start_date >= '{$enddate}'\n\t\t\t\t\t\t AND b.pk_booking_id = bd.fk_booking_id \n\t\t\t\t\t\t AND ISNULL(b.deleted_date) \n\t\t\t\t\t\t ORDER BY bd.start_date LIMIT 0,1";
$result2 = MetabaseQuery($gDatabase, $query);
if (!$result2) {
$errorhandler->display('SQL', 'Roomchangelist::getlist()', $query);
} elseif (MetabaseNumberOfRows($gDatabase, $result2) == 1) {
$bookings[$row] = array('enddate' => MetabaseFetchResult($gDatabase, $result, $row, 1), 'room' => MetabaseFetchResult($gDatabase, $result, $row, 2), 'color' => $color, 'startdate' => MetabaseFetchResult($gDatabase, $result2, 0, 0), 'bookingcat' => MetabaseFetchResult($gDatabase, $result2, 0, 1), 'person' => MetabaseFetchResult($gDatabase, $result2, 0, 2), 'children1' => MetabaseFetchResult($gDatabase, $result2, 0, 3), 'children2' => MetabaseFetchResult($gDatabase, $result2, 0, 4), 'children3' => MetabaseFetchResult($gDatabase, $result2, 0, 5), 'firstname' => MetabaseFetchResult($gDatabase, $result2, 0, 7), 'lastname' => MetabaseFetchResult($gDatabase, $result2, 0, 8), 'addinfo' => MetabaseFetchResult($gDatabase, $result2, 0, 9), 'enddate2' => MetabaseFetchResult($gDatabase, $result2, 0, 10), 'children0' => MetabaseFetchResult($gDatabase, $result2, 0, 11));
} else {
$bookings[$row] = array('enddate' => MetabaseFetchResult($gDatabase, $result, $row, 1), 'room' => MetabaseFetchResult($gDatabase, $result, $row, 2), 'color' => $color, 'startdate' => "", 'bookingcat' => "", 'person' => "", 'children1' => "", 'children2' => "", 'children3' => "", 'firstname' => "", 'lastname' => "", 'addinfo' => "", 'enddate2' => "");
}
}
}
return $bookings;
}
示例3: GetGroups
function GetGroups(&$g)
{
if (strlen($this->groups_query) == 0) {
return "it was not specified a valid query to retrieve all the options groups";
}
$g = array();
if (isset($this->default_option)) {
$g[] = $this->default_option;
}
$error = "";
if ($r = MetabaseQuery($this->connection, $this->groups_query)) {
for ($l = 0; !MetabaseEndOfResult($this->connection, $r); $l++) {
if (!MetabaseFetchResultArray($this->connection, $r, $d, $l)) {
$error = "Could not retrieve the options group: " . MetabaseError($this->connection);
break;
}
$g[] = $d[0];
}
if (count($g) == 0 && strlen($error) == 0) {
$error = "there are no group options";
}
MetabaseFreeResult($this->connection, $r);
} else {
$error = "Groups query execution failed: " . MetabaseError($this->connection);
}
if (strlen($error)) {
unset($g);
}
return $error;
}
示例4: get
/**
* article::get()
*
* get all articles
*
* @return array articles
* @access public
* @since 2004-03-07
* @author Christian Ehret <chris@uffbasse.de>
*/
function get()
{
global $gDatabase, $tbl_article, $errorhandler, $request;
$article = array();
$query = "SELECT pk_article_id, article, price_netto, price_brutto, mwst\n\t\t\t\t FROM {$tbl_article} \n\t\t\t\t WHERE ISNULL(fk_deleted_user_id) \n\t\t\t\t ORDER BY article ";
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'Article::get()', $query);
} else {
$row = 0;
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
$color = 0;
if ($row % 2 != 0) {
$color = 1;
}
$article[$row] = array('articleid' => MetabaseFetchResult($gDatabase, $result, $row, 0), 'article' => MetabaseFetchResult($gDatabase, $result, $row, 1), 'price_netto' => MetabaseFetchResult($gDatabase, $result, $row, 2), 'price_brutto' => MetabaseFetchResult($gDatabase, $result, $row, 3), 'mwst' => MetabaseFetchResult($gDatabase, $result, $row, 4), 'color' => $color);
}
}
return $article;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: get
/**
* room::get()
*
* get all rooms
*
* @return array room data
* @access public
* @since 2003-07-24
* @author Christian Ehret <chris@uffbasse.de>
*/
function get()
{
global $gDatabase, $tbl_room, $tbl_roomcat, $errorhandler, $request;
$rooms = array();
$query = "SELECT pk_room_id, {$tbl_room}.room, capacity, " . "{$tbl_room}.description, fk_roomcat_id, roomcat " . "FROM {$tbl_room} " . "LEFT JOIN {$tbl_roomcat} ON(pk_roomcat_id = fk_roomcat_id) " . "WHERE ISNULL({$tbl_room}.fk_deleted_user_id) " . "ORDER BY {$tbl_room}.room";
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'room::get()', $query);
} else {
$row = 0;
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
$color = 0;
if ($row % 2 != 0) {
$color = 1;
}
$infotxt = "<strong>Bezeichnung:</strong> " . MetabaseFetchResult($gDatabase, $result, $row, 1) . "<br>" . "<strong>Personen:</strong> " . MetabaseFetchResult($gDatabase, $result, $row, 2) . "<br>" . "<strong>Kategorie:</strong> " . MetabaseFetchResult($gDatabase, $result, $row, 5) . "<br>";
if (MetabaseFetchResult($gDatabase, $result, $row, 3) !== "") {
$infotxt .= "<strong>Info:</strong> " . nl2br(MetabaseFetchResult($gDatabase, $result, $row, 3));
}
$rooms[$row] = array('roomid' => MetabaseFetchResult($gDatabase, $result, $row, 0), 'name' => MetabaseFetchResult($gDatabase, $result, $row, 1), 'persons' => MetabaseFetchResult($gDatabase, $result, $row, 2), 'info' => MetabaseFetchResult($gDatabase, $result, $row, 3), 'roomcatid' => MetabaseFetchResult($gDatabase, $result, $row, 4), 'catname' => MetabaseFetchResult($gDatabase, $result, $row, 5), 'color' => $color, 'infotxt' => $infotxt);
}
}
return $rooms;
}
示例11: 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;
}
示例12: 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>';
}
?>
示例13: geteditablefields
/**
* DefaultData::geteditablefields()
*
* This function returns an array with editable fields. The value is either
* the hotel spezific one or - if none is set - the system default value
*
* @return array returns an array of data fields
* @access public
* @since 2003-08-01
* @author Christian Ehret <chris@uffbasse.de>
*/
function geteditablefields()
{
global $gDatabase, $request, $tbl_default, $tbl_hotel_default, $sess, $errorhandler;
$query = "SELECT " . "def.pk_default_id, default_name, fieldtype, " . "IF(ISNULL(hotel.string_value),def.string_value,hotel.string_value) AS string_value, " . "IF(ISNULL(hotel.integer_value),def.integer_value,hotel.integer_value) AS integer_value, " . "IF(ISNULL(hotel.datetime_value),def.datetime_value,hotel.datetime_value) AS datetime_value, " . "IF(ISNULL(hotel.boolean_value),def.boolean_value,hotel.boolean_value) AS boolean_value, " . "description " . "FROM {$tbl_default} AS def " . "LEFT JOIN {$tbl_hotel_default} AS hotel " . "ON (hotel.pk_fk_default_id = def.pk_default_id " . "AND hotel.pk_fk_hotel_id = " . $request->GetVar('hotelid', 'session') . ") " . "WHERE def.editable = 'Y' " . "ORDER BY default_name";
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'defaultdata::geteditablefields()', $query);
} else {
$row = 0;
$fields = array();
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
if (MetabaseFetchResult($gDatabase, $result, $row, 3) != null) {
$value = MetabaseFetchResult($gDatabase, $result, $row, 3);
} elseif (MetabaseFetchResult($gDatabase, $result, $row, 4) != null) {
$value = MetabaseFetchResult($gDatabase, $result, $row, 4);
} elseif (MetabaseFetchResult($gDatabase, $result, $row, 5) != null) {
$value = MetabaseFetchResult($gDatabase, $result, $row, 5);
} elseif (MetabaseFetchResult($gDatabase, $result, $row, 6) != null) {
$value = MetabaseFetchResult($gDatabase, $result, $row, 6);
} else {
$value = '';
}
$color = 0;
if ($row % 2 != 0) {
$color = 1;
}
$fields[$row] = array('defaultid' => MetabaseFetchResult($gDatabase, $result, $row, 0), 'title' => MetabaseFetchResult($gDatabase, $result, $row, 1), 'fieldtype' => MetabaseFetchResult($gDatabase, $result, $row, 2), 'description' => MetabaseFetchResult($gDatabase, $result, $row, 7), 'value' => $value, 'color' => $color);
}
return $fields;
}
}
示例14: 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;
}
示例15: getOneYear
/**
* season::getOneYear()
*
* get all season data of one year
*
* @param number $year year
* @return array season data
* @access public
* @since 2003-12-31
* @author Christian Ehret <chris@uffbasse.de>
*/
function getOneYear($year)
{
global $gDatabase, $tbl_season, $errorhandler, $request;
$season = array();
$query = "SELECT pk_season_id, name \n\t\t FROM {$tbl_season} \n\t\t\t\t WHERE ISNULL(fk_deleted_user_id) \n\t\t\t\t AND DATE_FORMAT( start_date, '%Y' ) = {$year}\n\t\t\t\t ORDER BY start_date ";
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'Season::getOneYear()', $query);
} else {
$row = 0;
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
$season[$row] = array('seasonid' => MetabaseFetchResult($gDatabase, $result, $row, 0), 'name' => MetabaseFetchResult($gDatabase, $result, $row, 1));
}
}
return $season;
}