Beispiel #1
0
    }
    if (count($Errors) == 0) {
        $Question->question = $form->Question;
        $Question->saveThis();
        if (isset($_POST['SaveAction'])) {
            erLhcoreClassModule::redirect('questionary/list');
            exit;
        } else {
            $tpl->set('updated', true);
        }
    } else {
        $tpl->set('errors', $Errors);
    }
}
// Voting tab actions
$Option = (int) $Params['user_parameters_unordered']['option_id'] > 0 ? erLhcoreClassModelQuestionOption::fetch((int) $Params['user_parameters_unordered']['option_id']) : new erLhcoreClassModelQuestionOption();
if (isset($_POST['UpdateO'])) {
    $tab = 'voting';
    $definition = array('Option' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Priority' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'));
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect();
        exit;
    }
    if (!$form->hasValidData('Option') || $form->Option == '') {
        $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('questionary/edit', 'Please enter an option!');
    }
    if ($form->hasValidData('Priority')) {
        $Option->priority = $form->Priority;
    } else {
<?php

if (!$currentUser->validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
    die('Invalid CSFR Token');
    exit;
}
$question = erLhcoreClassModelQuestionOption::fetch((int) $Params['user_parameters']['id']);
$question->removeThis();
erLhcoreClassModule::redirect('questionary/edit', "/{$question->question_id}/(tab)/voting");
exit;