Rovak / KJSencha

Ext-JS / Sencha Touch Integration Module for Zend Framework 2
Other
24 stars 15 forks source link

Adding a controller cooperating with Sencha Architect 3 Direct #31

Open demon222 opened 10 years ago

demon222 commented 10 years ago

example:

<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace Application\Controller;

//use Zend\Mvc\Controller\AbstractActionController;

use JaztecAcl\Controller\AuthorizedController;
use KJSencha\Direct\Remoting\Api\Api;
use Zend\Http\Headers;
class IndexController extends AuthorizedController
{
    public function indexAction()
    {
        $sm = $this->getServiceLocator();
        $bootstrap = $sm->get('kjsencha.bootstrap');
        return $bootstrap->getViewModel();
    }

    public function apiAction()
    {
        $this->layout( 'layout/api' );        
        $headers = new Headers();
        $headers->addHeaderLine('Content-Type', 'text/javascript');
        $headers->addHeaderLine('Access-Control-Allow-Origin','*');
        $this->getResponse()->setHeaders($headers);        
        $sm = $this->getServiceLocator();
        $dr = $sm->get('kjsencha.api');
        $dr->setType('rpc');
        $dr->setUrl( (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $dr->getUrl());        
        echo sprintf('Ext.ns(\'Ext.mbDirect\'); Ext.mbDirect.APIDesc = %s;', $dr->buildRemotingProvider()->toJson());

    }    
}
Rovak commented 10 years ago

Hi Demon, what is the intent of this ticket?

demon222 commented 10 years ago

Hi my name is Radek

Please test Sencha Architect 3 - you will know what is the intention of the ticket

Wiadomość napisana przez Roy van Kaathoven notifications@github.com w dniu 30 lis 2013, o godz. 18:15:

Hi Demon, what is the intent of this ticket?

— Reply to this email directly or view it on GitHub.