Example #1
0
 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";
         }
     }
 }