Popravek seznama pri vabilih pri uvozu respondentov iz datoteke

This commit is contained in:
Peter Hrvatin 2020-11-26 09:56:48 +01:00
parent 34cceb83e5
commit a209c666b4

View File

@ -3050,15 +3050,19 @@ class SurveyInvitationsNew {
}
function displayMailToSourceLists($source_type) {
global $lang,$site_url;
global $lang, $site_url;
$canShowSubOption = false;
echo '<p style="margin-left:25px;">';
echo $lang['srv_inv_send_who_create1'].'<a href="'.$site_url.'admin/survey/index.php?anketa='.$this->sid.'&a=invitations&m=inv_lists">'.$lang['srv_inv_send_who_create2'].'</a><br/>';
if ((int)$source_type == 0) {
# vsi respondenti v bazi
echo $lang['srv_inv_send_who_database_note'];
$canShowSubOption = true;
} elseif ((int)$source_type == 1) {
}
elseif ((int)$source_type == 1) {
# Arhivi pošiljanja
# poiščemo arhiv mailingov
@ -3067,7 +3071,9 @@ class SurveyInvitationsNew {
$sql_query_arc = sisplet_query($sql_string_arc);
if (mysqli_num_rows($sql_query_arc) > 0) {
$canShowSubOption = true;
echo $lang['srv_inv_send_who_archive_note'];
echo '<table id="tbl_recipients_source_list">';
echo '<tr>';
@ -3076,6 +3082,7 @@ class SurveyInvitationsNew {
echo '<th>'.$lang['srv_inv_send_who_table_respondents'].'</th>';
echo '<th>'.$lang['srv_inv_send_who_table_date_create'].'</th>';
echo '</tr>';
while ($row_arc = mysqli_fetch_assoc($sql_query_arc)) {
echo '<tr>';
echo '<td class="tbl_icon"><input type="checkbox" name="mailsource_lists[]" onchange="mailToSourceCheckboxChange();" value="'.$row_arc['id'].'"></td>';
@ -3084,21 +3091,31 @@ class SurveyInvitationsNew {
echo '<td>'.$row_arc['ds'].'</td>';
echo '</tr>';
}
echo '</table>';
} else{
}
else{
echo $lang['srv_inv_send_who_archive_no_archive'];
}
} elseif ((int)$source_type == 2) {
}
elseif ((int)$source_type == 2) {
# seznami respondentov
# zloopamo skozi posamezne sezname respondentov
$sql_string_arc ="SELECT list_id as id, COUNT(*) as cnt_succsess, list_id, sirp.name as naslov, DATE_FORMAT(sirp.insert_time,'%d.%m.%Y, %T') AS ds FROM srv_invitations_recipients AS sir LEFT JOIN srv_invitations_recipients_profiles AS sirp ON sir.list_id = sirp.pid WHERE ank_id ='".$this->sid."' AND sir.deleted ='0' group BY list_id";
#$sql_string_arc = "SELECT sia.*, DATE_FORMAT(sia.date_send,'%d.%m.%Y, %T') AS ds, u.name, u.surname, u.email FROM srv_invitations_archive AS sia LEFT JOIN users AS u ON sia.uid = u.id WHERE ank_id = '".$this->sid."' ORDER BY sia.date_send ASC;";
$sql_query_arc = sisplet_query($sql_string_arc);
$sql_string_arc ="";
$sql_query_arc = sisplet_query("SELECT list_id as id, COUNT(*) as cnt_succsess, list_id, sirp.name as naslov, DATE_FORMAT(sirp.insert_time,'%d.%m.%Y, %T') AS ds
FROM srv_invitations_recipients AS sir
LEFT JOIN srv_invitations_recipients_profiles AS sirp
ON sir.list_id = sirp.pid
WHERE ank_id ='".$this->sid."' AND sir.deleted ='0' group BY list_id
");
if (mysqli_num_rows($sql_query_arc) > 0) {
$canShowSubOption = true;
echo $lang['srv_inv_send_who_all_units_note'];
echo '<table id="tbl_recipients_source_list">';
echo '<tr>';
echo '<th class="tbl_icon">&nbsp;</th>';
@ -3107,20 +3124,26 @@ class SurveyInvitationsNew {
echo '<th>'.$lang['srv_inv_send_who_table_date_create'].'</th>';
echo '</tr>';
while ($row_arc = mysqli_fetch_assoc($sql_query_arc)) {
if ($row_arc['id'] > 0 && $row_arc['naslov'] == '') {
# če ni imena in je id < 0 je bil izbrisan
} else {
}
else {
if ($row_arc['id'] > 0) {
if ($row_arc['naslov'] != '') {
$_naslov = $row_arc['naslov'];
} else {
}
else {
$_naslov = $lang['srv_inv_send_who_table_list_deleted'];
}
} else if ($row_arc['id'] == 0) {
}
else if ($row_arc['id'] == 0) {
$_naslov = $lang['srv_inv_send_who_table_list_temporary'];
} else if ($row_arc['id'] < 0) {
}
else if ($row_arc['id'] < 0) {
$_naslov = $lang['srv_inv_send_who_table_list_noname'];
}
echo '<tr>';
echo '<td class="tbl_icon"><input type="checkbox" name="mailsource_lists[]" onchange="mailToSourceCheckboxChange();" value="'.$row_arc['id'].'"></td>';
echo '<td>'.$_naslov.'</td>';
@ -3130,14 +3153,15 @@ class SurveyInvitationsNew {
}
}
echo '</table>';
} else{
}
else{
echo $lang['srv_inv_send_who_no_lists'];
}
}
echo '</p>';
if ($canShowSubOption == true) {
echo '<span id="inv_select_mail_to">';
echo '<span class="bold">'.$lang['srv_inv_send_note'].'</span><br/>';
echo '<span class="inv_send_span"><input name="mailto" id="mailto0" value="0" type="radio" checked="checked" onclick="mailToRadioChange();"><label for="mailto0">' . $lang['srv_inv_send_recipients0'] . '</label></span><br/>';
@ -4478,12 +4502,12 @@ class SurveyInvitationsNew {
// Vejica NI kul, ker se uporablja pri nazivih in v custom poljih Za interni delimiter naj bo recimo " | "...
$recipients_list = str_replace ($_POST['recipientsDelimiter'], "|~|", $recipients_list);
// Dodamo polja
$result = $this->addMassRecipients($recipients_list, $fields);
// Shranimo v seznam
$pid = $this->saveAppendRecipientList($pid=0, $fields, $recipients_list, $profileName='', $profileComment='');
// Dodamo polja
$result = $this->addMassRecipients($recipients_list, $fields, $pid);
// Prikažemo napake
$invalid_recipiens_array = $this->displayRecipentsErrors($result);
@ -5084,75 +5108,10 @@ class SurveyInvitationsNew {
function getProfileName() {
echo 'DEPRECATED';
/*
global $lang,$site_url, $global_user_id;
$array_profiles = array();
#ne vem če je fino da lahko dodaja kar na vse sezname
session_start();
$_only_this_survey = (isset($_SESSION['inv_rec_only_this_survey']) && $_SESSION['inv_rec_only_this_survey'] == false) ? '' : " AND from_survey = '".$this->sid. "'" ;
# polovimo še ostale porfile
$sql_string = "SELECT pid, name,comment FROM srv_invitations_recipients_profiles WHERE uid in('0', '".$global_user_id."')".$_only_this_survey;
$sql_query = sisplet_query($sql_string);
while ($sql_row = mysqli_fetch_assoc($sql_query)) {
$array_profiles[$sql_row['pid']] = array('name' => $sql_row['name'], 'comment'=>$sql_row['comment']);
}
#echo '<div id="inv_recipients_profile_name">';
echo '<span class="inv_new_list_note">';
echo $lang[''].'Izberite seznam kamor želite dodati prejemnike. Izbirate lahko med:<br/><ul><li>\'Nov seznam\' - prejemniki se dodajo v nov seznam, kateremu določite ime</li><li>\'Začasen seznam\' - seznam obstaja samo v času seje brskalnika</li><li>ali izberete obstoječ seznam, h kateremu se bodo dodali prejemniki</li></ul><br/>';
echo '</span>';
echo $lang['srv_invitation_recipients_list_add'].':&nbsp;';
echo '<select id="sel_inv_list_type" onchange="inv_new_recipients_list_change(this);" autofocus="autofocus">';
echo '<option value="0" class="gray bold"'.((int)$_POST['pid'] > 0 ? '' : ' selected="selected"' ).'>'.$lang['srv_invitation_new_list'].'</option>';
echo '<option value="-1" class="gray bold">'.$lang['srv_invitation_new_templist'].'</option>';
if (count($array_profiles) > 0){
foreach($array_profiles AS $key => $profile) {
echo '<option value="'.$key.'" comment="'.$profile['comment'].'"'.($_POST['pid'] == $key ? ' selected="selected"' : '').'>'.$profile['name'].'</option>';
}
}
echo '</select>';
echo '<span id="new_recipients_list_span" '.((int)$_POST['pid'] > 0 ? ' class="displayNone"' : '' ).'>';
echo '<br><br/>';
echo '<label>'.$lang['srv_inv_recipient_list_name'];
# zaporedno številčimo ime seznama1,2.... če slučajno ime že obstaja
$new_name = $lang['srv_inv_recipient_list_new'];
$names = array();
$s = "SELECT name FROM srv_invitations_recipients_profiles WHERE name LIKE '%".$new_name."%' AND uid='$global_user_id'";
$q = sisplet_query($s);
while ($r = mysqli_fetch_assoc($q)) {
$names[] = $r['name'];
}
if (count($names) > 0) {
$cnt = 1;
while (in_array($lang['srv_inv_recipient_list_new'].$cnt, $names)) {
$cnt++;
}
$new_name = $lang['srv_inv_recipient_list_new'].$cnt;
}
echo '<input type="text" id="rec_profile_name" value="'.$new_name.'" tabindex="1" autofocus="autofocus">';
echo '</label>';
echo '</span>';
echo '<br/><br/>';
echo $lang['srv_inv_recipient_list_comment'];
echo '<textarea id="rec_profile_comment" tabindex="3" rows="2" ></textarea>';
echo '<br class="clr" /><br class="clr" />';
echo '<span class="buttonwrapper floatLeft spaceRight" title="'.$lang['srv_cancel'].'"><a class="ovalbutton ovalbutton_gray" href="#" onclick="$(\'#fade\').fadeOut(\'slow\');$(\'#fullscreen\').fadeOut(\'slow\').html(\'\');return false;" ><span>'.$lang['srv_cancel'].'</span></a></span>';
echo '<span class="buttonwrapper floatRight spaceRight" title="'.$lang['save'].'"><a class="ovalbutton ovalbutton_orange" href="#" onclick="inv_save_rec_profile(); return false;"><span>'.$lang['save'].'</span></a></span>';
echo '<br class="clr" />';
#echo '</div>'; # id="inv_view_arch_recipients"
echo '<script type="text/javascript">';
echo "$('#rec_profile_name').focus();";
echo '</script>';
*/
}
function saveRecProfile() {
global $lang,$site_url, $global_user_id;
global $lang, $site_url, $global_user_id;
$return = array('error'=>'0');
$profile_id = isset($_POST['profile_id'])? (int)$_POST['profile_id'] : -1;