Exemplo n.º 1
0
 static function target_picker_to_caste_group($id)
 {
     $target_rights = Rights::restricted();
     if (Env::has('target_everybody_' . $id)) {
         $target_rights = Rights::everybody();
     }
     if (S::user()->group()->id() == Env::i('target_group_' . $id)) {
         $target_rights = Rights::restricted();
     }
     $target_group = new Group(Env::i('target_group_' . $id));
     $target_filter = new CasteFilter(new PFC_And(new CFC_Group($target_group), new CFC_Rights($target_rights)));
     return array($target_filter->get(true), $target_group);
 }
Exemplo n.º 2
0
 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());
 }
Exemplo n.º 3
0
 public function __construct($groups)
 {
     $cf = new CasteFilter(new PFC_And(new CFC_Holder(), new CFC_Group($groups)));
     $this->cids = $cf->get()->ids();
 }
Exemplo n.º 4
0
            echo "Error: Unknown NS " . $g->ns() . " for group " . $gtext . "\n";
        }
    }
}
// Fetch groups
$groups = Group::selectAll(GroupSelect::base())->select(GroupSelect::castes());
$groups = $groups->toArray();
krsort($groups);
// Remember used castes
$used_castes = array();
echo "Checking " . count($groups) . " groups\n";
while (!empty($groups)) {
    $g = array_pop($groups);
    check_group($g);
    foreach ($g->castes() as $c) {
        array_push($used_castes, $c->id());
    }
    // Frees memory
    unset($g);
}
// Fetch castes
$cf = new CasteFilter();
$castes = $cf->get();
unset($cf);
echo "There are " . $castes->count() . " castes.\n";
// Unused castes
$unused_castes = array_diff($castes->ids(), $used_castes);
if (!empty($unused_castes)) {
    echo "Warning: " . count($unused_castes) . " unused castes\n";
}
echo "Done.\n";