29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
31require_once DOL_DOCUMENT_ROOT.
"/core/lib/files.lib.php";
32require_once DOL_DOCUMENT_ROOT.
"/opensurvey/class/opensurveysondage.class.php";
42$action =
GETPOST(
'action',
'aZ09');
45 $numsondage =
GETPOST(
"id",
'alpha');
50$result =
$object->fetch(
'', $numsondage);
56if (!$user->hasRight(
'opensurvey',
'read')) {
73$nbcolonnes = substr_count(
$object->sujet,
',') + 1;
74$toutsujet = explode(
",",
$object->sujet);
77$input = $langs->trans(
"Name").
";";
78for ($i = 0; $toutsujet[$i]; $i++) {
82 $input .= $toutsujet[$i].
';';
88if (strpos(
$object->sujet,
'@') !==
false) {
90 for ($i = 0; $toutsujet[$i]; $i++) {
91 $heures = explode(
"@", $toutsujet[$i]);
92 $input .= $heures[1].
';';
99$sql =
'SELECT nom as name, reponses';
100$sql .=
' FROM '.MAIN_DB_PREFIX.
"opensurvey_user_studs";
101$sql .=
" WHERE id_sondage='".$db->escape($numsondage).
"'";
102$sql .=
" ORDER BY id_users";
103$resql = $db->query($sql);
105 $num = $db->num_rows($resql);
108 $obj = $db->fetch_object($resql);
111 $nombase = str_replace(
"°",
"'", $obj->name);
112 $input .= $nombase.
';';
115 $ensemblereponses = $obj->reponses;
116 for ($k = 0; $k < $nbcolonnes; $k++) {
117 if (empty($somme[$k])) {
120 $car = substr($ensemblereponses, $k, 1);
124 } elseif ($car ==
"2") {
140$filesize = strlen($input);
141$filename = $numsondage.
"_".
dol_print_date($now,
'%Y%m%d%H%M').
".csv";
145header(
'Content-Type: text/csv; charset=utf-8');
146header(
'Content-Length: '.$filesize);
147header(
'Content-Disposition: attachment; filename="'.$filename.
'"');
148header(
'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.