Popravek obvestila da nima dostopa do funkcionalnosti, ce avtor ankete nima zakupljenega paketa in uporabnik ni avtor.
This commit is contained in:
parent
a209c666b4
commit
a5cfb3f90d
@ -721,7 +721,7 @@ class SurveyAdmin
|
||||
// Preverimo trenuten paket uporabnika
|
||||
$userAccess = UserAccess::getInstance($global_user_id);
|
||||
$current_package = $userAccess->getPackage();
|
||||
if($current_package != '3'){
|
||||
if($current_package != '3' && !$userAccess->userNotAuthor()){
|
||||
|
||||
$drupal_url = ($lang['id'] == '2') ? $site_url.'d/en/' : $site_url.'d/';
|
||||
$upgrade_url = $drupal_url.'izvedi-nakup/3/podatki';
|
||||
|
@ -37,8 +37,8 @@ function userAccessFilters(){
|
||||
// Prikaz popupa da funkcionalnost ni na voljo v paketu
|
||||
function popupUserAccess(what) {
|
||||
|
||||
$('#fade').fadeTo('slow', 1);
|
||||
$("#popup_user_access").load('ajax.php?t=userAccess&a=displayNoAccessPopup', {what: what});
|
||||
$('#fade').fadeTo('slow', 1);
|
||||
$("#popup_user_access").load('ajax.php?t=userAccess&a=displayNoAccessPopup', {what: what, anketa: srv_meta_anketa_id});
|
||||
$("#popup_user_access").show();
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ class UserAccess{
|
||||
|
||||
private $usr_id;
|
||||
private $user_access;
|
||||
private $user_not_author = false;
|
||||
|
||||
private $anketa_old = false; // Pri starih anketah ne upostevamo paketov in so na voljo vse funkcionalnosti
|
||||
private $anketa_old_date = '2020-07-01'; // Anketa je stara, ce je bila ustvarjena pred tem datumom
|
||||
@ -219,6 +220,10 @@ class UserAccess{
|
||||
return $this->anketa_old;
|
||||
}
|
||||
|
||||
public function userNotAuthor(){
|
||||
return $this->user_not_author;
|
||||
}
|
||||
|
||||
|
||||
// Preverimo ce ima uporabnik dostop do neke funkcionalnosti
|
||||
public function checkUserAccess($what=''){
|
||||
@ -297,22 +302,28 @@ class UserAccess{
|
||||
// Preverimo, ce smo znotraj dolocene ankete in ce je usr_id enak id-ju avtorja ankete
|
||||
private function checkSurveyAuthor(){
|
||||
|
||||
// Nastavimo id ankete
|
||||
if(isset($_GET['anketa'])){
|
||||
$ank_id = $_GET['anketa'];
|
||||
}
|
||||
elseif(isset($_POST['anketa']) && $_POST['anketa'] != 'undefined'){
|
||||
$ank_id = $_POST['anketa'];
|
||||
}
|
||||
// Ce nismo znotraj ankete je vse ok
|
||||
if(!isset($_GET['anketa'])){
|
||||
else{
|
||||
return;
|
||||
}
|
||||
|
||||
// Nastavimo id ankete
|
||||
$ank_id = $_GET['anketa'];
|
||||
|
||||
// Ce smo znotraj ankete, preverimo, ce je usr_id enak avtorju ankete
|
||||
$sqlA = sisplet_query("SELECT insert_uid FROM srv_anketa WHERE id='".$ank_id."'");
|
||||
if(mysqli_num_rows($sqlA) > 0){
|
||||
$rowA = mysqli_fetch_array($sqlA);
|
||||
|
||||
// Ce user ni avtor, preverjamo za avtorja
|
||||
if($this->usr_id != $rowA['insert_uid'])
|
||||
if($this->usr_id != $rowA['insert_uid']){
|
||||
$this->usr_id = $rowA['insert_uid'];
|
||||
$this->user_not_author = true;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
@ -340,8 +351,14 @@ class UserAccess{
|
||||
|
||||
echo '<div class="user_access_warning">';
|
||||
|
||||
// Ce user ni avtor ankete
|
||||
if($this->user_not_author){
|
||||
echo '<p>'.$lang['srv_access_no_access_not_author'].'</p>';
|
||||
}
|
||||
|
||||
echo '<p>'.$lang['srv_access_no_access'].' "'.$package_required_name.'".</p>';
|
||||
echo '<span class="floatLeft"><div class="buttonwrapper"><a class="ovalbutton ovalbutton_blue" href="'.$drupal_url.'" target="_blank">'.$lang['srv_narocila_buy'].'</a></div></span>';
|
||||
if(!$this->user_not_author)
|
||||
echo '<span class="floatLeft"><div class="buttonwrapper"><a class="ovalbutton ovalbutton_blue" href="'.$drupal_url.'" target="_blank">'.$lang['srv_narocila_buy'].'</a></div></span>';
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
@ -360,8 +377,14 @@ class UserAccess{
|
||||
else
|
||||
$drupal_url = $site_url.'d/izvedi-nakup/'.$package_required.'/podatki';
|
||||
|
||||
// Ce user ni avtor ankete
|
||||
if($this->user_not_author){
|
||||
echo '<p>'.$lang['srv_access_no_access_not_author'].'</p>';
|
||||
}
|
||||
|
||||
echo '<p>'.$lang['srv_access_no_access'].' "'.$package_required_name.'".</p>';
|
||||
echo '<span class="floatRight"><div class="buttonwrapper"><a class="ovalbutton ovalbutton_blue" href="'.$drupal_url.'" target="_blank">'.$lang['srv_narocila_buy'].'</a></div></span>';
|
||||
if(!$this->user_not_author)
|
||||
echo '<span class="floatRight"><div class="buttonwrapper"><a class="ovalbutton ovalbutton_blue" href="'.$drupal_url.'" target="_blank">'.$lang['srv_narocila_buy'].'</a></div></span>';
|
||||
echo '<span class="floatRight spaceRight"><div class="buttonwrapper"><a class="ovalbutton ovalbutton_gray" href="#" onClick="popupUserAccess_close();">'.$lang['srv_zapri'].'</a></div></span>';
|
||||
}
|
||||
|
||||
@ -378,7 +401,16 @@ class UserAccess{
|
||||
$package_required = (isset($this->functionality_package[$what])) ? $this->functionality_package[$what] : 3;
|
||||
$package_required_name = $this->packages[$package_required]['name'];
|
||||
|
||||
echo '<p class="user_access_warning_text">'.$lang['srv_access_no_access'].' "'.$package_required_name.'".</p>';
|
||||
echo '<p class="user_access_warning_text">';
|
||||
|
||||
// Ce user ni avtor ankete
|
||||
if($this->user_not_author){
|
||||
echo $lang['srv_access_no_access_not_author'].'<br /><br />';
|
||||
}
|
||||
|
||||
echo $lang['srv_access_no_access'].' "'.$package_required_name.'"';
|
||||
|
||||
echo '</p>';
|
||||
}
|
||||
|
||||
|
||||
|
@ -7472,6 +7472,7 @@ $lang = array (
|
||||
|
||||
|
||||
// DOSTOP GLEDE NA PAKET
|
||||
'srv_access_no_access_not_author' => "Avtor ankete nima zakupljenega ustreznega paketa, ki vključuje to funkcionalnost.",
|
||||
'srv_access_no_access' => "Funkcionalnost je na voljo samo v plačljivi verziji 1ke v paketu",
|
||||
'srv_access_package' => "Aktivni paket",
|
||||
'srv_access_package_free' => "brezplačno",
|
||||
|
@ -7355,6 +7355,7 @@ $lang = array (
|
||||
|
||||
|
||||
// DOSTOP GLEDE NA PAKET
|
||||
'srv_access_no_access_not_author' => "Survey author does not have sufficient package for this functionality.",
|
||||
'srv_access_no_access' => "Functionality is available only in paid version of 1ka in package",
|
||||
'srv_access_package' => "Active package",
|
||||
'srv_access_package_free' => "free",
|
||||
|
Loading…
x
Reference in New Issue
Block a user