コード例 #1
0
ファイル: encaminhamento.php プロジェクト: hexti/troncal
include_once '../DAO/WorkFlowDAO.php';
include_once '../WorkFlow.class.php';
checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true');
include_once '../../head.php';
$pedido = new WorkFlow();
$DAO = new WorkFlowDAO();
// if(!in_array(212, listarAcesso())){
// 	echo '<script language= "JavaScript">location.href="'.EXTERNAL_ROOT_PORTAL.'/modulos.php";</script>';
// }
if (!empty($_POST['cmd']) && $_POST['cmd'] == 'inserir') {
    $pedido->setLista($_POST['lista']);
    $pedido->setAssunto(limpaTexto($_POST['assunto']));
    $lista_info = $DAO->Listar("SELECT rl.*, nome_completo as responsavel FROM " . MYSQL_BASE_REMESSA_LISTAS . " rl\r\n\t\t\t\t\t\t\t\tINNER JOIN \r\n\t\t\t\t\t\t\t\t\t" . MYSQL_BASE_PESSOAS . " p ON rl.id_usuario = p.id \r\n\t\t\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\t\t\texcluido IS NULL AND rl.id= " . $pedido->getLista());
    foreach ($lista_info as $lista) {
        $pedido->setResponsavel($lista['id_usuario']);
        $pedido->setEmpresa($lista['id_empresa']);
        $pedido->setUsuario($lista['responsavel']);
    }
    if ($pedido->getLista() != '') {
        if ($pedido->getAssunto() != '') {
            $retorno = $DAO->Gravar($pedido);
            if ($retorno > 0) {
                $post = $_POST;
                foreach (array_keys($post) as $row) {
                    $explode = explode("-", $row);
                    if ($explode[0] == 'pergunta' && !empty($post[$row]) && $post['selecionado' . $explode[1]] == '1') {
                        $pedido->setPedidoInformacao($retorno);
                        $pedido->setPergunta($post[$row]);
                        $pedido->setListaArquivo($explode[1]);
                        /*Inicio - Anexar arquivo*/
                        if ($_FILES['file']['error'] != 4) {