function moreinfoAction() { $guid = $this->_getParam('guid'); $tblPowerban = new Pandamp_Modules_Misc_Banner_Model_Powerban(); $rowset = $tblPowerban->find($guid)->current(); if ($rowset) { $this->view->rowset = $rowset; } }
public function isBannerExist($zid = '') { $tblPowerban = new Pandamp_Modules_Misc_Banner_Model_Powerban(); $row = $tblPowerban->fetchBanner($zid); if (count($row)) { return true; } else { return false; } }
function fetchBannerAction() { $start = $this->_getParam('start') ? $this->_getParam('start') : 0; $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10; $tblPBanner = new Pandamp_Modules_Misc_Banner_Model_Powerban(); $rowset = $tblPBanner->fetchAll(null, 'createdDate DESC', $end, $start); $a = array(); $a['totalCount'] = $tblPBanner->countPowerban(); $now = date('Y-m-d H:i:s'); $ii = 0; if ($a['totalCount'] != 0) { foreach ($rowset as $row) { $a['banner'][$ii]['guid'] = $row->guid; $a['banner'][$ii]['title'] = $row->name; $a['banner'][$ii]['source'] = $row->src; $a['banner'][$ii]['type'] = $row->type; $a['banner'][$ii]['alt'] = $row->alt; $a['banner'][$ii]['url'] = $row->url; $a['banner'][$ii]['createdby'] = $row->createdBy; $a['banner'][$ii]['modifiedby'] = $row->modifiedBy; $a['banner'][$ii]['createdDate'] = Pandamp_Lib_Formater::get_date($row->createdDate); if ($now <= $row->publishedDate && $row->status == 99) { $status = "publish_y"; } else { if (($now <= $row->expiredDate || $row->expiredDate == '0000-00-00 00:00:00') && $row->status == 99) { $status = "publish_g"; } else { if ($now > $row->expiredDate && $row->status == 99) { $status = "publish_r"; } else { if ($row->status == 0) { $status = "publish_x"; } else { if ($row->status == -1) { $status = "disabled"; } } } } } $a['banner'][$ii]['status'] = $status; $ii++; } } if ($a['totalCount'] == 0) { $a['banner'][0]['guid'] = 'XXX'; $a['banner'][0]['title'] = "No Data"; $a['banner'][0]['source'] = "-"; $a['banner'][0]['createdDate'] = ''; } echo Zend_Json::encode($a); }
function visitAction() { $guid = $this->_getParam('guid'); $tblPowerban = new Pandamp_Modules_Misc_Banner_Model_Powerban(); $rowset = $tblPowerban->find($guid); if (count($rowset)) { $row = $rowset->current(); $row->visits = $row->visits + 1; $gid = $row->save(); if ($gid) { $tblPowerbanVisit = new Pandamp_Modules_Misc_Banner_Statistic_Model_PowerbanStatistik(); $rowPStatistik = $tblPowerbanVisit->fetchNew(); $rowPStatistik->bid = $guid; $rowPStatistik->host = gethostbyname($_SERVER['HTTP_REFERER']); $rowPStatistik->address = Pandamp_Lib_Formater::getRealIpAddr(); $rowPStatistik->agent = $_SERVER['HTTP_USER_AGENT']; $rowPStatistik->datetime = date("Y-m-d h:i:s"); $rowPStatistik->referer = $_SERVER['HTTP_REFERER']; $rowPStatistik->save(); } $this->_redirect($row->url); } }
function delete($guid) { $tblPowerban = new Pandamp_Modules_Misc_Banner_Model_Powerban(); $rowset = $tblPowerban->find($guid); if (count($rowset)) { $row = $rowset->current(); $split = explode("/", $row->src); if (isset($row->fa)) { $sDir = ROOT_DIR . '/iklan/' . $row->fa; if (isset($split) && !empty($split)) { if (file_exists($sDir . "/" . $split[6])) { unlink($sDir . "/" . $split[6]); } } if (isset($row->af) && !empty($row->af)) { // $split2 = explode("/",$row->af); // if (file_exists($sDir."/".$split2[7])) { unlink($sDir."/".$split2[7]); } $attachfile = unserialize($row->af); foreach ($attachfile as $file) { if (file_exists($sDir . "/" . $file)) { unlink($sDir . "/" . $file); } // echo $file.'<br>'; } // die(); } } else { $sDir = ROOT_DIR . '/iklan'; if (isset($split) && !empty($split)) { if (file_exists($sDir . "/" . $split[6])) { unlink($sDir . "/" . $split[6]); } } if (isset($row->af) && !empty($row->af)) { // $split2 = explode("/",$row->af); // if (file_exists($sDir."/".$split2[6])) { unlink($sDir."/".$split2[6]); } $attachfile = unserialize($row->af); foreach ($attachfile as $file) { if (file_exists($sDir . "/" . $file)) { unlink($sDir . "/" . $file); } } } } $cache = Zend_Registry::get('cache'); $cacheKey = "fb_zid_" . $row->zone; $cache->remove($cacheKey); $row->delete(); } }