Ejemplo n.º 1
0
/**
 *  This file is part of amfPHP
 *
 * LICENSE
 *
 * This source file is subject to the license that is bundled
 * with this package in the file license.txt.
 * @package Amfphp_BackOffice
 */
/**
 * includes
 */
require_once dirname(__FILE__) . '/ClassLoader.php';
$accessManager = new Amfphp_BackOffice_AccessManager();
$isAccessGranted = $accessManager->isAccessGranted();
$config = new Amfphp_BackOffice_Config();
?>

<html>
    <title>Amfphp Back Office - Service Browser</title>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
        <link rel="stylesheet" type="text/css" href="css/jquery-ui.css" />
        <link rel="stylesheet" type="text/css" href="css/style.css" />

        <script type="text/javascript" src="js/jquery.js"></script>
        <script type="text/javascript" src="js/jquery.hotkeys.js"></script>
        <script type="text/javascript" src="js/jquery.jstree.js"></script>
        <script type="text/javascript" src="js/dataparse.js"></script>
        <script type="text/javascript" src="js/ace/ace.js"></script>
        <script type="text/javascript" src="js/amfphp_updates.js"></script>
Ejemplo n.º 2
0
?>

<div id='menu'>
    Use one of the following generators to generate a client Stub project. <br/>
    These include :<br/><br/>
    <ul>
        <li>code to make calling your services easy</li>
        <li>a starting point for a user interface you can customize</li>
    </ul>
    <br/><br/>
    Code will be generated for the following services:
    <br/><br/>
<?php 
$generatorManager = new Amfphp_BackOffice_ClientGenerator_GeneratorManager();
$generators = $generatorManager->loadGenerators(array('ClientGenerator/Generators'));
$config = new Amfphp_BackOffice_Config();
$amfphpUrl = $config->resolveAmfphpEntryPointUrl();
$serviceCaller = new Amfphp_BackOffice_ServiceCaller($amfphpUrl);
//load service descriptors
$services = $serviceCaller->makeAmfphpJsonServiceCall("AmfphpDiscoveryService", "discover");
//remove discovery service from list
unset($services->AmfphpDiscoveryService);
//list services
echo '<ul>';
foreach ($services as $service) {
    echo "<li>{$service->name}</li>";
}
echo '</ul>';
//links for each generator
echo "\n<table>";
foreach ($generators as $generator) {
$accessManager = new Amfphp_BackOffice_AccessManager();
$isAccessGranted = $accessManager->isAccessGranted();
if (!$isAccessGranted) {
    die('User not logged in');
}
$servicesStr = null;
if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
    $servicesStr = $GLOBALS['HTTP_RAW_POST_DATA'];
} else {
    $servicesStr = file_get_contents('php://input');
}
$services = json_decode($servicesStr);
$generatorClass = $_GET['generatorClass'];
$generatorManager = new Amfphp_BackOffice_ClientGenerator_GeneratorManager();
$generators = $generatorManager->loadGenerators(array('ClientGenerator/Generators'));
$config = new Amfphp_BackOffice_Config();
$generator = $generators[$generatorClass];
$newFolderName = date("Ymd-his-") . $generatorClass;
//temp for testing.
//$newFolderName = $generatorClass;
$genRootRelativeUrl = 'ClientGenerator/Generated/';
$genRootFolder = AMFPHP_BACKOFFICE_ROOTPATH . $genRootRelativeUrl;
$targetFolder = $genRootFolder . $newFolderName;
$generator->generate($services, $config->resolveAmfphpEntryPointUrl(), $targetFolder);
$urlSuffix = $generator->getTestUrlSuffix();
if ($urlSuffix !== false) {
    echo '<a target="_blank" href="' . $genRootRelativeUrl . $newFolderName . '/' . $urlSuffix . '"> try your generated project here</a><br/><br/>';
}
if (Amfphp_BackOffice_ClientGenerator_Util::serverCanZip()) {
    $zipFileName = "{$newFolderName}.zip";
    $zipFilePath = $genRootFolder . $zipFileName;
Ejemplo n.º 4
0
/**
 *  This file is part of amfPHP
 *
 * LICENSE
 *
 * This source file is subject to the license that is bundled
 * with this package in the file license.txt.
 * @package Amfphp_BackOffice
 */
/**
 * includes
 */
require_once dirname(__FILE__) . '/ClassLoader.php';
$addToTitle = ' - Service Browser';
require_once dirname(__FILE__) . '/Top.php';
$config = new Amfphp_BackOffice_Config();
$serviceCaller = new Amfphp_BackOffice_ServiceCaller($config->resolveAmfphpEntryPointUrl());
//load service descriptors
$services = $serviceCaller->makeAmfphpJsonServiceCall("AmfphpDiscoveryService", "discover");
//what are we calling?
$callMethodName = null;
if (isset($_GET['methodName'])) {
    $callMethodName = $_GET['methodName'];
}
$callServiceName = null;
if (isset($_GET['serviceName'])) {
    $callServiceName = $_GET['serviceName'];
}
$callParameters = $_POST;
/**
 * 3 cases: