コード例 #1
0
ファイル: check.groups.php プロジェクト: netixx/frankiz
// Get webmaster caste
$ufc_web = new UFC_Group(Group::from('webmasters'), Rights::member());
// Get kes admins
$ufc_kes = new UFC_Group(Group::from('kes'), Rights::admin());
// Shalom-CCX-AMEP
$shccxamep_groups = new Collection();
$shccxamep_groups->add(Group::from('shalom'));
$shccxamep_groups->add(Group::from('ccx'));
$shccxamep_groups->add(Group::from('amep'));
$ufc_shalom_ccx_amep = new UFC_Group($shccxamep_groups, Rights::admin());
unset($shccxamep_groups);
// licenses members = on_platal and X
$ufc_licenses = new PFC_And(array(new UFC_Group(Group::from('formation_x'), Rights::restricted()), new UFC_Group(Group::from('on_platal'), Rights::restricted())));
// Get formations
$formations = array();
foreach (Formation::selectAll(FormationSelect::base()) as $form) {
    $formations[$form->abbrev()] = intval($form->id());
}
// Test wether the userfilter which is in the database is the expected one
function test_userfilters($grouptext, $rights, $db_caste, $expected_condition = null)
{
    $castetext = $rights . " userfilter (caste " . $db_caste->id() . ")";
    $db_userfilter = $db_caste->userfilter();
    if (is_null($expected_condition)) {
        if ($db_userfilter) {
            echo "Info: group " . $grouptext . " has unexpected " . $castetext . " " . json_encode($db_userfilter->export()) . "\n";
        }
    } else {
        $expected_userfilter = new UserFilter($expected_condition);
        $expected_json = json_encode($expected_userfilter->export());
        if (!$db_userfilter) {
コード例 #2
0
ファイル: update.studies.php プロジェクト: netixx/frankiz
    if ($promo % 2 == 0) {
        $upload = FrankizUpload::fromFile(dirname(__FILE__) . '/../images/rouje.png');
        $label = 'Chic à la rouje';
    } else {
        $upload = FrankizUpload::fromFile(dirname(__FILE__) . '/../images/jone.png');
        $label = 'Chic à la jone';
    }
    $i = new FrankizImage();
    $i->insert();
    $i->caste($g->caste(Rights::everybody()));
    $i->label($label);
    $i->image($upload, false);
    $g->image($i);
}
// Update formations
$formations = Formation::selectAll(FormationSelect::base());
foreach ($formations as $form) {
    // Update group
    $f = new UserFilter(new UFC_Study(new Formation($form->id())));
    $g = update_group('formation_' . $form->abbrev(), $form->label(), Group::NS_STUDY, $f);
    $g->description($form->description());
    // Admin caste
    if ($form->abbrev() == 'x') {
        $c = $g->caste(Rights::admin());
        $c->select(CasteSelect::base());
        if (!$c->userfilter()) {
            $uf_kes = new UserFilter(new UFC_Group(Group::from('kes'), Rights::admin()));
            $c->userfilter($uf_kes);
        }
    }
}
コード例 #3
0
ファイル: user.php プロジェクト: netixx/frankiz
 public static function birthday()
 {
     return new UserSelect(array('hruid', 'original', 'photo', 'gender', 'firstname', 'lastname', 'nickname', 'studies'), array('studies' => FormationSelect::base()));
 }