function addDashlet() { if (!is_file(sugar_cached('dashlets/dashlets.php'))) { require_once 'include/Dashlets/DashletCacheBuilder.php'; $dc = new DashletCacheBuilder(); $dc->buildCache(); } require_once sugar_cached('dashlets/dashlets.php'); global $current_user; if (isset($_REQUEST['id'])) { $pages = $current_user->getPreference('pages', $this->type); $dashlets = $current_user->getPreference('dashlets', $this->type); $guid = create_guid(); $options = array(); if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'web') { $dashlet_module = 'Home'; require_once 'include/Dashlets/DashletRssFeedTitle.php'; $options['url'] = $_REQUEST['type_module']; $webDashlet = new DashletRssFeedTitle($options['url']); $options['title'] = $webDashlet->generateTitle(); unset($webDashlet); } elseif (!empty($_REQUEST['type_module'])) { $dashlet_module = $_REQUEST['type_module']; } elseif (isset($dashletsFiles[$_REQUEST['id']]['module'])) { $dashlet_module = $dashletsFiles[$_REQUEST['id']]['module']; } else { $dashlet_module = 'Home'; } if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'chart') { $report_id = $_REQUEST['id']; //co: fixes bug 20398 to respect ACL in dashlets $dashlets[$guid] = array('className' => $dashletsFiles['ChartsDashlet']['class'], 'module' => $dashlet_module, 'fileLocation' => $dashletsFiles['ChartsDashlet']['file'], 'reportId' => $report_id); } else { $dashlets[$guid] = array('className' => $dashletsFiles[$_REQUEST['id']]['class'], 'module' => $dashlet_module, 'options' => $options, 'fileLocation' => $dashletsFiles[$_REQUEST['id']]['file']); } // add to beginning of the array array_unshift($pages[$_REQUEST['activeTab']]['columns'][0]['dashlets'], $guid); $current_user->setPreference('dashlets', $dashlets, 0, $this->type); echo $guid; } else { echo 'ofdaops'; } }
function addDashlet() { if (!is_file(sugar_cached('dashlets/dashlets.php'))) { require_once 'include/Dashlets/DashletCacheBuilder.php'; $dc = new DashletCacheBuilder(); $dc->buildCache(); } require_once sugar_cached('dashlets/dashlets.php'); global $current_user; if (isset($_REQUEST['id'])) { $pages = $current_user->getPreference('pages', $this->type); $dashlets = $current_user->getPreference('dashlets', $this->type); $guid = create_guid(); $options = array(); if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'web') { $dashlet_module = 'Home'; require_once 'include/Dashlets/DashletRssFeedTitle.php'; $options['url'] = $_REQUEST['type_module']; $webDashlet = new DashletRssFeedTitle($options['url']); $options['title'] = $webDashlet->generateTitle(); unset($webDashlet); } elseif (!empty($_REQUEST['type_module'])) { $dashlet_module = $_REQUEST['type_module']; } elseif (isset($dashletsFiles[$_REQUEST['id']]['module'])) { $dashlet_module = $dashletsFiles[$_REQUEST['id']]['module']; } else { $dashlet_module = 'Home'; } $dashlets[$guid] = array('className' => $dashletsFiles[$_REQUEST['id']]['class'], 'module' => $dashlet_module, 'options' => $options, 'fileLocation' => $dashletsFiles[$_REQUEST['id']]['file']); if (!array_key_exists('current_tab', $_SESSION)) { $_SESSION["current_tab"] = '0'; } array_unshift($pages[$_SESSION['current_tab']]['columns'][0]['dashlets'], $guid); $current_user->setPreference('dashlets', $dashlets, 0, $this->type); echo $guid; } else { echo 'ofdaops'; } }