From 9bddccb11b17d98bab0457485d66c7053c9fb93c Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 20 Jan 2009 23:00:11 +0100 Subject: [PATCH] [svn r17874] Minor - UI improvements & lang variables changed FS#821 --- main/reservation/m_category.php | 4 +- main/reservation/m_item.php | 38 ++++++++--------- main/reservation/m_reservation.php | 20 ++++----- main/reservation/mysubscriptions.php | 8 ++-- main/reservation/reservation.php | 4 +- main/reservation/rsys.php | 62 ++++++++++++++-------------- 6 files changed, 69 insertions(+), 67 deletions(-) diff --git a/main/reservation/m_category.php b/main/reservation/m_category.php index cb6445e387..08c7b0370e 100644 --- a/main/reservation/m_category.php +++ b/main/reservation/m_category.php @@ -108,7 +108,9 @@ switch ($_GET['action']) { api_display_tool_title($tool_name); echo $msg; - echo ''.get_lang('AddNewResourceType').'

'; + echo '
'; + echo ''.get_lang('AddNewResourceType').'
'; + echo '
'; if (isset ($_POST['action'])) { switch ($_POST['action']) { case 'delete_categories' : diff --git a/main/reservation/m_item.php b/main/reservation/m_item.php index 9b4d5d8989..61b65b1068 100644 --- a/main/reservation/m_item.php +++ b/main/reservation/m_item.php @@ -60,7 +60,7 @@ function modify_filter($id) { $str.=''; } //if(Rsys::item_allow($id,'m_rights')) $str.='  '; - if(Rsys::item_allow($id,'delete')) $str.=' '; + if(Rsys::item_allow($id,'delete')) $str.=' '; return $str; } @@ -71,7 +71,7 @@ function modify_filter($id) { * @param - int $id The item-rights-id's */ function modify_rights_filter($id) { - return ' '; + return ' '; } /** @@ -95,7 +95,7 @@ if (isset ($_POST['action'])) { } else { - Display :: display_normal_message(get_lang('ItemDeleted'), false); + Display :: display_normal_message(get_lang('ResourceDeleted'), false); } $msg = ob_get_contents(); ob_end_clean(); @@ -359,15 +359,15 @@ switch ($_GET['action']) { $interbreadcrumb[] = array ("url" => "m_item.php", "name" => get_lang('ManageItems')); //$interbreadcrumb[] = array ("url" => "m_item.php", "name" => $tool_name); - Display :: display_header(get_lang('AddNewItem')); - api_display_tool_title(get_lang('AddNewItem')); + Display :: display_header(get_lang('AddNewResource')); + api_display_tool_title(get_lang('AddNewResource')); $form = new FormValidator('item', 'post', 'm_item.php?action=add'); $cats = Rsys :: get_category(); foreach ($cats as $cat) $catOptions[$cat['id']] = $cat['name']; $form->addElement('select', 'category', get_lang('ResourceType'), $catOptions); - $form->add_textfield('name', get_lang('ItemName'), true, array ('maxlength' => '128')); - $form->addElement('textarea', 'description', get_lang('ItemDescription'), array ('rows' => '3', 'cols' => '40')); + $form->add_textfield('name', get_lang('ResourceName'), true, array ('maxlength' => '128')); + $form->addElement('textarea', 'description', get_lang('Description'), array ('rows' => '3', 'cols' => '40')); $form->addRule('category', get_lang('ThisFieldIsRequired'), 'required'); // TODO: get list of courses (to link it to the item) @@ -379,11 +379,11 @@ switch ($_GET['action']) { $values = $form->exportValues(); if (Rsys :: add_item($values['name'], $values['description'], $values['category'], $values['course_code'])) { - Display :: display_normal_message(Rsys :: get_return_msg(get_lang('ItemAdded'), "m_item.php?action=m_rights&item_id=".Rsys :: get_item_id($values['name']), get_lang('MItemRight').' '.$values['name']),false); + Display :: display_normal_message(Rsys :: get_return_msg(get_lang('ResourceAdded'), "m_item.php?action=m_rights&item_id=".Rsys :: get_item_id($values['name']), get_lang('MItemRight').' '.$values['name']),false); } else { - Display :: display_normal_message(Rsys :: get_return_msg(get_lang('ItemExist'), "m_item.php?action=add", get_lang('AddNewItem')),false); + Display :: display_normal_message(Rsys :: get_return_msg(get_lang('ResourceExist'), "m_item.php?action=add", get_lang('AddNewResource')),false); } } else $form->display(); @@ -402,8 +402,8 @@ switch ($_GET['action']) { api_display_tool_title(get_lang('EditResource')); $form = new FormValidator('item', 'post', 'm_item.php?action=edit'); $form->addElement('select', 'category_id', get_lang('ResourceType'), $catOptions); - $form->add_textfield('name', get_lang('ItemName'), array ('maxlength' => '128')); - $form->addElement('textarea', 'description', get_lang('ItemDescription'), array ('rows' => '3', 'cols' => '40')); + $form->add_textfield('name', get_lang('ResourceName'), array ('maxlength' => '128')); + $form->addElement('textarea', 'description', get_lang('Description'), array ('rows' => '3', 'cols' => '40')); $form->addRule('category_id', get_lang('ThisFieldIsRequired'), 'required'); $form->addElement('hidden', 'id', $item['id']); $form->addElement('submit', 'submit', get_lang('Ok')); @@ -411,9 +411,9 @@ switch ($_GET['action']) { if ($form->validate()) { $values = $form->exportValues(); if (Rsys :: edit_item($values['id'], $values['name'], $values['description'], $values['category_id'], $values['course_id'])) - Display :: display_normal_message(Rsys :: get_return_msg(get_lang('ItemEdited'), "m_item.php", $tool_name),false); + Display :: display_normal_message(Rsys :: get_return_msg(get_lang('ResourceEdited'), "m_item.php", $tool_name),false); else - Display :: display_normal_message(Rsys :: get_return_msg(get_lang('ItemExist'), "m_item.php?action=edit&id=".$values['id'], get_lang('EditItem2')),false); + Display :: display_normal_message(Rsys :: get_return_msg(get_lang('ResourceExist'), "m_item.php?action=edit&id=".$values['id'], get_lang('EditItem2')),false); } else $form->display(); break; @@ -421,7 +421,7 @@ switch ($_GET['action']) { $result = Rsys :: delete_item($_GET['id']); ob_start(); if($result == '0'){ - Display :: display_normal_message(get_lang('ItemDeleted'),false);} + Display :: display_normal_message(get_lang('ResourceDeleted'),false);} else Display :: display_normal_message(str_replace('#NUM#', $result, get_lang('ItemHasReservations')),false); $msg = ob_get_contents(); @@ -448,7 +448,7 @@ switch ($_GET['action']) { echo '
'; echo ''; echo '
'.get_lang('ResourceFilter').': '; echo '
'; - echo '
'; + $table = new SortableTable('item', array ('Rsys', 'get_num_items'), array ('Rsys', 'get_table_items'), 1); $table->set_additional_parameters(array('cat'=>$_GET['cat'])); $table->set_header(0, '', false, array ('style' => 'width:10px')); - $table->set_header(1, get_lang('ItemName'), true); - $table->set_header(2, get_lang('ItemDescription'), true); + $table->set_header(1, get_lang('ResourceName'), true); + $table->set_header(2, get_lang('Description'), true); $table->set_header(3, get_lang('ResourceType'), true); $table->set_header(4, get_lang('Owner'), true); $table->set_header(5, '', false, array ('style' => 'width:100px;')); $table->set_column_filter(5, 'modify_filter'); - $table->set_form_actions(array ('delete_items' => get_lang('DeleteSelectedItems')), 'items'); + $table->set_form_actions(array ('delete_items' => get_lang('DeleteSelectedResources')), 'items'); $table->display(); } diff --git a/main/reservation/m_reservation.php b/main/reservation/m_reservation.php index bcfc3fb2e1..f523bda359 100644 --- a/main/reservation/m_reservation.php +++ b/main/reservation/m_reservation.php @@ -99,15 +99,15 @@ switch ($_GET['action']) { Display :: display_header(get_lang('OverviewSubscriptions')); api_display_tool_title(get_lang('Overview')); - - echo '
'; - + echo '
'; + echo ''; echo ''; - echo '
'; - echo '
'; + echo ''; + echo '

'; + $table = new SortableTable('reservation', array ('Rsys', 'get_num_subscriptions_overview'), array ('Rsys', 'get_table_subcribed_reservations'), 1); $table->set_additional_parameters(array ('action' => 'overviewsubscriptions','keyword' => $_GET['keyword'])); - $table->set_header(0, get_lang('ItemName'), true); + $table->set_header(0, get_lang('ResourceName'), true); $table->set_header(1, get_lang('ResourceTypeName'), true); $table->set_header(2, get_lang('StartDate'), true); $table->set_header(3, get_lang('EndDate'), true); @@ -180,7 +180,7 @@ switch ($_GET['action']) { $form = new FormValidator('reservation', 'post', 'm_reservation.php?action=add&cat_id='.$_GET['cat_id']); $choices[] = $form->createElement('radio', 'forever', '', get_lang('NoPeriod'), 0, array ('onclick' => 'javascript:window_hide(\'forever_timewindow\')')); $choices[] = $form->createElement('radio', 'forever', '', get_lang('FixedPeriod'), 1 , array ('onclick' => 'javascript:window_show(\'forever_timewindow\')')); - $form->addElement('select', 'itemid', get_lang('Item'), $itemlist); + $form->addElement('select', 'itemid', get_lang('Resource'), $itemlist); $form->add_timewindow('start', 'end', get_lang('StartDate'), get_lang('EndDate')); $form->addElement('html', '
'.get_lang('TimePickerLimitation').'

'); @@ -444,7 +444,7 @@ switch ($_GET['action']) { $form = new FormValidator('reservation', 'post', 'm_reservation.php?action=edit&id='.$Reservation_id); $choices[] = $form->createElement('radio', 'forever', '', get_lang('NoPeriod'), '0', array ('onclick' => 'javascript:timewindow_hide(\'forever_timewindow\')')); $choices[] = $form->createElement('radio', 'forever', '', get_lang('FixedPeriod'), '1', array ('onclick' => 'javascript:timewindow_show(\'forever_timewindow\')')); - $form->addElement('select', 'item_id', get_lang('Item'), $itemlist); + $form->addElement('select', 'item_id', get_lang('Resource'), $itemlist); $form->add_timewindow('start', 'end', get_lang('StartDate'), get_lang('EndDate')); $form->addElement('html', '
'.get_lang('TimePickerLimitation').'

'); @@ -570,8 +570,8 @@ switch ($_GET['action']) { echo ''.get_lang('AddNewBookingPeriod').''; echo '   '.get_lang('OverviewReservedPeriods').''; echo ''; + echo '
'; - echo '
'; echo '
'; if (isset ($_POST['action'])) { switch ($_POST['action']) { @@ -587,7 +587,7 @@ switch ($_GET['action']) { $table = new SortableTable('reservation', array ('Rsys', 'get_num_reservations'), array ('Rsys', 'get_table_reservations'), 1); $table->set_additional_parameters(array ('keyword' => $_GET['keyword'])); $table->set_header(0, '', false, array ('style' => 'width:10px')); - $table->set_header(1, get_lang('ItemName'), true); + $table->set_header(1, get_lang('ResourceName'), true); $table->set_header(2, get_lang('StartDate'), true); $table->set_header(3, get_lang('EndDate'), true); $table->set_header(4, get_lang('SubscribeFrom'), true); diff --git a/main/reservation/mysubscriptions.php b/main/reservation/mysubscriptions.php index d6dee286da..af8f582efb 100644 --- a/main/reservation/mysubscriptions.php +++ b/main/reservation/mysubscriptions.php @@ -59,7 +59,7 @@ switch ($_GET['action']) { $msg=ob_get_contents(); ob_end_clean(); default : - $NoSearchResults=get_lang('noSubscriptions'); + $NoSearchResults=get_lang('NoReservations'); Display :: display_header($tool_name); api_display_tool_title($tool_name); @@ -90,9 +90,9 @@ switch ($_GET['action']) { $table = new SortableTable('subscription', array('Rsys','get_num_subscriptions'),array('Rsys','get_table_subscriptions'),2); $table->set_header(0, '', false,array('style'=>'width:10px')); - $table->set_header(1, get_lang('ItemName'), true); - $table->set_header(2, get_lang('StartAt'), true); - $table->set_header(3, get_lang('EndAt'), true); + $table->set_header(1, get_lang('ResourceName'), true); + $table->set_header(2, get_lang('StartDate'), true); + $table->set_header(3, get_lang('EndDate'), true); $table->set_header(4, get_lang('Accept'), true); $table->set_header(5, get_lang('Modify'), false,array('style'=>'width:50px;')); $table->set_column_filter(5, 'modify_filter'); diff --git a/main/reservation/reservation.php b/main/reservation/reservation.php index c42a06c9ec..d97ff02ef9 100644 --- a/main/reservation/reservation.php +++ b/main/reservation/reservation.php @@ -89,7 +89,7 @@ if ($gogogo&&!empty($_GET['cat'])) { $itemlist = Rsys :: get_cat_items($_GET['cat']); echo '
'; if (count($itemlist) != 0) { - echo '
        '.get_lang('Item').': '.get_lang('Resource').':
'; @@ -130,7 +130,7 @@ if ($gogogo&&!empty($_GET['cat'])) { ob_end_clean(); - $legend=getBlock('green').' '.ucfirst(get_lang('Reservation')).' '.getBlock('blue').' '.get_lang('TimePicker').' '.getBlock('orange').' '.get_lang('OutPeriod').' '.getBlock('red').' '.get_lang('Reserved').' '.getBlock('grey').' '.get_lang('NoReservations').' '.getBlock('black').' '.get_lang('Blackout'); + $legend=getBlock('green').' '.ucfirst(get_lang('OpenBooking')).' '.getBlock('blue').' '.get_lang('TimePicker').' '.getBlock('orange').' '.get_lang('OutPeriod').' '.getBlock('red').' '.get_lang('Reserved').' '.getBlock('grey').' '.get_lang('NoReservations').' '.getBlock('black').' '.get_lang('Blackout'); echo '

'.$GLOBALS['weekstart'].' - '.$GLOBALS['weekend'].'
'.$buffer.'
 
'.$legend.'
'; } } diff --git a/main/reservation/rsys.php b/main/reservation/rsys.php index dabceb9be3..57e7cab551 100644 --- a/main/reservation/rsys.php +++ b/main/reservation/rsys.php @@ -59,7 +59,7 @@ class Rsys { function get_num_subscriptions_reservationperiods($res_id) { $sql = "SELECT COUNT(*) FROM ".Rsys :: getTable("subscription")." s WHERE s.reservation_id = '".$res_id."'"; - return @ mysql_result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); + return @ Database::result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); } /** @@ -167,7 +167,7 @@ class Rsys { if (Rsys :: check_category($naam)) { $sql = "INSERT INTO ".Rsys :: getTable("category")." (name) VALUES ('".Database::escape_string($naam)."')"; api_sql_query($sql, __FILE__, __LINE__); - return mysql_insert_id(); + return Database::get_last_insert_id(); } return false; } @@ -181,7 +181,7 @@ class Rsys { function check_category($name, $id=0) { $sql = "SELECT name FROM ".Rsys :: getTable("category")." WHERE LCASE(name)='".strtolower($name)."' AND id<>'".$id."'"; $Result = api_sql_query($sql, __FILE__, __LINE__); - return (mysql_num_rows($Result) == 0); + return (Database::num_rows($Result) == 0); } /** @@ -205,14 +205,14 @@ class Rsys { * @param - int $id The id */ function delete_category($id) { - $sql = "Select id FROM ".Rsys :: getTable("item")." WHERE category_id='".$id."'"; + $sql = "SELECT id FROM ".Rsys :: getTable("item")." WHERE category_id='".$id."'"; $result = api_sql_query($sql, __FILE__, __LINE__); - if (mysql_num_rows($result) == 0) { + if (Database::num_rows($result) == 0) { $sql2 = "DELETE FROM ".Rsys :: getTable("category")." WHERE id ='".$id."'"; api_sql_query($sql2, __FILE__, __LINE__); return 0; } else { - return mysql_num_rows($result); + return Database::num_rows($result); } } @@ -307,7 +307,7 @@ class Rsys { $keyword = Database::escape_string($_GET['keyword']); $sql .= " WHERE name LIKE '%".$keyword."%' OR id LIKE '%".$keyword."%'"; } - return @ mysql_result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); + return @ Database::result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); } /* @@ -325,13 +325,13 @@ class Rsys { * @param - String $category The category id * @return - Boolean True or false */ -function check_item($item, $category, $id=0) { + function check_item($item, $category, $id=0) { $sql = "SELECT name FROM ".Rsys :: getTable("item")." WHERE LCASE(name)='".strtolower($item)."' AND category_id='".$category."' AND id<>'".$id."'"; $Result = api_sql_query($sql, __FILE__, __LINE__); - return (mysql_num_rows($Result) == 0); + return (Database::num_rows($Result) == 0); } /** @@ -347,7 +347,7 @@ function check_item($item, $category, $id=0) { if (Rsys :: check_item($name, $category)) { $sql = "INSERT INTO ".Rsys :: getTable("item")." (category_id,course_code,name,description,creator) VALUES ('".Database::escape_string($category)."','".Database::escape_string($course)."','".Database::escape_string($name)."','".Database::escape_string($description)."','".api_get_user_id()."')"; api_sql_query($sql, __FILE__, __LINE__); - return mysql_insert_id(); + return Database::get_last_insert_id(); } return false; } @@ -394,7 +394,7 @@ function check_item($item, $category, $id=0) { api_sql_query($sql, __FILE__, __LINE__); return '0'; } else { - return mysql_num_rows($result); + return Database::num_rows($result); } } @@ -423,7 +423,7 @@ function check_item($item, $category, $id=0) { LEFT JOIN ".Database :: get_main_table(TABLE_MAIN_CLASS)." c ON ir.class_id=c.id AND ir.item_id = i.id LEFT JOIN ".Database :: get_main_table(TABLE_MAIN_CLASS_USER)." cu ON cu.class_id = c.id WHERE i.id='".$item_id."' AND (". (!empty ($x) ? "(cu.user_id='".api_get_user_id()."' AND ".$x.") OR " : '')." i.creator='".api_get_user_id()."' OR 1=". (api_is_platform_admin() ? 1 : 0).")"; - return mysql_num_rows(api_sql_query($sql, __FILE__, __LINE__)) > 0; + return Database::num_rows(api_sql_query($sql, __FILE__, __LINE__)) > 0; } /** @@ -457,7 +457,7 @@ function check_item($item, $category, $id=0) { function is_blackout($itemid) { $sql = "SELECT id FROM ".Rsys :: getTable("item"); $sql .= " WHERE id = '".$itemid."' AND blackout=1"; - return mysql_num_rows(api_sql_query($sql, __FILE__, __LINE__)) == 1; + return Database::num_rows(api_sql_query($sql, __FILE__, __LINE__)) == 1; } /** @@ -546,7 +546,7 @@ function check_item($item, $category, $id=0) { $sql .= " WHERE i.category_id LIKE '%".$keyword."%'"; }*/ //$sql .= " GROUP BY i.id"; - return @ mysql_result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); + return @ Database::result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); } /** @@ -619,7 +619,7 @@ function check_item($item, $category, $id=0) { function set_new_right($item_id, $class_id, $column, $value) { $sql = "SELECT item_id FROM ".Rsys :: getTable("item_rights")."WHERE item_id=".$item_id." AND class_id=".$class_id; $result = api_sql_query($sql, __FILE__, __LINE__); - $switcher = mysql_num_rows($result); + $switcher = Database::num_rows($result); if ($switcher > 0) { $sql = $sql = "UPDATE ".Rsys :: getTable("item_rights")." SET ".$column."='".Database::escape_string($value)."' WHERE class_id = '".$class_id."' AND item_id ='".$item_id."'"; api_sql_query($sql, __FILE__, __LINE__); @@ -636,7 +636,7 @@ function check_item($item, $category, $id=0) { */ function get_num_itemrights() { $sql = "SELECT COUNT(id) FROM ".Database :: get_main_table(TABLE_MAIN_CLASS); - return @ mysql_result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); + return @ Database::result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); } /** @@ -659,7 +659,7 @@ function check_item($item, $category, $id=0) { */ function get_num_itemfiltered_class($item_id) { $sql = "SELECT COUNT(id) FROM ".Database :: get_main_table(TABLE_MAIN_CLASS)." WHERE id NOT IN (SELECT class_id FROM ".Rsys :: getTable("item_rights")." WHERE item_id='".$item_id."') ORDER BY name ASC, code ASC"; - return mysql_result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); + return Database::result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); } /** @@ -958,7 +958,7 @@ function check_item($item, $category, $id=0) { function check_auto_accept($id) { $sql = "SELECT auto_accept FROM ".Rsys :: getTable('reservation')." WHERE id='".$id."'"; - return mysql_result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); + return Database::result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); } /** @@ -978,7 +978,7 @@ function check_item($item, $category, $id=0) { $keyword = Database::escape_string($_GET['keyword']); $sql .= " AND (i.name LIKE '%".$keyword."%' OR i.description LIKE '%".$keyword."%' OR r.notes LIKE '%".$keyword."%')"; } - return mysql_result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); + return Database::result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); } /** @@ -1118,7 +1118,7 @@ function check_item($item, $category, $id=0) { and r.id = '".$id."' and i.creator ='".api_get_user_id()."'"; $result = api_sql_query($sql, __FILE__, __LINE__); - if (mysql_num_rows($result) != 0) + if (Database::num_rows($result) != 0) return 1; return 0; } @@ -1158,7 +1158,7 @@ function check_item($item, $category, $id=0) { $keyword = Database::escape_string($_GET['keyword']); $sql .= " AND (i1.name LIKE '%".$keyword."%' or r1.start_at LIKE '%".$keyword."%' or r1.end_at LIKE '%".$keyword."%' or u.lastname LIKE '%".$keyword."%' or u.firstname LIKE '%".$keyword."%' or s.start_at LIKE '%".$keyword."%' or s.end_at LIKE '%".$keyword."%')"; } - return mysql_result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); + return Database::result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); } function get_table_subcribed_reservations($from, $per_page, $column, $direction) { @@ -1230,7 +1230,7 @@ function check_item($item, $category, $id=0) { if (isset ($_GET['rid'])) { $sql .= " WHERE reservation_id = '".$_GET['rid']."'"; } - return mysql_result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); + return Database::result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); } function get_table_waiting_users($from, $per_page, $column, $direction) { @@ -1308,16 +1308,16 @@ function check_item($item, $category, $id=0) { $item = Database::fetch_array($items); $item_name = $item[0]; - $sql = "select start_at, end_at, timepicker + $sql = "SELECT start_at, end_at, timepicker from ".Rsys :: getTable('reservation')." - where id in ( select reservation_id + where id in ( SELECT reservation_id from ".Rsys :: getTable('subscription')." where dummy ='".$id."')"; $items = api_sql_query($sql, __FILE__, __LINE__); $item = Database::fetch_array($items); if ($item['timepicker'] == '1') { - $sql = "select start_at, end_at + $sql = "SELECT start_at, end_at from ".Rsys :: getTable('subscription')." where dummy ='".$id."'"; $items = api_sql_query($sql, __FILE__, __LINE__); @@ -1345,7 +1345,7 @@ function check_item($item, $category, $id=0) { $sql = "SELECT id, start_at, end_at FROM ".Rsys :: getTable('reservation')." WHERE start_at > '".$start_at."' AND id='".$reservation_id."' "; $result = api_sql_query($sql, __FILE__, __LINE__); - if (mysql_num_rows($result) != 0){ + if (Database::num_rows($result) != 0){ $result2 = Database::fetch_array($result); $GLOBALS['start_date'] = $result2[1]; $GLOBALS['end_date'] = $result2[2]; @@ -1355,7 +1355,7 @@ function check_item($item, $category, $id=0) { $sql = "SELECT id, start_at, end_at FROM ".Rsys :: getTable('reservation')." WHERE end_at < '".$end_at."' AND id='".$reservation_id."' "; $result = api_sql_query($sql, __FILE__, __LINE__); - if (mysql_num_rows($result) != 0){ + if (Database::num_rows($result) != 0){ $result2 = Database::fetch_array($result); $GLOBALS['start_date'] = $result2[1]; $GLOBALS['end_date'] = $result2[2]; @@ -1401,7 +1401,7 @@ function check_item($item, $category, $id=0) { */ $result = api_sql_query($sql, __FILE__, __LINE__); - if (mysql_num_rows($result) != 0) + if (Database::num_rows($result) != 0) return true; return false; } @@ -1413,7 +1413,7 @@ function check_item($item, $category, $id=0) { */ function add_subscription($reservation_id, $user_id, $accepted) { $sql = "SELECT user_id FROM ".Rsys :: getTable("subscription")." WHERE user_id='".$user_id."' AND reservation_id='".$reservation_id."'"; - if (mysql_num_rows(api_sql_query($sql, __FILE__, __LINE__)) == 0) { + if (Database::num_rows(api_sql_query($sql, __FILE__, __LINE__)) == 0) { $sql = "INSERT INTO ".Rsys :: getTable("subscription")." (user_id,reservation_id,accepted) VALUES ('".Database::escape_string($user_id)."','".Database::escape_string($reservation_id)."','". ($accepted ? '1' : '0')."')"; api_sql_query($sql, __FILE__, __LINE__); $sql = "UPDATE ".Rsys :: getTable("reservation")." SET subscribers=subscribers+1 WHERE id='".$reservation_id."'"; @@ -1525,7 +1525,7 @@ function check_item($item, $category, $id=0) { INNER JOIN ".Rsys :: getTable("reservation")." r ON r.id = s.reservation_id INNER JOIN ".Rsys :: getTable("item")." i ON i.id=r.item_id WHERE s.user_id = '".api_get_user_id()."'"; - return @ mysql_result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); + return @ Database::result(api_sql_query($sql, __FILE__, __LINE__), 0, 0); } /** @@ -1566,7 +1566,7 @@ function check_item($item, $category, $id=0) { $ids = ''; $from_stamp = Rsys :: mysql_datetime_to_timestamp($from); $till_stamp = Rsys :: mysql_datetime_to_timestamp($till); - if (mysql_num_rows($result) == 0) + if (Database::num_rows($result) == 0) return false; while ($array = Database::fetch_array($result)) { $ids .= $array['id'].',';