Sweden Democrats' Meeting Tool
 All Classes Files Functions Variables Pages
Public Member Functions | Private Member Functions | List of all members
SD_Meeting_Tool_elections Class Reference

Plugin providing election services. More...

Inheritance diagram for SD_Meeting_Tool_elections:
SD_Meeting_Tool_0 SD_Meeting_Tool_Base

Public Member Functions

 __construct ()
 activate ()
 uninstall ()
 sd_mt_admin_menu ($menus)
 admin ()
 Main admin overview.
 admin_overview ()
 Overview tab.
 admin_edit ()
 Election edit tab.
 admin_electoral_register ()
 Electoral register tab.
 admin_query_register ()
 Queries the voting status of a participant.
 admin_register ()
 Register votes tab.
 admin_results ()
 Display results tab.
 ajax_sd_mt_elections ()
 Ajax functions.
 sd_mt_delete_election ($SD_Meeting_Tool_Election)
 Delete an election.
 sd_mt_get_all_elections ()
 List all elections.
 sd_mt_get_election ($id)
 Retrieves an election.
 sd_mt_update_election ($SD_Meeting_Tool_Election)
 Update an election.
 calculate_electoral_register ($SD_Meeting_Tool_Election)
 Calculate the electoral register for an election.
 display_electoral_register ($SD_Meeting_Tool_Election)
 Display an electoral register.
 generate_electoral_register ($SD_Meeting_Tool_Election)
 Generate an electoral register for an election.
 query_participant ($SD_Meeting_Tool_Election, $participant_id)
 Queries the voting status of a participant.
 register_manual_votes ($election)
 Register votes in a manual election.
 register_votes ($election)
 Register votes in an election.
 register_voter_options ($election)
 Shows the register UI of an election.
 register_finish ($election)
 Display a query box allowing the user to finish the election.
 maybe_create_list ($post_value, $new_list_name)
 Decide, from the post value, whether to create a list.
 shortcode_display_election_graph ($attr)
 Shows the graph of a completed election.
 shortcode_display_election_statistics ($attr)
 Shows the statistics of a completed election.

Private Member Functions

 election_sql_to_object ($sql)
 maybe_finish_election ($SD_Meeting_Tool_Election)
 Decide whether to finish this election.
 display_election_graph ($election)
 Display a results graph for an election.
 display_election_statistics ($election)
 Display voting statistics for an election.
 display_election_voters ($election)
 Display who voted in an election.
 display_election_nonvoters ($election)
 Display who should have, but did not vote in an election.

Additional Inherited Members

- Public Attributes inherited from SD_Meeting_Tool_Base
 $paths = array()
- Protected Member Functions inherited from SD_Meeting_Tool_0
 cache_directory ()
 Return the cache directory for the plugin.
 cache_file ($id)
 Returns the name of the cache file for this session.
 cache_url ()
 Returns the complete URL to the cache directory.
 check_cache_directory ()
 Check whether the cache directory is OK.
- Protected Attributes inherited from SD_Meeting_Tool_0
 $language_domain = 'SD_Meeting_Tool'

Detailed Description

Plugin providing election services.

Author
Edward Plainview edwar.nosp@m.d.pl.nosp@m.ainvi.nosp@m.ew@s.nosp@m.verig.nosp@m.edem.nosp@m.okrat.nosp@m.erna.nosp@m..se
Changelog
1.1

Constructor & Destructor Documentation

SD_Meeting_Tool_elections::__construct ( )

Member Function Documentation

SD_Meeting_Tool_elections::activate ( )

Overridable activation function.

It's here in case plugins need a common activation method in the future.

Reimplemented from SD_Meeting_Tool_Base.

SD_Meeting_Tool_elections::admin ( )

Main admin overview.

SD_Meeting_Tool_elections::admin_edit ( )

Election edit tab.

SD_Meeting_Tool_elections::admin_electoral_register ( )

Electoral register tab.

SD_Meeting_Tool_elections::admin_overview ( )

Overview tab.

SD_Meeting_Tool_elections::admin_query_register ( )

Queries the voting status of a participant.

SD_Meeting_Tool_elections::admin_register ( )

Register votes tab.

SD_Meeting_Tool_elections::admin_results ( )

Display results tab.

SD_Meeting_Tool_elections::ajax_sd_mt_elections ( )

Ajax functions.

SD_Meeting_Tool_elections::calculate_electoral_register (   $SD_Meeting_Tool_Election)

Calculate the electoral register for an election.

The SD_Meeting_Tool_Election must include the following variables:

The returned SD_Meeting_Tool_Election will have the following variables:

  • may_vote An array of participant IDs that are allowed to vote in this election.
Parameters
SD_Meeting_Tool_Election$SD_Meeting_Tool_ElectionThe election to use.
Returns
The modified, unsaved SD_Meeting_Tool_Election.
SD_Meeting_Tool_elections::display_election_graph (   $election)
private

Display a results graph for an election.

Parameters
SD_Meeting_Tool_Election$electionElection for which to display the results graph.
Returns
A HTML string containing the results graph for the election.
SD_Meeting_Tool_elections::display_election_nonvoters (   $election)
private

