public function indexAction() { $this->_helper->viewRenderer->setNoRender(); Zend_Loader::loadClass("wwnlDB"); $data = new DateTime($this->_getParam("date")); $wdb = new wwnlDB(); echo "oi"; print_r($wdb->getNovas($data)); }
function listAction() { $this->view->styles[] = 'campanha/list.css'; $this->view->styles[] = 'timepicker.css'; $this->view->scripts[] = 'jquery.timepicker.js'; $this->view->scripts[] = 'campanha/add.js'; $this->view->scripts[] = 'jquery.editinplace.js'; $this->view->scripts[] = 'campanha/list.js.php'; $id_campanha = $this->_getParam('id'); $all = $this->_getParam('all'); Zend_Loader::loadClass("wwnlDB"); $wdb = new wwnlDB(); $this->view->campaignList = $wdb->getCampaign($id_campanha, $all); }
public function generateplainAction() { $this->_helper->viewRenderer->setNoRender(); $this->getResponse()->setHeader("Content-Type", "text/plain"); $nl_date = new DateTime(); $nl_date->setTime(0, 0, 0); $nl_date->setDate($nl_date->format("Y"), $nl_date->format("m"), $nl_date->format("d") + 1); Zend_Loader::loadClass("wwnlDB"); $wdb = new wwnlDB(); $data = new DateTime($this->_getParam("date")); $novas = $wdb->getNovas($data); $ultimas = $wdb->getUltimas($data); $andamento = $wdb->getAndamento($data); $proxima = $wdb->getProxima($data); $revista = $wdb->getRevista($data); echo $wdb->generatePlainHeader(); if (count($novas)) { echo $wdb->generatePlainSectionHeader("NOVAS", "OFERTAS"); foreach ($novas as $block) { $start_date = new DateTime($block['start_date'], new DateTimeZone('America/Sao_Paulo')); echo $wdb->generatePlainSection($block['url_campanha'], $block['name_campanha'], $block['subline'], "Início", $start_date->format("d/m"), $start_date->format("h:i a")); } } if (count($ultimas)) { echo $wdb->generatePlainSectionHeader("ULTIMOS", "DIAS"); foreach ($ultimas as $block) { $end_date = new DateTime($block['end_date'], new DateTimeZone('America/Sao_Paulo')); echo $wdb->generatePlainSection($block['url_campanha'], $block['name_campanha'], $block['subline'], "Término", $end_date->format("d/m"), $end_date->format("h:i a")); } } if (count($andamento)) { echo $wdb->generatePlainSectionHeader("EM", "ANDAMENTO"); foreach ($andamento as $block) { $end_date = new DateTime($block['end_date'], new DateTimeZone('America/Sao_Paulo')); echo $wdb->generatePlainSection($block['url_campanha'], $block['name_campanha'], $block['subline'], "Término", $end_date->format("d/m"), $end_date->format("h:i a")); } } if (count($proxima)) { echo $wdb->generatePlainSectionHeader("PRÓXIMAS", "CAMPANHAS"); foreach ($proxima as $block) { $start_date = new DateTime($block['start_date'], new DateTimeZone('America/Sao_Paulo')); echo $wdb->generatePlainSection($block['url_campanha'], $block['name_campanha'], $block['subline'], "Início", "em breve", ""); } } if (count($revista)) { echo $wdb->generatePlainSectionHeader("NOVIDADES NA", "REVISTA"); foreach ($revista as $block) { $start_date = new DateTime($block['start_date'], new DateTimeZone('America/Sao_Paulo')); echo $wdb->generatePlainSection($block['url_campanha'], $block['name_campanha'], $block['subline'], "", "", ""); } } echo $wdb->generatePlainFooter(); /* $header = $wdb->generatePlainHeader(); $db = new sqlconnect(); $db->openConnection(); $blocks = $db->getAssocBlocks($nl_id,'1'); $db->closeConnection(); $novas = $novasHeader =""; if(count($blocks)){ $novasHeader = $wdb->generatePlainSectionHeader("NOVAS","OFERTAS"); foreach($blocks as $block){ $novas .= $wdb->generatePlainSection ( $block['short_link_url'], $block['text_main'], $block['text_sub'], $block['date_type'], $block['bl_date'], $block['bl_time']); } } $db = new sqlconnect(); $db->openConnection(); $blocks = $db->getAssocBlocks($nl_id,'2'); $db->closeConnection(); $ultimos = $ultimosHeader =""; if(count($blocks)){ $ultimosHeader = $wdb->generatePlainSectionHeader("ÚLTIMOS","DIAS"); foreach($blocks as $block){ $ultimos .= $wdb->generatePlainSection ( $block['short_link_url'], $block['text_main'], $block['text_sub'], $block['date_type'], $block['bl_date'], $block['bl_time']); } } $db = new sqlconnect(); $db->openConnection(); $blocks = $db->getAssocBlocks($nl_id,'3'); $db->closeConnection(); $andamento = $andamentoHeader = ""; if(count($blocks)){ $andamentoHeader = $wdb->generatePlainSectionHeader("EM","ANDAMENTO"); foreach($blocks as $block){ $andamento .= $wdb->generatePlainSection ( $block['short_link_url'], $block['text_main'], $block['text_sub'], $block['date_type'], $block['bl_date'], $block['bl_time']); } } $db = new sqlconnect(); $db->openConnection(); $blocks = $db->getAssocBlocks($nl_id,'4'); $db->closeConnection(); $proximas = $proximasHeader = ""; if(count($blocks)){ $proximasHeader = $wdb->generatePlainSectionHeader("PRÓXIMAS","CAMPANHAS"); foreach($blocks as $block){ $proximas .= $wdb->generatePlainSection ( $block['short_link_url'], $block['text_main'], $block['text_sub'], $block['date_type'], $block['bl_date'], $block['bl_time']); } } $db = new sqlconnect(); $db->openConnection(); $blocks = $db->getAssocBlocks($nl_id,'5'); $db->closeConnection(); $revista = $revistaHeader= ""; if(count($blocks)){ $revistaHeader = $wdb->generatePlainSectionHeader("NOVIDADES NA","REVISTA"); foreach($blocks as $block){ $revista .= $wdb->generatePlainSection ( $block['short_link_url'], $block['text_main'], $block['text_sub'], $block['date_type'], $block['bl_date'], $block['bl_time']); } } $footer = $this->generatePlainFooter(); $nl = ""; $nl .= $header; $nl .= $novasHeader.$novas; $nl .= $ultimosHeader.$ultimos; $nl .= $andamentoHeader.$andamento; $nl .= $proximasHeader.$proximas; $nl .= $revistaHeader.$revista; $nl .= $footer; return $nl;*/ }