Пример #1
0
 /**
  * Star/unstar an entry
  *
  * @return  string
  */
 protected function starAction()
 {
     if (User::isGuest()) {
         return $this->loginAction();
     }
     if (User::get('id') != $this->member->get('id')) {
         App::abort(403, Lang::txt('PLG_MEMBERS_ACTIVITY_NOTAUTH'));
     }
     $id = Request::getInt('activity', 0);
     $no_html = Request::getInt('no_html', 0);
     $action = Request::getVar('action', 'star');
     $entry = Hubzero\Activity\Recipient::oneOrFail($id);
     $entry->set('starred', $action == 'star' ? 1 : 0);
     if (!$entry->save()) {
         $this->setError($entry->getError());
     }
     $success = $action == 'star' ? Lang::txt('PLG_MEMBERS_ACTIVITY_RECORD_STARRED') : Lang::txt('PLG_MEMBERS_ACTIVITY_RECORD_UNSTARRED');
     if ($no_html) {
         $response = new stdClass();
         $response->success = true;
         $response->message = $success;
         if ($err = $this->getError()) {
             $response->success = false;
             $response->message = $err;
         }
         ob_clean();
         header('Content-type: text/plain');
         echo json_encode($response);
         exit;
     }
     if ($err = $this->getError()) {
         Notify::error($err);
     } else {
         Notify::success($success);
     }
     // Redirect
     App::redirect(Route::url($this->member->link() . '&active=activity', false));
 }
Пример #2
0
					</fieldset>
				</form>
			</div><!-- / .comment-add -->
		<?php 
}
?>

		<div class="activity-processor">
			<div class="spinner"><div></div></div>
			<div class="msg"></div>
		</div><!-- / .activity-processor -->
	</div><!-- / .activity-content -->

	<?php 
if ($this->row->log->get('scope') == 'activity.comment') {
    $recipient = Hubzero\Activity\Recipient::all();
    $r = $recipient->getTableName();
    $l = Hubzero\Activity\Log::blank()->getTableName();
    $rows = $recipient->select($r . '.*')->including('log')->join($l, $l . '.id', $r . '.log_id')->whereEquals($r . '.scope', 'group')->whereEquals($r . '.scope_id', $this->group->get('gidNumber'))->whereEquals($r . '.state', Hubzero\Activity\Recipient::STATE_PUBLISHED)->whereEquals($l . '.parent', $this->row->log->get('id'))->order('id', 'asc')->rows();
    if ($rows->count()) {
        ?>
			<ul class="activity-comments">
				<?php 
        foreach ($rows as $row) {
            $this->view('default_item')->set('group', $this->group)->set('online', $this->online)->set('row', $row)->display();
        }
        ?>
			</ul>
			<?php 
    }
}
Пример #3
0
 /**
  * Star/unstar an entry
  *
  * @return  string
  */
 protected function starAction()
 {
     $id = Request::getInt('activity', 0);
     $no_html = Request::getInt('no_html', 0);
     $action = Request::getVar('action', 'star');
     $entry = Hubzero\Activity\Recipient::oneOrFail($id);
     $entry->set('starred', $action == 'star' ? 1 : 0);
     if (!$entry->save()) {
         $this->setError($entry->getError());
     }
     $success = $action == 'star' ? Lang::txt('PLG_GROUPS_ACTIVITY_RECORD_STARRED') : Lang::txt('PLG_GROUPS_ACTIVITY_RECORD_UNSTARRED');
     if ($no_html) {
         $response = new stdClass();
         $response->success = true;
         $response->message = $success;
         if ($err = $this->getError()) {
             $response->success = false;
             $response->message = $err;
         }
         ob_clean();
         header('Content-type: text/plain');
         echo json_encode($response);
         exit;
     }
     if ($err = $this->getError()) {
         Notify::error($err);
     } else {
         Notify::success($success);
     }
     // Redirect
     App::redirect(Route::url($this->base . '&active=' . $this->_name, false));
 }