<commit_before><?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2014 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 Zend\View\Model\ViewModel;
use Zend\Session\Container;
use Zend\Stdlib\ArrayUtils;
use Zend\Json\Json;

class IndexController extends AbstractActionController
{
    public function indexAction()
    {
        
        $serviceLocator = $this->getServiceLocator();
        $config = $serviceLocator->get('config');
        $en_produccion = $config['en_produccion'];
        
        if( !$en_produccion ) {
            $this->redirect()->toRoute('index2');
        }
        
        $constantes = $config['constantes'];
        $moneda = $config['moneda'];

        $user_session = new Container('user');
        $user_session->facebook = array('id' => $constantes["id_facebook"],
                                        've' => $constantes["ve_facebook"]);
        
        $campanaTable = $serviceLocator->get('Dashboard\Model\CupcampanaTable');
        $datos = $campanaTable->getCampanasAll();
        
        $data = array();
        foreach ($datos as $dato) {
             $data[] = $dato;
        }
        
        $datosG = $campanaTable->getCampanaGrupo();
        
        $dataG = array();
        foreach ($datosG as $dato) {
             $dataG[] = $dato;
        }
        
        return new ViewModel(array('data' => $data, 
                                   'dataG' => $dataG,
                                   'user_session' => $user_session,
                                   'moneda' => $moneda,
                                   ));
    }
    
    public function phpinfoAction()
    {
        return new ViewModel();
    }
    
    public function index2Action()
    {
        $this->layout('layout/layout_afiliacion');
        
        $serviceLocator = $this->getServiceLocator();
        $config = $serviceLocator->get('config');
        $constantes = $config['constantes'];

        $user_session = new Container('user');
        $user_session->facebook = array('id' => $constantes["id_facebook"],
                                        've' => $constantes["ve_facebook"]);
        
        $pais = $config['id_pais'];
        $capital = $config['id_capital'];
        $existepromocion = true; 
        
        $departamentoTable = $serviceLocator->get('Dashboard\Model\UbidepartamentoTable');
        $departamentos = $departamentoTable->getDepartamentosxPais($pais);
        
        $tipodocumentoTable = $serviceLocator->get('Dashboard\Model\GentipodocumentoTable');
        $tipodocumentos = $tipodocumentoTable->fetchAll();
        
        $categoriaTable = $serviceLocator->get('Dashboard\Model\GencategoriaTable');
        $categorias = $categoriaTable->fetchAll();
        
        return new ViewModel(array('departamentos' => $departamentos, 
                                   'tipodocumentos' => $tipodocumentos, 
                                   'categorias' => $categorias,
                                   'pais' => $pais, 
                                   'capital' => $capital, 
                                   'user_session' => $user_session,
                                   'existepromocion' => $existepromocion));
    }
    
    public function suscribirmeAction() {
        $datos = $this->params()->fromPost();
        
        $serviceLocator = $this->getServiceLocator();
        $clienteTable = $serviceLocator->get('Dashboard\Model\CupclienteTable');
        $preferenciasTable = $serviceLocator->get('Dashboard\Model\CupclientepreferenciasTable');
        
        $clienteTable->addCliente($datos);
        if(isset($datos["preferencia"])) {
            $preferenciasTable->addPreferencias($datos);
        }
        
        $datosCliente = ArrayUtils::iteratorToArray($clienteTable->getUsuarioByUser($datos["email"]));
        $datosPreferencia = ArrayUtils::iteratorToArray($preferenciasTable->getPreferenciasByUser($datos["email"]));
        
        $datos = array('0' => $datosCliente,'1' => $datosPreferencia);
        
        $viewmodel = new ViewModel();
        $viewmodel->setTerminal(true);

        return $this->getResponse()->setContent(Json::encode($datos));
        
    }
   
}
<commit_msg>cambios url y adaptacion - ultimo<commit_after><?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2014 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 Zend\View\Model\ViewModel;
use Zend\Session\Container;
use Zend\Stdlib\ArrayUtils;
use Zend\Json\Json;

