Ejemplo n.º 1
0
 /**
  * makegrouplinkAction - Make group link
  */
 public function makegrouplinkAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $parentGrpId = $this->_request->getParam('parentgrpid');
         $this->view->parentgrpid = $parentGrpId;
         $childGrpId = $this->_request->getParam('childgrpid');
         $this->view->childgrpid = $childGrpId;
         if (!(isset($parentGrpId) && isset($childGrpId))) {
             $redirectUrl = $this->_urlHelper->url(array('controller' => 'group', 'action' => 'index', 'language' => $this->view->language), 'lang_default', true);
             $this->_redirector->gotoUrl($redirectUrl);
         }
         $grphasgrpmodel = new Default_Model_GroupHasGroup();
         if (!$grphasgrpmodel->checkIfGroupHasGroup($parentGrpId, $childGrpId) && !$grphasgrpmodel->checkIfGroupHasGroup($childGrpId, $parentGrpId)) {
             $grphasgrpmodel->addGroupToGroup($parentGrpId, $childGrpId);
         }
         // TODO:
         // Tell the user that the link was created.
         // Redirect back to the current campaign's page.
         $target = $this->_urlHelper->url(array('groupid' => $parentGrpId, 'language' => $this->view->language), 'group_shortview', true);
         $this->_redirector->gotoUrl($target);
     } else {
         $target = $this->_urlHelper->url(array('controller' => 'group', 'action' => 'index', 'language' => $this->view->language), 'lang_default', true);
         $this->_redirector->gotoUrl($target);
     }
 }