Dodan filter po paketu pri aktivnosti

This commit is contained in:
pero1203 2020-12-01 10:09:05 +01:00
parent fc34fc6002
commit 1a42e36bc6

View File

@ -15,8 +15,7 @@ class SurveyAktivnost{
* @desc prikaze diagnostiko anket * @desc prikaze diagnostiko anket
*/ */
public function diagnostics() { public function diagnostics() {
global $lang; global $lang, $global_user_id, $admin_type, $app_settings;
global $global_user_id, $admin_type;
$sum = 0; $sum = 0;
$sum_survey = 0; $sum_survey = 0;
@ -42,7 +41,7 @@ class SurveyAktivnost{
echo '<form id="diagnostics_form" action="index.php" method="get">'; echo '<form id="diagnostics_form" action="index.php" method="get">';
echo '<input type="hidden" name="a" value="diagnostics" />'; echo '<input type="hidden" name="a" value="diagnostics" />';
$testdata = (isset($_GET['testdata']) && $_GET['testdata']=='1') ? 1 : 0; $testdata = (isset($_GET['testdata']) && $_GET['testdata']=='1') ? 1 : 0;
$testdataauto = (isset($_GET['testdataauto']) && $_GET['testdataauto']=='1') ? 1 : 0; $testdataauto = (isset($_GET['testdataauto']) && $_GET['testdataauto']=='1') ? 1 : 0;
$uvoz = (isset($_GET['uvoz']) && $_GET['uvoz']=='1') ? 1 : 0; $uvoz = (isset($_GET['uvoz']) && $_GET['uvoz']=='1') ? 1 : 0;
@ -53,7 +52,25 @@ class SurveyAktivnost{
$mailsent = (isset($_GET['mailsent']) && $_GET['mailsent']=='1') ? 1 : 0; $mailsent = (isset($_GET['mailsent']) && $_GET['mailsent']=='1') ? 1 : 0;
$language = (isset($_GET['language'])) ? $_GET['language'] : 0; $language = (isset($_GET['language'])) ? $_GET['language'] : 0;
if(isset($app_settings['commercial_packages']) && $app_settings['commercial_packages'] == true){
$package_1ka = (isset($_GET['package_1ka']) && $_GET['package_1ka']=='0') ? 0 : 1;
$package_2ka = (isset($_GET['package_2ka']) && $_GET['package_2ka']=='0') ? 0 : 1;
$package_3ka = (isset($_GET['package_3ka']) && $_GET['package_3ka']=='0') ? 0 : 1;
echo '<span>'.$lang['srv_narocilo_paket'].':</span>';
echo '<input type="hidden" name="package_1ka" id="package_1ka_hidden" value="'.$package_1ka.'" />';
echo '<input type="checkbox" value="1" id="package_1ka" '.($package_1ka == 1 ? ' checked="checked"' : '').'" onchange="$(\'#package_1ka_hidden\').val('.($package_1ka==1 ? '0' : '1').');"><label for="package_1ka">1KA</label>';
echo '<input type="hidden" name="package_2ka" id="package_2ka_hidden" value="'.$package_2ka.'" />';
echo '<span class="spaceLeft"><input type="checkbox" value="1" id="package_2ka" '.($package_2ka == 1 ? ' checked="checked"' : '').' onchange="$(\'#package_2ka_hidden\').val('.($package_2ka==1 ? '0' : '1').');"><label for="package_2ka">2KA</label></span>';
echo '<input type="hidden" name="package_3ka" id="package_3ka_hidden" value="'.$package_3ka.'" />';
echo '<span class="spaceLeft"><input type="checkbox" value="1" id="package_3ka" '.($package_3ka == 1 ? ' checked="checked"' : '').' onchange="$(\'#package_3ka_hidden\').val('.($package_3ka==1 ? '0' : '1').');"><label for="package_3ka">3KA</label></span>';
echo '<span class="spaceLeft spaceRight bold">|</span>';
}
echo '<input type="checkbox" value="1" id="testdata" name="testdata" '.($testdata == 1 ? ' checked="checked"' : '').'"><label for="testdata">'.$lang['srv_diagnostics_filter_test'].'</label>'; echo '<input type="checkbox" value="1" id="testdata" name="testdata" '.($testdata == 1 ? ' checked="checked"' : '').'"><label for="testdata">'.$lang['srv_diagnostics_filter_test'].'</label>';
echo '<span class="spaceLeft"><input type="checkbox" value="1" id="testdataauto" name="testdataauto" '.($testdataauto == 1 ? ' checked="checked"' : '').'"><label for="testdataauto">'.$lang['srv_diagnostics_filter_autotest'].'</label></span>'; echo '<span class="spaceLeft"><input type="checkbox" value="1" id="testdataauto" name="testdataauto" '.($testdataauto == 1 ? ' checked="checked"' : '').'"><label for="testdataauto">'.$lang['srv_diagnostics_filter_autotest'].'</label></span>';
echo '<input type="hidden" name="uvoz" id="uvoz_hidden" value="'.$uvoz.'" />'; echo '<input type="hidden" name="uvoz" id="uvoz_hidden" value="'.$uvoz.'" />';
@ -163,25 +180,28 @@ class SurveyAktivnost{
$interval $interval
) AS grupe, srv_anketa ) AS grupe, srv_anketa
WHERE grupe.ank_id=srv_anketa.id WHERE grupe.ank_id=srv_anketa.id
AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN
(SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "'))
GROUP BY grupe.ank_id GROUP BY grupe.ank_id
ORDER BY responses DESC ORDER BY responses DESC
"); ");
} elseif ($type == 'users') { } elseif ($type == 'users') {
$filter = $this->diagnostics_get_user_settings(); $filter = $this->diagnostics_get_user_settings();
$filter_package = $this->diagnostics_get_user_package();
$filter_lang = $this->diagnostics_get_lang_filter(); $filter_lang = $this->diagnostics_get_lang_filter();
$sql = sisplet_query(" $sql = sisplet_query("
SELECT COUNT(srv_user.id) AS responses, users.email, srv_user.ank_id, srv_anketa.naslov SELECT COUNT(srv_user.id) AS responses, users.email, srv_user.ank_id, srv_anketa.naslov, user_access.package_id
FROM srv_user, srv_anketa, users FROM srv_user, srv_anketa, users
WHERE ".$filter." AND ".$filter_lang." srv_user.ank_id > '0' LEFT JOIN user_access
AND srv_anketa.id=srv_user.ank_id ON user_access.usr_id=users.id
AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN WHERE ".$filter." AND ".$filter_lang." ".$filter_package." srv_user.ank_id > '0'
(SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) AND srv_anketa.id=srv_user.ank_id
$interval AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN
AND srv_anketa.insert_uid = users.id (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "'))
$interval
AND srv_anketa.insert_uid = users.id
GROUP BY ank_id GROUP BY ank_id
ORDER BY responses DESC ORDER BY responses DESC
"); ");
@ -191,11 +211,11 @@ class SurveyAktivnost{
SELECT COUNT(srv_tracking_active.ank_id) AS responses, srv_tracking_active.ank_id, srv_anketa.naslov SELECT COUNT(srv_tracking_active.ank_id) AS responses, srv_tracking_active.ank_id, srv_anketa.naslov
FROM srv_tracking_active, srv_anketa FROM srv_tracking_active, srv_anketa
WHERE srv_anketa.id = srv_tracking_active.ank_id WHERE srv_anketa.id = srv_tracking_active.ank_id
AND (`get` LIKE '%analiza%' OR `get` LIKE '%analysis%' ) AND (`get` LIKE '%analiza%' OR `get` LIKE '%analysis%' )
AND NOT (`get` LIKE '%charts%') AND NOT (`get` LIKE '%charts%')
AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN
(SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "'))
$interval $interval
GROUP BY ank_id GROUP BY ank_id
ORDER BY responses DESC ORDER BY responses DESC
"); ");
@ -206,11 +226,11 @@ class SurveyAktivnost{
SELECT COUNT(srv_tracking_active.ank_id) AS responses, srv_tracking_active.ank_id, srv_anketa.naslov SELECT COUNT(srv_tracking_active.ank_id) AS responses, srv_tracking_active.ank_id, srv_anketa.naslov
FROM srv_tracking_active, srv_anketa FROM srv_tracking_active, srv_anketa
WHERE srv_anketa.id = srv_tracking_active.ank_id WHERE srv_anketa.id = srv_tracking_active.ank_id
AND (`get` LIKE '%analiza%' OR `get` LIKE '%analysis%' ) AND (`get` LIKE '%analiza%' OR `get` LIKE '%analysis%' )
AND (`get` LIKE '%charts%') AND (`get` LIKE '%charts%')
AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN
(SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "'))
$interval $interval
GROUP BY ank_id GROUP BY ank_id
ORDER BY responses DESC ORDER BY responses DESC
"); ");
@ -221,9 +241,9 @@ class SurveyAktivnost{
SELECT COUNT(srv_tracking_active.ank_id) AS responses, srv_tracking_active.ank_id, srv_anketa.naslov SELECT COUNT(srv_tracking_active.ank_id) AS responses, srv_tracking_active.ank_id, srv_anketa.naslov
FROM srv_tracking_active, srv_anketa FROM srv_tracking_active, srv_anketa
WHERE srv_anketa.id = srv_tracking_active.ank_id WHERE srv_anketa.id = srv_tracking_active.ank_id
AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN
(SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "'))
$interval $interval
GROUP BY ank_id GROUP BY ank_id
ORDER BY responses DESC ORDER BY responses DESC
"); ");
@ -234,9 +254,9 @@ class SurveyAktivnost{
SELECT COUNT(srv_invitations_recipients.id) AS responses, srv_invitations_recipients.ank_id, srv_anketa.naslov SELECT COUNT(srv_invitations_recipients.id) AS responses, srv_invitations_recipients.ank_id, srv_anketa.naslov
FROM srv_invitations_recipients, srv_anketa FROM srv_invitations_recipients, srv_anketa
WHERE srv_anketa.id = srv_invitations_recipients.ank_id AND srv_invitations_recipients.sent = '1' WHERE srv_anketa.id = srv_invitations_recipients.ank_id AND srv_invitations_recipients.sent = '1'
AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN
(SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "'))
$interval $interval
GROUP BY ank_id GROUP BY ank_id
ORDER BY responses DESC ORDER BY responses DESC
"); ");
@ -255,7 +275,7 @@ class SurveyAktivnost{
while ($row = mysqli_fetch_array($sql)) { while ($row = mysqli_fetch_array($sql)) {
if ($max == -1) if ($max == -1)
$max = max($row['responses'], $max)*1.3; $max = max($row['responses'], $max)*1.3;
echo '<tr>'; echo '<tr>';
echo '<td><a href="'.SurveyInfo::getSurveyLink($row['ank_id']).'?preview=on&pages=all" target="_blank">' . $row['naslov'] . '</a></td>'; echo '<td><a href="'.SurveyInfo::getSurveyLink($row['ank_id']).'?preview=on&pages=all" target="_blank">' . $row['naslov'] . '</a></td>';
@ -263,9 +283,7 @@ class SurveyAktivnost{
$sum = $sum + $row['responses']; $sum = $sum + $row['responses'];
$sum_survey = $sum_survey + 1; $sum_survey = $sum_survey + 1;
echo '<td style="width:60%"><div class="graph_lb" style="float: left; width:' . (round($row['responses'] / $max * 100, 0)) . '%">&nbsp;</div><div style="float:left">&nbsp;'.$row['responses'].'</div></td>'; echo '<td style="width:60%"><div class="graph_lb" style="float: left; width:' . (round($row['responses'] / $max * 100, 0)) . '%">&nbsp;</div><div style="float:left">&nbsp;'.$row['responses'].'</div></td>';
echo '</tr> echo '</tr>';
';
//$sum_survey = sizeof($row);
} }
echo '<script type="text/javascript"> echo '<script type="text/javascript">
@ -284,21 +302,42 @@ class SurveyAktivnost{
global $lang; global $lang;
$interval = $this->diagnostics_get_interval('month'); $interval = $this->diagnostics_get_interval('month');
$filter = $this->diagnostics_get_user_settings(); $filter = $this->diagnostics_get_user_settings();
$filter_package = $this->diagnostics_get_user_package();
$filter_lang = $this->diagnostics_get_lang_filter(); $filter_lang = $this->diagnostics_get_lang_filter();
$this->diagnostics_show_interval('time_span'); $this->diagnostics_show_interval('time_span');
$sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_anketa] AS datedate, YEAR(insert_time) AS color, insert_time AS date FROM srv_anketa WHERE ".$filter_lang." insert_time > 0 AND YEAR(insert_time)>=2009 GROUP BY datedate ORDER BY insert_time ASC"); $sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_anketa] AS datedate, YEAR(insert_time) AS color, insert_time AS date
FROM srv_anketa
LEFT JOIN user_access
ON user_access.usr_id=srv_anketa.insert_uid
WHERE ".$filter_lang." ".$filter_package." insert_time > 0 AND YEAR(insert_time)>=2009
GROUP BY datedate
ORDER BY insert_time ASC
");
$this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_survey'], 'day', 'year', false); $this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_survey'], 'day', 'year', false);
$this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_sum_survey'], 'day', 'year', true); $this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_sum_survey'], 'day', 'year', true);
$sql = sisplet_query("SELECT COUNT(*) as count, $interval[users] AS datedate, YEAR(when_reg) AS color, when_reg AS date
$sql = sisplet_query("SELECT COUNT(*) as count, $interval[users] AS datedate, YEAR(when_reg) AS color, when_reg AS date FROM users WHERE when_reg > 0 AND YEAR(when_reg)>=2009 GROUP BY datedate ORDER BY when_reg ASC"); FROM users
LEFT JOIN user_access
ON user_access.usr_id=users.id
WHERE ".$filter_package." when_reg > 0 AND YEAR(when_reg)>=2009
GROUP BY datedate
ORDER BY when_reg ASC
");
$this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_register'], 'day', 'year', false); $this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_register'], 'day', 'year', false);
$this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_sum_register'], 'day', 'year', true); $this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_sum_register'], 'day', 'year', true);
$sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_user] AS datedate, YEAR(srv_user.time_insert) AS color, srv_user.time_insert AS date FROM srv_user, srv_anketa WHERE srv_user.ank_id=srv_anketa.id AND ".$filter." AND ".$filter_lang." time_insert > 0 AND YEAR(time_insert)>=2009 GROUP BY datedate ORDER BY time_insert ASC"); $sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_user] AS datedate, YEAR(srv_user.time_insert) AS color, srv_user.time_insert AS date
FROM srv_user, srv_anketa
LEFT JOIN user_access
ON user_access.usr_id=srv_anketa.insert_uid
WHERE srv_user.ank_id=srv_anketa.id AND ".$filter." AND ".$filter_lang." ".$filter_package." time_insert > 0 AND YEAR(time_insert)>=2009
GROUP BY datedate
ORDER BY time_insert ASC
");
$this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_answer'], 'day', 'year', false); $this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_answer'], 'day', 'year', false);
$this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_sum_answer'], 'day', 'year', true); $this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_sum_answer'], 'day', 'year', true);
} }
@ -307,42 +346,83 @@ class SurveyAktivnost{
global $lang; global $lang;
$interval = $this->diagnostics_get_interval('day'); $interval = $this->diagnostics_get_interval('day');
$filter = $this->diagnostics_get_user_settings(); $filter = $this->diagnostics_get_user_settings();
$filter_package = $this->diagnostics_get_user_package();
$filter_lang = $this->diagnostics_get_lang_filter(); $filter_lang = $this->diagnostics_get_lang_filter();
$this->diagnostics_show_interval('time_span_yearly'); $this->diagnostics_show_interval('time_span_yearly');
$sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_anketa] AS datedate, MONTH(insert_time) AS color, insert_time AS date FROM srv_anketa WHERE ".$filter_lang." insert_time > 0 AND insert_time >= '".date("Y-m-1 0:00:00", strtotime("-11 month"))."' GROUP BY datedate ORDER BY insert_time ASC"); $sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_anketa] AS datedate, MONTH(insert_time) AS color, insert_time AS date
FROM srv_anketa
LEFT JOIN user_access
ON user_access.usr_id=srv_anketa.insert_uid
WHERE ".$filter_lang." ".$filter_package." insert_time > 0 AND insert_time >= '".date("Y-m-1 0:00:00", strtotime("-11 month"))."'
GROUP BY datedate
ORDER BY insert_time ASC
");
$this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_survey'], 'day', 'month', false); $this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_survey'], 'day', 'month', false);
$sql = sisplet_query("SELECT COUNT(*) as count, $interval[users] AS datedate, MONTH(when_reg) AS color, when_reg AS date
$sql = sisplet_query("SELECT COUNT(*) as count, $interval[users] AS datedate, MONTH(when_reg) AS color, when_reg AS date FROM users WHERE when_reg > 0 AND when_reg >= '".date("Y-m-1 0:00:00", strtotime("-11 month"))."' GROUP BY datedate ORDER BY when_reg ASC"); FROM users
LEFT JOIN user_access
ON user_access.usr_id=users.id
WHERE ".$filter_package." when_reg > 0 AND when_reg >= '".date("Y-m-1 0:00:00", strtotime("-11 month"))."'
GROUP BY datedate
ORDER BY when_reg ASC
");
$this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_register'], 'day', 'month', false); $this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_register'], 'day', 'month', false);
$sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_user] AS datedate, MONTH(srv_user.time_insert) AS color, srv_user.time_insert AS date
$sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_user] AS datedate, MONTH(srv_user.time_insert) AS color, srv_user.time_insert AS date FROM srv_user, srv_anketa WHERE srv_user.ank_id=srv_anketa.id AND ".$filter." AND ".$filter_lang." time_insert > 0 AND time_insert >= '".date("Y-m-1 0:00:00", strtotime("-11 month"))."' GROUP BY datedate ORDER BY time_insert ASC"); FROM srv_user, srv_anketa
$this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_answer'], 'day', 'month', false); LEFT JOIN user_access
ON user_access.usr_id=srv_anketa.insert_uid
WHERE srv_user.ank_id=srv_anketa.id AND ".$filter." AND ".$filter_lang." ".$filter_package." time_insert > 0 AND time_insert >= '".date("Y-m-1 0:00:00", strtotime("-11 month"))."'
GROUP BY datedate
ORDER BY time_insert ASC
");
$this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_answer'], 'day', 'month', false);
} }
public function diagnostics_time_span_monthly () { public function diagnostics_time_span_monthly () {
global $lang; global $lang;
$interval = $this->diagnostics_get_interval('day'); $interval = $this->diagnostics_get_interval('day');
$filter = $this->diagnostics_get_user_settings(); $filter = $this->diagnostics_get_user_settings();
$filter_package = $this->diagnostics_get_user_package();
$filter_lang = $this->diagnostics_get_lang_filter(); $filter_lang = $this->diagnostics_get_lang_filter();
$this->diagnostics_show_interval('time_span_monthly'); $this->diagnostics_show_interval('time_span_monthly');
$sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_anketa] AS datedate, MONTH(insert_time) AS color, insert_time AS date FROM srv_anketa WHERE ".$filter_lang." insert_time > 0 AND insert_time >= '".date("Y-m-1 0:00:00", strtotime("-2 month"))."' GROUP BY datedate ORDER BY insert_time ASC"); $sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_anketa] AS datedate, MONTH(insert_time) AS color, insert_time AS date
FROM srv_anketa
LEFT JOIN user_access
ON user_access.usr_id=srv_anketa.insert_uid
WHERE ".$filter_lang." ".$filter_package." insert_time > 0 AND insert_time >= '".date("Y-m-1 0:00:00", strtotime("-2 month"))."'
GROUP BY datedate
ORDER BY insert_time ASC
");
$this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_survey'], 'day', 'month', false); $this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_survey'], 'day', 'month', false);
$sql = sisplet_query("SELECT COUNT(*) as count, $interval[users] AS datedate, MONTH(when_reg) AS color, when_reg AS date FROM users WHERE when_reg > 0 AND when_reg >= '".date("Y-m-1 0:00:00", strtotime("-2 month"))."' GROUP BY datedate ORDER BY when_reg ASC"); $sql = sisplet_query("SELECT COUNT(*) as count, $interval[users] AS datedate, MONTH(when_reg) AS color, when_reg AS date
FROM users
LEFT JOIN user_access
ON user_access.usr_id=users.id
WHERE ".$filter_package." when_reg > 0 AND when_reg >= '".date("Y-m-1 0:00:00", strtotime("-2 month"))."'
GROUP BY datedate
ORDER BY when_reg ASC
");
$this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_register'], 'day', 'month', false); $this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_register'], 'day', 'month', false);
$sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_user] AS datedate, MONTH(srv_user.time_insert) AS color, srv_user.time_insert AS date FROM srv_user, srv_anketa WHERE srv_user.ank_id=srv_anketa.id AND ".$filter." AND ".$filter_lang." time_insert > 0 AND time_insert >= '".date("Y-m-1 0:00:00", strtotime("-2 month"))."' GROUP BY datedate ORDER BY time_insert ASC"); $sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_user] AS datedate, MONTH(srv_user.time_insert) AS color, srv_user.time_insert AS date
FROM srv_user, srv_anketa
LEFT JOIN user_access
ON user_access.usr_id=srv_anketa.insert_uid
WHERE srv_user.ank_id=srv_anketa.id AND ".$filter." AND ".$filter_lang." ".$filter_package." time_insert > 0 AND time_insert >= '".date("Y-m-1 0:00:00", strtotime("-2 month"))."'
GROUP BY datedate
ORDER BY time_insert ASC
");
$this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_answer'], 'day', 'month', false); $this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_month_answer'], 'day', 'month', false);
} }
@ -352,19 +432,41 @@ class SurveyAktivnost{
$interval = $this->diagnostics_get_interval('hour'); $interval = $this->diagnostics_get_interval('hour');
$filter = $this->diagnostics_get_user_settings(); $filter = $this->diagnostics_get_user_settings();
$filter_package = $this->diagnostics_get_user_package();
$filter_lang = $this->diagnostics_get_lang_filter(); $filter_lang = $this->diagnostics_get_lang_filter();
$this->diagnostics_show_interval('time_span_daily'); $this->diagnostics_show_interval('time_span_daily');
$sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_anketa] AS datedate, DAYOFWEEK(insert_time) AS color, insert_time AS date FROM srv_anketa WHERE ".$filter_lang." insert_time >= '".date("Y-m-d 0:00:00", strtotime("-1 week"))."' GROUP BY datedate ORDER BY insert_time"); $sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_anketa] AS datedate, DAYOFWEEK(insert_time) AS color, insert_time AS date
FROM srv_anketa
LEFT JOIN user_access
ON user_access.usr_id=srv_anketa.insert_uid
WHERE ".$filter_lang." ".$filter_package." insert_time >= '".date("Y-m-d 0:00:00", strtotime("-1 week"))."'
GROUP BY datedate
ORDER BY insert_time
");
$this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_week_survey'], 'hour', 'day', false); $this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_week_survey'], 'hour', 'day', false);
$sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_tracking_active] AS datedate, DAYOFWEEK(datetime) AS color, datetime AS date FROM srv_tracking_active WHERE datetime >= '".date("Y-m-d 0:00:00", strtotime("-1 week"))."' GROUP BY datedate ORDER BY datetime"); $sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_tracking_active] AS datedate, DAYOFWEEK(datetime) AS color, datetime AS date
FROM srv_tracking_active
LEFT JOIN user_access
ON user_access.usr_id=srv_tracking_active.user
WHERE ".$filter_package." datetime >= '".date("Y-m-d 0:00:00", strtotime("-1 week"))."'
GROUP BY datedate
ORDER BY datetime
");
$this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_week_edit'], 'hour', 'day', false); $this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_week_edit'], 'hour', 'day', false);
$sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_user] AS datedate, DAYOFWEEK(srv_user.time_insert) AS color, srv_user.time_insert AS date FROM srv_user, srv_anketa WHERE srv_user.ank_id=srv_anketa.id AND ".$filter." AND ".$filter_lang." time_insert >= '".date("Y-m-d 0:00:00", strtotime("-1 week"))."' GROUP BY datedate ORDER BY time_insert"); $sql = sisplet_query("SELECT COUNT(*) as count, $interval[srv_user] AS datedate, DAYOFWEEK(srv_user.time_insert) AS color, srv_user.time_insert AS date
FROM srv_user, srv_anketa
LEFT JOIN user_access
ON user_access.usr_id=srv_anketa.insert_uid
WHERE srv_user.ank_id=srv_anketa.id AND ".$filter." AND ".$filter_lang." ".$filter_package." time_insert >= '".date("Y-m-d 0:00:00", strtotime("-1 week"))."'
GROUP BY datedate
ORDER BY time_insert
");
$this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_week_answer'], 'hour', 'day', false); $this->diagnostics_graph($sql, $lang['srv_diagnostics_graph_week_answer'], 'hour', 'day', false);
} }
@ -610,7 +712,7 @@ class SurveyAktivnost{
} }
private function diagnostics_show_interval ($t) { private function diagnostics_show_interval ($t) {
global $lang; global $lang, $app_settings;
echo '<form name="intr" action="index.php" method="get">'; echo '<form name="intr" action="index.php" method="get">';
echo '<input type="hidden" name="a" value="diagnostics">'; echo '<input type="hidden" name="a" value="diagnostics">';
@ -626,7 +728,25 @@ class SurveyAktivnost{
$mailsent = (isset($_GET['mailsent']) && $_GET['mailsent']=='1') ? 1 : 0; $mailsent = (isset($_GET['mailsent']) && $_GET['mailsent']=='1') ? 1 : 0;
$language = (isset($_GET['language'])) ? $_GET['language'] : 0; $language = (isset($_GET['language'])) ? $_GET['language'] : 0;
if(isset($app_settings['commercial_packages']) && $app_settings['commercial_packages'] == true){
$package_1ka = (isset($_GET['package_1ka']) && $_GET['package_1ka']=='0') ? 0 : 1;
$package_2ka = (isset($_GET['package_2ka']) && $_GET['package_2ka']=='0') ? 0 : 1;
$package_3ka = (isset($_GET['package_3ka']) && $_GET['package_3ka']=='0') ? 0 : 1;
echo '<span>'.$lang['srv_narocilo_paket'].':</span>';
echo '<input type="hidden" name="package_1ka" id="package_1ka_hidden" value="'.$package_1ka.'" />';
echo '<input type="checkbox" value="1" id="package_1ka" '.($package_1ka == 1 ? ' checked="checked"' : '').'" onchange="$(\'#package_1ka_hidden\').val('.($package_1ka==1 ? '0' : '1').');"><label for="package_1ka">1KA</label>';
echo '<input type="hidden" name="package_2ka" id="package_2ka_hidden" value="'.$package_2ka.'" />';
echo '<span class="spaceLeft"><input type="checkbox" value="1" id="package_2ka" '.($package_2ka == 1 ? ' checked="checked"' : '').' onchange="$(\'#package_2ka_hidden\').val('.($package_2ka==1 ? '0' : '1').');"><label for="package_2ka">2KA</label></span>';
echo '<input type="hidden" name="package_3ka" id="package_3ka_hidden" value="'.$package_3ka.'" />';
echo '<span class="spaceLeft"><input type="checkbox" value="1" id="package_3ka" '.($package_3ka == 1 ? ' checked="checked"' : '').' onchange="$(\'#package_3ka_hidden\').val('.($package_3ka==1 ? '0' : '1').');"><label for="package_3ka">3KA</label></span>';
echo '<span class="spaceLeft spaceRight bold">|</span>';
}
echo '<input type="checkbox" value="1" id="testdata" name="testdata" '.($testdata == 1 ? ' checked="checked"' : '').'"><label for="testdata">'.$lang['srv_diagnostics_filter_test'].'</label>'; echo '<input type="checkbox" value="1" id="testdata" name="testdata" '.($testdata == 1 ? ' checked="checked"' : '').'"><label for="testdata">'.$lang['srv_diagnostics_filter_test'].'</label>';
echo '<span class="spaceLeft"><input type="checkbox" value="1" id="testdataauto" name="testdataauto" '.($testdataauto == 1 ? ' checked="checked"' : '').'"><label for="testdataauto">'.$lang['srv_diagnostics_filter_autotest'].'</label></span>'; echo '<span class="spaceLeft"><input type="checkbox" value="1" id="testdataauto" name="testdataauto" '.($testdataauto == 1 ? ' checked="checked"' : '').'"><label for="testdataauto">'.$lang['srv_diagnostics_filter_autotest'].'</label></span>';
echo '<input type="hidden" name="uvoz" id="uvoz_hidden" value="'.$uvoz.'" />'; echo '<input type="hidden" name="uvoz" id="uvoz_hidden" value="'.$uvoz.'" />';
@ -698,7 +818,7 @@ class SurveyAktivnost{
// Vrnemo filter za srv_user (filtriranje testnih podatkov, preview, email vabil, ustreznih...) // Vrnemo filter za srv_user (filtriranje testnih podatkov, preview, email vabil, ustreznih...)
private function diagnostics_get_user_settings(){ private function diagnostics_get_user_settings(){
$testdata = (isset($_GET['testdata']) && $_GET['testdata']=='1') ? 1 : 0; $testdata = (isset($_GET['testdata']) && $_GET['testdata']=='1') ? 1 : 0;
$testdataauto = (isset($_GET['testdataauto']) && $_GET['testdataauto']=='1') ? 1 : 0; $testdataauto = (isset($_GET['testdataauto']) && $_GET['testdataauto']=='1') ? 1 : 0;
$uvoz = (isset($_GET['uvoz']) && $_GET['uvoz']=='1') ? 1 : 0; $uvoz = (isset($_GET['uvoz']) && $_GET['uvoz']=='1') ? 1 : 0;
@ -707,8 +827,7 @@ class SurveyAktivnost{
$delnoustrezni = (isset($_GET['delnoustrezni']) && $_GET['delnoustrezni']=='0') ? 0 : 1; $delnoustrezni = (isset($_GET['delnoustrezni']) && $_GET['delnoustrezni']=='0') ? 0 : 1;
$neustrezni = (isset($_GET['neustrezni']) && $_GET['neustrezni']=='1') ? 1 : 0; $neustrezni = (isset($_GET['neustrezni']) && $_GET['neustrezni']=='1') ? 1 : 0;
$mailsent = (isset($_GET['mailsent']) && $_GET['mailsent']=='1') ? 1 : 0; $mailsent = (isset($_GET['mailsent']) && $_GET['mailsent']=='1') ? 1 : 0;
// Vedno filtriramo preview vnose // Vedno filtriramo preview vnose
$filter = " srv_user.preview='0'"; $filter = " srv_user.preview='0'";
@ -741,15 +860,39 @@ class SurveyAktivnost{
else else
$filter .= "srv_user.last_status NOT IN ('0','1','2','3','4','5','6'))"; $filter .= "srv_user.last_status NOT IN ('0','1','2','3','4','5','6'))";
// Filtriramo uvozene podatke // Filtriramo uvozene podatke
if($uvoz == 0){ if($uvoz == 0){
$filter .= " AND !(srv_user.referer='' AND testdata='0' AND ip='' AND recnum='0')"; $filter .= " AND !(srv_user.referer='' AND testdata='0' AND ip='' AND recnum='0')";
} }
return $filter; return $filter;
} }
// Filter po paketih, ce jih imamo
private function diagnostics_get_user_package(){
global $app_settings;
$filter = '';
if(isset($app_settings['commercial_packages']) && $app_settings['commercial_packages'] == true){
$package_1ka = (isset($_GET['package_1ka']) && $_GET['package_1ka']=='0') ? 0 : 1;
$package_2ka = (isset($_GET['package_2ka']) && $_GET['package_2ka']=='0') ? 0 : 1;
$package_3ka = (isset($_GET['package_3ka']) && $_GET['package_3ka']=='0') ? 0 : 1;
if($package_1ka == 0){
$filter .= " ((user_access.package_id='2' OR user_access.package_id='3') AND user_access.time_expire > NOW()) AND ";
}
if($package_2ka == 0){
$filter .= " (user_access.package_id!='2' OR user_access.time_expire < NOW()) AND ";
}
if($package_3ka == 0){
$filter .= " (user_access.package_id!='3' OR user_access.time_expire < NOW()) AND ";
}
}
return $filter;
}
// Vrnemo filter za srv_user (filtriranje testnih podatkov, preview, email vabil, ustreznih...) // Vrnemo filter za srv_user (filtriranje testnih podatkov, preview, email vabil, ustreznih...)
private function diagnostics_get_lang_filter(){ private function diagnostics_get_lang_filter(){
@ -764,7 +907,5 @@ class SurveyAktivnost{
return $filter; return $filter;
} }
} }