summaryrefslogtreecommitdiffstats
path: root/admin/survey/modules/mod_voting/class.SurveyVoting.php
blob: 8f0dd35054adfe75b3c3ad9c052285913d2bad4b (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
<?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 '  <p class="bottom16">';
        echo $lang['srv_voting_edit1'].' <a href="index.php?anketa='.$this->anketa.'&amp;a='.A_BRANCHING.'">'.$lang['srv_voting_edit2'].'</a>.';
        echo '  </p>';
        
        echo '  <p>';
        echo $lang['srv_voting_invitations1'].' <a href="index.php?anketa='.$this->anketa.'&amp;a='.A_INVITATIONS.'">'.$lang['srv_voting_invitations2'].'</a>.';
        echo '  </p>';

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