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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
<?php
/*
Class, ki skrbi za prikaz in urejanje vprasajckov
*/
class Help {
/**
* @desc izpise polje s helpom.
* ce smo v editmodu se bo prikazal textbox za urejanje helpa
* ce smo v navadnem modu se bo prikazal help box
*/
public static function display ($what, $title='') {
global $admin_type, $lang;
$help = '';
$sql = sisplet_query("SELECT help FROM srv_help WHERE what='$what' AND lang='$lang[id]'");
if(mysqli_num_rows($sql) > 0){
$row = mysqli_fetch_array($sql);
$help = $row['help'];
}
if ($admin_type == 0 && isset($_COOKIE['edithelp'])) {
return ' <a href="/" id="help_'.$what.'" lang="'.$lang['id'].'" class="edithelp" onclick="return false;" title_txt="">'.(empty($title) ? '(?)' : '<span class="faicon help2 title20"></span>').'</a>';
}
elseif ($help != '') {
return ' <a href="/" id="help_'.$what.'" lang="'.$lang['id'].'" class="help" onclick="return false;" title_txt="">'.(empty($title) ? '(?)' : '<span class="faicon help2 title20"></span>').'</a>';
}
}
// Prikazemo zavihek z nastavitvami vprasajckov
public static function displaySettings(){
global $lang;
// Vklop / izklop urejanja vprasajckov
echo '<fieldset>';
echo ' <legend>' . $lang['help_settings_activate_editing'] . '</legend>';
echo ' <p class="bottom16" >' . $lang['help_settings_activate_editing'] . ' '.Help::display('srv_window_help').':</p>';
self::editToggle();
echo '</fieldset>';
// Urejanje vseh vprasajckov
echo '<fieldset>';
echo ' <legend>' . $lang['help_settings_list'] . '</legend>';
self::editVprasajcki();
echo '</fieldset>';
}
// vkljuci izkljuci editiranje helpa
private static function editToggle () {
global $lang;
if (isset($_COOKIE['edithelp'])) {
echo '<div class="button_holder bottom0">';
echo '<button class="medium blue" onClick="window.location.href=\'ajax.php?t=help&a=edit_off\';return false;">'.$lang['srv_insend'].'</button>';
echo '</div>';
}
else {
echo '<div class="button_holder bottom0">';
echo '<button class="medium blue" onClick="window.location.href=\'ajax.php?t=help&a=edit_on\';return false;">'.$lang['start'].'</button>';
echo '</div>';
}
}
// Izpise seznam vprasajckov za urejanje
private static function editVprasajcki () {
global $lang;
$sql = sisplet_query("SELECT *
FROM srv_help h
LEFT JOIN users u
ON u.id=h.last_edit_usr_id
WHERE h.lang='".$lang['id']."'
ORDER BY h.last_edit_time DESC, h.what ASC
");
while($row = mysqli_fetch_array($sql)){
echo '<div class="setting_holder help_edit">';
echo '<div class="col1">';
echo $row['what'].' '.self::display($row['what']);
echo '<div class="last_edit">';
echo 'Zadnje urejanje:<br>'.date('d.m.Y, H:i', strtotime($row['last_edit_time']));
if($row['email'] != '')
echo '<br>('.$row['email'].')';
echo '</div>';
echo '</div>';
echo '<div class="col2">';
echo ' <textarea id="edithelp_mass_'.$row['what'].'">'.$row['help'].'</textarea>';
echo '</div>';
echo '<div class="col3">';
echo ' <button class="small blue" onClick="save_help_mass(\''.$row['what'].'\', \''.$lang['id'].'\');">Shrani</button>';
echo '</div>';
echo '</div>';
}
}
function ajax () {
if ($_GET['a'] == 'edit_on') {
$this->ajax_edit_on();
}
elseif ($_GET['a'] == 'edit_off') {
$this->ajax_edit_off();
}
elseif ($_GET['a'] == 'display_edit_help') {
$this->ajax_display_edit_help();
}
elseif ($_GET['a'] == 'save_help') {
$this->ajax_save_help();
}
elseif ($_GET['a'] == 'display_help') {
$this->ajax_display_help();
}
}
/**
* @desc vklopi editiranje helpa (nastavi cooike)
*/
function ajax_edit_on () {
setcookie('edithelp', 'on');
header("Location: index.php?a=nastavitve&m=help_settings");
}
/**
* @desc izklopi editiranje helpa (nastavi cooike)
*/
function ajax_edit_off () {
setcookie('edithelp', '', time()-3600);
header("Location: index.php?a=nastavitve&m=help_settings");
}
/**
* @desc prikaze formo za urejanje helpa
*/
function ajax_display_edit_help () {
global $lang;
$l = (int)$_GET['lang'];
$what = substr($_REQUEST['what'], 5);
$sql = sisplet_query("SELECT help FROM srv_help WHERE what = '$what' AND lang='$l'");
$row = mysqli_fetch_array($sql);
echo '<textarea id="edithelp_'.$what.'" name="help" style="width:100%; height: 100px">'.$row['help'].'</textarea>';
echo '<input type="button" value="'.$lang['save'].'" onclick="save_help(\''.$what.'\', \''.$l.'\')" />';
}
/**
* @desc shrani help
*/
function ajax_save_help () {
global $global_user_id;
$l = (int)$_GET['lang'];
$what = $_REQUEST['what'];
$help = $_POST['help'];
sisplet_query("REPLACE INTO srv_help (what, lang, help, last_edit_usr_id) VALUES ('".$what."', '".$l."', '".$help."', '".$global_user_id."')");
}
function ajax_display_help() {
$l = (int)$_GET['lang'];
$what = substr($_REQUEST['what'], 5);
$sql = sisplet_query("SELECT help FROM srv_help WHERE what = '$what' AND lang='$l'");
$row = mysqli_fetch_array($sql);
echo '<div class="qtip-help">'.nl2br($row['help']).'</div>';
}
}
?>
|