Esempio n. 1
0
    public function inactivesubscriptionAction()
    {
        $producturrency = new Admin_Model_DbTable_Countries();
        $id = $this->_request->getParam('id', 0);
        $modelSubscription = new Publisher_Model_DbTable_Subscriptions();
        if ($id > 0 && $modelSubscription->isExist($id)) {
            $data['status'] = 0;
            $success = $modelSubscription->update($data, 'id="' . $id . '"');
            if ($success) {
                echo "Subscription deleted successfully." . "#####";
                echo "<fieldset class='dashboard_fieldset'>\n\t\t<legend>Store Price</legend><table width='100%' class='table-list' border='0' cellspacing='0' cellpadding='0'><tr>\n\t\t<td width='50%'><div align='left'><strong>Store</strong></div></td>\n\t\t<td width='30%'><div align='left'><strong>Language</strong></div></td>\n\t\t<td width='10%'><div align='left'><strong>Subscription type</strong></div></td>\n\t\t<td width='10%'><div align='left'><strong>Number of issues</strong></div></td>\n\t\t<td width='10%'><div align='left'><strong>Price</strong></div></td>\n\t\t<td width='20%'><div align='left'><strong>Group Price</strong></div></td>\n\t\t<td width='10%'><div align='left'><strong>Action</strong></div></td>\n\t\t</tr>";
                $modelSubscription = new Publisher_Model_DbTable_Subscriptions();
                $subscriptionList = $modelSubscription->getSubscriptionList($_POST['productid']);
                for ($jj = 0; $jj < count($subscriptionList); $jj++) {
                    $deletePriceUrl = $this->view->url(array('module' => 'publisher', 'controller' => 'book', 'action' => 'deletesubscription', 'id' => $subscriptionList[$jj]['id']), '', true);
                    echo "<tr><td><div align='left'>";
                    $modelCountry = new Publisher_Model_DbTable_Books();
                    $producturrency = new Admin_Model_DbTable_Countries();
                    $countryRecord = $modelCountry->getCountryName($subscriptionList[$jj]['country_sub']);
                    echo $countryRecord['country'];
                    echo "</div></td><td><div align='left'>";
                    $modelLanguage = new Publisher_Model_DbTable_Books();
                    $languageRecord = $modelLanguage->getLanguageName($subscriptionList[$jj]['language_sub']);
                    echo $languageRecord['language_name'];
                    echo "</div></td><td><div align='left'>";
                    echo $subscriptionList[$jj]['subscription_type'];
                    echo "</div></td><td><div align='left'>";
                    echo $subscriptionList[$jj]['number_of_issues'];
                    echo "</div></td><td><div align='left'>";
                    echo $producturrency->getCurrencyInfo($subscriptionList[$jj]['country_sub']) . "" . $subscriptionList[$jj]['individual_price'];
                    echo "</div></td><td><div align='left'>";
                    echo $producturrency->getCurrencyInfo($subscriptionList[$jj]['country_sub']) . $subscriptionList[$jj]['group_price_sub'];
                    echo "</div></td><td><div align='left'>";
                    /*echo "<a class='action-icon' href='".$deletePriceUrl."' onclick='return deletesubscription(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>&nbsp;";*/
                    ?>
		
		<?php 
                    if ($subscriptionList[$jj]['status'] == '1') {
                        ?>
		<a class="action-icon" href="<?php 
                        echo $this->view->url(array('module' => 'publisher', 'controller' => 'book', 'action' => 'inactivesubscription', 'id' => $subscriptionList[$jj]['id']), '', true);
                        ?>
" title="Deactivate Subscription" onclick="return inactivesubscription(this.href,'tab2','book');"><img alt="Active" src="<?php 
                        echo $this->view->serverUrl() . $this->view->baseUrl();
                        ?>
/public/css/admin/images/active.png"/></a>	
		<?php 
                    } else {
                        ?>
		<a class="action-icon" href="<?php 
                        echo $this->view->url(array('module' => 'publisher', 'controller' => 'book', 'action' => 'activesubscription', 'id' => $subscriptionList[$jj]['id']), '', true);
                        ?>
" title="Activate Subscription" onclick="return activesubscription(this.href,'tab2','book');"><img alt="Inactive" src="<?php 
                        echo $this->view->serverUrl() . $this->view->baseUrl();
                        ?>
/public/css/admin/images/inactive.png"/></a>
		<?php 
                    }
                    ?>
                    
		
		<a href="javascript:void(0);" onclick="return updatesubscription1('<?php 
                    echo $subscriptionList[$jj]['id'];
                    ?>
','<?php 
                    echo $this->view->serverUrl() . $this->view->baseUrl() . "/publisher/book/savesubscription";
                    ?>
','<?php 
                    echo $_POST['productid'];
                    ?>
','<?php 
                    echo $subscriptionList[$jj]['id'];
                    ?>
','<?php 
                    echo $this->view->serverUrl() . $this->view->baseUrl() . "/publisher/book/savesubscription";
                    ?>
','<?php 
                    echo $_POST['productid'];
                    ?>
');">
		<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>";
                }
                if (count($subscriptionList) == 0) {
                    echo "<tr><td colspan='6' align='center'>No Record Found</td></tr>";
                }
                if (!empty($price_error)) {
                    foreach ($price_error as $error_msg) {
                        echo "<tr><td colspan='4'><strong><font color='red'>" . $error_msg . "</font></strong></td></tr>";
                    }
                }
                echo "</table></fieldset>";
                exit;
            } else {
                echo "<font color='red'><strong>Sorry!, unable to inactive subscription</strong></font>";
                exit;
            }
        }
    }