public function setChannel($policyNumber, $channelOn, $isNewQuote)
 {
     $core_channel = new Manager_Core_Channel();
     return $core_channel->setChannel($policyNumber, $channelOn, $isNewQuote);
 }
 public function step2Action()
 {
     $pageForm = new LandlordsInsuranceQuote_Form_Step2();
     // Tell page to use AJAX validation as we go
     $this->view->headScript()->appendScript('var ajaxValidate = true; var ajaxValidatePage = 2;');
     $quoteManager = new Manager_Insurance_LandlordsPlus_Quote($this->_quoteID);
     $policynumber = $quoteManager->getQuote();
     // Push the QHLI to something usable by the templates.
     $this->view->qhli = $policynumber;
     $channelManager = new Manager_Core_Channel();
     $channel = $channelManager->getChannelName($policynumber);
     $isNewQuote = 1;
     if ($channel) {
         $isNewQuote = 0;
     }
     $channelManager->setChannel($policynumber, 'WEB', $isNewQuote);
     if ($this->getRequest()->isPost()) {
         // We need to validate and save the data
         $valid = $this->_formStepCommonValidate($pageForm, 2);
         if ($valid) {
             //Update the WebLead summary and create a STEP2 blob.
             $session = new Zend_Session_Namespace('landlords_insurance_quote');
             $webLeadManager = new Manager_Core_WebLead();
             $webLeadSummary = $webLeadManager->getSummary($session->webLeadSummaryId);
             $webLeadSummary->lastUpdatedTime = $this->_offsetDate();
             $webLeadManager->updateSummary($webLeadSummary);
             //Determine if a new STEP2 blob needs to be created, or an existing one retrieved.
             if ($webLeadManager->getBlobExists($webLeadSummary->webLeadSummaryId, Model_Core_WebLeadStep::STEP2)) {
                 $webLeadBlob = $webLeadManager->getBlob($webLeadSummary->webLeadSummaryId, Model_Core_WebLeadStep::STEP2);
             } else {
                 $webLeadBlob = $webLeadManager->createNewBlob($webLeadSummary->webLeadSummaryId, Model_Core_WebLeadStep::STEP2);
             }
             //Update the blob and store
             $webLeadBlob->blob = Zend_Json::encode($_POST);
             $webLeadBlob->blobChecksum = crc32($webLeadBlob->blob);
             $webLeadManager->updateBlob($webLeadBlob);
             // Everything has been saved ok so navigate to next step
             $this->_formStepCommonNavigate(2);
             return;
         } elseif (isset($_POST['back'])) {
             $this->_formStepCommonNavigate(2);
             return;
         }
     }
     // Load the element data from the database if we can
     if ($this->_formStepCommonPopulate($pageForm, 2)) {
         // Render the page unless we have been redirected
         $this->view->form = $pageForm;
         $this->render('step');
     }
 }