public function viewAction() { $id = Zend_Filter::filterStatic($this->_getParam('id'), 'int'); $string = $this->_getParam('string'); $session = new Zend_Session_Namespace('data'); $restriction = Content_Model_Restriction::verify($id); if (empty($restriction['has'])) { $table = new Tri_Db_Table('content'); $contentAccess = new Tri_Db_Table('content_access'); $this->view->data = $table->find($id)->current(); $data['content_id'] = $id; $data['user_id'] = Zend_Auth::getInstance()->getIdentity()->id; $data['classroom_id'] = $session->classroom_id; $contentAccess->createRow($data)->save(); } else { $this->view->restriction = $this->view->translate($restriction['content']) . " " . $restriction['value']; } }
public function deleteAction() { $id = Zend_Filter::filterStatic($this->_getParam('id'), 'int'); $type = $this->_getParam("type"); $restriction = new Content_Model_Restriction(); $restrictionTime = new Content_Model_RestrictionTime(); $restrictionBulletin = new Content_Model_RestrictionBulletin(); if ($type == Content_Model_Restriction::TIME) { $result = $restrictionTime->delete($id); } else { $result = $restrictionBulletin->delete(array('restriction_id' => $id)); } $result = $restriction->delete($id); $this->_helper->_flashMessenger->addMessage($result->message); $this->_redirect("/content/restriction/"); }