spabloramirez
4/6/2015 - 8:39 AM

EzPublish

DESDE JAVASCRIPT
{{ jstranslates('contacto',app.request.locale)|raw }} /*incluirla en la plantilla*/
console.log(translate.contacto.apellidos)


CONTROLADOR
  $translated = $this->get('translator')->trans('feedback', array(), 'test');
PLANTILLA
  //especificar el dominio
  {% trans from "test" %}feedback{% endtrans %}
  //definir un dominio por defecto
  {% trans_default_domain "test" %}
  {{'feedback'|trans}}
  {{'feedback.max_size.2000'|trans}}
  

//Z:\ezpublish\src\EzSystems\DemoBundle\Resources\translations\test.es.xlf
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
    <file source-language="en" datatype="plaintext" original="file.ext">
        <body>
            <trans-unit id="1">
                <source>feedback</source>
                <target>This field cannot be longer than 255 characters</target>
            </trans-unit>
            <trans-unit id="2">
                <source>feedback.max_size.2000</source>
                <target>This field cannot be longer than 2000 characters</target>
            </trans-unit>
            <trans-unit id="3">
                <source>search.simple.max_size.2000</source>
                <target>This field cannot be longer than 2000 characters</target>
            </trans-unit>
        </body>
    </file>
</xliff>
public function getPageHeaderAction()
    {
        $searchServiceHelper = $this->get('searchservice');
        $ezLocale = $this->get('getlanguage')->getEzLocale();

        $addSortArray[] = new SortClause\LocationPriority(Query::SORT_ASC);

        $locationId = $this->container->getParameter('ezdemo.menu_page_header.location_id');
        $menuElements = $searchServiceHelper->getChildrenObjects($locationId, $ezLocale, array('Link'), array(), $addSortArray);

        $content = array();
        foreach ($menuElements as $key => $menuElement) {
            $content['menus'][$key]['href'] = $menuElement->valueObject->getField( 'location', $ezLocale )->value->link;
            $content['menus'][$key]['text'] = $menuElement->valueObject->getField( 'location', $ezLocale )->value->text;
        }

        $response = new Response();
        return $this->render(
            'eZDemoBundle:page_layout:page_header.html.twig',
            array(
                'content' => $content
            ),
            $response
        );
    }
/*******************************************************************************/

SECCION
$section = $sectionService->loadSection( $micrositeResources[0]->valueObject->versionInfo->contentInfo->sectionId 

 public function printLocationAction( $locationId ){

        $ezLocale = $this->get('getlanguage')->getEzLocale();

        $searchServiceHelper = $this->get('searchservice');
        $locationService = $this->getRepository()->getLocationService();
        $URLAliasService = $this->getRepository()->getURLAliasService();
        $contentTypeService = $this->getRepository()->getContentTypeService();

        $addSortArray[] = new SortClause\LocationPriority( Query::SORT_ASC );
        $childrenObjects = $searchServiceHelper->getChildrenObjects( $locationId, $ezLocale, array('banner1','keywords_page_item','banner2','imagen_texto_left','imagen_texto_right','imagen_texto_left2','columnas','boxes'), array(), $addSortArray );

        foreach($childrenObjects as $key => $elem){
            $contentType = $contentTypeService->loadContentType($elem->valueObject->versionInfo->contentInfo->contentTypeId);
            $contentClass = $contentType->getName($ezLocale);
            switch( $contentClass ){
                case 'keywords_page_item':
                    var_dump('ok');
                    break;
            }
        }
 }
//definir origen
<a href="#" class="modal-open" data-modal-id="{{loop.index}}">{{ 'leermas'|trans }}</a>
//definir destino
<div class="modal-content oculto" id="{{loop.index}}">

//ez-cabecera
  <li>Cubre el 99% de las mascotas. 
    <literal class="html"><a href="" class="modal-open" data-modal-id="modal-mascotas"><span>Ver animales incluido.</span></a></literal>
 </li>
 //ez-modal
 <div class="modal-group full">
http://share.ez.no/content/download/161941/957952/version/8/file/ezpublish5_community_project-2014.11.1-gpl-full.tar.gz

tar xvzf ezpublish5_community_project-2014.11.1-gpl-full.tar.gz
mv ezpublish5_community_project-2014.11.1-gpl-full ezpublish
chown -R root:root ezpublish
cd ezpublish
setfacl -R -m u:apache:rwx -m u:apache:rwx ezpublish/{cache,logs,config,sessions} ezpublish_legacy/{design,extension,settings,var} web
setfacl -dR -m u:apache:rwx -m u:`whoami`:rwx ezpublish/{cache,logs,config,sessions} ezpublish_legacy/{design,extension,settings,var} web


/************************************************
SERVICIOS
************************************************/
/*
*CARGAR SERVICIOS DE EZ
*$NAMEService = $this->getRepository()->getNAMEService();
*/
$contentService               = $this->getRepository()->getContentService();
$locationService              = $this->getRepository()->getLocationService();
$imageVariationService        = $this->get( 'ezpublish.fieldType.ezimage.variation_service' );
$contentTypeService           = $this->getRepository()->getContentTypeService();

/*
*CARGAR SERVICIOS PROPIOS
*/
$searchServiceHelper = $this->get('searchservice');
	$locationId 	= $searchServiceHelper->getObjectLocationId($contentId);
	$objectList 	= $searchServiceHelper->getChildrenObjects($locationId, $ezLocale, array('OBJECT_CLASS'), array(), $addSortArray);

/************************************************
CONTENIDO
************************************************/
//recuperar objeto por contentId
$objectContent = $contentService->loadContent($contentId,array($ezLocale));
//recuperar objeto por locationId
$contentId = $locationService->loadLocation($locationId)->contentInfo->id;
$objectContent = $contentService->loadContent($contentId,array($ezLocale));


/************************************************
TIPOs DE CAMPO
************************************************/
//META INFORMACION
$content['name']                 = $objectContent->versionInfo->contentInfo->name;
$content['contentTypeId']        = $objectContent->versionInfo->contentInfo->contentTypeId;
$content['mainLocationId']       = $objectContent->versionInfo->contentInfo->mainLocationId;
$content['content_class']        = $contentTypeService->loadContentType($objectContent->contentInfo->contentTypeId)->getName($ezLocale)

//IMAGE
$content['image_url']            = $objectContent->getField('image')->value->uri;
$content['image_alt']            = $objectContent->getField('image')->value->alternativeText;
$content['content_class']        = $contentTypeService->loadContentType($objectContent->contentInfo->contentTypeId)->getName($ezLocale)
$content['image_url_medium']     = $imageVariationService->getVariation( $objectContent->getField('image') , $objectContent->versionInfo, "medium" )->uri;//small|medium|large|reference

//TEXT
$content['text'] = $object->getField( 'text', $ezLocale )->value->text;

//URL ALIAS
{{ path( 'ez_urlalias', {'contentId': content.contacto.content_id } ) }}

//XML
{{ ez_render_field( content.footerContent, 'description' ) }}
{% if content.getField('description').value.xml|xmltext_to_html5 %}//has content twig

//CHECKBOX
$content['check'] = $object->valueObject->getField('check', $ezLocale)->value;
if ($object->valueObject->getField('check', $this->ezLocale)->value->bool){}
{% if content.separador == '1'%} {% endif %}//twig

/************************************************
IDIOMA
************************************************/
$ezLocale = $this->get('getlanguage')->getEzLocale();
$locale = $this->get('getlanguage')->getLocale(); 

/************************************************
GENERAL
************************************************/
//Obtener un parametro
$slideDirContentId = $this->container->getParameter('ezdemo.slide_dir.content_id');