-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScoreManager.ctrl.php
More file actions
83 lines (73 loc) · 2.99 KB
/
ScoreManager.ctrl.php
File metadata and controls
83 lines (73 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
if(!class_exists("ScoreManager")){
class ScoreManager extends SeoPluginsController{
function index() {
$this->set('sectionHead', SCORE_MANAGER_HEAD);
$userId = isLoggedIn();
$this->pluginRender('index');
}
function settings($info) {
$this->set('sectionHead', SCORE_MANAGER_SET_HEAD);
if($info['error']){
$this->set('error', $info['error']);
}else{
$this->set('error', '');
}
$this->pluginRender('settings');
}
function update_settings($info){
global $scores;
if(isset($info['type']) && isset($info['set'])){
$set = $info['set'];
$ret = $scores[$info['type']][$set]->save_setting($info[$set]);
}
if($ret['error_code'] > 0){
$info['error'] = $ret['error'];
}
$this->settings($info);
}
function weights($info){
$this->set('sectionHead', SCORE_MANAGER_WEI_HEAD);
$this->pluginRender('weights');
}
function update_weights($info){
global $scores;
if(isAdmin()){
foreach($scores as $n => $m){
if(!empty($m) && key_exists($n, $info)){
foreach ($info[$n] as $k => $v){
if(key_exists($k, $m)){
$get_weight = $m[$k]->get_weight();
if($get_weight != v){
$m[$k]->save_weight($v);
}
}
}
}
}
}
$this->weights($info);
}
function togglePlugin($info){
global $scores;
$status = 'Error';
if(isAdmin() && isset($info['handle']) && isset($info['toggle'])){
foreach($scores as $n => $m){
if(!empty($m) && key_exists($info['handle'], $m)){
if($info['toggle'] == '2'){
$m[$info['handle']]->deactivate();
}else if($info['toggle'] == '1'){
$m[$info['handle']]->activate();
}
if($m[$info['handle']]->is_active()){
$status = 'Active';
}else{
$status = 'Inactive';
}
}
}
}
echo $status;
}
}
}