function handler_group_ajax_admin_users($page) { $group = Group::fromId(Json::i('gid')); $limit = 10; $total = 0; $users = false; if ($group) { $users = array(); $order = new UFO_Name(UFO_Name::LASTNAME); $filters = array(); $rights = Rights::everybody(); if (Json::s('rights', '') != '') { $rights = new Rights(Json::s('rights')); } $filters[] = new UFC_Group($group, $rights); if (Json::t('promo', '') != '') { $filters[] = new UFC_Group(explode(';', Json::v('promo'))); } if (Json::t('name', '') != '') { $filters[] = new UFC_Name(Json::t('name'), UFC_Name::LASTNAME | UFC_Name::FIRSTNAME | UFC_Name::NICKNAME, UFC_Name::CONTAINS); } $uf = new UserFilter(new PFC_And($filters), $order); $users = $uf->get(new PlLimit($limit, (Json::i('page', 1) - 1) * $limit)); $total = $uf->getTotalCount(); $export = array(); if ($users->count() > 0) { $users->select(UserSelect::base()); /* * Fetching rights */ $users_rights = $group->selectRights($users); /* * Fetching comments */ $users_comments = array(); $iter = XDB::iterRow('SELECT uid, comment FROM users_comments WHERE gid = {?} AND uid IN {?}', $group->id(), $users->ids()); while (list($uid, $comment) = $iter->next()) { $users_comments[$uid] = $comment; } /* * Exporting */ $page->assign('defaultrights', array(Rights::admin(), Rights::member(), Rights::friend())); foreach ($users as $uid => $u) { $page->assign('user', $u); $page->assign('rights', empty($users_rights[$uid]) ? array() : $users_rights[$uid]); $page->assign('comment', empty($users_comments[$uid]) ? "" : $users_comments[$uid]); $export[$uid] = $page->filteredFetch(FrankizPage::getTplPath('groups/admin_user.tpl')); } } } $page->jsonAssign('limit', $limit); $page->jsonAssign('total', $total); $page->jsonAssign('users', $export); return PL_JSON; }
function handler_ajax_minimodules_layout($page) { $layout = FrankizMiniModule::emptyLayout(); foreach (array_keys($layout) as $col) { if (Json::has($col)) { $layout[$col] = Json::v($col); } } if (!S::user()->layoutMinimodules($layout)) { $page->jsonAssign('error', "Le réagencement des minimodules n'a pas pu se faire"); } return PL_JSON; }