/** * removelinksAction * * Remove content link from content. * * @author Mikko Korpinen */ public function removelinksAction() { // Get authentication $auth = Zend_Auth::getInstance(); // If user has identity if ($auth->hasIdentity()) { // Get requests $params = $this->getRequest()->getParams(); // Get content type $contenttype = isset($params['contenttype']) ? $params['contenttype'] : ''; $relatestoid = isset($params['parentid']) ? $params['parentid'] : ''; $linkedcontentid = isset($params['childid']) ? $params['childid'] : ''; $id_usr = $auth->getIdentity()->user_id; $model_content = new Default_Model_Content(); $isOwner = $model_content->checkIfUserIsOwner($relatestoid, $id_usr); if ($isOwner) { $model_cnt_has_cnt = new Default_Model_ContentHasContent(); $model_cnt_has_cnt->removeContentFromContent($relatestoid, $linkedcontentid); } //$message = 'content-unlink-successful'; // TODO: // Tell the user that the unlink was created. // Redirect back to the user page $redirectUrl = $this->_urlHelper->url(array('controller' => 'content', 'action' => 'unlink', 'relatestoid' => $relatestoid, 'language' => $this->view->language), 'unlinkcontent', true); $this->_redirector->gotoUrl($redirectUrl); /* $url = $this->_urlHelper->url(array('controller' => 'msg', 'action' => 'index', 'language' => $this->view->language), 'lang_default', true); $this->flash($message, $url); */ } else { // If not logged, redirecting to system message page $message = 'content-link-not-logged'; $url = $this->_urlHelper->url(array('controller' => 'msg', 'action' => 'index', 'language' => $this->view->language), 'lang_default', true); $this->flash($message, $url); } }
/** * removelinksAction * * Remove content link from content. * * @author Mikko Korpinen */ public function removelinksAction() { // Get authentication $auth = Zend_Auth::getInstance(); // If user has identity if ($auth->hasIdentity()) { // Get requests $params = $this->getRequest()->getParams(); // Get content type $contenttype = isset($params['contenttype']) ? $params['contenttype'] : ''; $relatestoid = isset($params['parentid']) ? $params['parentid'] : ''; $linkedcontentid = isset($params['childid']) ? $params['childid'] : ''; $model_cnt_has_cnt = new Default_Model_ContentHasContent(); $model_cnt_has_cnt->removeContentFromContent($relatestoid, $linkedcontentid); $message = 'content-unlink-successful'; $url = $this->_urlHelper->url(array('controller' => 'msg', 'action' => 'index', 'language' => $this->view->language), 'lang_default', true); $this->flash($message, $url); } else { // If not logged, redirecting to system message page $message = 'content-link-not-logged'; $url = $this->_urlHelper->url(array('controller' => 'msg', 'action' => 'index', 'language' => $this->view->language), 'lang_default', true); $this->flash($message, $url); } }