public function run() { // Total Users $f = new UserFilter(null); $users = $f->getTotalCount(); $this->assign('users', $users); // Total Groups $f = new GroupFilter(null); $groups = $f->getTotalCount(); $this->assign('groups', $groups); // Total Castes $f = new CasteFilter(null); $castes = $f->getTotalCount(); $this->assign('castes', $castes); // Total News $f = new NewsFilter(null); $news = $f->getTotalCount(); $this->assign('news', $news); // Total Images $f = new ImageFilter(null); $images = $f->getTotalCount(); $this->assign('images', $images); $this->assign('user', S::user()); }
function handler_groups($page) { global $globals; $except = new PFC_True(); $max = $globals->groups->limit; // Re-fetch user's groups S::user()->select(UserSelect::castes()); // Fetch samples of other groups $binet = new GroupFilter(new PFC_And(new GFC_Namespace(Group::NS_BINET), $except), new GFO_Score(true)); $binet = $binet->get(new PlLimit($max)); $course = new GroupFilter(new PFC_And(new GFC_Namespace(Group::NS_COURSE), $except), new GFO_Score(true)); $course = $course->get(new PlLimit($max)); $free = new GroupFilter(new PFC_And(new GFC_Namespace(Group::NS_FREE), $except), new GFO_Score(true)); $free = $free->get(new PlLimit($max)); // Load associated datas $temp = new Collection('Group'); $temp->merge($binet)->merge($course)->merge($free); $temp->select(GroupSelect::base()); // Fetch the total count of groups $allf = new GroupFilter(new GFC_Visible()); $total = $allf->getTotalCount(); $user_binet = S::user()->castes()->groups()->filter('ns', Group::NS_BINET)->remove($binet); $page->assign('binet', $binet); $page->assign('user_binet', $user_binet); $user_course = S::user()->castes()->groups()->filter('ns', Group::NS_COURSE)->remove($course); $page->assign('course', $course); $page->assign('user_course', $user_course); $user_free = S::user()->castes()->groups()->filter('ns', Group::NS_FREE)->remove($free); $page->assign('free', $free); $page->assign('user_free', $user_free); $page->assign('user', S::user()); $page->assign('total', $total); $page->assign('title', 'Groupes'); $page->changeTpl('groups/groups.tpl'); $page->addCssLink('groups.css'); }
XDB::execute('INSERT INTO ips ( SELECT ip, prise_id, IF(piece_id REGEXP "^[A-Z]", piece_id, CONCAT("X", piece_id)), type FROM admin.prises )'); echo "-----------------------------------------------\n"; // Populating Groups $iter = XDB::iterator("SELECT b.binet_id, b.nom, b.description, b.http, b.mail, COUNT(m.binet_id) AS score\n FROM trombino.binets AS b\n LEFT JOIN trombino.membres AS m ON m.binet_id = b.binet_id\n GROUP BY b.binet_id"); $groups = $iter->total(); $k = 0; while ($datas = $iter->next()) { $g = new Group(); $g->insert($datas['binet_id']); $g->label(conv($datas['nom'])); $name = conv_name($datas['nom']); $gf = new GroupFilter(new GFC_Name($name)); if (strlen($name) >= 2 && $gf->getTotalCount() == 0) { $g->name($name); } else { $g->name('g_' . $g->id()); } if ($datas['score'] > 5) { $g->ns(Group::NS_BINET); } else { $g->ns(Group::NS_FREE); } $g->description(conv($datas['description'])); $g->external(0); $g->leavable(1); $g->visible(1); if (!empty($datas['http'])) { $g->web($datas['http']);