/*
+---------------------------------------------------------------+
| Election by bugrain (www.bugrain.plus.com)
|
| A plugin for the e107 Website System (http://e107.org)
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: e:\_repository\e107_plugins/election/handlers/election_candidate.php,v $
| $Revision: 1.1 $
| $Date: 2006/12/31 16:01:20 $
| $Author: Neil $
+---------------------------------------------------------------+
*/
/**
* Model Object for an Election Candidate
*/
class electionCandidate {
var $candidate; // An array of candidate field values
/**
* Constructor
* @param $candidate a row from the candidates table
* @param $election an election object for the election that this candidate belongs to
*/
function electionCandidate($candidate=false, $election=false) {
// Set some default values
$this->candidate["election_candidate_election_ids"] = $election ? $election->getId() : 0;
if ($candidate) {
$this->candidate = array_merge($this->candidate, $candidate);
}
}
// Getters
function getId() {
return $this->candidate["election_candidate_id"];
}
function getElectionId() {
return $this->candidate["election_candidate_election_ids"];
}
function getName() {
return $this->candidate["election_candidate_name"];
}
function getTitle() {
return $this->candidate["election_candidate_title"];
}
function getDescription() {
return $this->candidate["election_candidate_description"];
}
function getIcon() {
return $this->candidate["election_candidate_icon"];
}
function getImages() {
return $this->candidate["election_candidate_images"];
}
function getLinkDescription() {
return $this->candidate["election_candidate_link_description"];
}
function getLinkURL() {
return $this->candidate["election_candidate_link_url"];
}
function getTemplate() {
return $this->candidate["election_candidate_template"];
}
function getRestrictionValue() {
return $this->candidate["election_candidate_vote_restriction_value"];
}
function getRestrictionField() {
return $this->candidate["election_candidate_vote_restriction_field"];
}
}
?>
/*
+---------------------------------------------------------------+
| Election by bugrain (www.bugrain.plus.com)
|
| A plugin for the e107 Website System (http://e107.org)
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: e:\_repository\e107_plugins/election/handlers/election_voter.php,v $
| $Revision: 1.2 $
| $Date: 2007/04/05 19:38:46 $
| $Author: Neil $
+---------------------------------------------------------------+
*/
/**
* Model Object for an Election Voter
*/
class electionVoter {
var $voter; // An array of voter field values
/**
* Constructor
* @param $voter a row from the voters table
* @param $election an election object for the election that this voter belongs to
*/
function electionVoter($voter=false, $election=false) {
// Set some default values
$this->voter["election_voter_election_ids"] = $election ? $election->getId() : 0;
if ($voter) {
$this->voter = array_merge($this->voter, $voter);
}
}
// Getters
function getUserId() {
return $this->voter["election_voter_user_id"];
}
function getElectionId() {
return $this->voter["election_voter_election_id"];
}
function getVotes() {
return explode(",", $this->voter["election_voter_votes"]);
}
function getTimestamp() {
return $this->voter["election_voter_timestamp"];
}
}
?>
/*
+---------------------------------------------------------------+
| Election by bugrain (www.bugrain.plus.com)
|
| A plugin for the e107 Website System (http://e107.org)
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: e:\_repository\e107_plugins/election/handlers/election_user.php,v $
| $Revision: 1.2 $
| $Date: 2008/02/10 15:23:13 $
| $Author: Neil $
+---------------------------------------------------------------+
*/
/**
* Model Object for an Election user
* Holds information relating to the current user and what they are allowed to do in Election
*/
class electionUser {
var $user; // user data
var $privs; // an array of election privilieges, index on election ID
/**
* Constructor
* @param $elections a Election object or an array of Election objects
*/
function electionUser($elections) {
if (!is_array($elections)) {
$electionlist[$elections->getId()] = $elections;
} else {
$electionlist = $elections;
}
foreach ($electionlist as $election) {
$this->setViewElection($election);
$this->setViewElectionResults($election);
$this->setVoteElection($election);
}
$this->user = get_user_data(USERID);
}
// Setters
function setViewElection($election) {
$this->privs[$election->getId()]["view"] = check_class($election->getViewClass());
}
function setViewElectionResults($election) {
$this->privs[$election->getId()]["view_results"] = check_class($election->getViewResultsClass());
}
function setVoteElection($election) {
$this->privs[$election->getId()]["vote"] = check_class($election->getVoteClass()) || USERID == $election->getOwnerId();
}
// Privilege checks
function canViewElection($electionId) {
return $this->privs[$electionId]["view"];
}
function canViewElectionResults($electionId) {
return $this->privs[$electionId]["view_results"];
}
function canVoteElection($electionId) {
return $this->privs[$electionId]["vote"];
}
function isRestricted($value, $field) {
return ($value && $value == $this->user["user_$field"]);
}
}
?>
/*
+---------------------------------------------------------------+
| Election by bugrain (www.bugrain.plus.com)
|
| A plugin for the e107 Website System (http://e107.org)
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: e:\_repository\e107_plugins/election/handlers/election_status_info.php,v $
| $Revision: 1.1 $
| $Date: 2006/12/31 16:01:21 $
| $Author: Neil $
+---------------------------------------------------------------+
*/
// Status Info levels
define("STATUS_INFO", "INFO");
define("STATUS_WARN", "WARN");
define("STATUS_ERROR", "ERROR");
define("STATUS_FATAL", "FATAL");
define("STATUS_DEBUG", "DEBUG");
/**
* Model Object for an Election error
* Holds information relating to errors and warnings
*/
class electionStatusInfo {
var $level; // Status level
var $messages; // array of messages
/**
* Constructor
* @param $level status level, defaults to STATUS_ERROR - refer to STATUS_* constants
*/
function electionStatusInfo($level=STATUS_ERROR) {
$this->level = $level;
$this->messages = array();
}
function getLevel() {
return $this->level;
}
function getLevelDescription() {
switch ($this->level) {
case STATUS_DEBUG : {
return ELEC_LAN_MSG_DEBUG;
}
case STATUS_INFO : {
return ELEC_LAN_MSG_INFORMATION;
}
case STATUS_WARN : {
return ELEC_LAN_MSG_WARNING;
}
case STATUS_ERROR : {
return ELEC_LAN_MSG_ERROR;
}
case STATUS_FATAL : {
return ELEC_LAN_MSG_FATAL;
}
default : {
return "";
}
}
}
function getMessageCount() {
return count($this->messages);
}
function getMessage($ix) {
return $this->messages[$ix]["message"];
}
function getAdditionalDetails($ix) {
return $this->messages[$ix]["additional"];
}
function hasAdditionalDetails($ix) {
return (isset($this->messages[$ix]["additional"]));
}
function addMessage($message, $additionalDetails=false) {
$this->messages[]["message"] = $message;
if (false !== $additionalDetails) {
return $this->messages[count($this->messages)-1]["additional"] = $additionalDetails;
}
}
function addMissingMandatory($fieldName) {
return $this->messages[]["message"] = $fieldName.ELEC_LAN_MSG_MANDATORY;
}
}
?>
Fatal error: Class 'electionUser' not found in E:\WEBSPACE\lorma\launion.gov.ph\launion.gov.ph\www\e107_plugins\election\handlers\election_class.php on line 92