/** * Display status update details * * @param null * @return null */ function view() { if ($this->active_status_update->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if (!$this->active_status_update->canView($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if $this->smarty->assign('active_status_update_author', $this->active_status_update->getCreatedBy()); if ($this->request->isSubmitted()) { db_begin_work(); $reply_data = $this->request->post('reply'); $reply = new StatusUpdate(); $reply->setAttributes(array('message' => array_var($reply_data, 'message'), 'parent_id' => $this->active_status_update->getId())); $reply->setCreatedBy($this->logged_user); $save = $reply->save(); if ($save && !is_error($save)) { UserConfigOptions::setValue('status_update_last_visited', new DateTimeValue(), $this->logged_user); db_commit(); if ($this->request->isAsyncCall()) { $this->smarty->assign('status_update_reply', $reply); print $this->smarty->fetch(get_template_path('_status_reply_row', 'status', STATUS_MODULE)); die; } else { flash_success('Reply has been successfully posted'); } // if } else { db_rollback(); if ($this->request->isAsyncCall()) { $this->serveData($save); } else { flash_error('Failed to post reply to selected status message'); } // if } // if $this->redirectToUrl($this->active_status_update->getViewUrl()); } // if }