public function indexAction()
 {
     $this->view->headTitle('Galeria');
     $galeriasModel = new Application_Model_Galerias();
     $nome_galerias = $galeriasModel->fetchAll($galeriasModel->select()->from($galeriasModel->info(Zend_Db_Table_Abstract::NAME))->columns(array('nome'))->where('excluido = 0'));
     $this->view->nome_galerias = $nome_galerias;
     $galeriaModel = new Application_Model_Galeria();
     $busca = $this->_request->getParam('galeria');
     //		$this->view->busca = $nome_evento;
     $galeria = $galeriaModel->fetchAll($galeriaModel->select()->where('galeria LIKE :busca')->where('excluido = 0')->bind(array('busca' => '%' . $busca . '%')));
     $this->view->galeria = $galeria;
 }
 public function init()
 {
     $this->addElement('text', 'descricao', array('label' => 'Descrição*', 'class' => 'campo-txt', 'required' => true));
     $galeriasModel = new Application_Model_Galerias();
     $galerias = $galeriasModel->fetchAll($galeriasModel->select()->from($galeriasModel->info(Zend_Db_Table_Abstract::NAME))->columns(array('nome'))->where('excluido = 0'));
     $galeriasArr = array();
     foreach ($galerias as $galeria) {
         $galeriasArr[$galeria['nome']] = $galeria['nome'];
     }
     $this->addElement('select', 'galeria', array('label' => 'Galeria: ', 'multiple' => false, 'multiOptions' => $galeriasArr, 'registerInArrayValidator' => false));
     $this->addElement('file', 'pFoto', array('label' => 'Foto*', 'required' => true));
     $this->addElement('submit', 'submit_button', array('label' => 'Salvar', 'class' => 'bt-enviar', 'ignore' => true));
 }
 public function editargaleriaAction()
 {
     $id = $this->_request->getParam('id');
     require_once APPLICATION_PATH . '/modules/admin/forms/Galerias.php';
     $this->view->form = new admin_Form_Galerias();
     $galeriasModel = new Application_Model_Galerias();
     if ($this->_request->isPost()) {
         $this->view->form->setDefaults($this->_request->getPost());
         $data = $this->view->form->getValues();
         if ($this->view->form->isValid($data)) {
             $galeriasModel->update($data, 'id_galeria = ' . $id);
             return $this->_helper->redirector('index');
         }
     }
     $galerias = $galeriasModel->find($id)->current();
     $this->view->form->setDefaults($galerias->toArray());
 }