Пример #1
0
 public function init()
 {
     /* Initialize action controller here */
     // for URL
     $uri = new Zend_View_Helper_BaseUrl();
     define('URL_BASE', $uri->getBaseUrl() . "/");
     define('URL_MEDIA_COMPANY_PROFILE', URL_BASE . 'library/media/companyprofiles/');
     define('URL_MEDIA_PORTFOLIO', URL_BASE . 'library/media/portfolio/');
     define('URL_MEDIA_VIDEO', URL_BASE . 'library/media/video/');
     define('URL_MEDIA_PHOTO', URL_BASE . 'library/media/photo/');
     define('URL_THEMES', URL_BASE . "library/themes/standard/");
     //Mobile
     define('URL_THEMES_MOBILE', URL_BASE . "library/themes/mobile/");
     //End Mobile
     define('URL_MEDIA', URL_BASE . "library/media/");
     define('URL_MEDIA_PROFILE', URL_MEDIA . "profiles/");
     define('URL_MEDIA_TEMP', URL_MEDIA . "temp/");
     define('URL_MEDIA_SCHOOLLOGO', URL_MEDIA . "schoollogos/");
     //define('URL_MEDIA_PROFILE_NOAVATAR', "DefaultPerson.jpg");
     define('URL_MEDIA_PROFILE_NOAVATAR', "none.png");
     //define('LAYOUT', "");
     // for DIR
     define('DIR_BASE', realpath(APPLICATION_PATH . '/../'));
     define('DIR_MEDIA_COMPANY_PROFILE', DIR_BASE . '/library/media/companyprofiles/');
     define('DIR_MEDIA_PORTFOLIO', DIR_BASE . '/library/media/portfolio/');
     define('DIR_MEDIA_VIDEO', DIR_BASE . '/library/media/video/');
     define('DIR_MEDIA_PHOTO', DIR_BASE . '/library/media/photo/');
     define('DIR_MEDIA', DIR_BASE . '/library/media/');
     define('DIR_MEDIA_TEMP', DIR_MEDIA . 'temp/');
     define('LIMIT_PAGE_LEFT', 10);
     define('LIMIT_PAGE_NUMBER_LEFT', 3);
     define('USER_TYPE_COMPANY', 1);
     define('USER_TYPE_CANDIDATE', 2);
     //  $this->_client = PR_Session::getSession(PR_Session::SESSION_CLIENT);pii
     $this->_client = PR_Session::getSession(PR_Session::SESSION_USER);
     $this->view->loginclient = $this->_client;
     //$this->layout()-
     $this->_layout = $this->_helper->layout->getLayoutInstance();
     $this->_layout->loginclient = $this->_client;
     $this->_layout->logout = $this->_helper->url('do-logout', 'user');
     $this->_layout->_helper = $this->_helper;
     //for querystring
     $this->_request = $this->getRequest();
     $ajax = $this->_request->getParam('ajax', 0);
     $this->view->ajax = $ajax;
     if ($ajax == 1) {
         $this->_helper->layout->disableLayout();
     }
     $pageajax = $this->_request->getParam('pageajax', "");
     $this->view->pageajax = $pageajax;
 }
 public function init()
 {
     $oBaseUrlHelper = new Zend_View_Helper_BaseUrl();
     $this->setAction($oBaseUrlHelper->getBaseUrl('/contribuinte/guia/notas-tomador'));
     $this->setMethod(Zend_form::METHOD_POST);
     $this->setAttrib('id', 'nota');
     $e = $this->createElement('hidden', 'cpfcnpj')->setValue($this->cpfcnpj);
     $this->addElement($e);
     $e = $this->createElement('hidden', 'inscricao')->setValue($this->inscricao);
     $this->addElement($e);
     $e = $this->createElement('hidden', 'ano_comp')->setValue($this->ano_comp);
     $this->addElement($e);
     $e = $this->createElement('hidden', 'mes_comp')->setValue($this->mes_comp);
     $this->addElement($e);
     $e = $this->createElement('text', 'competencia')->setValue($this->mes_comp . '/' . $this->ano_comp)->setLabel('Competência')->setAttrib('readonly', true);
     $this->addElement($e);
     $e = $this->createElement('text', 'total_servicos')->setValue('R$ ' . number_format($this->total_servico, 2, ',', '.'))->setLabel('Total de serviços')->setAttrib('readonly', true);
     $this->addElement($e);
     $e = $this->createElement('text', 'total_iss')->setValue('R$ ' . number_format($this->total_iss, 2, ',', '.'))->setLabel('Total de ISS')->setAttrib('readonly', true);
     $this->addElement($e);
     $e = $this->createElement('text', 'data_guia')->setLabel('Data do pagamento')->setValidators(array(new Zend_Validate_Date(array('format' => 'dd/mm/yyyy'))));
     $this->addElement($e);
 }
