<div id="dashboard"> <div class="column"> <?php if (!$request_only) { $context = new WidgetContext('dashboard1'); $context->render(); } ?> </div> <div class="column"> <?php if (!$request_only) { $context = new WidgetContext('dashboard2'); $context->render(); } ?> </div> </div><!-- /#dashboard --> <div class="clear"></div> <script src="<?php echo $Campsite['WEBSITE_URL']; ?> /js/jquery/jquery.cookie.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $('#dummy_stat_link').fancybox({
/** * Add widget to user dashboard * @param int $widgetId * @param string|IWidgetContext $contextName * @param int $uid * @param int $order * @return bool */ public static function AddWidget($widgetId, $context, $uid = NULL, $order = NULL) { global $g_ado_db, $g_user; // get context object if (is_string($context)) { $context = new WidgetContext($context); } // set uid if (empty($uid)) { $uid = $g_user->getId(); } if ($order === NULL) { // set order to be on top $sql = 'SELECT MIN(`order`) FROM ' . WidgetManagerDecorator::TABLE . ' WHERE fk_user_id = ' . (int) $uid . ' AND fk_widgetcontext_id = ' . $context->getId(); $order = $g_ado_db->getOne($sql) - 1; } // generate uniq id $id = 'w' . substr(sha1(uniqid() . $g_user->getId()), -12); // add widget $widget = new WidgetManagerDecorator(array('id' => $id, 'fk_widget_id' => (int) $widgetId, 'fk_widgetcontext_id' => $context->getId(), 'fk_user_id' => (int) $uid, 'order' => (int) $order)); $widget->create(); return $id; }