redirect(); } $proposal->submit(); redirect(); break; case "apply_proponent": Login::access_action("entitled", $_SESSION['ngroup']); action_required_parameters('proponent'); $proposal->update_proponent(trim($_POST['proponent'])); redirect(); break; case "become_proponent": Login::access_action("entitled", $_SESSION['ngroup']); action_required_parameters('proponent'); $proposal->add_proponent(trim($_POST['proponent'])); redirect(); break; case "confirm_proponent": Login::access_action("entitled", $_SESSION['ngroup']); action_required_parameters('member'); if (!$proposal->is_proponent(Login::$member)) { warning(_("Your are not a proponent of this proposal.")); redirect(); } $member = new Member($_POST['member']); if (!$member->id) { warning(_("The member does not exist.")); redirect(); } $proposal->confirm_proponent($member);
/** * create a new member and let it support the supplied proposal * * @param Proposal $proposal * @param string $i */ function add_proponent(Proposal $proposal, $i) { create_member("user".$i); $proposal->add_proponent(Login::$member->username, true); }
/** * * @param integer $period * @return array */ function create_vote_proposals($period) { global $area, $lorem_ipsum; // single proposal login(1); $proposal1 = new Proposal; $proposal1->title = "einzelner Beispielantrag"; $proposal1->content = $lorem_ipsum; $proposal1->reason = $lorem_ipsum; $proposal1->create(Login::$member->username, $area->id); for ( $i=2; $i<=5; $i++ ) { login($i); $proposal1->add_proponent(Login::$member->username, true); } $issue1 = $proposal1->issue(); // assign issue to period $issue1->period = $period; /** @var $issue Issue */ $issue1->update(['period']); time_warp($issue1); $proposal1->submit(); time_warp($issue1); $proposal1->read(); for ( $i=6; $i<=23; $i++ ) { login($i); $proposal1->add_support(); } time_warp($issue1); // 4 proposals login(1); $proposal2 = new Proposal; $proposal2->title = "Beispielantrag"; $proposal2->content = $lorem_ipsum; $proposal2->reason = $lorem_ipsum; $proposal2->create(Login::$member->username, $area->id); for ( $i=2; $i<=5; $i++ ) { login($i); $proposal2->add_proponent(Login::$member->username, true); } $issue2 = $proposal2->issue(); // assign issue to period $issue2->period = $period; /** @var $issue Issue */ $issue2->update(['period']); login(1); $proposal3 = new Proposal; $proposal3->title = "Alternativantrag"; $proposal3->content = $lorem_ipsum; $proposal3->reason = $lorem_ipsum; $proposal3->issue = $proposal2->issue; $proposal3->create(Login::$member->username, $area->id); for ( $i=2; $i<=5; $i++ ) { login($i); $proposal3->add_proponent(Login::$member->username, true); } login(1); $proposal4 = new Proposal; $proposal4->title = "nicht zugelassener Alternativantrag"; $proposal4->content = $lorem_ipsum; $proposal4->reason = $lorem_ipsum; $proposal4->issue = $proposal2->issue; $proposal4->create(Login::$member->username, $area->id); for ( $i=2; $i<=5; $i++ ) { login($i); $proposal4->add_proponent(Login::$member->username, true); } login(1); $proposal5 = new Proposal; $proposal5->title = "zurückgezogener Antrag"; $proposal5->content = $lorem_ipsum; $proposal5->reason = $lorem_ipsum; $proposal5->issue = $proposal2->issue; $proposal5->create(Login::$member->username, $area->id); for ( $i=2; $i<=5; $i++ ) { login($i); $proposal5->add_proponent(Login::$member->username, true); } time_warp($issue2); login(1); $proposal2->submit(); $proposal3->submit(); $proposal4->submit(); $proposal5->submit(); time_warp($issue2); $proposal2->read(); for ( $i=6; $i<=24; $i++ ) { login($i); $proposal2->add_support(); } $proposal3->read(); for ( $i=6; $i<=15; $i++ ) { login($i); $proposal3->add_support(); } $proposal4->read(); for ( $i=6; $i<=8; $i++ ) { login($i); $proposal4->add_support(); } $proposal5->read(); for ( $i=6; $i<=15; $i++ ) { login($i); $proposal5->add_support(); } // revoke by removing all proponents for ( $i=1; $i<=5; $i++ ) { login($i); $proposal5->remove_proponent(Login::$member); } time_warp($issue2); // single proposal for offline voting login(1); $proposal6 = new Proposal; $proposal6->title = "einzelner Beispielantrag"; $proposal6->content = $lorem_ipsum; $proposal6->reason = $lorem_ipsum; $proposal6->create(Login::$member->username, $area->id); for ( $i=2; $i<=5; $i++ ) { login($i); $proposal6->add_proponent(Login::$member->username, true); } $issue3 = $proposal6->issue(); // assign issue to period $issue3->period = $period; /** @var $issue Issue */ $issue3->update(['period']); time_warp($issue3); $proposal6->submit(); time_warp($issue3); $proposal6->read(); for ( $i=6; $i<=23; $i++ ) { login($i); $proposal6->add_support(); } for ( $i=1; $i<=23; $i++ ) { login($i); $issue3->demand_votingmode(); } time_warp($issue3); return [$issue1, $issue2, $issue3]; }