/** * Save an entry * * @return void */ protected function _save() { // Ensure the user is logged in if (User::isGuest()) { return $this->_login(); } // Check for request forgeries Request::checkToken(); // Incoming $comment = Request::getVar('comment', array(), 'post', 'none', 2); // Instantiate a new comment object and pass it the data $row = \Components\Courses\Models\Comment::blank()->set($comment); $row->setUploadDir($this->params->get('comments_uploadpath', '/site/comments')); if ($row->get('id') && !$this->params->get('access-edit-comment')) { App::redirect($this->url, Lang::txt('PLG_COURSES_REVIEWS_NOTAUTH'), 'warning'); } // Store new content if (!$row->save()) { App::redirect($this->url, $row->getError(), 'error'); } App::redirect($this->url, Lang::txt('PLG_COURSES_REVIEWS_SAVED'), 'message'); }
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * HUBzero is a registered trademark of Purdue University. * * @package hubzero-cms * @author Shawn Rice <*****@*****.**> * @copyright Copyright 2005-2015 HUBzero Foundation, LLC. * @license http://opensource.org/licenses/MIT MIT */ // No direct access defined('_HZEXEC_') or die; $comment = \Components\Courses\Models\Comment::blank(); $edit = Request::getInt('editcomment', 0); $vote = $comment->votes()->whereEquals('created_by', User::get('id'))->row(); $this->js(); if ($this->params->get('access-view-comment')) { ?> <h3 class="review-title"> <?php echo Lang::txt('PLG_COURSES_REVIEWS'); ?> </h3> <?php if ($this->comments->count() > 0) { $this->view('list')->set('option', $this->option)->set('comments', $this->comments)->set('obj_type', $this->obj_type)->set('obj', $this->obj)->set('params', $this->params)->set('depth', $this->depth)->set('url', $this->url)->set('cls', 'odd')->display(); } else { if ($this->depth <= 1 && !$this->params->get('access-review-comment')) {