/**
     * GetExistingAddons
     * Get a list of existing addon packages to display on the addons page
     *
     * @param Array $AddonsIds An array in which the addons ids will be stored
     * @return String
     */
    private function _GetExistingAddons(&$AddonsIds)
    {
        $output = "";
        $addon_root = sprintf("%s/addons", GetConfig("ShopPath"));
        $addons = GetAvailableAddonModules();
        $AddonsIds = array();
        if (count($addons) > 0) {
            foreach ($addons as $addon) {
                array_push($AddonsIds, $addon['object']->GetId());
                // Is the addon enabled and configured? If so it can be ran
                if (AddonsModuleIsEnabled($addon['object']->GetId())) {
                    $run_command = sprintf("document.location.href='index.php?ToDo=runAddon&addon=%s';", $addon['object']->GetId());
                } else {
                    $run_command = sprintf("if(confirm('%s')) { document.location.href='index.php?ToDo=viewAddonSettings'; } ", sprintf(GetLang("AddonModuleMustBeEnabled"), $addon['object']->GetName()));
                }
                $addonDirectory = str_replace("addon_", "", $addon['object']->GetId());
                $logo = $addon['object']->GetImage();
                if ($logo) {
                    $logo = '<img src="' . $logo . '" width="200" height="92" />';
                } else {
                    $logo = '<div style="width: 200px; height: 92px; border: 1px solid #000; text-align: center; font-size: 150%;"><div style="padding-top: 30px;">' . $addon['object']->GetName() . '</div></div>';
                }
                $output .= sprintf('<div style="text-align: center; float:left; margin-right:10px; height:145px">
									%s
									<div style="padding-top:10px;">
										<input type="button" value="%s" onclick="%s" /><br />
										<a href="index.php?ToDo=viewAddonSettings">%s</a>
									</div>
								</div>', $logo, GetLang("RunThisAddon"), $run_command, GetLang("AddonSettings"));
            }
        } else {
            $output = GetLang("NoAddons");
        }
        return $output;
    }
 private function ManageAddonSettings()
 {
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     $numAvailableAddons = count(GetAvailableAddonModules());
     if ($numAvailableAddons == 0) {
         $GLOBALS['ErrorTitle'] = GetLang('NoAddonPackages');
         $GLOBALS['Message'] = MessageBox(GetLang('SeeAddonPackages'), MSG_INFO);
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("error");
         $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
     } else {
         $GLOBALS['AddonJavaScript'] = "";
         $GLOBALS['AddonProviders'] = $this->GetAddonPackagesAsOptions();
         $GLOBALS['AddonSelectBoxSize'] = min($numAvailableAddons * 4, 12);
         // Which addon modules are enabled?
         $packages = GetEnabledAddonModules();
         $GLOBALS['AddonTabs'] = "";
         $GLOBALS['AddonDivs'] = "";
         $count = 1;
         // Setup each addon module with its own tab
         foreach ($packages as $package) {
             $package['object']->init();
             $GLOBALS['AddonTabs'] .= sprintf('<li><a href="#" id="tab%d" onclick="ShowTab(%d)">%s</a></li>', $count, $count, $package['name']);
             $GLOBALS['AddonDivs'] .= sprintf('<div id="div%d" style="padding-top: 10px;">%s</div>', $count, $package['object']->getpropertiessheet($count));
             $count++;
         }
         if (isset($GLOBALS['TabIdsToHideButtonsFrom'])) {
             $GLOBALS['TabIdsToHideButtonsFrom'] = preg_replace("/,\$/", "", $GLOBALS['TabIdsToHideButtonsFrom']);
         }
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("settings.addons.manage");
         $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
     }
 }
Esempio n. 3
0
/**
 * Return a list of the addons that are enabled and configured.
 *
 * @return array An array of addon modules that are enabled and configured.
 */
function GetSetupAddonsModules()
{
	$modules = GetAvailableAddonModules(true, true);
	return $modules;
}