✏️ 正在编辑: CallcenterConfig.php
路径:
/srv/systems_dir/yuppiecred-bkp/application/forms/CallcenterConfig.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Form_CallcenterConfig extends Core_Form { public function init() { $this->setName('f_save_callcenter'); $this->addElement('select', 'consulta_beneficio', [ 'label' => 'Sistema hiscon', 'multiOptions' => array( '' => '', 'InTouch' => 'InTouch', 'MultiBr' => 'MultiBr', 'Fucador' => 'Fucador', 'ViperRest' => 'Viper', 'AnaliseInfo' => 'AnaliseInfo', 'ConsultaPlus' => 'ConsultaPlus', 'ConsigXyz' => 'ConsigXyz' ) ]); $this->addElement('text', 'dias', [ 'label' => 'Qtd. Dias', 'size' => 40, 'required' => true, 'validators' => array('Digits'), 'description' => "Dias corridos para contagem dos agendamentos" ]); $this->addElement('text', 'retornos', [ 'label' => 'Máximo Retornos', 'size' => 40, 'required' => true, 'validators' => ['Digits'], 'description' => "Nº de vezes que pode agendar o cliente no intervalo de X dias" ]); $this->addElement('text', 'maximo_retornos', [ 'label' => 'Nº agendamentos', 'size' => 40, 'required' => true, 'onkeypress' => 'mascara(this, mvalor)', 'description' => "Máximo de agendamentos na mesma data" ]); $this->addElement('text', 'email_simulacao', [ 'label' => 'Email Envio de Simulação', 'size' => 40, 'validators' => array('EmailAddress'), 'description' => "Email responsável pelo envio das simulações" ]); $this->addElement('textarea', 'facebook_pixel', [ 'label' => 'Pixel do Facebook / Tag Google', 'size' => 40, 'rows' => 5, 'description' => "Cole acima o código do Facebook / Google" ]); $this->getElement('facebook_pixel') ->addDecorator('Label', array( 'tag' => 'dt', 'tagClass' => 'clear' )); $this->addElement('text', 'google_conversion_consulta', [ 'label' => 'Gtag consulta', 'size' => 40, 'class' => 'noKeyup', ]); $this->getElement('google_conversion_consulta') ->addDecorator('Label', array( 'tag' => 'dt', 'tagClass' => 'clear' )); $this->addElement('text', 'google_conversion_lead_qualificado', [ 'label' => 'Gtag Lead Qualificado', 'size' => 40, 'class' => 'noKeyup', ]); $this->addElement('text', 'google_conversion_contratou', [ 'label' => 'Gtag Contratou', 'size' => 40, 'class' => 'noKeyup', ]); $this->addElement('textarea', 'yuppie_plugin', [ 'label' => 'Plugin de integração de formulários', 'size' => 40, 'rows' => 5, 'value' => $this->_makeYuppieTagShare(), 'description' => 'Copie e cole esse código em seu site', 'onclick' => "selectAll('yuppie_plugin')" ]); $this->getElement('yuppie_plugin') ->addDecorator('Label', array( 'tag' => 'dt', 'tagClass' => 'clear' )); $this->addElement('textarea', 'whats_plugin', [ 'label' => 'Plugin de integração com whatsapp', 'size' => 40, 'rows' => 5, 'value' => $this->_makeWhatsTagShare(), 'description' => 'Copie e cole esse código em seu site', 'onclick' => "selectAll('whats_plugin')" ]); $this->getElement('whats_plugin') ->addDecorator('Label', ['tag' => 'dt', 'tagClass' => 'clear']); $this->addElement('text', 'url_simulaca_aberta', [ 'label' => 'URL Captura Leads', 'size' => 82, 'value' => $this->_makeCapturaLeadsUrl(), 'onclick' => "selectAll('url_simulaca_aberta')", 'description' => 'Clique para copiar', ]); $this->getElement('url_simulaca_aberta') ->addDecorator('Label', array( 'tag' => 'dt', 'tagClass' => 'clear' )); $this->addElement('text', 'url_autocontratacao', [ 'label' => 'Auto-contratação FGTS', 'size' => 82, 'value' => $this->_makeAutocontratacaoUrl(), 'onclick' => "selectAll('url_autocontratacao')", 'description' => 'Clique para copiar', ]); $this->getElement('url_autocontratacao') ->addDecorator('Label', array( 'tag' => 'dt', 'tagClass' => 'clear' )); $this->addElement('text', 'shorten_link_auto', [ 'label' => 'Short Link Auto-contratação FGTS', 'size' => 40, 'value' => $this->_makeShortLink(), 'onclick' => "selectAll('shorten_link_auto')", 'description' => 'Clique para copiar', ]); $this->getElement('shorten_link_auto') ->addDecorator('Label', array( 'tag' => 'dt', 'tagClass' => 'clear' )); $this->addElement('text', 'url_autocontratacao_inss', [ 'label' => 'Auto-contratação INSS', 'size' => 82, 'value' => $this->_makeAutocontratacaoUrl('inss'), 'onclick' => "selectAll('url_autocontratacao_inss')", 'description' => 'Clique para copiar', ]); $this->getElement('url_autocontratacao_inss') ->addDecorator('Label', array( 'tag' => 'dt', 'tagClass' => 'clear' )); $this->addElement('text', 'shorten_link_auto_inss', [ 'label' => 'Short Link Auto-contratação INSS', 'size' => 40, 'value' => $this->_makeShortLink('inss'), 'onclick' => "selectAll('shorten_link_auto_inss')", 'description' => 'Clique para copiar', ]); $this->getElement('shorten_link_auto_inss') ->addDecorator('Label', ['tag' => 'dt', 'tagClass' => 'clear']); $this->addElement('text', 'utm_source', [ 'label' => 'UTM Source', 'size' => 40, ]); $this->getElement('utm_source') ->addDecorator('Label', array( 'tag' => 'dt', 'tagClass' => 'clear' )); $this->addElement('text', 'utm_campaign', [ 'label' => 'UTM Campaign', 'size' => 40 ]); $this->addElement('text', 'whatsapp_business', [ 'label' => 'Whatsapp Business', 'onkeypress' => 'mascara(this, telefone)', 'size' => 20, 'maxlength' => 15 ]); $this->getElement('whatsapp_business') ->addDecorator('Label', ['tag' => 'dt', 'tagClass' => 'clear']); $this->addElement('select', 'tipo_landing_page', [ 'label' => 'Landing Page', 'multiOptions' => [ 1 => 'Colar HTML', 2 => 'Criar Landing Page' ], 'required' => true, 'onchange' => 'habilitarPlugin()' ]); $this->addElement('textarea', 'html_autocontratacao', [ 'label' => '', 'rows' => 20, 'cols' => 100, 'description' => 'Utilize a tag [LINK_AUTO] nos seus botões para que seja direcionado para a página de auto-contratação.' ]); $this->getElement('html_autocontratacao') ->addDecorator('Label', ['tag' => 'dt', 'tagClass' => 'clear']); $this->addElement('text', 'nome_empresa', [ 'label' => 'Nome / Razão Social', 'size' => 45, ]); $this->addElement('text', 'cnpj_empresa', [ 'label' => 'CNPJ:', 'onkeypress' => 'mascara(this, fcnpj)', 'maxlength' => 18, 'validators' => [new Validators_Cnpj()] ]); $this->addElement('text', 'endereco_empresa', [ 'label' => 'Endereço completo', 'size' => 45, ]); $this->addElement('text', 'cep_empresa', [ 'label' => 'CEP:', 'onkeypress' => 'mascara(this, soNumeros)', 'maxlength' => 8, 'size' => 10 ]); $this->addElement('text', 'fone_empresa', [ 'label' => 'Fone:', 'onkeypress' => 'mascara(this, telefone)', 'maxlength' => 14, 'size' => 15 ]); $this->addDisplayGroup([ 'consulta_beneficio' ], 'beneficio', ['legend' => 'Geral'] ); $this->addDisplayGroup( [ 'dias', 'retornos', 'maximo_retornos' ], 'agendamento', ['legend' => 'Agendamentos'] ); $this->addDisplayGroup( [ 'email_simulacao', 'google_conversion_consulta', 'google_conversion_lead_qualificado', 'google_conversion_contratou', 'facebook_pixel', 'yuppie_plugin', 'whats_plugin', 'url_autocontratacao', 'shorten_link_auto', 'url_simulaca_aberta', 'utm_source', 'utm_campaign', 'url_autocontratacao_inss', 'shorten_link_auto_inss', 'whatsapp_business' ], 'simulacao_config', ['legend' => 'Landing Page'] ); $this->addDisplayGroup( [ 'tipo_landing_page', 'html_autocontratacao' ], 'autocontratacao', ['legend' => 'HTML Landing Page Autocontratação'] ); $this->addDisplayGroup( [ 'nome_empresa', 'cnpj_empresa', 'endereco_empresa', 'cep_empresa', 'fone_empresa', ], 'endereco', ['legend' => 'Dados de endereço da Landing Page'] ); $this->removeGroupLabelDecorator(); $this->_initButtons(); $callcenterConfig = CLIENT_PATH . '/configs/callcenter.php'; if (file_exists($callcenterConfig)) { $this->populate(include $callcenterConfig); } } private function removeGroupLabelDecorator() { foreach ($this->getDisplayGroups() as $displayGroup) { $displayGroup->removeDecorator('DtDdWrapper'); } } protected function _initButtons() { $this->addElement('submit', 'btn_save', [ 'label' => 'Salvar', 'class' => 'bt_save' ]); $this->addDisplayGroup(['btn_save'], 'buttons'); } public function persistData() { $values = $this->getValues(); if ($values) { $callcenterConfig = CLIENT_PATH . '/configs/callcenter.php'; $dados = []; if (file_exists($callcenterConfig)) { $dados = include $callcenterConfig; } unset( $dados['whats_plugin'], $dados['yuppie_plugin'], $dados['url_autocontratacao'], $dados['url_simulaca_aberta'], $dados['utm_source'], $dados['utm_campaign'], $values['whats_plugin'], $values['yuppie_plugin'], $values['url_autocontratacao'], $values['url_simulaca_aberta'], $values['utm_source'], $values['utm_campaign'] ); $config = new Zend_Config(array_merge($dados, $values), true); $writer = new Zend_Config_Writer_Array([ 'config' => $config, 'filename' => CLIENT_PATH . '/configs/callcenter.php' ]); $writer->write(); } } protected function _makeYuppieTagShare() { $basePath = "<script>var baseUrl = '" . domain('/public') . "'; </script>"; $jquery = "<script type='text/javascript' src='" . domain('/public/scripts/jquery/jquery.min.js') . "'></script>"; $scriptUrl = "<script type='text/javascript' src='" . domain('/public/scripts/yuppie-plugin-capture.min.js') . "'></script>"; $code = implode("\n", [$jquery, $basePath, $scriptUrl]); return $code; } protected function _makeWhatsTagShare() { $basePath = "<script>var baseUrl = '" . domain('/public') . "'; </script>"; $numWsp = "<script>var whatsappNunber = '". String_Refatorar::soNumeros(service('config_callcenter')->get()->whatsapp_business) . "'; </script>"; $jquery = "<script type='text/javascript' src='" . domain('/public/scripts/jquery/jquery.min.js') . "'></script>"; $scriptUrl = "<script type='text/javascript' src='" . domain('/public/scripts/whats-plugin-capture.min.js') . "'></script>"; $code = implode("\n", [$jquery, $basePath, $numWsp, $scriptUrl]); return $code; } protected function _makeCapturaLeadsUrl() { return domain('/public/simulacao-aberta'); } protected function _makeAutocontratacaoUrl($tipo = 'fgts') { return domain('/public/simulacao-aberta?tipo=' . $tipo); } protected function _makeShortLink($tipo = 'fgts') { if (!empty(service('config')->get()->yuppie->bitly_token) && empty($this->getValue('shorten_link_auto'))) { $link = $this->_makeAutocontratacaoUrl($tipo); return \Yuppie_Link::shortenBitly($link, service('config')->get()->yuppie->bitly_token); } } }
💾 保存文件
← 返回文件管理器