[svn r17874] Minor - UI improvements & lang variables changed FS#821

skala
Julio Montoya 16 years ago
parent 5af55b37d9
commit 9bddccb11b
  1. 4
      main/reservation/m_category.php
  2. 38
      main/reservation/m_item.php
  3. 20
      main/reservation/m_reservation.php
  4. 8
      main/reservation/mysubscriptions.php
  5. 4
      main/reservation/reservation.php
  6. 62
      main/reservation/rsys.php

@ -108,7 +108,9 @@ switch ($_GET['action']) {
api_display_tool_title($tool_name);
echo $msg;
echo '<a href="m_category.php?action=add"><img src="../img/view_more_stats.gif" border="0" alt="" title="'.get_lang('AddNewBookingPeriod').'"/>'.get_lang('AddNewResourceType').'</a><br /><br />';
echo '<div class="actions">';
echo '<a href="m_category.php?action=add"><img src="../img/view_more_stats.gif" border="0" alt="" title="'.get_lang('AddNewBookingPeriod').'"/>'.get_lang('AddNewResourceType').'</a><br />';
echo '</div>';
if (isset ($_POST['action'])) {
switch ($_POST['action']) {
case 'delete_categories' :

@ -60,7 +60,7 @@ function modify_filter($id) {
$str.='<a href="m_item.php?action=edit&amp;id='.$id.'" title="'.get_lang("EditItem2").'"><img alt="" src="../img/edit.gif" /></a>';
}
//if(Rsys::item_allow($id,'m_rights')) $str.=' &nbsp;<a href="m_item.php?action=m_rights&amp;item_id='.$id.'" title="'.get_lang("MRights").'"><img alt="" src="../img/info_small.gif" /></a>';
if(Rsys::item_allow($id,'delete')) $str.=' <a href="m_item.php?action=delete&amp;id='.$id.'" title="'.get_lang("DeleteItem").'" onclick="javascript:if(!confirm('."'".addslashes(htmlentities(get_lang("ConfirmDeleteItem")))."'".')) return false;"><img alt="" src="../img/delete.gif" /></a>';
if(Rsys::item_allow($id,'delete')) $str.=' <a href="m_item.php?action=delete&amp;id='.$id.'" title="'.get_lang('DeleteResource').'" onclick="javascript:if(!confirm('."'".addslashes(htmlentities(get_lang("ConfirmDeleteResource")))."'".')) return false;"><img alt="" src="../img/delete.gif" /></a>';
return $str;
}
@ -71,7 +71,7 @@ function modify_filter($id) {
* @param - int $id The item-rights-id's
*/
function modify_rights_filter($id) {
return ' <a href="m_item.php?action=m_rights&amp;subaction=delete&amp;item_id='.substr($id, 0, strpos($id, '-')).'&amp;class_id='.substr($id, strrpos($id, '-') + 1).'" title="'.get_lang("RemoveClassRights").'" onclick="javascript:if(!confirm('."'".addslashes(htmlentities(get_lang("ConfirmDeleteItem")))."'".')) return false;"><img alt="" src="../img/delete.gif" /></a>';
return ' <a href="m_item.php?action=m_rights&amp;subaction=delete&amp;item_id='.substr($id, 0, strpos($id, '-')).'&amp;class_id='.substr($id, strrpos($id, '-') + 1).'" title="'.get_lang("RemoveClassRights").'" onclick="javascript:if(!confirm('."'".addslashes(htmlentities(get_lang("ConfirmDeleteResource")))."'".')) return false;"><img alt="" src="../img/delete.gif" /></a>';
}
/**
@ -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 '<form id="cat_form" action="m_item.php" method="get">';
echo '<div class="actions">';
echo '<a href="m_item.php?action=add"><img src="../img/view_more_stats.gif" border="0" alt="" title="'.get_lang('AddNewBookingPeriod').'"/>'.get_lang('AddNewItem').'</a>';
echo '<a href="m_item.php?action=add"><img src="../img/view_more_stats.gif" border="0" alt="" title="'.get_lang('AddNewBookingPeriod').'"/>'.get_lang('AddNewResource').'</a>';
echo '</div>';
echo '<div style="text-align: right;">'.get_lang('ResourceFilter').': ';
echo '<select name="cat" onchange="this.form.submit();"><option value="0"> '.get_lang('All').' </option>';
@ -456,17 +456,17 @@ switch ($_GET['action']) {
foreach ($cats as $cat)
echo '<option value="'.$cat['id'].'"'. ($cat['id'] == $_GET['cat'] ? ' selected="selected"' : '').'>'.$cat['name'].'</option>';
echo '</select></div></form>';
echo '<br />';
$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();
}

@ -99,15 +99,15 @@ switch ($_GET['action']) {
Display :: display_header(get_lang('OverviewSubscriptions'));
api_display_tool_title(get_lang('Overview'));
echo '<form id="cat_form" action="m_reservation.php" method="get">';
echo '<div class="actions">';
echo '<form id="cat_form" action="m_reservation.php" method="get">';
echo '<input type="hidden" name="action" value="overviewsubscriptions"/>';
echo '<div style="text-align: right;"><input type="text" name="keyword" /><input type="submit" value="'.get_lang('Search').'" /></div></form>';
echo '<br>';
echo '<input type="text" name="keyword" /><input type="submit" value="'.get_lang('Search').'" /></form>';
echo '</div><br>';
$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', '<div class="row"><div class="label"></div><div class="formw">'.get_lang('TimePickerLimitation').'</div></div><br />');
@ -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', '<div class="row"><div class="label"></div><div class="formw">'.get_lang('TimePickerLimitation').'</div></div><br />');
@ -570,8 +570,8 @@ switch ($_GET['action']) {
echo '<a href="m_reservation.php?action=add"><img src="../img/view_more_stats.gif" border="0" alt="" title="'.get_lang('AddNewBookingPeriod').'"/>'.get_lang('AddNewBookingPeriod').'</a>';
echo '&nbsp;&nbsp;&nbsp;<a href="m_reservation.php?action=overviewsubscriptions">'.get_lang('OverviewReservedPeriods').'</a>';
echo '</div>';
echo '<div style="text-align: right; "><input type="text" name="keyword" /><input type="submit" value="'.get_lang('Search').'" /></div></form>';
echo '<div style="text-align: right;"><input type="text" name="keyword" /><input type="submit" value="'.get_lang('Search').'" /></div></form>';
echo '<br>';
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);

@ -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');

@ -89,7 +89,7 @@ if ($gogogo&&!empty($_GET['cat'])) {
$itemlist = Rsys :: get_cat_items($_GET['cat']);
echo '<div style="float: left;">';
if (count($itemlist) != 0) {
echo '<form id="item_form" action="reservation.php?cat='.$_GET['cat'].'&amp;item=" method="get">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="hidden" name="cat" value="'.$_GET['cat'].'" />'.get_lang('Item').': <select name="item" onchange="this.form.submit();"><option value="0">'.get_lang('NONE').'</option>';
echo '<form id="item_form" action="reservation.php?cat='.$_GET['cat'].'&amp;item=" method="get">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="hidden" name="cat" value="'.$_GET['cat'].'" />'.get_lang('Resource').': <select name="item" onchange="this.form.submit();"><option value="0">'.get_lang('NONE').'</option>';
foreach ($itemlist as $id => $item)
echo '<option value="'.$id.'"'. ($id == $_GET['item'] ? ' selected="selected"' : '').'>'.$item.'</option>';
echo '</select></form>';
@ -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 '<br /><br /><div style="text-align:right; border-bottom: 2px dotted #666; margin: 0 0 0.2em 0; padding: 0.2em;clear:both;font-family: Verdana,sans-serif;font-size: 1.2em;color:#666;font-weight:bold">'.$GLOBALS['weekstart'].' - '.$GLOBALS['weekend'].'</div>'.$buffer.'<div style="clear:both;">&nbsp;</div><div style="background-color:#EEE;padding: 0.5em;font-family:Verdana;sans-serif;font-size:10px;text-align:center">'.$legend.'</div>';
}
}

@ -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'].',';

Loading…
Cancel
Save