mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Modified GET param of poll id to accept standard ID
This commit is contained in:
parent
c35a704875
commit
048ea8062a
|
|
@ -50,6 +50,9 @@ http://www.fsf.org/licensing/licenses/index_html
|
|||
Copyright
|
||||
---------
|
||||
|
||||
Copyright (C) 2014
|
||||
- Marcos García <marcosgdf@gmail.com>
|
||||
|
||||
Copyright (C) 2013
|
||||
- Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
- Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -35,18 +36,10 @@ if (!$user->admin) accessforbidden();
|
|||
// Initialisation des variables
|
||||
$action=GETPOST('action');
|
||||
$numsondage = $numsondageadmin = '';
|
||||
if (GETPOST('sondage'))
|
||||
{
|
||||
if (strlen(GETPOST('sondage')) == 24) // recuperation du numero de sondage admin (24 car.) dans l'URL
|
||||
{
|
||||
$numsondageadmin=GETPOST("sondage",'alpha');
|
||||
$numsondage=substr($numsondageadmin, 0, 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
$numsondageadmin='';
|
||||
$numsondage=GETPOST("sondage",'alpha');
|
||||
}
|
||||
|
||||
if (GETPOST('id')) {
|
||||
$numsondageadmin = GETPOST('id', 'alpha');
|
||||
$numsondage = substr($numsondageadmin, 0, 16);
|
||||
}
|
||||
|
||||
$object=new Opensurveysondage($db);
|
||||
|
|
@ -128,7 +121,7 @@ if (GETPOST('ajoutcomment'))
|
|||
$comment_user = GETPOST('commentuser');
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."opensurvey_comments (id_sondage, comment, usercomment)";
|
||||
$sql.= " VALUES ('".$db->escape($numsondage)."','".$db->escape($comment)."','".$db->escape($comment_user)."')";
|
||||
$sql.= " VALUES ('".$db->escape($object->id_sondage)."','".$db->escape($comment)."','".$db->escape($comment_user)."')";
|
||||
$resql = $db->query($sql);
|
||||
dol_syslog("sql=".$sql);
|
||||
if (! $resql)
|
||||
|
|
@ -153,7 +146,7 @@ if ($idcomment)
|
|||
|
||||
$form=new Form($db);
|
||||
|
||||
$result=$object->fetch(0,$numsondage);
|
||||
$result=$object->fetch(0, $numsondageadmin);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$object->error);
|
||||
|
|
@ -177,7 +170,7 @@ $toutsujet=str_replace("@","<br>",$toutsujet);
|
|||
$toutsujet=str_replace("°","'",$toutsujet);
|
||||
|
||||
|
||||
print '<form name="updatesurvey" action="'.$_SERVER["PHP_SELF"].'?sondage='.$numsondageadmin.'" method="POST">'."\n";
|
||||
print '<form name="updatesurvey" action="'.$_SERVER["PHP_SELF"].'?id='.$numsondageadmin.'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
$head = array();
|
||||
|
|
@ -271,7 +264,7 @@ $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($
|
|||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
$url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/studs.php',1).'?sondage='.$numsondage;
|
||||
$url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/studs.php',1).'?sondage='.$object->id_sondage;
|
||||
$urllink='<a href="'.$url.'" target="_blank">'.$url.'</a>';
|
||||
print $urllink;
|
||||
|
||||
|
|
@ -289,15 +282,15 @@ dol_fiche_end();
|
|||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($action != 'edit') print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&sondage=' . $numsondageadmin . '">'.$langs->trans("Modify") . '</a>';
|
||||
if ($action != 'edit') print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id=' . $numsondageadmin . '">'.$langs->trans("Modify") . '</a>';
|
||||
|
||||
if ($action != 'edit') print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?suppressionsondage=1&sondage='.$numsondageadmin.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
if ($action != 'edit') print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?suppressionsondage=1&id='.$numsondageadmin.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?&sondage='.$numsondageadmin, $langs->trans("RemovePoll"), $langs->trans("ConfirmRemovalOfPoll",$id), 'delete_confirm', '', '', 1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?&id='.$numsondageadmin, $langs->trans("RemovePoll"), $langs->trans("ConfirmRemovalOfPoll",$id), 'delete_confirm', '', '', 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -312,7 +305,6 @@ print_fiche_titre($langs->trans("CommentsOfVoters"),'','');
|
|||
// Comment list
|
||||
$sql = 'SELECT id_comment, usercomment, comment';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_comments';
|
||||
$sql.= " WHERE id_sondage='".$db->escape($numsondage)."'";
|
||||
$sql.= " ORDER BY id_comment";
|
||||
$resql = $db->query($sql);
|
||||
$num_rows=$db->num_rows($resql);
|
||||
|
|
@ -322,7 +314,7 @@ if ($num_rows > 0)
|
|||
while ( $i < $num_rows)
|
||||
{
|
||||
$obj=$db->fetch_object($resql);
|
||||
print '<a href="'.dol_buildpath('/opensurvey/adminstuds.php',1).'?deletecomment='.$obj->id_comment.'&sondage='.$numsondageadmin.'"> '.img_picto('', 'delete.png').'</a> ';
|
||||
print '<a href="'.dol_buildpath('/opensurvey/adminstuds.php',1).'?deletecomment='.$obj->id_comment.'&id='.$numsondageadmin.'"> '.img_picto('', 'delete.png').'</a> ';
|
||||
print $obj->usercomment.' : '.dol_nl2br($obj->comment)." <br>";
|
||||
$i++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -35,7 +36,7 @@ if (!$user->admin) accessforbidden();
|
|||
|
||||
// Init vars
|
||||
$action=GETPOST('action');
|
||||
$numsondageadmin=GETPOST("sondage");
|
||||
$numsondageadmin=GETPOST("id");
|
||||
$numsondage=substr($numsondageadmin, 0, 16);
|
||||
|
||||
$object=new Opensurveysondage($db);
|
||||
|
|
@ -471,7 +472,7 @@ if (GETPOST('ajoutsujet'))
|
|||
{
|
||||
//on recupere les données et les sujets du sondage
|
||||
print '<form name="formulaire" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="sondage" value="'.$numsondageadmin.'">';
|
||||
print '<input type="hidden" name="id" value="'.$numsondageadmin.'">';
|
||||
print '<input type="hidden" name="backtourl" value="'.GETPOST('backtourl').'">';
|
||||
|
||||
print '<div class="center">'."\n";
|
||||
|
|
@ -586,7 +587,7 @@ print '</div>'."\n";
|
|||
$nbcolonnes=substr_count($object->sujet,',')+1;
|
||||
|
||||
print '<form name="formulaire" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="sondage" value="'.$numsondageadmin.'">';
|
||||
print '<input type="hidden" name="id" value="'.$numsondageadmin.'">';
|
||||
|
||||
print '<div class="cadre"> '."\n";
|
||||
print '<br>'."\n";
|
||||
|
|
@ -643,7 +644,7 @@ if ($object->format=="D"||$object->format=="D+")
|
|||
}
|
||||
}
|
||||
|
||||
print '<td class="annee"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&sondage='.$object->id_sondage_admin.'">'.$langs->trans("Add").'</a></td>'."\n";
|
||||
print '<td class="annee"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage_admin.'">'.$langs->trans("Add").'</a></td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
print '<tr>'."\n";
|
||||
print '<td></td>'."\n";
|
||||
|
|
@ -669,7 +670,7 @@ if ($object->format=="D"||$object->format=="D+")
|
|||
}
|
||||
}
|
||||
|
||||
print '<td class="mois"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&sondage='.$object->id_sondage_admin.'">'.$langs->trans("Add").'</a></td>'."\n";
|
||||
print '<td class="mois"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage_admin.'">'.$langs->trans("Add").'</a></td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
print '<tr>'."\n";
|
||||
print '<td></td>'."\n";
|
||||
|
|
@ -693,7 +694,7 @@ if ($object->format=="D"||$object->format=="D+")
|
|||
}
|
||||
}
|
||||
|
||||
print '<td class="jour"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&sondage='.$object->id_sondage_admin.'">'.$langs->trans("Add").'</a></td>'."\n";
|
||||
print '<td class="jour"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage_admin.'">'.$langs->trans("Add").'</a></td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
//affichage des horaires
|
||||
|
|
@ -711,7 +712,7 @@ if ($object->format=="D"||$object->format=="D+")
|
|||
}
|
||||
}
|
||||
|
||||
print '<td class="heure"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&sondage='.$object->id_sondage_admin.'">'.$langs->trans("Add").'</a></td>'."\n";
|
||||
print '<td class="heure"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage_admin.'">'.$langs->trans("Add").'</a></td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
|
@ -728,7 +729,7 @@ else
|
|||
print '<td class="sujet">'.$tmp[0].'</td>'."\n";
|
||||
}
|
||||
|
||||
print '<td class="sujet"><a href="'.$_SERVER["PHP_SELF"].'?sondage='.$numsondageadmin.'&ajoutsujet=1&backtourl='.urlencode($_SERVER["PHP_SELF"].'?sondage='.$numsondageadmin).'">'.img_picto('',dol_buildpath('/opensurvey/img/add-16.png',1),'',1).'</a></td>'."\n";
|
||||
print '<td class="sujet"><a href="'.$_SERVER["PHP_SELF"].'?id='.$numsondageadmin.'&ajoutsujet=1&backtourl='.urlencode($_SERVER["PHP_SELF"]).'">'.img_picto('',dol_buildpath('/opensurvey/img/add-16.png',1),'',1).'</a></td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ while ($i < min($num,$limit))
|
|||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
print '<a href="'.dol_buildpath('/opensurvey/adminstuds.php',1).'?sondage='.$obj->id_sondage_admin.'">'.img_picto('','object_opensurvey').' '.$obj->id_sondage.'</a>';
|
||||
print '<a href="'.dol_buildpath('/opensurvey/adminstuds.php',1).'?id='.$obj->id_sondage_admin.'">'.img_picto('','object_opensurvey').' '.$obj->id_sondage.'</a>';
|
||||
print '</td><td>';
|
||||
$type=($obj->format=='A' || $obj->format=='A+')?'classic':'date';
|
||||
print img_picto('',dol_buildpath('/opensurvey/img/'.($type == 'classic'?'chart-32.png':'calendar-32.png'),1),'width="16"',1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user