public function init() { $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger'); /**********************************************************/ $storage = new Zend_Auth_Storage_Session('publisher_type'); $data = $storage->read(); //$this->modelPublishers = new Publisher_Model_DbTable_Publishers(); $storage1 = new Zend_Auth_Storage_Session('company_type'); $data1 = $storage1->read(); //$this->modelCompanies = new Company_Model_DbTable_Companies(); if (!empty($data) || !empty($data1)) { $this->_redirect('/'); } /******************************************************************/ //$storeId=$this->getRequest()->getCookie('sid'); //$storeName=$this->getRequest()->getCookie('sname'); $storeSession = new Zend_Session_Namespace('storeInfo'); if (!empty($storeSession->sid) && !empty($storeSession->sid) && !empty($storeSession->sname) && !empty($storeSession->sid) && !empty($storeSession->cid) && !empty($storeSession->cname)) { $this->view->storeId = $storeSession->sid; $this->view->storeName = $storeSession->sname; } else { //$modelCountry = new Admin_Model_DbTable_Countries(); //$country_info = $modelCountry->fetchRow('country="Nigeria"'); //$this->_redirect('/auth/storechange/storeid/'.$country_info->id); $this->_redirect('/auth/storechange/'); } $modelBooks = new Publisher_Model_DbTable_Books(); $allStored = $modelBooks->getAllStores(); $this->view->allStored = $allStored; /******************************************************************/ }
public function deletepriceAction() { $id = $this->_request->getParam('id', 0); $modelPrice = new Publisher_Model_DbTable_BookPrices(); $currentrecord = $modelPrice->CurrentRow($id); if ($id > 0 && $modelPrice->isExist($id)) { $success = $modelPrice->delete('id=' . $id); if ($success) { echo "<table width='100%' class='table-list' border='0' cellspacing='0' cellpadding='0'><tr>\n<td width='20%'><div align='left'><strong>Country</strong></div></td>\n<td width='20%'><div align='left'><strong>Language</strong></div></td>\n<td width='10%'><div align='left'><strong>Price</strong></div></td>\n<td width='20%'><div align='left'><strong>Group Price</strong></div></td>\n<td width='10%'><div align='left'><strong>Action</strong></div></td>\n</tr>"; $modelPrice = new Publisher_Model_DbTable_BookPrices(); $priceList = $modelPrice->getPriceList($currentrecord['product_id']); for ($jj = 0; $jj < count($priceList); $jj++) { $deletePriceUrl = $this->view->url(array('module' => 'publisher', 'controller' => 'book', 'action' => 'deleteprice', 'id' => $priceList[$jj]['id']), '', true); echo "<tr><td><div align='left'>"; $modelCountry = new Publisher_Model_DbTable_Books(); $countryRecord = $modelCountry->getCountryName($priceList[$jj]['country_id']); echo $countryRecord['country']; echo "</div></td><td><div align='left'>"; $modelLanguage = new Publisher_Model_DbTable_Books(); $languageRecord = $modelLanguage->getLanguageName($priceList[$jj]['language_id']); echo $languageRecord['language_name']; echo "</div></td><td><div align='left'>"; echo "\$" . $priceList[$jj]['price']; echo "</div></td><td><div align='left'>"; echo "\$" . $priceList[$jj]['group_price']; echo "</div></td><td><div align='left'>"; echo "<a class='action-icon' href='" . $deletePriceUrl . "' onclick='return deleteprice(this.href);' title='Delete'>"; echo "<img src='" . $this->view->serverUrl() . $this->view->baseUrl() . "/public/css/publisher/images/trash.gif' height='10' width='10'>"; echo "</a> "; ?> <a href="javascript:void(0);" onclick="return updateprice1('<?php echo $priceList[$jj]['id']; ?> ','<?php echo $this->view->serverUrl() . $this->view->baseUrl() . "/publisher/book/saveprice"; ?> ','<?php echo $currentrecord['product_id']; ?> ');"'<?php echo $priceList[$jj]['id']; ?> ','<?php echo $this->view->serverUrl() . $this->view->baseUrl() . "/publisher/book/saveprice"; ?> ','<?php echo $formData['id']; ?> ');"> <img src="<?php echo $this->view->serverUrl() . $this->view->baseUrl() . "/public/css/publisher/images/icon_edit.png"; ?> " width="10" height="10"/> </a> <?php echo "</div></td></tr>"; } echo "</table>"; exit; } else { echo "<font color='red'><strong>Sorry!, unable to delete price</strong></font>"; exit; } } }
function exportorderhistoryAction() { $productPrice = new Publisher_Model_DbTable_BookPrices(); $producturrency = new Admin_Model_DbTable_Countries(); $modelCategory = new Publisher_Model_DbTable_Books(); $order_key = $this->_request->getParam('order_key'); $to_date = $this->_request->getParam('to_date'); $from_date = $this->_request->getParam('from_date'); $subscription_name = $this->_request->getParam('subscription_name'); $user_type = $this->_request->getParam('user_type'); $formData = $this->getRequest()->getPost(); $where = ''; if (isset($order_key) && $order_key != '') { $condition .= ' and order_id="' . $order_key . '"'; } if (isset($from_date) && $from_date != '') { $condition .= ' and date(start_date) ="' . $from_date . '"'; } if (isset($to_date) && $to_date != '') { $condition .= ' and date(end_date) ="' . $to_date . '"'; } if (isset($subscription_name) && $subscription_name != '') { $condition .= ' and subscription_name ="' . $subscription_name . '"'; } if (isset($user_type) && $user_type == 'individual') { $condition .= ' and user_id > 0 and group_id=0'; } if (isset($user_type) && $user_type == 'Group') { $condition .= ' and user_id > 0 and group_id > 0'; } $formData = $this->getRequest()->getPost(); $productData = $this->modelUserSubscription->fetchAll('subscription_type > 0 ' . $condition . ''); $productPrice = new Publisher_Model_DbTable_BookPrices(); $producturrency = new Admin_Model_DbTable_Countries(); $this->modelCompanydata = new Model_DbTable_Companies(); $this->group_members = new Company_Model_DbTable_Groups(); $request_list = $productData; if (count($request_list) > 0) { $csv_output = ""; //$csv_output.="First Name".$separator."Last Name".$separator."User Name".$separator."Country".$separator."Email".$separator."Phone\n"; $content = '<table class="table-list" cellpadding="0" cellspacing="0" width="100%"> <tr> <th>Order Id</th> <th>User</h> <th>Group Name</th> <th>Company User</th> <th>Title / Brand</th> <th>Subscription Name</th> <th>Number of issues</th> <th>Number of Downloaded issues</th> <th>Subscription Price</th> <th>Start Date</th> <th>End Date</th> </tr>'; $sNumber = 1; foreach ($request_list as $row) { $this->sessCompanyInfo = $this->modelCompanydata->getInfoByUserId($row['user_id']); $this->sesscompany_user = $this->modelCompanydata->getInfoByUserId($row['company_id']); $this->sessgroup_members = $this->group_members->getInfoByGroupId($row['group_id']); $modelCategory = new Publisher_Model_DbTable_Books(); $getProductInfo = $this->modelCompany->getProductInfo($row['product_id']); $getBrandInfo = $modelCategory->getBrandInfo($getProductInfo['title']); if (!empty($getBrandInfo)) { $titleBrand = $getBrandInfo['brand']; } else { $titleBrand = $getProductInfo['title']; } if (!empty($getProductInfo['parent_brand_id'])) { $productInfo = $this->modelCompany->getProductInfo($getProductInfo['parent_brand_id']); $getParentBrandInfo = $modelCategory->getBrandInfo($productInfo['title']); if (!empty($getParentBrandInfo)) { $titleBrand = $getParentBrandInfo['brand'] . " - " . $titleBrand; } } $getCurrencyName = $producturrency->getCurrencyCode($row['country']); $totNairaPrice = $producturrency->currencyconverter($getCurrencyName, "NGN", $row['subscription_price']); $content .= '<tr> <td>' . $row['order_id'] . '</td> <td>' . $this->sessCompanyInfo['first_name'] . " " . $this->sessCompanyInfo['last_name'] . '</td> <td>' . $this->sesscompany_user['first_name'] . " " . $this->sesscompany_user['last_name'] . '</td> <td>' . $this->sessgroup_members['group_name'] . '</td> <td>' . stripslashes($titleBrand) . '</td> <td>' . $row['subscription_name'] . '</td> <td>' . $row['number_of_issues'] . '</td> <td>' . $row['number_of_downloaded'] . '</td> <td>' . $producturrency->getCurrencyInfo($row['country']) . @number_format($totNairaPrice, 2) . '</td> <td>' . $row['start_date'] . '</td> <td>' . $row['end_date'] . '</td> </tr>'; $sNumber++; } } else { $content .= '<tr><td colspan="8" class="list-not-found">Data Not Found</td></tr>'; } $content .= '</table>'; $file = "subscription_report"; $filename = $file . "_" . time() . ".xls"; $test = $content; header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename={$filename}"); echo $test; exit; }
function viewxmlAction() { $this->_helper->layout->disableLayout(); $trans_id = $this->_request->getParam('transid'); $modelBooks = new Publisher_Model_DbTable_Books(); $trans_history_data = $modelBooks->getAllProductTransactionById($trans_id); /*if($trans_history_data[0]['transaction_xml']!='') { echo $trans_history_data[0]['transaction_xml']; } else { echo "No Data"; } exit;*/ $this->view->trans_history_data = $trans_history_data; $this->view->trans_id = $trans_id; }
function createrssAction() { $modelContinent = new Admin_Model_DbTable_Continents(); $this->modelBooks = new Publisher_Model_DbTable_Books(); $allStored = $this->modelBooks->getAllStores(); $modelBooks = new Publisher_Model_DbTable_Books(); $xml_content = '<?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0"> <channel> <title>eVendor</title> <link>' . $this->view->serverUrl() . $this->view->baseUrl() . '</link> <description>The largest digital publication store in Africa</description> <image> <url>' . $this->view->serverUrl() . $this->view->baseUrl() . '/public/css/default/images/logo.png</url> <title>' . $this->view->serverUrl() . $this->view->baseUrl() . '</title> <link>' . $this->view->serverUrl() . $this->view->baseUrl() . '</link> </image>'; foreach ($allStored as $continent_id => $country_array) { $continentInfo = $modelContinent->fetchRow("id='{$continent_id}'"); $storect = 0; foreach ($country_array as $cid => $cname) { echo $cname . "<br/>"; $publicationcount = $modelBooks->getPublicationListByStore($cid, 1); $countryFlag = $modelBooks->getCountryName($cid); $storect++; if (count($publicationcount) > 0) { //$xml_content.="<country>"; $xml_content .= '<item> <title>Newspaper publications in ' . $cname . '</title> <link>' . $this->view->serverUrl() . $this->view->baseUrl() . '/search/index/publication/ebook/cat_id/1/store/' . $cid . '</link> <description>Buy ' . $cname . ' newspapers from anywhere in the world</description> </item>'; $xml_content .= '<item> <title>Magazine publications in ' . $cname . '</title> <link>' . $this->view->serverUrl() . $this->view->baseUrl() . '/search/index/publication/ebook/cat_id/2/store/' . $cid . '</link> <description>Buy ' . $cname . ' Magazine from anywhere in the world</description> </item>'; $xml_content .= '<item> <title>eBooks publications in ' . $cname . '</title> <link>' . $this->view->serverUrl() . $this->view->baseUrl() . '/search/index/publication/ebook/cat_id/3/store/' . $cid . '</link> <description>Buy ' . $cname . ' newspapers from anywhere in the world</description> </item>'; //$xml_content.='</country>'; } } } $xml_content .= '</channel></rss>'; $file = $_SERVER['DOCUMENT_ROOT'] . '/projects/evendor/rssfeed.xml'; $fp = fopen($file, 'w'); $fp1 = fwrite($fp, $xml_content); fclose($fp); exit; }
public function deletepriceAction() { $id = $this->_request->getParam('id', 0); $parent_publication_id = $this->_request->getParam('parentid', 0); $modelPrice = new Publisher_Model_DbTable_BookPrices(); $currentrecord = $modelPrice->CurrentRow($id); if ($id > 0 && $modelPrice->isExist($id)) { $success = $modelPrice->delete('id=' . $id); if ($success) { echo "<table width='100%' class='table-list' border='0' cellspacing='0' cellpadding='0'><tr>\n<td width='50%'><div align='left'><strong>Country</strong></div></td>\n<td width='30%'><div align='left'><strong>Language</strong></div></td>\n<td width='10%'><div align='left'><strong>Price</strong></div></td>\n<td width='10%'><div align='left'><strong>Action</strong></div></td>\n</tr>"; $modelPrice = new Publisher_Model_DbTable_BookPrices(); $priceList = $modelPrice->getPriceList($currentrecord['product_id']); for ($jj = 0; $jj < count($priceList); $jj++) { $deletePriceUrl = $this->view->url(array('module' => 'publisher', 'controller' => 'issues', 'action' => 'deleteprice', 'id' => $priceList[$jj]['id'], 'parentid' => $parent_publication_id), '', true); echo "<tr><td><div align='left'>"; $modelCountry = new Publisher_Model_DbTable_Books(); $countryRecord = $modelCountry->getCountryName($priceList[$jj]['country_id']); echo $countryRecord['country']; echo "</div></td><td><div align='left'>"; $modelLanguage = new Publisher_Model_DbTable_Books(); $languageRecord = $modelLanguage->getLanguageName($priceList[$jj]['language_id']); echo $languageRecord['language_name']; echo "</div></td><td><div align='left'>"; echo $priceList[$jj]['price']; echo "</div></td><td><div align='left'>"; echo "<a class='action-icon' href='" . $deletePriceUrl . "' onclick='return deleteprice(this.href);' title='delete'>"; echo "<img src='" . $this->view->serverUrl() . $this->view->baseUrl() . "/public/css/publisher/images/trash.gif' height='10' width='10'>"; echo "</a> "; echo "</div></td></tr>"; } echo "</table>"; exit; } else { echo "<font color='red'><strong>Sorry!, unable to delete price</strong></font>"; exit; } } }
public function cartAction() { $tempObj = new Model_DbTable_Checkout(); $formdata = $this->getRequest()->getPost(); $creditHistoryObj = new User_Model_DbTable_Chistory(); $UsersubObj = new Model_DbTable_Usersubscription(); $product_details = new Publisher_Model_DbTable_Books(); $storage_company = new Zend_Auth_Storage_Session('company_type'); $company_data = $storage_company->read(); $storage = new Zend_Auth_Storage_Session('account_type'); $data = $storage->read(); $modelSubscription = new Publisher_Model_DbTable_Subscriptions(); $subscription_price = 0; if ($data->id) { $user_id = $data->id; } elseif ($company_data->id) { $user_id = $company_data->id; } if ($company_data->account_type == '1') { $groupObj = new Company_Model_DbTable_Groups(); $groupList = $groupObj->getGroupList($company_data->id); } if (count($groupList) > 0 && $_POST['subscription_type'] == '') { $group_id = $groupList[0]['id']; } /* else { $group_id = 0; //$price_to_show = $subscription_data[0]->individual_price; } */ $group_id = 0; $sessionid = session_id(); if ($this->getRequest()->isPost()) { $product_id = $formdata['product_id']; //$user_id = $formdata['user_id']; $user_type = $formdata['user_type']; $store_id = $formdata['store_id']; $getallData = $tempObj->fetchAll("session_id='" . $sessionid . "' and product_id='" . $product_id . "' and user_id='" . $user_id . "'"); $quntity = $formdata['quantity']; if ($_POST['chk_button'] == 'Subscribe') { $subscription_type = $_POST['subscription_type']; $subscription_data = $modelSubscription->fetchAll('id="' . $subscription_type . '"'); } else { $subscription_type = ""; $subscription_data = ""; } if ($company_data->account_type == '1' && count($subscription_data) > 0) { $subscription_price = $subscription_data[0]->group_price_sub; $subscription_name = $subscription_data[0]->subscription_type; $subscription_store = $subscription_data[0]->country_sub; $subscription_language = $subscription_data[0]->language_sub; $subscription_issues = $subscription_data[0]->number_of_issues; $company_id = $user_id; } if ($company_data->account_type != '1' && count($subscription_data) > 0) { $subscription_price = $subscription_data[0]->individual_price; $subscription_name = $subscription_data[0]->subscription_type; $subscription_store = $subscription_data[0]->country_sub; $subscription_language = $subscription_data[0]->language_sub; $subscription_issues = $subscription_data[0]->number_of_issues; $company_id = $user_id; } //$purchasedBook = $creditHistoryObj->fetchAll("bookid ='".$product_id."' and userid='".$user_id."' and payment_status=1"); $data_product = $product_details->fetchAll('id="' . $product_id . '"'); if ($data_product[0]['cat_id'] == '3') { $purchasedBook = $UsersubObj->fetchAll("product_id ='" . $product_id . "' and user_id='" . $user_id . "'"); } if ($data_product[0]['cat_id'] != '3' && count($subscription_data) == 0) { $purchasedBook = $UsersubObj->fetchAll("product_id ='" . $product_id . "' and user_id='" . $user_id . "'"); } /* else if($data_product[0]['cat_id']!='3' && count($subscription_data)>0) { $purchasedBook = $UsersubObj->fetchAll("product_id ='".$product_id."' and user_id='".$user_id."' and subscription_type='".$_POST['subscription_type']."'"); } */ if (count($purchasedBook) > 0) { $is_purchase = 1; } else { $is_purchase = 0; } /* if($group_id!='0' && $formdata['subscription_type']=='') { $this->modelCompany = new Company_Model_DbTable_Companies(); $listGroupMember = $this->modelCompany->getMemberByGroupId($group_id); $quntity = count($listGroupMember); } */ if ($quntity == '' && $company_data->account_type != '1') { $quntity = '1'; } else { $quntity = '0'; } if (count($getallData) == 0) { $data_array = array("product_id" => $product_id, "store_id" => $store_id, "user_id" => $user_id, "user_type" => $user_type, "session_id" => $sessionid, "quntity" => $quntity, "group_id" => $group_id, "is_purchase" => $is_purchase, "subscription_type" => $subscription_type, "subscription_name" => $subscription_name, "subscription_price" => $subscription_price, "subscription_store" => $subscription_store, "subscription_language" => $subscription_language, "subscription_issues" => $subscription_issues, "company_id" => $company_id); $tempObj->insert($data_array); } else { $data_array = array("subscription_type" => $subscription_type, "subscription_price" => $subscription_price, "quntity" => $quntity, "subscription_store" => $subscription_store, "subscription_language" => $subscription_language, "subscription_name" => $subscription_name, "subscription_issues" => $subscription_issues); $where = "session_id='" . $sessionid . "' and product_id='" . $product_id . "'"; $tempObj->update($data_array, $where); } } $this->view->sesid = $sessionid; }
public function subscriptionsAction() { $idvalue = $this->_request->getParams('id'); $bookDetail = $this->modelPublications->getInfoByPublisherId($idvalue['id']); $subscriptions_data = $this->modelSubscriptions->fetchAll('product_id=' . $idvalue['id'] . ''); $this->view->subscriptiondata = $subscriptions_data; $whrcls = 'id=' . $idvalue['id'] . ''; $get_publicationname = $this->modelPublications->getListWhere($whrcls); $modelCategory = new Publisher_Model_DbTable_Books(); $getBrandInfo = $modelCategory->getBrandInfo($get_publicationname[0]->title); if (!empty($getBrandInfo)) { $titleBrand = $getBrandInfo['brand']; } else { $titleBrand = $get_publicationname[0]->title; } $this->view->publicationname = $titleBrand; }
public function exportfreereportxlsAction() { $category = $this->_request->getParam('category'); $brand = $this->_request->getParam('brand'); $productid = $this->_request->getParam('productid'); $frmdate = $this->_request->getParam('frmdate'); $todate = $this->_request->getParam('todate'); $publisher_id = $this->_request->getParam('publisher'); $modelCategory = new Publisher_Model_DbTable_Books(); $brand_exp = explode("**", $brand); $request_list = $this->modelBooks->getProductReport($category, $brand_exp[0], $productid, $frmdate, $todate, $publisher_id); $request_list = $this->modelBooks->getProductFreeReport($category, $brand_exp[0], $productid, $frmdate, $todate, $publisher_id); $separator = ","; // separate column in csv if (count($request_list) > 0) { $csv_output = ""; //$csv_output.="First Name".$separator."Last Name".$separator."User Name".$separator."Country".$separator."Email".$separator."Phone\n"; $content = '<table class="table-list" cellpadding="0" cellspacing="0" width="100%"> <tr> <th>Publication Id</th> <th>Title / Brand</th> <th>Category</th> <th>Publisher</th> <th>Total Downloads</th> </tr>'; foreach ($request_list as $req) { $getBrandInfo = $modelCategory->getBrandInfo($req['title']); if (!empty($getBrandInfo)) { $titleBrand = $getBrandInfo['brand']; } else { $titleBrand = $req['title']; } if (!empty($row->parent_brand_id)) { $productInfo = $this->modelPublications->fetchRow('id=' . $req['parent_brand_id']); $getParentBrandInfo = $modelCategory->getBrandInfo($productInfo->title); if (!empty($getParentBrandInfo)) { $titleBrand = $getParentBrandInfo['brand'] . " - " . $titleBrand; } } $title = stripslashes($titleBrand); $catInfo = $modelCategory->getCategoryInfo($req['cat_id']); $publiseherDetails = $this->modelPublisher->getInfoByPublisherId($req['publisher_id']); $publisherName = $publiseherDetails['publisher']; $totalDownLoad = $req['no_download']; $publication_id = $req['id']; $price = $req['price']; $quantity = $req['total_count']; $category_name = $catInfo['category_name']; $totalPurchase = $req['best_seller']; $content .= '<tr> <td>' . $publication_id . '</td> <td>' . stripslashes($title) . '</td> <th>' . $category_name . '</th> <td>' . $publisherName . '</td> <td>' . $totalDownLoad . '</td> </tr>'; //$csv_output .= str_replace(",","",$req['first_name']).$separator.str_replace(",","",$req['last_name']).$separator.str_replace(",","",$req['user_name']).$separator.str_replace(",","",$countryName['country']).$separator.str_replace(",","",$req['user_email']).$separator.str_replace(",","",$req['phone'])."\n"; } } else { $content .= '<tr><td colspan="5" class="list-not-found">Data Not Found</td></tr>'; } $content .= '</table>'; $file = "freereport"; $filename = $file . "_" . time() . ".xls"; $test = $content; header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename={$filename}"); echo $test; exit; }