class IndexController extends AbstractActionController
{
    public function indexAction()
    {
        
        $serviceLocator = $this->getServiceLocator();
        $config = $serviceLocator->get('config');
        $en_produccion = $config['en_produccion'];
        
        if( !$en_produccion ) {
            $this->redirect()->toRoute('index2');
        }
        
        $constantes = $config['constantes'];
        $moneda = $config['moneda'];

        $user_session = new Container('user');
        $user_session->facebook = array('id' => $constantes["id_facebook"],
                                        've' => $constantes["ve_facebook"]);
        
        $campanaTable = $serviceLocator->get('Dashboard\Model\CupcampanaTable');
        $datos = $campanaTable->getCampanasAll();
        
        $data = array();
        foreach ($datos as $dato) {
             $data[] = $dato;
        }
        
        $datosG = $campanaTable->getCampanaGrupo();
        
        $dataG = array();
        foreach ($datosG as $dato) {
             $dataG[] = $dato;
        }
        
        return new ViewModel(array('data' => $data, 
                                   'dataG' => $dataG,
                                   'user_session' => $user_session,
                                   'moneda' => $moneda,
                                   ));
    }
    
    public function phpinfoAction()
    {
        return new ViewModel();
    }
    
    public function index2Action()
    {
        $this->layout('layout/layout_afiliacion');
        
        $serviceLocator = $this->getServiceLocator();
        $config = $serviceLocator->get('config');
        $constantes = $config['constantes'];

        $user_session = new Container('user');
        $user_session->facebook = array('id' => $constantes["id_facebook"],
                                        've' => $constantes["ve_facebook"]);
        
        $pais = $config['id_pais'];
        $capital = $config['id_capital'];
        $existepromocion = false; 
        
        $departamentoTable = $serviceLocator->get('Dashboard\Model\UbidepartamentoTable');
        $departamentos = $departamentoTable->getDepartamentosxPais($pais);
        
        $tipodocumentoTable = $serviceLocator->get('Dashboard\Model\GentipodocumentoTable');
        $tipodocumentos = $tipodocumentoTable->fetchAll();
        
        $categoriaTable = $serviceLocator->get('Dashboard\Model\GencategoriaTable');
        $categorias = $categoriaTable->fetchAll();
        
        return new ViewModel(array('departamentos' => $departamentos, 
                                   'tipodocumentos' => $tipodocumentos, 
                                   'categorias' => $categorias,
                                   'pais' => $pais, 
                                   'capital' => $capital, 
                                   'user_session' => $user_session,
                                   'existepromocion' => $existepromocion));
    }
    
    public function suscribirmeAction() {
        $datos = $this->params()->fromPost();
        
        $serviceLocator = $this->getServiceLocator();
        $clienteTable = $serviceLocator->get('Dashboard\Model\CupclienteTable');
        $preferenciasTable = $serviceLocator->get('Dashboard\Model\CupclientepreferenciasTable');
        
        $clienteTable->addCliente($datos);
        if(isset($datos["preferencia"])) {
            $preferenciasTable->addPreferencias($datos);
        }
        
        $datosCliente = ArrayUtils::iteratorToArray($clienteTable->getUsuarioByUser($datos["email"]));
        $datosPreferencia = ArrayUtils::iteratorToArray($preferenciasTable->getPreferenciasByUser($datos["email"]));
        
        $datos = array('0' => $datosCliente,'1' => $datosPreferencia);
        
        $viewmodel = new ViewModel();
        $viewmodel->setTerminal(true);

        return $this->getResponse()->setContent(Json::encode($datos));
        
    }
   
}

{'fraction_non_alphanumeric': 0.13205114429998926, 'fraction_numerical': 0.002578704201138928, 'mean_word_length': 1.889785780813412, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 97, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '15666', 'n_tokens_mistral': 2718, 'n_tokens_neox': 2590, 'n_words': 370}