27require
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
29require_once DOL_DOCUMENT_ROOT.
"/core/lib/files.lib.php";
30require_once DOL_DOCUMENT_ROOT.
"/opensurvey/class/opensurveysondage.class.php";
33$action =
GETPOST(
'action',
'aZ09');
36 $numsondage =
GETPOST(
"id",
'alpha');
41$result = $object->fetch(0, $numsondage);
47if (!$user->hasRight(
'opensurvey',
'read')) {
64$nbcolonnes = substr_count($object->sujet,
',') + 1;
65$toutsujet = explode(
",", $object->sujet);
68$input = $langs->trans(
"Name").
";";
69for ($i = 0; $toutsujet[$i]; $i++) {
70 if ($object->format ==
"D") {
73 $input .= $toutsujet[$i].
';';
79if (strpos($object->sujet,
'@') !==
false) {
81 for ($i = 0; $toutsujet[$i]; $i++) {
82 $heures = explode(
"@", $toutsujet[$i]);
83 $input .= $heures[1].
';';
90$sql =
'SELECT nom as name, reponses';
91$sql .=
' FROM '.MAIN_DB_PREFIX.
"opensurvey_user_studs";
92$sql .=
" WHERE id_sondage='".$db->escape($numsondage).
"'";
93$sql .=
" ORDER BY id_users";
94$resql = $db->query($sql);
96 $num = $db->num_rows($resql);
99 $obj = $db->fetch_object($resql);
102 $nombase = str_replace(
"°",
"'", $obj->name);
103 $input .= $nombase.
';';
106 $ensemblereponses = $obj->reponses;
107 for ($k = 0; $k < $nbcolonnes; $k++) {
108 if (empty($somme[$k])) {
111 $car = substr($ensemblereponses, $k, 1);
115 } elseif ($car ==
"2") {
131$filesize = strlen($input);
132$filename = $numsondage.
"_".
dol_print_date($now,
'%Y%m%d%H%M').
".csv";
136header(
'Content-Type: text/csv; charset=utf-8');
137header(
'Content-Length: '.$filesize);
138header(
'Content-Disposition: attachment; filename="'.$filename.
'"');
139header(
'Cache-Control: max-age=10');
Put here description of your class.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.