public function edit(Context $context, $id = 0) { parent::edit($context, $id); // lotacoes do usuario $query = $this->em()->createQuery("SELECT e FROM Novosga\\Model\\Lotacao e JOIN e.cargo c JOIN e.grupo g WHERE e.usuario = :usuario ORDER BY g.left DESC"); $query->setParameter('usuario', $this->model->getId()); $rs = $query->getResult(); $items = array(); foreach ($rs as $lotacao) { $items[] = array('grupo_id' => $lotacao->getGrupo()->getId(), 'grupo' => $lotacao->getGrupo()->getNome(), 'cargo_id' => $lotacao->getCargo()->getId(), 'cargo' => $lotacao->getCargo()->getNome()); } $this->app()->view()->set('lotacoes', $items); // servicos do usuario $query = $this->em()->createQuery("SELECT e FROM Novosga\\Model\\ServicoUsuario e WHERE e.usuario = :usuario"); $query->setParameter('usuario', $this->model->getId()); $rs = $query->getResult(); $items = array(); foreach ($rs as $servico) { $items[] = array('unidade_id' => $servico->getUnidade()->getId(), 'unidade' => $servico->getUnidade()->getNome(), 'servico_id' => $servico->getServico()->getId(), 'servico' => $servico->getServico()->getNome()); } $this->app()->view()->set('servicos', $items); // unidades $query = $this->em()->createQuery("SELECT e FROM Novosga\\Model\\Unidade e ORDER BY e.nome"); $this->app()->view()->set('unidades', $query->getResult()); // cargos disponiveis $query = $this->em()->createQuery("SELECT e FROM Novosga\\Model\\Cargo e ORDER BY e.nome"); $this->app()->view()->set('cargos', $query->getResult()); }
public function edit(Context $context, $id = 0) { parent::edit($context, $id); $query = $this->em()->createQuery("SELECT e FROM Novosga\\Model\\Servico e WHERE e.mestre IS NULL AND e.id != :id ORDER BY e.nome ASC"); $query->setParameter('id', $this->model->getId()); $this->app()->view()->set('macros', $query->getResult()); }
public function edit(Context $context, $id = 0) { parent::edit($context, $id); $className = get_class($this->model); $query = $this->em()->createQuery("SELECT e FROM {$className} e WHERE e.id != :id ORDER BY e.left"); $query->setParameter('id', $this->model->getId()); $this->app()->view()->set('pais', $query->getResult()); $this->app()->view()->set('modelParent', $this->model->getParent($this->em())); }
public function edit(Context $context, $id = 0) { $this->app()->view()->set('pesos', array(0 => _('Normal'), 1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5')); $this->app()->view()->set('status', array('' => _('Selecione'), 1 => _('Ativo'), 0 => _('Inativo'))); parent::edit($context, $id); }
public function edit(Context $context, $id = 0) { parent::edit($context, $id); $this->app()->view()->set('grupos', $this->getGruposFolhasDisponiveis($this->model)); }