Esempio n. 1
0
/**
 * Add a poll
 *
 * @return	void
 */
function ajouter_sondage()
{
    global $db, $user;
    require_once DOL_DOCUMENT_ROOT . '/opensurvey/class/opensurveysondage.class.php';
    $sondage = dol_survey_random(16);
    $allow_comments = empty($_SESSION['allow_comments']) ? 0 : 1;
    $allow_spy = empty($_SESSION['allow_spy']) ? 0 : 1;
    // Insert survey
    $opensurveysondage = new Opensurveysondage($db);
    $opensurveysondage->id_sondage = $sondage;
    $opensurveysondage->commentaires = $_SESSION['commentaires'];
    $opensurveysondage->mail_admin = $_SESSION['adresse'];
    $opensurveysondage->nom_admin = $_SESSION['nom'];
    $opensurveysondage->titre = $_SESSION['titre'];
    $opensurveysondage->date_fin = $_SESSION['champdatefin'];
    $opensurveysondage->format = $_SESSION['formatsondage'];
    $opensurveysondage->mailsonde = $_SESSION['mailsonde'];
    $opensurveysondage->allow_comments = $allow_comments;
    $opensurveysondage->allow_spy = $allow_spy;
    $opensurveysondage->sujet = $_SESSION['toutchoix'];
    $res = $opensurveysondage->create($user);
    if ($res < 0) {
        dol_print_error($db);
    }
    unset($_SESSION["titre"]);
    unset($_SESSION["nom"]);
    unset($_SESSION["adresse"]);
    unset($_SESSION["commentaires"]);
    unset($_SESSION["mailsonde"]);
    unset($_SESSION['allow_comments']);
    unset($_SESSION['allow_spy']);
    unset($_SESSION['toutchoix']);
    unset($_SESSION['totalchoixjour']);
    unset($_SESSION['champdatefin']);
    $urlback = dol_buildpath('/opensurvey/card.php', 1) . '?id=' . $sondage;
    header("Location: " . $urlback);
    exit;
}
 */
/**
 *	\file       htdocs/opensurvey/exportcsv.php
 *	\ingroup    opensurvey
 *	\brief      Page to list surveys
 */
require_once '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
require_once DOL_DOCUMENT_ROOT . "/opensurvey/class/opensurveysondage.class.php";
$action = GETPOST('action');
$numsondage = '';
if (GETPOST('id')) {
    $numsondage = GETPOST("id", 'alpha');
}
$object = new Opensurveysondage($db);
$result = $object->fetch(0, $numsondage);
if ($result <= 0) {
    dol_print_error('', 'Failed to get survey id ' . $numsondage);
}
/*
 * Actions
 */
/*
 * View
 */
$now = dol_now();
$nbcolonnes = substr_count($object->sujet, ',') + 1;
$toutsujet = explode(",", $object->sujet);
// affichage des sujets du sondage
$input .= $langs->trans("Name") . ";";
Esempio n. 3
0
 *	\brief      Page to preview votes of a survey
 */
$res = 0;
require_once '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
require_once DOL_DOCUMENT_ROOT . "/opensurvey/class/opensurveysondage.class.php";
require_once DOL_DOCUMENT_ROOT . "/opensurvey/fonctions.php";
// Security check
if (!$user->rights->opensurvey->read) {
    accessforbidden();
}
// Init vars
$action = GETPOST('action');
$numsondage = GETPOST("id");
$object = new Opensurveysondage($db);
$result = $object->fetch(0, $numsondage);
if ($result <= 0) {
    dol_print_error('', 'Failed to get survey id ' . $numsondage);
}
$nblignes = $object->fetch_lines();
/*
 * Actions
 */
//Return to the results
if (GETPOST('retoursondage')) {
    header('Location: results.php?id=' . $_GET['id']);
    exit;
}
$nbcolonnes = substr_count($object->sujet, ',') + 1;
// Add vote
Esempio n. 4
0
define("NOLOGIN", 1);
// This means this output page does not require to be logged.
define("NOCSRFCHECK", 1);
// We accept to go on this page from external web site.
require_once '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
require_once DOL_DOCUMENT_ROOT . "/opensurvey/class/opensurveysondage.class.php";
require_once DOL_DOCUMENT_ROOT . "/opensurvey/fonctions.php";
// Init vars
$action = GETPOST('action');
$numsondage = '';
if (GETPOST('sondage')) {
    $numsondage = GETPOST('sondage', 'alpha');
}
$object = new Opensurveysondage($db);
$result = $object->fetch(0, $numsondage);
if ($result <= 0) {
    dol_print_error('', 'Failed to get survey id ' . $numsondage);
}
$nblignes = $object->fetch_lines();
//If the survey has not yet finished, then it can be modified
$canbemodified = $object->date_fin > dol_now();
/*
 * Actions
 */
$nbcolonnes = substr_count($object->sujet, ',') + 1;
$listofvoters = explode(',', $_SESSION["savevoter"]);
// Add comment
if (GETPOST('ajoutcomment')) {
    if (!$canbemodified) {
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
require_once DOL_DOCUMENT_ROOT . "/core/class/doleditor.class.php";
require_once DOL_DOCUMENT_ROOT . "/opensurvey/class/opensurveysondage.class.php";
require_once DOL_DOCUMENT_ROOT . "/opensurvey/fonctions.php";
// Security check
if (!$user->rights->opensurvey->read) {
    accessforbidden();
}
// Initialisation des variables
$action = GETPOST('action');
$numsondage = '';
if (GETPOST('id')) {
    $numsondage = GETPOST('id', 'alpha');
}
$object = new Opensurveysondage($db);
$result = $object->fetch(0, $numsondage);
if ($result <= 0) {
    dol_print_error($db, $object->error);
    exit;
}
$expiredate = dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear'));
/*
 * Actions
 */
// Delete
if ($action == 'delete_confirm') {
    // Security check
    if (!$user->rights->opensurvey->write) {
        accessforbidden();
    }