public function approveAction()
{
$this->getHelper('contextSwitch')->addActionContext('approve', 'json')->initContext();
$parameters = $this->getRequest()->getParams();
if ($parameters['type'] == 'image') {
$image = new Image($parameters['id']);
$image->update(array('Status' => 'approved'));
$user_id = $image->getUploadingUserId();
$user = $this->_helper->service('user')->find($user_id);
$this->_helper->service->getService('dispatcher')->dispatch('image.approved', new GenericEvent($this, array('user' => $user, 'image_id' => $parameters['id'])));
}
if ($parameters['type'] == 'document') {
$document = new Attachment($parameters['id']);
$document->update(array('Status' => 'approved'));
$user_id = $document->getUploadingUserId();
$user = $this->_helper->service('user')->find($user_id);
$this->_helper->service->getService('dispatcher')->dispatch('document.approved', new GenericEvent($this, array('user' => $user, 'document_id' => $parameters['id'])));
}
}