Phalcon system in perfect running 1.3.4, 2.0.2 to upgrade to the views do not show me the form or content of the views. renowned folders "Persons" to "persons", ie you change the lowercase pa and if it shows the content.
there any way to display the content leaving P in uppercase?
however there are two views that are not seen, despite the renowned Lower case, placed them as one example of what I have.
in the routes.
<?php
//Use the annotations router
$router = new \Phalcon\Mvc\Router\Annotations(false);
$router->removeExtraSlashes(true);
$router->setUriSource(\Phalcon\Mvc\Router::URI_SOURCE_SERVER_REQUEST_URI);
//se agregan todos los controladores que tienen annotations de rutas
$router->addResource('Index', '/');
$router->addResource('Login', '/login');
$router->addResource('Personas', '/personas');
$router->addResource('Usuarios', '/usuarios');
$router->addResource('Select', '/select');
$router->addResource('EmpresaEntidad', '/empresaentidad');
$router->addResource('Llamadas', '/llamadas');
$router->addResource('Permisos', '/permisos');
$router->addResource('UsuarioControl', '/usuariocontrol');
$router->addResource('Usuarios', '/usuarios');
$router->addResource('Usuariostipos', '/usuariostipos');
$router->addResource('MenuPrivilegio', '/menuprivilegio'); <----------------------------------- VIEW NOT SHOWN ------------------------------>
$router->notFound([
"controller" => "Index",
"action" => "page404"
]);
/*
* Define custom routes. File gets included in the router service definition.
*/
$router->add('/confirm/{codigo}/{correo}', array(
'controller' => 'usuario_control',
'action' => 'confirmCorreo'
));
$router->add('/reset-password/{codigo}/{correo}', array(
'controller' => 'usuario_control',
'action' => 'resetClave'
));
return $router;
in the controller.
<?php
use Phalcon\Mvc\Model\Criteria;
use Phalcon\Paginator\Adapter\Model as Paginator;
/**
* @RoutePrefix("/menuprivilegio")
*/
class MenuPrivilegioController extends ControllerBase
{
/**
* @Route("")
*/
public function indexAction()
{
$UsuarioForm = new UsuarioForm;
$this->view->UsuarioForm = $UsuarioForm;
$caso = 0;
if ($this->request->isPost()) {
$caso = 1;
// Validate the usuario tipo
$usuarioTipo = UsuarioTipos::findFirstById($this->request->getPost('id_usuario_tipo'));
$permisos_usuario = $this->modelsManager->createBuilder()
->from('Menu')
->innerjoin('MenuPrivilegio', 'Menu.id=MenuPrivilegio.id_menu')
->innerjoin('UsuarioTipos', 'UsuarioTipos.id=MenuPrivilegio.id_usuario_tipos')
->where('Menu.id_menu_padre IS NOT NULL')
->andWhere('UsuarioTipos.id='.$usuarioTipo->id)
->orderBy('Menu.controlador')
->getQuery()
->execute();
if ($this->request->hasPost('permissions') or $this->request->getPost('check')=='true') {
$menus = $this->modelsManager->createBuilder()
->from('MenuPrivilegio')
->Where('id_usuario_tipos='.$usuarioTipo->id)
->getQuery()
->execute();
if ($menus) {
foreach ($menus as $menu) {
$menu->delete();
}
}
$this->tag->setDefault("id_usuario_tipo", $usuarioTipo->id);
$cont1 = 0;
$cont2 = 0;
// Save the new permisos
foreach ($this->request->getPost('permissions') as $permiso) {
$parts = explode('.', $permiso);
/*
obtenemos el id de la tabla menu donde el controlador y
accion sean iguales al checkbox seleccionado en la vista
*/
$menus = Menu::query()
->where("controlador = '".$parts[0]."'")
->andWhere("accion = '".$parts[1]."'")
->execute();
$permiso = new MenuPrivilegio;
$permiso->id_usuario_tipos = $usuarioTipo->id;
foreach ($menus as $menu) {
$permiso->id_menu = $menu->getId();
}
$cont1++;
if($permiso->save()){
$cont2++;
}
}
if( $cont1 == $cont2){
$this->flash->success('Los permisos han sido actualizados correctamente');
}
}
// Rebuild the ACL with
$this->acl->rebuild();
// Pass the current permisos to the view
$this->view->usuarioTipo = $this->request->getPost('id_usuario_tipo');
$this->view->permisos_usuario = $permisos_usuario;
}
$this->view->caso = $caso;
// Pass all the active usuarioTipos
$this->view->usuarioTipos = UsuarioTipos::find('es_activo = "Y"');
}
}
in the model.
<?php
class MenuPrivilegio extends \Phalcon\Mvc\Model
{
/**
*
* @var integer
*/
protected $id_menu;
/**
*
* @var integer
*/
protected $id_usuario_tipos;
/**
* Method to set the value of field id_menu
*
* @param integer $id_menu
* @return $this
*/
public function setIdMenu($id_menu)
{
$this->id_menu = $id_menu;
return $this;
}
/**
* Method to set the value of field id_usuario_tipos
*
* @param integer $id_usuario_tipos
* @return $this
*/
public function setIdUsuarioTipos($id_usuario_tipos)
{
$this->id_usuario_tipos = $id_usuario_tipos;
return $this;
}
/**
* Returns the value of field id_menu
*
* @return integer
*/
public function getIdMenu()
{
return $this->id_menu;
}
/**
* Returns the value of field id_usuario_tipos
*
* @return integer
*/
public function getIdUsuarioTipos()
{
return $this->id_usuario_tipos;
}
/**
* Initialize method for model.
*/
public function initialize()
{
$this->setSchema("sipv_comun");
$this->belongsTo('id_menu', 'menu', 'id', array('alias' => 'menu'));
$this->belongsTo('id_usuario_tipos', 'usuariotipos', 'id', array('alias' => 'usuariotipos'));
}
/**
* Independent Column Mapping.
*/
public function columnMap()
{
return array(
'id_menu' => 'id_menu',
'id_usuario_tipos' => 'id_usuario_tipos'
);
}
}
in the view.
{{ content() }}
<div class="col-sm-12">
{{ link_to("", "Inicio", 'class': 'btn btn-default btn-flat') }}
</div>
<div class="col-sm-8 col-sm-offset-2">
<div class="box box-danger">
<div class="box-header">
<h3 class="box-title">Administrar Permisos</h3>
</div>
<div class="box-body">
{{ form('method': 'post', 'autocomplete': 'on', 'onsubmit': 'if(!jQuery(this).isValidForm()) return false;', 'class': 'form-horizontal') }}
<div class="form-group">
{{ UsuarioForm.label('id_usuario_tipo', ['class': 'control-label col-lg-3']) }}
<div class="col-lg-7">
{{ UsuarioForm.render('id_usuario_tipo', ['class': 'form-control']) }}
</div>
<div class="col-lg-2">
{{ submit_button('Buscar', 'class': 'btn btn-primary') }}
</div>
</div>
{{ end_form() }}
</div>
</div>
</div>
{% if caso == 1 %}
{{ form('method': 'post', 'autocomplete': 'on', 'onsubmit': 'if(!jQuery(this).isValidForm()) return false;', 'class': 'form-horizontal') }}
<div class="col-sm-10 col-sm-offset-1">
<div class="nav-tabs-custom">
{% if request.isPost() and usuarioTipo %}
<ul class="nav nav-tabs nav-justified">
{% set aux = 0 %}
{% for resource, actions in acl.RecursosPrivados2() %}
{% if aux == 0 %}
<li class="active"><a href={{ '#' ~ resource }} data-toggle="tab" aria-expanded="true">{{ resource }}</a></li>
{% else %}
<li><a href={{ '#' ~ resource }} data-toggle="tab" aria-expanded="false">{{ resource }}</a></li>
{% endif %}
{% set aux = aux + 1 %}
{% endfor %}
</ul>
<div class="tab-content">
{% set aux2 = 0 %}
{% for resource, actions in acl.RecursosPrivados2() %}
{% if aux2 == 0 %}
<div class="tab-pane fade in active" id='{{ resource }}'>
<table class="table table-striped table-bordered table-hover ordenada table-responsive">
<thead>
<tr>
<th width="5%"></th>
<th><a href="javascript:void(0)" class="ordenar">Accion <i class="fa fa-sort"></i></a></th>
</tr>
</thead>
<tbody>
{% for action in actions %}
<tr>
<td align="center">
<input type="checkbox" name="permissions[]" id="permissions" value="{{ resource ~ '.' ~ action }}"
<?php
foreach ($permisos_usuario as $permiso_usuario) {
if($permiso_usuario->getControlador().'/'.$permiso_usuario->getAccion() == $resource.'/'.$action){
echo "checked='checked'";
}
}
?>
>
</td>
<td>{{ action }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="tab-pane fade" id='{{ resource }}'>
<table class="table table-striped table-bordered table-hover ordenada table-responsive">
<thead>
<tr>
<th width="5%"></th>
<th><a href="javascript:void(0)" class="ordenar">Accion <i class="fa fa-sort"></i></a></th>
</tr>
</thead>
<tbody>
{% for action in actions %}
<tr>
<td align="center">
<input type="checkbox" name="permissions[]" id="permissions" value="{{ resource ~ '.' ~ action }}"
<?php
foreach ($permisos_usuario as $permiso_usuario) {
if($permiso_usuario->getControlador().'/'.$permiso_usuario->getAccion() == $resource.'/'.$action){
echo "checked='checked'";
}
}
?>
>
</td>
<td>{{ action }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% set aux2 = aux2 + 1 %}
{% endfor %}
<div class="form-group">
<div class="col-sm-2 col-sm-offset-5">
{{ hidden_field("check") }}
{{ hidden_field("id_usuario_tipo") }}
{{ submit_button('Modificar', 'class': 'btn btn-primary') }}
</div>
</div>
</div>
{% endif %}
</div>
</div>
{{ end_form() }}
{% endif %}
<script type="text/javascript">
$(document).ready(function () {
$("#permissions").on("change", function()
{
document.getElementById("check").value = true;
});
});
</script>
thanks in advance