/** * Método para buscar os segmentos de uma área * Busca como XML para o AJAX * @access public * @param void * @return void */ public function comboAction() { $this->_helper->layout->disableLayout(); // desabilita o Zend_Layout // recebe o idUF via post $post = Zend_Registry::get('post'); $idArea = (int) $post->id; $idSegmento = isset($post->segmento) ? $post->segmento : 0; // integração MODELO e VISÃO $Segmento = new Segmento(); $resultado = $Segmento->combo(array("a.Codigo = '?'" => $idArea), array('s.Segmento ASC')); if (count($resultado) > 0) { $html = '<option value=""> - Selecione - </option>'; foreach ($resultado as $value) { if ($idSegmento > 0 && $idSegmento == $value->id) { $html = $html . '<option value="' . $value->id . '" selected="selected">' . utf8_encode($value->descricao) . '</option>'; } else { $html = $html . '<option value="' . $value->id . '">' . utf8_encode($value->descricao) . '</option>'; } } echo $html; } else { echo '<option value=""> - Selecione - </option>'; } die; }
/** * Método para buscar os segmentos culturais de uma área * Busca como XML para o AJAX * @access public * @param void * @return void */ public function comboZAction() { $this->_helper->layout->disableLayout(); // desabilita o Zend_Layout // recebe o id via post $post = Zend_Registry::get('post'); $id = (int) $post->id; // integração MODELO e VISÃO $Segmento = new Segmento(); $this->view->combosegmentosculturais = $Segmento->combo(array('a.Codigo = ?' => $id), array('s.Descricao ASC')); }