Revision: 2652
https://sourceforge.net/p/mrbs/code/2652/
Author: cimorrison
Date: 2013-01-22 16:34:37 +0000 (Tue, 22 Jan 2013)
Log Message:
-----------
Restructured code
Modified Paths:
--------------
mrbs/branches/linked_bookings/web/functions_table.inc
mrbs/branches/linked_bookings/web/month.php
mrbs/branches/linked_bookings/web/mrbs_sql.inc
Modified: mrbs/branches/linked_bookings/web/functions_table.inc
===================================================================
--- mrbs/branches/linked_bookings/web/functions_table.inc 2013-01-19
15:49:29 UTC (rev 2651)
+++ mrbs/branches/linked_bookings/web/functions_table.inc 2013-01-22
16:34:37 UTC (rev 2652)
@@ -30,7 +30,7 @@
// It looks like:
// $column[s][n][id]
// [is_repeat]
- // [n_linked] the number of entries that are
linked together
+ // [linked] the room_ids of linked entries
// [is_multiday_start] a boolean indicating if the booking
stretches
// beyond the day start
// [is_multiday_end] a boolean indicating if the booking
stretches
@@ -120,7 +120,7 @@
// fill in the id, type and start time
$column[$s][$n]["id"] = $row['entry_id'];
$column[$s][$n]["is_repeat"] = !empty($row['repeat_id']);
- $column[$s][$n]["n_linked"] = $row['n_linked'];
+ $column[$s][$n]["linked"] = $row['linked'];
$column[$s][$n]["is_multiday_start"] = $is_multiday_start;
$column[$s][$n]["is_multiday_end"] = $is_multiday_end;
$column[$s][$n]["status"] = $row['status'];
@@ -265,7 +265,7 @@
//
// $cell[n][id]
// [is_repeat]
- // [n_linked]
+ // [linked]
// [is_multiday_start]
// [is_multiday_end]
// [color]
@@ -332,7 +332,7 @@
{
$id = $cell[$n]["id"];
$is_repeat = $cell[$n]["is_repeat"];
- $n_linked = $cell[$n]["n_linked"];
+ $linked = $cell[$n]["linked"];
$is_multiday_start = $cell[$n]["is_multiday_start"];
$is_multiday_end = $cell[$n]["is_multiday_end"];
$status = $cell[$n]["status"];
@@ -393,7 +393,7 @@
{
$id = $cell[$n]["id"];
$is_repeat = $cell[$n]["is_repeat"];
- $n_linked = $cell[$n]["n_linked"];
+ $linked = $cell[$n]["linked"];
$is_multiday_start = $cell[$n]["is_multiday_start"];
$is_multiday_end = $cell[$n]["is_multiday_end"];
$status = $cell[$n]["status"];
@@ -428,7 +428,7 @@
$html .= "<div class=\"celldiv slots1\">\n"; // we want clipping of
overflow
$html .= "<a href=\"view_entry.php?id=$id&".
$query_strings['booking'] . "\" title=\"$long_descr\">";
$html .= ($is_repeat) ? "<img class=\"repeat_symbol\"
src=\"images/repeat.png\" alt=\"" . get_vocab("series") . "\" title=\"" .
get_vocab("series") . "\" width=\"10\" height=\"10\">" : '';
- $html .= ($n_linked > 1) ? "<img class=\"link_symbol $c\"
src=\"images/link.png\" alt=\"" . get_vocab("linked_entry") . "\" title=\"" .
get_vocab("linked_entry") . "\" width=\"16\" height=\"16\">" : '';
+ $html .= (count($linked) > 1) ? "<img class=\"link_symbol $c\"
src=\"images/link.png\" alt=\"" . get_vocab("linked_entry") . "\" title=\"" .
get_vocab("linked_entry") . "\" width=\"16\" height=\"16\">" : '';
$html .= "$descr</a>\n";
$html .= "</div>\n";
@@ -449,7 +449,7 @@
{
$id = $cell[0]["id"];
$is_repeat = $cell[0]["is_repeat"];
- $n_linked = $cell[0]["n_linked"];
+ $linked = $cell[0]["linked"];
$is_multiday_start = $cell[0]["is_multiday_start"];
$is_multiday_end = $cell[0]["is_multiday_end"];
$status = $cell[0]["status"];
@@ -541,7 +541,7 @@
"\">\n";
$html .= "<a href=\"view_entry.php?id=$id&".
$query_strings['booking'] . "\" title=\"$long_descr\">";
$html .= ($is_repeat) ? "<img class=\"repeat_symbol $c\"
src=\"images/repeat.png\" alt=\"" . get_vocab("series") . "\" title=\"" .
get_vocab("series") . "\" width=\"10\" height=\"10\">" : '';
- $html .= ($n_linked > 1) ? "<img class=\"link_symbol $c\"
src=\"images/link.png\" alt=\"" . get_vocab("linked_entry") . "\" title=\"" .
get_vocab("linked_entry") . "\" width=\"16\" height=\"16\">" : '';
+ $html .= (count($linked) > 1) ? "<img class=\"link_symbol $c\"
src=\"images/link.png\" alt=\"" . get_vocab("linked_entry") . "\" title=\"" .
get_vocab("linked_entry") . "\" width=\"16\" height=\"16\">" : '';
$html .= "$descr</a>\n";
$html .= "</div>\n";
}
@@ -794,8 +794,8 @@
// row['entry_create_by'] = Creator/owner of entry
// row['status'] = Status code of the entry
- // Add in the number of entries that are linked
- $row['n_linked'] = $linked_entries[$row['entry_id']];
+ // Add in the array of linked room_ids
+ $row['linked'] = $linked_entries[$row['entry_id']];
map_add_booking($row, $today[$row['room_id']][$day], $am7, $pm7);
@@ -1116,8 +1116,8 @@
{
for ($i = 0; ($row = sql_row_keyed($res, $i)); $i++)
{
- // Add in the number of entries that are linked
- $row['n_linked'] = $linked_entries[$row['entry_id']];
+ // Add in the array of linked room ids
+ $row['linked'] = $linked_entries[$row['entry_id']];
map_add_booking($row, $week_map[$room][$j], $am7[$j], $pm7[$j]);
}
}
Modified: mrbs/branches/linked_bookings/web/month.php
===================================================================
--- mrbs/branches/linked_bookings/web/month.php 2013-01-19 15:49:29 UTC (rev
2651)
+++ mrbs/branches/linked_bookings/web/month.php 2013-01-22 16:34:37 UTC (rev
2652)
@@ -219,7 +219,7 @@
$d[$day_num]['id'][] = $row['id'];
$d[$day_num]['color'][] = $row['type'];
$d[$day_num]['is_repeat'][] = !empty($row['repeat_id']);
- $d[$day_num]['n_linked'][] = $linked_entries[$row['id']];
+ $d[$day_num]['linked'][] = $linked_entries[$row['id']];
// Handle private events
if (is_private_event($row['status'] & STATUS_PRIVATE))
@@ -493,7 +493,7 @@
}
echo "<a href=\"$booking_link\" title=\"$full_text\">";
echo ($d[$cday]['is_repeat'][$i]) ? "<img class=\"repeat_symbol\"
src=\"images/repeat.png\" alt=\"" . get_vocab("series") . "\" title=\"" .
get_vocab("series") . "\" width=\"10\" height=\"10\">" : '';
- echo ($d[$cday]['n_linked'][$i] > 1) ? "<img class=\"link_symbol\"
src=\"images/link.png\" alt=\"" . get_vocab("linked_entry") . "\" title=\"" .
get_vocab("linked_entry") . "\" width=\"16\" height=\"16\">" : '';
+ echo (count($d[$cday]['linked'][$i]) > 1) ? "<img
class=\"link_symbol\" src=\"images/link.png\" alt=\"" .
get_vocab("linked_entry") . "\" title=\"" . get_vocab("linked_entry") . "\"
width=\"16\" height=\"16\">" : '';
echo "$display_text</a>\n";
echo "</div>\n";
}
Modified: mrbs/branches/linked_bookings/web/mrbs_sql.inc
===================================================================
--- mrbs/branches/linked_bookings/web/mrbs_sql.inc 2013-01-19 15:49:29 UTC
(rev 2651)
+++ mrbs/branches/linked_bookings/web/mrbs_sql.inc 2013-01-22 16:34:37 UTC
(rev 2652)
@@ -1740,10 +1740,11 @@
// Get all the linked entries in the system between $interval_start and
$interval_end
-// Returns an array with index id and value the number of linked entries
+// Returns an array with index id and value an array of room_ids.
function get_linked_entries($interval_start, $interval_end)
{
global $tbl_room_entry, $tbl_entry, $tbl_room, $tbl_area;
+ global $area_room_separator;
$linked_entries = array();
@@ -1758,7 +1759,7 @@
// booking a new booking will be made leaving the rest of the linked booking
in
// the disabled room as a separate booking).
- $sql = "SELECT entry_id, COUNT(*) AS n_linked
+ $sql = "SELECT entry_id, room_id
FROM $tbl_room_entry RE, $tbl_entry E, $tbl_room R, $tbl_area A
WHERE E.id = RE.entry_id
AND RE.room_id = R.id
@@ -1766,7 +1767,7 @@
AND R.disabled = 0
AND A.disabled = 0
AND start_time <= $interval_end AND end_time > $interval_start
- GROUP BY entry_id";
+ ORDER BY entry_id, area_name, R.sort_key";
$res = sql_query($sql);
if ($res === FALSE)
@@ -1777,7 +1778,11 @@
for ($i = 0; ($row = sql_row_keyed($res, $i)); $i++)
{
- $linked_entries[$row['entry_id']] = $row['n_linked'];
+ if (!isset($linked_entries[$row['entry_id']]))
+ {
+ $linked_entries[$row['entry_id']] = array();
+ }
+ $linked_entries[$row['entry_id']][] = $row['room_id'];
}
return $linked_entries;
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits