Exemplo n.º 1
0
 public function makelinkAction()
 {
     $cmpId = $this->_request->getParam('cmpid');
     $this->view->cmpid = $cmpId;
     $cntId = $this->_request->getParam('cntid');
     $this->view->cntid = $cntId;
     if (!(isset($cmpId) && isset($cntId))) {
         $redirectUrl = $this->_urlHelper->url(array('controller' => 'campaign', 'action' => 'index', 'language' => $this->view->language), 'lang_default', true);
         $this->_redirector->gotoUrl($redirectUrl);
     }
     // Check if campaign is open
     $cmpModel = new Default_Model_Campaigns();
     if (!$cmpModel->isOpen($cmpId)) {
         $redirectUrl = $this->_urlHelper->url(array('controller' => 'campaign', 'action' => 'index', 'language' => $this->view->language), 'lang_default', true);
         $this->_redirector->gotoUrl($redirectUrl);
     }
     $cmphascntmodel = new Default_Model_CampaignHasContent();
     $cmphascntmodel->addContentToCampaign($cmpId, $cntId);
     // TODO:
     // Tell the user that the link was created.
     // Redirect back to the current campaign's page.
     $target = $this->_urlHelper->url(array('cmpid' => $cmpId, 'language' => $this->view->language), 'campaign_view', true);
     $this->_redirector->gotoUrl($target);
 }