Version: 1.0
Date: March 2015
Author: Eyana Mallari
- Add Candidates.
- Set Eligibility. Determine if a candidate is called or not called.
- Cast Votes
- See Results
- Reset Votes for Next Round.
- Reset Vote Limit in
views/admin/votes/create.php
line 60
var limit = 2; //set vote limit here
$('input[type=checkbox]').on('change', function (e) {
if ($('input[type=checkbox]:checked').length > limit) {
$(this).prop('checked', false);
alert("You are only allowed to vote for "+limit+" candidates.");
}
});
controller/admin/votes.php
line 50
public function create()
{
$this->template->title('Cast Vote');
if($this->input->post('submit'))
{
$can_ids = $this->input->post('can_ids');
$can_ids_count = count($can_ids);
if($can_ids !== false)
{
$limit = 2; //set limit here
if($can_ids_count >= $limit)
{
foreach($can_ids as $can_id)
{
controller/admin/candidates.php
line 58
public function results()
{
...
$vote_count = $page['vote_count'];
//hardcoded
$limit = 2; //set limit here
$page['voters_count'] = $vote_count/$limit;
-
Vote Limit must be an attribute of the
settings
model. This is to avoid hardcoding. -
Archiving and comparison of past rounds of votes. This is to see trends easily in one page, and to avoid taking screenshots of voting results page per round.
-
Improve access privileges function for
admin
anduser
(voter) in the controllers. Make sure that voters cannot access the voting results by all means. -
Create
ballot
model (or table) that has the list of chosen candidates of a voter. One submitted form is a ballot. Database speak, one ballot has many votes.