[Isocial-svn] SF.net SVN: isocial:[301]
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <di...@us...> - 2008-08-29 13:44:16
|
Revision: 301 http://isocial.svn.sourceforge.net/isocial/?rev=301&view=rev Author: dim0s77 Date: 2008-08-29 13:44:26 +0000 (Fri, 29 Aug 2008) Log Message: ----------- added filter and sorting for groups list Modified Paths: -------------- app/controllers/groupapp/group_controller.php app/views/groupapp/group/index.tpl public/stylesheets/groupapp/Group.css Added Paths: ----------- app/views/groupapp/group/_groups_list.tpl Modified: app/controllers/groupapp/group_controller.php =================================================================== --- app/controllers/groupapp/group_controller.php 2008-08-28 13:34:12 UTC (rev 300) +++ app/controllers/groupapp/group_controller.php 2008-08-29 13:44:26 UTC (rev 301) @@ -43,27 +43,36 @@ function index () { $user_groups = $this->current_user->groupapp_group->load(); - $this->user_groups_count = count($user_groups); - $this->sort_type = !empty($this->params['s']) ? $this->params['s'] : ''; - $_filter_pagination = array('items_per_page' => 10); $group_pages = $this->array_pagination_helper->getPaginator("user_group_pages", $user_groups, $_filter_pagination);// paginator + + $this->filter_you_admin = ''; + if (!empty($this->params['you_admin'])) { + $user_groups = $this->_get_group_administrated($user_groups); + $this->filter_you_admin = 'checked'; + } + if (!empty($this->params['sort']) && !empty($this->params['direction'])) { $user_groups = $this->array_pagination_helper->sortByColumn($user_groups, $this->GroupappGroup, $this->params['sort'], $this->params['direction'] ); + $this->sort_column = $this->params['sort']; + $this->sort_direction = $this->params['direction']; } $links = $group_pages->paginator->getLinks(); $this->pages_links = $links['first'] . ' ' . $links['back'] . ' ' . $links['pages'] . ' ' . $links['next' ] . ' ' . $links['last']; + $this->sort_by_name_link = $this->array_pagination_helper->sortable_link('name'); + $this->sort_by_members_count_link = $this->array_pagination_helper->sortable_link('members_count'); + $this->user_groups = $this->array_pagination_helper->getPageItems("user_group_pages", $user_groups); $this->user_picture = $this->_current_user_picture(); @@ -436,6 +445,22 @@ return $this->current_user->basic_profile->load()->stored_file_id ? $this->current_user->basic_profile->picture->load()->url() : 'USER_DEFAULT_PICTURE_URL'; } + + function _get_group_administrated($groups) { + $group_administrated = array(); + foreach ($groups as $group) { + $members = $group->groupapp_member->load(); + foreach ($members as $member) { + if ($member->user_id == $this->current_user->getId()) { + if ($member->groupapp_member_role_id < 3) { + $group_administrated[] = $group; + } + continue; + } + } + } + return $group_administrated; + } } ?> Added: app/views/groupapp/group/_groups_list.tpl =================================================================== --- app/views/groupapp/group/_groups_list.tpl (rev 0) +++ app/views/groupapp/group/_groups_list.tpl 2008-08-29 13:44:26 UTC (rev 301) @@ -0,0 +1,50 @@ + <div class="paginationUnder2"> + {pages_links?} + </div> + + <div class="container"> + {loop user_groups} + <div class="group_row"> + + <div class="actions"> + <ul class="actions_list"> + <? $members = $user_group->groupapp_member->load() ?> + {loop members} + <? if ($member->user_id == $current_user->getId() && $member->groupapp_member_role_id < 3): ?> + <li><a href="/groupapp/group/edit_info/{user_group.id?}">_{Edit Group}</a></li> + <? endif ?> + {end} + <li><a href="#" onclick="leave_this_group(this); return false;" id="{user_group.id?}" name="{user_group.name?}">_{Leave Group}</a></li> + </ul> + </div> + + <div class="avatar"> + {?user_group.stored_file_id} + <? $group_picture = $user_group->picture->load()->url(); ?> + {else} + <? $group_picture = GROUPAPP_DEFAULT_PICTURE_URL; ?> + {end} + <a href="/groupapp/group/show_group/{user_group.id?}"><img src="/preview/100x100/{group_picture}"></a> + </div> + + <div class="info"> + <div class="name"><a href="/groupapp/group/show_group/{user_group.id?}">{user_group.name}</a></div> + <div class="other"><span class="param">_{Members count}:</span> + <a href="/groupapp/group/show_members/{user_group.id?}">{user_group.members_count}</a> + </div> + <div class="other"><span class="param">_{Type}:</span> + <? $subtype_id = $user_group->type_id; $type_id = $subgroup_types[$subtype_id]; ?> + <a href="/groupapp/group/browse/?g={type_id?}"><?= $gt[$type_id] ?></a> - + <a href="/groupapp/group/browse/?g={type_id?}&sg={subtype_id?}"><?= $gt[$subtype_id] ?></a> + </div> + </div> + + <div class="clearfix"></div> + </div> + {end} + + </div> + <div class="paginationAbove2"> + {pages_links?} + </div> + <div class="clearfix"></div> Modified: app/views/groupapp/group/index.tpl =================================================================== --- app/views/groupapp/group/index.tpl 2008-08-28 13:34:12 UTC (rev 300) +++ app/views/groupapp/group/index.tpl 2008-08-29 13:44:26 UTC (rev 301) @@ -8,7 +8,7 @@ </div> <div class="info"> <div class="header"> - <div class="name groupapp">_{My Groups}</div> + <div class="name groupapp">_{My Groups} ({user_groups_count})</div> </div> <div class="clearfix"></div> <div class="subheader"><a href="/groupapp/group/create">_{Create a New Group}</a></div> @@ -17,73 +17,21 @@ </div> {?user_groups_count} -<div class="submenu_separator"> </div> -<div class="submenu"> - <div class="menu_block selector"> - <label for="action_select">_{Show}: - <select onchange="javascript: window.location.href='?s=' + this.options[this.selectedIndex].value"> - <option <? if(empty($sort_type) || $sort_type == "all"): ?>selected="selected" <? endif ?> value="all">_{All groups}</option> - <option <? if(!empty($sort_type) && $sort_type == "members"): ?>selected="selected" <? endif ?> value="members">_{By Group Member Size}</option> - <option <? if(!empty($sort_type) && $sort_type == "admin"): ?>selected="selected" <? endif ?> value="admin">_{Groups You Admin}</option> - </select> - </label> - </div> -</div> -<div class="clearfix"></div> +<div class="submenu_separator"></div> <div class="groups_list"> - <div class="head">_{You are in groups}: {user_groups_count}</div> - <div class="paginationUnder2"> - {pages_links?} - </div> - - <div class="container"> - {loop user_groups} - <div class="group_row"> - - <div class="actions"> - <ul class="actions_list"> - <? if ($members = $user_group->groupapp_member->load()): ?> - {loop members} - <? if ($member->user_id == $current_user->getId() && $member->groupapp_member_role_id < 3): ?> - <li><a href="/groupapp/group/edit_info/{user_group.id?}">_{Edit Group}</a></li> - <? endif ?> - {end} - <? endif ?> - <li><a href="#" onclick="leave_this_group(this); return false;" id="{user_group.id?}" name="{user_group.name?}">_{Leave Group}</a></li> - </ul> - </div> - - <div class="avatar"> - {?user_group.stored_file_id} - <? $group_picture = $user_group->picture->load()->url(); ?> - {else} - <? $group_picture = GROUPAPP_DEFAULT_PICTURE_URL; ?> - {end} - <a href="/groupapp/group/show_group/{user_group.id?}"><img src="/preview/100x100/{group_picture}"></a> - </div> - - <div class="info"> - <div class="name"><a href="/groupapp/group/show_group/{user_group.id?}">{user_group.name}</a></div> - <div class="other"><span class="param">_{Members count}:</span> - <a href="/groupapp/group/show_members/{user_group.id?}">{user_group.members_count}</a> - </div> - <div class="other"><span class="param">_{Type}:</span> - <? $subtype_id = $user_group->type_id; $type_id = $subgroup_types[$subtype_id]; ?> - <a href="/groupapp/group/browse/?g={type_id?}"><?= $gt[$type_id] ?></a> - - <a href="/groupapp/group/browse/?g={type_id?}&sg={subtype_id?}"><?= $gt[$subtype_id] ?></a> - </div> - </div> - - <div class="clearfix"></div> + <div class="head"> + <div class="left">_{Sort by}: {sort_by_name_link}; {sort_by_members_count_link}</div> + <div class="right"><?= $form_helper->check_box('filter', 'you_admin', array('class' => 'checkboxinput', + 'onclick' => 'filter_you_admin();', + 'checked' => $filter_you_admin)) ?> + _{Groups You Admin} </div> - {end} - + <div class="clearfix"></div> </div> - <div class="paginationAbove2"> - {pages_links?} + <div class="body"> + <?= $controller->renderPartial("groups_list") ?> </div> - <div class="clearfix"></div> </div> {else} @@ -128,7 +76,10 @@ </div> <div class="clearfix"></div> </div> +<input type="hidden" id="sort_column" name="sort_column" value="{sort_column?}" /> +<input type="hidden" id="sort_direction" name="sort_direction" value="{sort_direction?}" /> + <script type="text/javascript"> function leave_this_group (element) { new Dialog.Box(element, { @@ -148,4 +99,16 @@ return false; } +function filter_you_admin() { + var href = ''; + if ($('sort_column').value && $('sort_direction').value) { + href = 'sort=' + $('sort_column').value + '&direction=' + $('sort_direction').value; + } + if ($('filter_you_admin').checked) { + href += href != '' ? '&' : ''; + href += 'you_admin=1'; + } + window.location.href = '?' + href; +} + </script> Modified: public/stylesheets/groupapp/Group.css =================================================================== --- public/stylesheets/groupapp/Group.css 2008-08-28 13:34:12 UTC (rev 300) +++ public/stylesheets/groupapp/Group.css 2008-08-29 13:44:26 UTC (rev 301) @@ -156,6 +156,10 @@ float: left; } +.groups_list .head .right { + float: right; +} + .groups_list .container { padding: 5px 10px 5px 10px; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |