1
|
|
|
<?php |
2
|
|
|
// $Id: cadastrardocumento.php,v 1.8 2007/03/24 17:50:52 marcellobrandao Exp $ |
3
|
|
|
// ------------------------------------------------------------------------ // |
4
|
|
|
// XOOPS - PHP Content Management System // |
5
|
|
|
// Copyright (c) 2000 XOOPS.org // |
6
|
|
|
// <http://www.xoops.org/> // |
7
|
|
|
// ------------------------------------------------------------------------ // |
8
|
|
|
// This program is free software; you can redistribute it and/or modify // |
9
|
|
|
// it under the terms of the GNU General Public License as published by // |
10
|
|
|
// the Free Software Foundation; either version 2 of the License, or // |
11
|
|
|
// (at your option) any later version. // |
12
|
|
|
// // |
13
|
|
|
// You may not change or alter any portion of this comment or credits // |
14
|
|
|
// of supporting developers from this source code or any supporting // |
15
|
|
|
// source code which is considered copyrighted (c) material of the // |
16
|
|
|
// original comment or credit authors. // |
17
|
|
|
// // |
18
|
|
|
// This program is distributed in the hope that it will be useful, // |
19
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
20
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
21
|
|
|
// GNU General Public License for more details. // |
22
|
|
|
// // |
23
|
|
|
// You should have received a copy of the GNU General Public License // |
24
|
|
|
// along with this program; if not, write to the Free Software // |
25
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
26
|
|
|
// ------------------------------------------------------------------------ // |
27
|
|
|
|
28
|
|
|
include dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; |
29
|
|
|
include_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.admin.php'; |
30
|
|
|
include dirname(__DIR__) . '/class/assessment_documentos.php'; |
31
|
|
|
include dirname(__DIR__) . '/class/assessment_provas.php'; |
32
|
|
|
global $xoopsModuleConfig; |
|
|
|
|
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Verifica��o de seguran�a validando o TOKEN |
36
|
|
|
*/ |
37
|
|
|
if (!$GLOBALS['xoopsSecurity']->check()) { |
38
|
|
|
redirect_header($_SERVER['HTTP_REFERER'], 5, _AM_ASSESSMENT_TOKENEXPIRED); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
$documento_texto = $_POST['campo_documento']; |
42
|
|
|
$fonte = $_POST['campo_fonte']; |
43
|
|
|
$titulo = $_POST['campo_titulo']; |
44
|
|
|
$perguntas = isset($_POST['campo_perguntas']) ? $_POST['campo_perguntas'] : ''; |
45
|
|
|
|
46
|
|
|
$cod_prova = $_POST['campo_codprova']; |
47
|
|
|
$uid_elaborador = $xoopsUser->getVar('uid'); |
48
|
|
|
$html = 1; |
49
|
|
|
if ($xoopsModuleConfig['editorpadrao'] === 'dhtmlext' || $xoopsModuleConfig['editorpadrao'] === 'textarea') { |
50
|
|
|
$html = 0; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
$fabrica_de_documentos = new Xoopsassessment_documentosHandler($xoopsDB); |
54
|
|
|
$documento = $fabrica_de_documentos->create(); |
55
|
|
|
if ($perguntas !== '') { |
56
|
|
|
$documento->setVar('cods_perguntas', implode(',', $perguntas)); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
$documento->setVar('titulo', $titulo); |
60
|
|
|
$documento->setVar('cod_prova', $cod_prova); |
61
|
|
|
$documento->setVar('documento', $documento_texto); |
62
|
|
|
$documento->setVar('tipo', 0); |
63
|
|
|
$documento->setVar('fonte', $fonte); |
64
|
|
|
$documento->setVar('uid_elaborador', $uid_elaborador); |
65
|
|
|
$documento->setVar('html', $html); |
66
|
|
|
if ($fabrica_de_documentos->insert($documento)) { |
67
|
|
|
redirect_header('main.php?op=editar_prova&cod_prova=' . $cod_prova, 2, _AM_ASSESSMENT_SUCESSO); |
68
|
|
|
} |
69
|
|
|
|
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state