28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
30require_once DOL_DOCUMENT_ROOT.
"/core/lib/files.lib.php";
31require_once DOL_DOCUMENT_ROOT.
"/opensurvey/class/opensurveysondage.class.php";
41$action =
GETPOST(
'action',
'aZ09');
44 $numsondage =
GETPOST(
"id",
'alpha');
49$result =
$object->fetch(0, $numsondage);
55if (!$user->hasRight(
'opensurvey',
'read')) {
72$nbcolonnes = substr_count(
$object->sujet,
',') + 1;
73$toutsujet = explode(
",",
$object->sujet);
76$input = $langs->trans(
"Name").
";";
77for ($i = 0; $toutsujet[$i]; $i++) {
81 $input .= $toutsujet[$i].
';';
87if (strpos(
$object->sujet,
'@') !==
false) {
89 for ($i = 0; $toutsujet[$i]; $i++) {
90 $heures = explode(
"@", $toutsujet[$i]);
91 $input .= $heures[1].
';';
98$sql =
'SELECT nom as name, reponses';
99$sql .=
' FROM '.MAIN_DB_PREFIX.
"opensurvey_user_studs";
100$sql .=
" WHERE id_sondage='".$db->escape($numsondage).
"'";
101$sql .=
" ORDER BY id_users";
102$resql = $db->query($sql);
104 $num = $db->num_rows($resql);
107 $obj = $db->fetch_object($resql);
110 $nombase = str_replace(
"°",
"'", $obj->name);
111 $input .= $nombase.
';';
114 $ensemblereponses = $obj->reponses;
115 for ($k = 0; $k < $nbcolonnes; $k++) {
116 if (empty($somme[$k])) {
119 $car = substr($ensemblereponses, $k, 1);
123 } elseif ($car ==
"2") {
139$filesize = strlen($input);
140$filename = $numsondage.
"_".
dol_print_date($now,
'%Y%m%d%H%M').
".csv";
144header(
'Content-Type: text/csv; charset=utf-8');
145header(
'Content-Length: '.$filesize);
146header(
'Content-Disposition: attachment; filename="'.$filename.
'"');
147header(
'Cache-Control: max-age=10');
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Put here description of your class.
dol_now($mode='auto')
Return date for now.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.