$jscode .= " \$.post(\"index.php\", { saveorder: \"1\", widgetdata: orderdata, token: \"" . $csrfToken . "\" });\n}\nfunction resHomeWidgets() {\n var IDs = '';\n var IDsp = '';\n var widgetID = '';\n var visible = '';\n var widget = '';\n for (var z = 1, y = 2; z <= y; z++) {\n \tif (savedOrders[z]) {\n IDs = savedOrders[z].split(',');\n for (var i = 0, n = IDs.length; i < n; i++) {\n IDsp = (IDs[i].split(':'));\n widgetID = IDsp[0];\n visible = IDsp[1];\n widget = \$(\".homecolumn\").find('#' + widgetID).appendTo(\$('#homecol'+z));\n if (visible === 'false') {\n widget.find(\".ui-icon\").toggleClass(\"ui-icon-minusthick\").toggleClass(\"ui-icon-plusthick\");\n widget.find(\".widget-content\").hide();\n }\n }\n }\n }\n}"; $hooksdir = ROOTDIR . "/modules/widgets/"; if (is_dir($hooksdir)) { $dh = opendir($hooksdir); while (false !== ($hookfile = readdir($dh))) { if (is_file($hooksdir . $hookfile) && $hookfile != "index.php") { $extension = explode(".", $hookfile); $extension = end($extension); if ($extension == "php") { include $hooksdir . $hookfile; } } } } closedir($dh); $templatevars['widgets'] = load_admin_home_widgets(); if (checkPermission("View Income Totals", true)) { $templatevars['viewincometotals'] = true; $jquerycode .= "jQuery.post(\"index.php\", { getincome: 1, token: \"" . generate_token("plain") . "\" },\n function(data){\n jQuery(\"#incometotals\").html(data);\n });"; } $invoicedialog = $aInt->jqueryDialog("geninvoices", $aInt->lang("invoices", "geninvoices"), $aInt->lang("invoices", "geninvoicessendemails"), array($aInt->lang("global", "yes") => "window.location='index.php?generateinvoices=true" . generate_token("link") . "'", $aInt->lang("global", "no") => "window.location='index.php?generateinvoices=true&noemails=true" . generate_token("link") . "'")); $cccapturedialog = $aInt->jqueryDialog("cccapture", $aInt->lang("invoices", "attemptcccaptures"), $aInt->lang("invoices", "attemptcccapturessure"), array($aInt->lang("global", "yes") => "window.location='index.php?attemptccpayments=true" . generate_token("link") . "'", $aInt->lang("global", "no") => "")); $addons_html = run_hook("AdminHomepage", array()); $templatevars['addons_html'] = $addons_html; if (get_query_val("tbladmins", "roleid", array("id" => (int) $_SESSION['adminid'])) == 1) { $infotoggle = unserialize($whmcs->get_config("ToggleInfoPopup")); if (!is_array($infotoggle)) { $infotoggle = array(); } $showdialog = true; if (isset($infotoggle[$_SESSION['adminid']])) {
return array(); } reset($hooks[$hook_name]); $results = array(); while (list($key, $hook) = each($hooks[$hook_name])) { $widgetname = substr($hook['hook_function'], 7); if (function_exists($hook['hook_function'])) { $res = call_user_func($hook['hook_function'], $args); if ($res) { $results[$widgetname] = $res['title']; } } } return $results; } $listwidgets = load_admin_home_widgets(); asort($listwidgets); $totalportlets = ceil(count($listwidgets) / 3); $i = 1; foreach ($listwidgets as $k => $v) { echo "<input type=\"checkbox\" name=\"widget[]\" value=\"" . $k . "\" id=\"widget" . $k . "\""; if (in_array($k, $widgets)) { echo " checked"; } echo " /> <label for=\"widget" . $k . "\">" . $v . "</label><br />"; if ($totalportlets <= $i) { echo "</td><td width=\"33%\" valign=\"top\">"; $i = 1; continue; } ++$i;