예제 #1
0
 /**
  * View all groups under the category
  * @param string $categoryId
  */
 public function actionGroups($categoryId = '')
 {
     RAssert::not_empty($categoryId);
     $category = Category::get($categoryId);
     RAssert::not_null($category);
     $page = $this->getPage("page", 1);
     $pageSize = $this->getPageSize("pagesize", 10);
     $groups = Group::getGroupsOfCategory($categoryId, ($page - 1) * $pageSize, $pageSize);
     if (Rays::isAjax()) {
         if (!count($groups)) {
             echo 'nomore';
         } else {
             $this->renderPartial("_groups_list", array("groups" => $groups), false);
         }
         exit;
     }
     $this->addCss("/public/css/group.css");
     $this->addJs("/public/js/masonry.pkgd.min.js");
     $this->render('groups', ['category' => $category, 'groups' => $groups], false);
 }