Пример #3
0
 public function testGetBaseUrlReturnsBaseUrlWithoutScriptName()
 {
     $_SERVER['SCRIPT_NAME'] = '/foo/bar/bat/mybar/index.php';
     Zend_Controller_Front::getInstance()->setBaseUrl('/mybar/index.php');
     $helper = new Zend_View_Helper_BaseUrl();
     $this->assertEquals('/mybar', $helper->getBaseUrl());
 }
 public function init()
 {
     $oBaseUrlHelper = new Zend_View_Helper_BaseUrl();
     $this->setAction($oBaseUrlHelper->getBaseUrl($this->sAction));
     $this->setMethod(Zend_Form::METHOD_POST);
     $this->setAttrib('id', 'formEmpresa');
     $oElm = $this->createElement('hidden', 'endereco_fora');
     $oElm->setValue('1');
     $this->addElement($oElm);
     $oElm = $this->createElement('text', 'z01_cgccpf');
     $oElm->setLabel('CNPJ: ');
     $oElm->setAttrib('class', 'mask-cnpj');
     $oElm->setAttrib('maxlength', '14');
     $oElm->addValidator(new DBSeller_Validator_Cnpj());
     $oElm->addValidator(new Zend_Validate_StringLength(array('min' => 14, 'max' => 18)));
     $oElm->addFilter(new Zend_Filter_Digits());
     $oElm->setRequired(TRUE);
     $oElm->removeDecorator('errors');
     $this->addElement($oElm);
     $oElm = $this->createElement('text', 'z01_nome');
     $oElm->setLabel('Razão Social: ');
     $oElm->setRequired(TRUE);
     $oElm->removeDecorator('errors');
     $this->addElement($oElm);
     $aEstados = Default_Model_Cadenderestado::getEstados('01058');
     $oElm = $this->createElement('select', 'z01_uf', array('multiOptions' => $aEstados));
     $oElm->setLabel('Estado: ');
     $oElm->setAttrib('class', 'select-estados');
     $oElm->setAttrib('select-munic', 'z01_munic');
     $oElm->setAttrib('ajax-url', $oBaseUrlHelper->getBaseUrl('/endereco/get-municipios/'));
     $oElm->setAttrib('key', FALSE);
     $oElm->setRequired(TRUE);
     $oElm->addValidator(new Zend_Validate_Alpha());
     $oElm->removeDecorator('errors');
     $this->addElement($oElm);
     $oElm = $this->createElement('select', 'z01_munic');
     $oElm->setLabel('Cidade: ');
     $oElm->setAttrib('key', TRUE);
     $oElm->setRequired(TRUE);
     $oElm->addValidator(new Zend_Validate_Digits());
     $oElm->addValidator(new Zend_Validate_GreaterThan(array('min' => 0)));
     $oElm->removeDecorator('errors');
     $this->addElement($oElm);
     $oElm = $this->createElement('text', 'z01_cep');
     $oElm->setLabel('CEP: ');
     $oElm->setAttrib('maxlength', 8);
     $oElm->setAttrib('class', 'mask-cep');
     $oElm->setRequired(TRUE);
     $oElm->addValidator(new Zend_Validate_Digits());
     $oElm->addValidator(new Zend_Validate_StringLength(array('min' => 8)));
     $oElm->addFilter(new Zend_Filter_Digits());
     $oElm->removeDecorator('errors');
     $this->addElement($oElm);
     // pega codigo do IBGE do municipio no arquivo de configuracao
     $iCodigoIbge = Administrativo_Model_Prefeitura::getDadosPrefeituraBase()->getIbge();
     // Lista de bairros do municipio
     $aBairros = Default_Model_Cadenderbairro::getBairros();
     $oElm = $this->createElement('select', 'z01_bairro_munic', array('multiOptions' => $aBairros));
     $oElm->setLabel('Bairro: ');
     $oElm->setAttrib('municipio', $iCodigoIbge);
     $oElm->setRequired(TRUE);
     $oElm->addValidator(new Zend_Validate_Digits());
     $oElm->addValidator(new Zend_Validate_GreaterThan(array('min' => 0)));
     $oElm->removeDecorator('errors');
     $this->addElement($oElm);
     $aMunicipios = Default_Model_Cadenderrua::getRuas();
     $oElm = $this->createElement('select', 'z01_ender_munic', array('multiOptions' => $aMunicipios));
     $oElm->setLabel('Endereço: ');
     $oElm->setAttrib('municipio', $iCodigoIbge);
     $oElm->setRequired(TRUE);
     $oElm->addValidator(new Zend_Validate_Digits());
     $oElm->addValidator(new Zend_Validate_GreaterThan(array('min' => 0)));
     $oElm->removeDecorator('errors');
     $this->addElement($oElm);
     $oElm = $this->createElement('text', 'z01_bairro_fora');
     $oElm->setLabel('Bairro: ');
     $oElm->setRequired(TRUE);
     $oElm->removeDecorator('errors');
     $this->addElement($oElm);
     $oElm = $this->createElement('text', 'z01_ender_fora');
     $oElm->setLabel('Endereço: ');
     $oElm->setRequired(TRUE);
     $oElm->removeDecorator('errors');
     $this->addElement($oElm);
     $oElm = $this->createElement('text', 'z01_numero');
     $oElm->setLabel('Número: ');
     $oElm->setRequired(TRUE);
     $oElm->removeDecorator('errors');
     $this->addElement($oElm);
     $oElm = $this->createElement('text', 'z01_compl');
     $oElm->setLabel('Complemento: ');
     $this->addElement($oElm);
     $oElm = $this->createElement('text', 'z01_telef');
     $oElm->setLabel('Telefone: ');
     $oElm->setAttrib('class', 'mask-fone');
     $oElm->addFilter(new Zend_Filter_Digits());
     $this->addElement($oElm);
     $oElm = $this->createElement('text', 'z01_email');
     $oElm->setLabel('Email: ');
     $oElm->setRequired(TRUE);
     $oElm->addValidator(new Zend_Validate_EmailAddress());
     $oElm->removeDecorator('errors');
     $this->addElement($oElm);
     if ($this->bSubmit) {
         $this->addElement(new Zend_Form_Element_Submit('Cadastrar', 'Cadastrar', array('label' => 'Criar')));
     }
     return $this;
 }
 /**
  * Construtor
  *
  * @return $this|void
  */
 public function init()
 {
     parent::init();
     $oBaseUrlHelper = new Zend_View_Helper_BaseUrl();
     $this->setAction($oBaseUrlHelper->baseUrl('/contribuinte/dms/emissao-manual-saida-salvar'));
     // Remove elementos
     $this->removeElement('natureza_operacao');
     $this->removeElement('situacao_documento');
     $this->removeElement('tipo_documento');
     $this->removeElement('s_imposto_retido');
     $this->removeElement('s_data');
     // Adiciona elementos
     $oElm = $this->createElement('hidden', 'natureza_operacao');
     $oElm->setValue(1);
     // Somente "dentro do município"
     $this->addElement($oElm);
     $oElm = $this->createElement('hidden', 's_imposto_retido');
     $oElm->setValue(0);
     $this->addElement($oElm);
     $oElm = $this->createElement('hidden', 'situacao_documento');
     $oElm->setValue('N');
     // Somente "normal"
     $this->addElement($oElm);
     $oElm = $this->createElement('text', 'tipo_documento_descricao', array('divspan' => '10'));
     $oElm->setLabel('Tipo de Documento:');
     $oElm->setAttrib('class', 'span5');
     $oElm->setOrder(3);
     $oElm->setRequired(TRUE);
     $oElm->removeDecorator('errors');
     $this->addElement($oElm);
     $oGrupo = $this->getDisplayGroup('dados_declarante');
     $oGrupo->addElement($oElm);
     // Ajuste layout
     $oElm = $this->createElement('text', 's_data', array('divspan' => '8'));
     $oElm->setLabel('Data:');
     $oElm->setAttrib('class', 'span2 mask-data');
     $oElm->setOrder(0);
     $oElm->setRequired(TRUE);
     $oElm->addValidator(new Zend_Validate_Date(array('locale' => 'pt-Br')));
     $oElm->removeDecorator('errors');
     $this->addElement($oElm);
     $oGrupo = $this->getDisplayGroup('dados_servico');
     $oGrupo->addElement($oElm);
     // Outros ajustes
     $oElm = $this->getElement('s_servico_prestado');
     $oElm->setAttrib('data-url', $oBaseUrlHelper->getBaseUrl('/contribuinte/dms/emissao-manual-buscar-dados-servico/'));
     $oElm->setAttrib('class', 'span7');
     self::setServico();
     return $this;
 }