<?php
/**
 * Clase con la acción para mostrar la pagina principal de un usuario en la
 * web del banco del tiempo de Málaga.
 **/
 class AccionMenuUsuarioBtMalaga extends AccionBtMalaga {
 
 	/**
 	 * clase con la acción a realizar.
 	 **/
 	public function ejecutarAccion($controlador, $recurso) {
 		$usuario = Member::CurrentMember();
 		$componenteUsuario = DataObject::get_one('ComponenteUsuarioBtMalaga','UsuarioID='.$usuario->ID);
 		$direccionFormulario = $controlador->FormularioAccion()->FormAction();
 		$codigoSeguridad = $controlador->FormularioAccion()->SecurityID();
 		Requirements::javascript('picassocms/templates/jsparty/jquery/jquery.dimensions.js');
 		Requirements::javascript('picassocms/templates/jsparty/jquery/jquery.flydom.js');
 		Requirements::javascript('picassocms/templates/plantillasestilosopencms/scripts/jq_edit.js');
 		Requirements::css('picassocms/templates/plantillasestilosopencms/css/jq_edit.css');
	  	Requirements::customScript(<<<JS
                                        ocms_de_data["ocms_botoneraEdicionUsuario"]= { 
                                          id: "ocms_botoneraEdicionUsuario",
                                          deDisabled: false,
                                          hasModelar: false,
                                          hasEdit: true,
                                          hasDelete: false,
                                          hasNew: false,
                                          actionForm: "$direccionFormulario",
                                          securityID: "$codigoSeguridad",
                                          formularioEdicion: "FormularioEditableUsuarioBtMalaga",
                                          recursoAEditar: "$componenteUsuario->ID",
                                          accionEditar: "editarcontrol",
                                          accionAnadir: "anadirrecurso",
                                          accionBorrar: "borrarrecurso",
                                          accionModelar: "ponerwidget%26ModeladorERWidget%26FrameWidget",
                                          path: "",
                                          tipo: "",
                                          pathRecurso: "",
                                          button_edit: "Editar",
                                          button_delete: "Borrar",
                                          button_new: "Nuevo",
                                          button_modelar: "Modelar"
                                        };	  	
JS
	  	); 		
      Requirements::javascript("dhtmlx/dhtmlxscheduler/dhtmlxscheduler.js");
      Requirements::javascript("dhtmlx/dhtmlxscheduler/ext_mes_unico_view.js");
      Requirements::javascript("dhtmlx/dhtmlxscheduler/locale_es.js");
      Requirements::css("dhtmlx/dhtmlxscheduler/dhtmlxscheduler.css");
      Requirements::css("dhtmlx/dhtmlxscheduler/ext/dhtmlxscheduler_ext.css");
      
      Requirements::javascript("btmalaga/javascript/jsparty/star-rating/jquery.MetaData.js");
      Requirements::javascript("btmalaga/javascript/jsparty/star-rating/jquery.rating.js");
      Requirements::css("btmalaga/javascript/jsparty/star-rating/jquery.rating.css");
      Requirements::customScript(<<<JS
        jQuery(document).ready(function() {
                                 scheduler.init('scheduler_here',null,"mes_unico");
                                 ponerEventos();
                               }
                              );
JS
);	  	
  	  //Requirements::css('dhtmlx/dhtmlxgrid/dhtmlxgrid.css');
  	  //Requirements::css('dhtmlx/dhtmlxgrid/skins/dhtmlxgrid_dhx_skyblue.css');
  	  //Requirements::css('dhtmlx/dhtmlxgrid/ext/dhtmlxgrid_pgn_bricks.css');
  	  Requirements::css('dhtmlx/dhtmlxwindows/dhtmlxwindows.css');
  	  Requirements::css('dhtmlx/dhtmlxwindows/skins/dhtmlxwindows_dhx_skyblue.css');
      Requirements::css('dhtmlx/dhtmlxtoolbar/skins/dhtmlxtoolbar_dhx_skyblue.css');
  	  Requirements::javascript('dhtmlx/dhtmlxcommon/dhtmlxcommon.js');
  	  //Requirements::javascript('dhtmlx/dhtmlxgrid/dhtmlxgrid.js');
  	  //Requirements::javascript('dhtmlx/dhtmlxgrid/dhtmlxgridcell.js');
  	  //Requirements::javascript('dhtmlx/dhtmlxgrid/ext/dhtmlxgrid_filter.js');
  	  //Requirements::javascript('dhtmlx/dhtmlxgrid/ext/dhtmlxgrid_pgn.js');
  	  Requirements::javascript('dhtmlx/dhtmlxwindows/dhtmlxwindows.js');
      Requirements::javascript('dhtmlx/dhtmlxtoolbar/dhtmlxtoolbar.js');
  	  Requirements::javascript('dhtmlx/dhtmlxwindows/dhtmlxcontainer.js');

  	  $variables = array('direccionVer' => $controlador->URLSegment.'/verComponente',
  	                     'direccionCargarToolbar' => $controlador->URLSegment.'/cargarToolbar',
			     'direccionBase' => $controlador->URLSegment.'/FormularioAccion',
                             'direccionEditar' => $controlador->URLSegment.'/FormularioAccion',	
                             'direccionCrearNuevaOpinionServicio' => $controlador->URLSegment.'/FormularioAccion?'.ControlPicasso::PARAMETRO_ACCION.'='.ComponenteBtMalagaControl::ACCION_CREAR_NUEVO_COMPONENTE.'&'.ControlPicasso::PARAMETRO_TIPO_COMPONENTE.'=OpinionServicioBtMalaga&'.ControlPicasso::PARAMETRO_FORMULARIO_EDICION.'=FormularioEditableBtMalaga&'.ControlPicasso::PARAMETRO_NUEVO_RECURSO.'=si&'.OpinionServicioBtMalaga::PARAMETRO_FACTURA_SELECCIONADA.'=',
  	                     'seleccionarComponente' => 0,
                             'cargaAutomatica' => 0,
                             'camposGrid' => '{"Campos":[]}',
                             'camposFiltro' => '{"Campos":[]}',
                             'parametros' => ''				    					    	
  	                    );
      Requirements::javascriptTemplate('btmalaga/javascript/listarcomponentes.js', $variables);

  	  $controlador->setPlantilla('PlantillaMenuUsuario');

 		return parent::ejecutarAccion($controlador, $componenteUsuario);
 	}

 }

?>