echo $this->row->get('id'); ?> "> <?php echo $content; ?> </div> <?php if ($attached) { ?> <div class="activity-attachments"> <?php foreach ($attachments as $attachment) { $attachment = new Plugins\Groups\Activity\Models\Attachment($attachment); $attachment->setUploadDir('/site/groups/' . $this->group->get('gidNumber') . '/uploads'); if (!$attachment->exists()) { continue; } if (!trim($attachment->get('description'))) { $attachment->set('description', $attachment->get('filename')); } $link = 'index.php?option=com_groups&cn=' . $this->group->get('cn') . '&active=File:/uploads/' . ($attachment->get('subdir') ? $attachment->get('subdir') . '/' : '') . $attachment->get('filename'); if ($attachment->isImage()) { ?> <a class="attachment img" rel="lightbox" href="<?php echo Route::url($link); ?> "> <img src="<?php echo Route::url($link);
/** * Save a comment * * @return void */ protected function postAction() { // Check for request forgeries Request::checkToken(); // Incoming $comment = Request::getVar('activity', array(), 'post', 'none', 2); // Instantiate a new object and bind data $row = Hubzero\Activity\Log::oneOrNew($comment['id'])->set($comment); // Process attachment $upload = Request::getVar('activity_file', '', 'files', 'array'); if (!empty($upload) && $upload['name']) { if ($upload['error']) { $this->setError(\Lang::txt('PLG_GROUPS_ACTIVITY_ERROR_UPLOADING_FILE')); } $file = new Plugins\Groups\Activity\Models\Attachment(); $file->setUploadDir('/site/groups/' . $this->group->get('gidNumber') . '/uploads'); if (!$file->upload($upload['name'], $upload['tmp_name'], $upload['size'])) { App::redirect(Route::url($this->base . '&active=' . $this->_name), $file->getError(), 'error'); } else { $row->details->set('attachments', array($file->toArray())); $row->set('details', $row->details->toString()); } } // Store new content if (!$row->save()) { User::setState('failed_comment', $row->get('description')); App::redirect(Route::url($this->base . '&active=' . $this->_name), $row->getError(), 'error'); } // Record the activity $recipients = array(['group', $this->group->get('gidNumber')], ['user', $row->get('created_by')]); if ($row->get('parent')) { $recipients[] = ['user', $row->parent()->get('created_by')]; } Event::trigger('system.logActivity', ['activity' => ['id' => $row->get('id'), 'action' => $comment['id'] ? 'updated' : 'created', 'scope' => $row->get('scope'), 'scope_id' => $row->get('scope_id'), 'anonymous' => $row->get('anonymous', 0), 'description' => $row->get('description'), 'details' => array('url' => Route::url($this->base . '&active=' . $this->_name . '#activity' . $row->get('id')), 'attachments' => $row->details->get('attachments'))], 'recipients' => $recipients]); // Redirect App::redirect(Route::url($this->base . '&active=' . $this->_name), Lang::txt('PLG_GROUPS_ACTIVITY_COMMENTS_SAVED')); }