summaryrefslogtreecommitdiffstats
path: root/admin/survey/modules/mod_voting/class.SurveyVoting.php
blob: 98ef5fbd4ed96d72509159cc0d0b9e0e0166dcfc (plain) (blame)
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
<?php

/*
 *  Modul za volitve
 */


class SurveyVoting{

	var $anketa;				# id ankete

	
	function __construct($anketa){
		global $site_url;

		// Ce imamo anketo
		if ((int)$anketa > 0){
			$this->anketa = $anketa;
		}
	}
	
	
    // Izvedemo vse potrebno pri vklopu (vklopimo obvescanje, ugasnemo belezenje parapodatkov...)
	public function turnOnVoting(){
		global $lang;

        SurveySetting::getInstance()->Init($this->anketa);

        // Ugasnimo belezenje vseh parapodatkov
        SurveySetting::getInstance()->setSurveyMiscSetting('survey_ip', '1');
        SurveySetting::getInstance()->setSurveyMiscSetting('survey_show_ip', '0');
        SurveySetting::getInstance()->setSurveyMiscSetting('survey_browser', '1');
        SurveySetting::getInstance()->setSurveyMiscSetting('survey_referal', '1');
        SurveySetting::getInstance()->setSurveyMiscSetting('survey_date', '1');

        // Vklopimo email vabila
        sisplet_query("UPDATE srv_anketa SET user_base='1', show_email='0' WHERE id='".$this->anketa."'");
        sisplet_query("INSERT INTO srv_anketa_module (ank_id, modul) VALUES ('".$this->anketa."', 'email')");
        
        // Ugasnemo obvescanje respondenta
        sisplet_query("UPDATE srv_alert SET finish_respondent='0', finish_respondent_cms='0' WHERE ank_id='".$this->anketa."'");
	}
    
	// Nastavitve volitev
	public function displaySettings(){
		global $lang;
    			
        echo '<fieldset><legend>'.$lang['settings'].'</legend>';

        echo '<br>';

        echo $lang['srv_voting_edit1'].' <a href="index.php?anketa='.$this->anketa.'&amp;a='.A_BRANCHING.'"><span class="bold">'.$lang['srv_voting_edit2'].'</span></a>.';
        
        echo '<br><br>';
        
        echo $lang['srv_voting_invitations1'].' <a href="index.php?anketa='.$this->anketa.'&amp;a='.A_INVITATIONS.'"><span class="bold">'.$lang['srv_voting_invitations2'].'</span></a>.';

        echo '<br><br>';

        echo '</fieldset>';
	}
	
    // Pridobimo trenutne nastavitve volitev za anketo
    private function getSettings(){
            
        $settings = array();
                
        return $settings;
    }
    
}