} } //make all the css for the modal echo "<style>"; foreach ($userWidgets as $widgetID => $userID) { echo "#modalBox #dialog" . $widgetID; echo "{\n\t\twidth:auto;\n\t\tmax-width: 80%;\n\t\tmin-width:40%;\n \t\theight:auto;\n\t\tpadding:10px;\n\t\tpadding-top:10px;\n\t\toverflow:auto;\n\t}"; } echo "</style>"; echo "<div id='main'>\n<h1 id='mainTitle'>HOME</h1>"; echo "<div id='col1' class='infoBox'>"; if ($userWidgets != '') { foreach ($userWidgets as $widgetID => $userID) { $curWidgetInfo = new Widgets($widgetID); $title = $curWidgetInfo->get_name(); $col = $curUser->get_position_x($widgetID); if ($col == 0) { if (file_exists($curWidgetInfo->get_filename())) { include_once $curWidgetInfo->get_filename(); $widgetClass = $curWidgetInfo->get_class_name(); if (class_exists($widgetClass)) { $widget = new $widgetClass(); echo "<div class='portlet' id='p_" . $widgetID . "'>\n\t\t\t\t\t\t\t<div id='title' class='portlet-header'>"; echo $title; echo "<div class='minimize'></div>"; if (method_exists($widget, 'get_config')) { echo "<a name=modal href='#dialog" . $widgetID . "' style='float:right;color:#FFF'>Edit</a>"; } echo "</div>\n\t\t\t\t\t\t\t<div id='id" . $widgetID . "' class='portlet-content information'>\n\t\t\t\t\t\t\t<h3> LOADING...</h3>"; echo "</div>\n\t\t\t\t\t\t </div>"; if (method_exists($widget, 'get_config')) {
function checkPosition($widgetID) { $curUser = new DashboardUsers($_SESSION['userid']); $userWidgets = $curUser->get_users_widgets(); $curWidPosX = $curUser->get_position_x($widgetID); $curWidPosY = $curUser->get_position_y($widgetID); foreach ($userWidgets as $widgetID2 => $userID2) { if ($widgetID != $widgetID2) { $compWidPosX = $curUser->get_position_x($widgetID2); $compWidPosY = $curUser->get_position_y($widgetID2); if ($curWidPosX == $compWidPosX && $curWidPosY == $compWidPosY) { $curUser->set_widget_id($widgetID2); $newX = $compWidPosX + 1; $newY = $compWidPosY; if ($newX >= 3) { $newX = 0; $newY++; } $curUser->set_position_x($newX); $curUser->set_position_y($newY); $curUser->update_widget(); checkPosition($widgetID2); } } } }