function addTab(&$bean, $event) { global $current_user; //make sure this only runs on a Users Edit or Detail view if ($_REQUEST['module'] == 'Users' && !empty($_REQUEST['record']) && ($_REQUEST['action'] == 'EditView' || $_REQUEST['action'] == 'DetailView')) { //$mod_strings = return_module_language($GLOBALS['current_language'], 'Users'); //require_once('custom/modules/Users/homepage_manager.php'); $focus = new User(); $focus->retrieve($_REQUEST['record']); $dd = new defaultHomepage(); $defaultHomepage = $focus->hm_default_homepage_c; $onlyOnce = $focus->hm_only_once_c; $lockOptions = $dd->getLockOptions($focus->hm_lockhomepage_c); if ($onlyOnce == '1') { $onlyOnce = "checked"; } else { $onlyOnce = ""; } $defaultHomepageOptions = $dd->getAllDashboardOptions($focus->id, $defaultHomepage); if ($_REQUEST['action'] == 'EditView' && $current_user->is_admin) { echo "<script type=\"text/javascript\">\n\t\t\t\tvar EditView_tabs = new YAHOO.widget.TabView(\"EditView_tabs\");\n\t\t\t\tEditView_tabs.on('contentReady', function(e){\n\t\t\t\tEditView_tabs.addTab( new YAHOO.widget.Tab({\n\t\t\t\tlabel: 'Dashlet Manager',\n\t\t\t\tcontent: '" . $this->createFormHTML($onlyOnce, $lockOptions, $defaultHomepageOptions) . "',\n\t\t\t\tcacheData: true\n\t\t\t\t}));\n\t\t\t\t});\n\t\t\t\t</script> \n"; } if ($_REQUEST['action'] == 'DetailView') { echo "<script type=\"text/javascript\">\n\t\t\t\tvar DetailView_tabs = new YAHOO.widget.TabView(\"user_detailview_tabs\");\n\t\t\t\tDetailView_tabs.on('contentReady', function(e){\n\t\t\t\tDetailView_tabs.addTab( new YAHOO.widget.Tab({\n\t\t\t\tlabel: 'Dashlet Manager',\n\t\t\t\tcontent: '" . $this->createFormHTML($onlyOnce, $lockOptions, $defaultHomepageOptions) . "',\n\t\t\t\tcacheData: true\n\t\t\t\t}));\n\t\t\t\t});\n\t\t\t\t</script> \n"; } } }
<?php global $current_user; require_once 'modules/Users/User.php'; require_once 'custom/modules/Users/homepage_manager.php'; $dd = new defaultHomepage(); $focus = new User(); if ($_REQUEST['stage'] == '1') { if ($_REQUEST['submit'] == "Delete") { $id = $_REQUEST['dashboard_name']; $sql = "UPDATE user_preferences SET deleted=1 WHERE assigned_user_id='{$id}' AND category='Home';"; $result = $focus->db->query($sql, true); } elseif ($_REQUEST['submit'] == "Save") { $user_id = $current_user->id; $sql = "SELECT * FROM user_preferences WHERE assigned_user_id='{$user_id}' AND category='Home';"; $result = $focus->db->query($sql, true); $hash = $focus->db->fetchByAssoc($result); $name = 'DD_' . $_REQUEST['new_dashboard_name']; $new_id = create_guid(); $todays_date = date('Y-m-d h:i:s'); $sql = "INSERT INTO user_preferences (id,category,deleted,date_entered,date_modified,assigned_user_id,contents)\n\t\t\t\t\tVALUES('{$new_id}',\n\t\t\t\t\t\t 'Home',\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t '{$todays_date}',\n\t\t\t\t\t\t '{$todays_date}',\n\t\t\t\t\t\t '{$name}',\n\t\t\t\t\t\t '{$hash['contents']}');"; $result = $focus->db->query($sql, true); } } echo "\n<p>\n"; echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME'] . ": " . $mod_strings['LBL_HOMEPAGE_MANAGER_TITLE'], true); echo "\n</p>\n"; ?> <form name="default-dashboard" action="index.php" method="GET" enctype="multipart/form-data"> <INPUT type="hidden" name="module" value="Users"> <INPUT type="hidden" name="action" value="EditHomepageSettings">