Display who should have, but did not vote in an election.

Parameters
SD_Meeting_Tool_Election$electionElection for which to display the non-voters.
Returns
A HTML string showing non-voters.
SD_Meeting_Tool_elections::display_election_statistics (   $election)
private

Display voting statistics for an election.

Parameters
SD_Meeting_Tool_Election$electionElection for which to display the statistics.
Returns
A HTML string containing the voting statistics for the election.
SD_Meeting_Tool_elections::display_election_voters (   $election)
private

Display who voted in an election.

Parameters
SD_Meeting_Tool_Election$electionElection for which to display the voters.
Returns
A HTML string showing who voted in the election.
SD_Meeting_Tool_elections::display_electoral_register (   $SD_Meeting_Tool_Election)

Display an electoral register.

Parameters
SD_Meeting_Tool_Election$SD_Meeting_Tool_ElectionThe election from which to display the electoral register.
Returns
A HTML string containing all the info about the electoral register of an election.
SD_Meeting_Tool_elections::election_sql_to_object (   $sql)
private

Convert a election row from SQL to an SD_Meeting_Tool_Election.

Parameters
array$sqlRow from the database as an array.
Returns
A complete SD_Meeting_Tool_Election object.
SD_Meeting_Tool_elections::generate_electoral_register (   $SD_Meeting_Tool_Election)

Generate an electoral register for an election.

Will empty and refill the may_vote list.

Parameters
$SD_Meeting_Tool_ElectionSD_Meeting_Tool_Election for which to generate the electoral register.
Returns
An HTML message.
SD_Meeting_Tool_elections::maybe_create_list (   $post_value,
  $new_list_name 
)

Decide, from the post value, whether to create a list.

Parameters
string$post_valueEither 'create', to create a list or just a number.
string$new_list_nameThe name of the new list, if it is to be created.
Returns
Either the newly-created list's ID, or the integerized value from the post.
SD_Meeting_Tool_elections::maybe_finish_election (   $SD_Meeting_Tool_Election)
private

Decide whether to finish this election.

It's time to finish when all eligible voters have voted.

Parameters
SD_Meeting_Tool_Election$SD_Meeting_Tool_ElectionElection to analyze.
Returns
The election in return, maybe in a finished state.
SD_Meeting_Tool_elections::query_participant (   $SD_Meeting_Tool_Election,
  $participant_id 
)

Queries the voting status of a participant.

Returns what would happen if the participant were to join / leave the electoral register.

Parameters
SD_Meeting_Tool_Election$SD_Meeting_Tool_ElectionThe election on which to base the query.
int$participant_idID of participant to query.
Returns
A HTML string containing a message() or error().
SD_Meeting_Tool_elections::register_finish (   $election)

Display a query box allowing the user to finish the election.

Parameters
SD_Meeting_Tool_Election$electionElection to finish.
SD_Meeting_Tool_elections::register_manual_votes (   $election)

Register votes in a manual election.

Parameters
SD_Meeting_Tool_Election$electionElection in which to register votes.
SD_Meeting_Tool_elections::register_voter_options (   $election)

Shows the register UI of an election.

Parameters
SD_Meeting_Tool_Election$electionElection in which to register votes.
SD_Meeting_Tool_elections::register_votes (   $election)

Register votes in an election.

Parameters
SD_Meeting_Tool_Election$electionElection in which to register votes.
SD_Meeting_Tool_elections::sd_mt_admin_menu (   $menus)
SD_Meeting_Tool_elections::sd_mt_delete_election (   $SD_Meeting_Tool_Election)

Delete an election.

Parameters
SD_Meeting_Tool_Election$SD_Meeting_Tool_ElectionElection to delete.
SD_Meeting_Tool_elections::sd_mt_get_all_elections ( )

List all elections.

Returns
An array of {SD_Meeting_Tool_Election}s.
SD_Meeting_Tool_elections::sd_mt_get_election (   $id)

Retrieves an election.

Parameters
int$idThe ID of the election to retrieve.
Returns
The SD_Meeting_Tool_Election object, or FALSE if no election with this ID was found.
SD_Meeting_Tool_elections::sd_mt_update_election (   $SD_Meeting_Tool_Election)

Update an election.

Parameters
SD_Meeting_Tool_Election$SD_Meeting_Tool_ElectionThe election to update.
SD_Meeting_Tool_elections::shortcode_display_election_graph (   $attr)

Shows the graph of a completed election.

Attributes
  • id Election ID. Required.
Parameters
array$attrAttributes array.
Returns
Election HTML string to display.
SD_Meeting_Tool_elections::shortcode_display_election_statistics (   $attr)

Shows the statistics of a completed election.

Attributes
  • id Election ID. Required.
Parameters
array$attrAttributes array.
Returns
Election HTML string to display.
SD_Meeting_Tool_elections::uninstall ( )

Overridable uninstall method.

Reimplemented from SD_Meeting_Tool_Base.


The documentation for this class was generated from the following file: