Example #1
0
 function gravar_voto($enquete_id, $resposta, $cod_aluno = null)
 {
     $ok = false;
     if (!is_array($resposta)) {
         $resposta = array($resposta);
     }
     $ip = $_SERVER['HTTP_X_REAL_IP'] ? $_SERVER['HTTP_X_REAL_IP'] : $_SERVER['REMOTE_ADDR'];
     $opcao = MY_Utils::to_pg_array($resposta);
     $voto = array('enquete_id' => $enquete_id, 'opcao_id' => $opcao, 'ip' => $ip, 'cod_aluno' => $cod_aluno);
     $ok = $this->db->insert('cms_enquetes_votos', $voto);
     return $ok;
 }