Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Computer Availability Map UI for Drupal
<?php
drupal_add_css("sites/all/themes/osulibraries/comp_map.css");
drupal_add_js('setTimeout("window.location.reload()",300000);', 'inline');
db_set_active('comp_map');
$total_pc_results = db_query("SELECT * FROM compstatus WHERE computer_type='PC'");
$avail_pc_results = db_query("SELECT * FROM compstatus WHERE status='0' AND computer_type='PC'");
$pcs = mysql_num_rows($avail_pc_results) . '/' . mysql_num_rows($total_pc_results);
$total_mac_results = db_query("SELECT * FROM compstatus WHERE computer_type='MAC'");
$avail_mac_results = db_query("SELECT * FROM compstatus WHERE status='0' AND computer_type='MAC'");
$macs = mysql_num_rows($avail_mac_results) . '/' . mysql_num_rows($total_mac_results);
$result = db_query("SELECT * FROM compstatus");
db_set_active('default');
?>
<div id="computer_map">
#Text Equivalant
<p>PC's available: <?php echo $pcs; ?> Mac's available: <?php echo $macs; ?></p>
<div id="computer_map_600">
<dl>
<?php while($row = mysql_fetch_assoc($result)){?>
<dt class="<?=($row['status']==0 ? 'avail' : 'busy');?>_<?=(strcmp($row['computer_type'],'PC')==0 ? 'pc' : 'mac');?>_600 icon" style="left: <?=($row['left_pos']*2);?>px; top:<?=($row['top_pos']*2)+30;?>px" ><?=$row['computer_name']?></dt>
<?php }?>
</dl>
<dl>
<dt class="avail_pc_600 legend_icon" style="left: 376px; top: -2795px;">PC Available</dt>
<dt class="busy_pc_600 legend_icon" style="left: 376px; top: -2790px;">PC Busy</dt>
<dt class="avail_mac_600 legend_icon" style="left: 376px; top: -2785px;">Mac Available</dt>
<dt class="busy_mac_600 legend_icon" style="left: 376px; top: -2780px;">Mac Busy</dt>
</dl>
</div>
#Last Update
<p>Map is updated every 5 minutes. Last updated: <?php echo date("M j, Y \&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;\m\d\a\s\h\; H:i:s"); ?></p>
#end map
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.