Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560 [2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85 [3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50 [4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13 [5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
| Server IP : 94.177.8.99 / Your IP : 216.73.217.165 Web Server : Apache/2.4.58 (Ubuntu) System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/hopeinstoughton_vote/modules/vote/controller/ |
Upload File : |
<?php
class vote_admin extends Controller {
private $val;
private $mode;
function __construct() {
parent::__construct(dirname(__DIR__));
$this->getWebsiteMode();
}
private function getWebsiteMode() {
$temp = $GLOBALS['loader']->getModuleList();
$SETTINGS = $temp['vote']['.info']['settings'];
$settings = $this->GetModuleSettings();
$this->val = $settings['mode'];
$this->mode = '';
foreach($SETTINGS as $item) {
if ($item['name'] == 'mode') {
$this->mode = $item['options'][$this->val];
break;
}
}
}
public function __Register() {
$this->RegisterView(__CLASS__ .'::create_labels', ['voteadmin_view' => ['handlebars_labels', 'handlebars_batch']]);
$this->RegisterView(__CLASS__ .'::batch', ['voteadmin_view' => ['handlebars_batch']]);
$this->RegisterView(__CLASS__ .'::results', ['voteadmin_view' => ['handlebars_results']]);
$this->RegisterView(__CLASS__ .'::totals', ['voteadmin_view' => ['handlebars_display']]);
$this->RegisterView(__CLASS__ .'::person', ['voteadmin_view' => ['handlebars_person']]);
$this->RegisterView(__CLASS__ .'::optout', ['voteadmin_view' => ['handlebars_optout', 'handlebars_optout2']]);
$this->RegisterView(__CLASS__ .'::the_list', ['voteadmin_view' => ['handlebars_display', 'handlebars_displayv']]);
$this->RegisterView(__CLASS__ .'::member_list', ['voteadmin_view' => ['voteadmin_members']]);
}
/** staff */
public function create_labels() {
$result = $this->DefaultResult(__METHOD__);
$model = $this->loadmodel('vfi_model');
if (empty($this->mode)) $this->mode = 'Unknown';
if ($this->isPost) {
$qty = empty($_POST['qty']) ? 0 : intval($_POST['qty']);
if ($qty > 0) {
if ($qty > 81) $qty = 81;
$batch = $model->CreateBatch($qty, $this->val);
$result['redirect'] = '/admin/batch/' . $batch;
return $result;
}
}
$result['qty'] = 27;
$result['mode'] = $this->mode;
$result['template'] = 'voteadmin_label';
return $result;
}
/** staff */
public function batch($batch_id = '') {
$result = $this->DefaultResult(__METHOD__);
$batch_id = intval($batch_id);
$model = $this->loadmodel('vfi_model');
/* // Create PDF
if ($batch_id) {
$this->LoadPlugin('fpdf/fpdf');
$view = $this->loadview('pdf_labels');
$items = $model->GetBatch($batch_id); // Create the PDF
$view->Render($items, $batch_id);
header('Content-type: application/pdf');
$view->Output('I', 'AuthLabels-' . $batch_id . '.pdf');
}
*/
$result['links'] = $model->generateLinks($batch_id);
$result['template'] = 'voteadmin_batch';
return $result;
}
/** staff */
public function results() {
$result = $this->DefaultResult(__METHOD__);
$model = $this->loadmodel('vfi_model');
$model->generateSummary($result, $this->val);
$result['nominations'] = $this->val == 'n';
$result['template'] = 'voteadmin_result';
return $result;
}
/** staff */
public function totals() {
$result = $this->DefaultResult(__METHOD__);
$model = $this->loadmodel('vfi_model');
$model_member = $this->LoadModel('member_model');
$memberhash = $model_member->GetMasterListByHash();
$roles = $model_member->GetJobList();
$result['role'] = $model->GetVotingResults($this->val, $roles, $memberhash);
$result['template'] = 'voteadmin_display';
$result['page_title'] = "Results — {$this->mode}";
return $result;
}
/** staff */
public function person() {
$result = $this->DefaultResult(__METHOD__);
$model = $this->loadmodel('vfi_model');
$model_member = $this->LoadModel('member_model');
$memberhash = $model_member->GetMasterListByHash();
$roles = $model_member->GetJobList();
$result['nominee'] = $model->GetByPerson($this->val, $roles, $memberhash);
$result['template'] = 'voteadmin_person';
$result['page_title'] = "Results — By Person";
return $result;
}
/** staff */
public function optout() {
$result = $this->DefaultResult(__METHOD__);
$model = $this->loadmodel('vfi_model');
$model_member = $this->LoadModel('member_model');
$memberhash = $model_member->GetMasterListByHash();
$roles = $model_member->GetJobList();
if ($this->isPost) { // save checkboxes
$cb = empty($_POST['cb']) ? [] : $_POST['cb'];
$model->Checkboxes($cb);
}
$checkboxes = $model->Checkboxes();
// this is grouped by Person:
// $result['nominee'] = $model->GetByPerson($this->val, $roles, $memberhash, $checkboxes);
// $result['template'] = 'voteadmin_optout';
// group by Role:
$result['role'] = $model->GetByRole($this->val, $roles, $memberhash, $checkboxes);
$result['template'] = 'voteadmin_optout2';
$result['page_title'] = "Results — Opt Out";
return $result;
}
/** staff */
public function export() {
$result = [];
$model = $this->loadmodel('vfi_model');
$model_member = $this->LoadModel('member_model');
$memberhash = $model_member->GetMasterListByHash();
$roles = $model_member->GetJobList();
$checkboxes = $model->Checkboxes();
$stuff = $model->FinalResults($this->val, $roles, $memberhash, $checkboxes);
header('Content-type: text/plain');
echo json_encode($stuff);
exit;
}
/** staff */
public function the_list() {
$model = $this->loadmodel('vfi_model');
$model_member = $this->LoadModel('member_model');
$memberhash = $model_member->GetMasterListByHash();
$roles = $model_member->GetJobList();
$result = $this->DefaultResult(__METHOD__);
$role_results = $model->GetVotingResults($this->val, $roles, $memberhash);
$result['role'] = $model->TrimResults($role_results);
if ($this->val == 'n') {
$result['template'] = 'voteadmin_display';
} else {
$result['template'] = 'voteadmin_displayv';
}
$result['page_title'] = "Results — {$this->mode}";
return $result;
}
/** staff */
public function member_list() {
$result = $this->DefaultResult(__METHOD__);
$model_member = $this->LoadModel('member_model');
$members = array_merge($model_member->Males(),$model_member->Females());
$result['template'] = 'voteadmin_members';
$result['list_members'] = $members;
return $result;
}
}