Exemplo n.º 1
0
 public function actionList($groupId = null)
 {
     $group = Group::get($groupId);
     $page = $this->getPage("page");
     $pageSize = $this->getPageSize("pagesize", 10);
     $query = Topic::find("groupId", $groupId)->join("user")->order_desc("lastCommentTime");
     $count = $query->count();
     $topics = $query->range(($page - 1) * $pageSize, $pageSize);
     $data = array("topics" => $topics, "group" => $group);
     $pager = new RPager("page", $count, $pageSize, RHtml::siteUrl("post/list/" . $groupId), $page);
     $data['pager'] = $pager->showPager();
     $data['canPost'] = Rays::isLogin() && GroupUser::isUserInGroup(Rays::user()->id, $groupId);
     $this->setHeaderTitle("Hello");
     $this->addCss('/public/css/post.css');
     $this->render("list", $data, false);
 }
Exemplo n.º 2
0
                <a href="javascript:void(0);" title="Members of this group">
                    <span class="glyphicon glyphicon-user"></span> <?php 
    echo $group->memberCount;
    ?>
                </a>
            </div>

            <div class="action action-like">
                <?php 
    $self->module('rating_plus', array('id' => 'rating_plus', 'entityType' => Group::ENTITY_TYPE, 'entityId' => $group->id));
    ?>
            </div>

            <?php 
    if (Rays::isLogin()) {
        if (!GroupUser::isUserInGroup(Rays::user()->id, $group->id)) {
            ?>
                    <div class="action action-right">
                        <?php 
            $url = RHtml::siteUrl('group/join');
            ?>
                        <a href="javascript: joinGroup('<?php 
            echo $url;
            ?>
','<?php 
            echo $group->id;
            ?>
')" title="Join the group"><span class="glyphicon glyphicon-plus"></span></a>
                    </div>
                <?php 
        }
Exemplo n.º 3
0
 public function actionDecline($censorId = null)
 {
     $censor = Censor::get($censorId);
     if ($censor !== null) {
         $groupUser = new GroupUser();
         $groupUser->groupId = $censor->secondId;
         $groupUser->userId = $censor->firstId;
         $groupUser->joinTime = date('Y-m-d H:i:s');
         $groupUser->status = 1;
         if (!GroupUser::isUserInGroup($groupUser->userId, $groupUser->groupId)) {
             $this->flash("message", "The request is processed.");
             $group = Group::get($groupUser->groupId);
             $title = "Join group request declined";
             $content = 'Group creator have declined your request of joining in group ' . RHtml::linkAction('group', $group->name, 'detail', $group->id);
             $content = RHtml::encode($content);
             Message::sendMessage("group", $group->id, $groupUser->userId, $title, $content);
         } else {
             $this->flash("warning", "TA is already a member of this group.");
         }
         $censor->fail();
         $this->redirectAction('message', 'view');
     }
 }