Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ( ! defined('BASEPATH')) exit('No direct script access allowed');
- class InscurrFactory {
- private $_ci;
- function __construct()
- {
- //When the class is constructed get an instance of codeigniter so we can access it locally
- $this->_ci =& get_instance();
- //Include the user_model so we can use it
- $this->_ci->load->model("SingOff_Model");
- }
- public function insertcurr() {
- $this->_ci->load->helper('form');
- //Are we getting an individual user or are we getting them all
- $query = $this->_ci->db->query('SELECT MAX(progressivo) as progress, MAX(id) as maxid from curriculum');
- //Getting an individual user
- foreach ($query->result() as $row){
- $prog = $row->progress;
- $id = $row->maxid;
- }
- $idprovnasc = $this->_ci->input->post('cpnascita');
- $idprovres = $this->_ci->input->post('cpresidenza');
- $idprovdom = $this->_ci->input->post('cpdomicilio');
- $query = $this->_ci->db->query('SELECT id from curriculum where codicefiscale = "'.$this->_ci->input->post('ccodfis').'"');
- if ($query->num_rows() > 0) {
- return FALSE;
- }else{
- foreach ($query->result() as $row){
- $idprovdom = $row->provincia;
- }
- if ($this->_ci->input->post('ccinglese') != 0){//$_SESSION['ccinglese'] != 0){
- $corsoinglese = 0;
- }else{
- $corsoinglese = 1;
- }
- if ($this->_ci->input->post('ccfrancese') != 0){
- $corsofrancese = 0;
- }else{
- $corsofrancese = 1;
- }
- if ($this->_ci->input->post('ccspagnolo') != 0){
- $corsospagnolo = 0;
- }else{
- $corsospagnolo = 1;
- }
- if ($this->_ci->input->post('cctedesco') != 0){
- $corsotedesco = 0;
- }else{
- $corsotedesco = 1;
- }
- if (isset($_SESSION['logged_in']['id'])){
- $idsel = $_SESSION['logged_in']['id'];
- }else{
- $idsel = $_SESSION['idreg'];
- }
- $query = $this->_ci->db->query('SELECT nome from utenti where id = "'.$idsel.'"');//.$_SESSION['logged_in']['id'].'"');
- if ($query->num_rows() > 0) {
- foreach ($query->result() as $row){
- $nomecognome = explode(" ", $row->nome);
- $nomeins = $nomecognome[0]; // piece1
- $cognomeins= $nomecognome[1]; // piece2
- }
- }
- if ($this->_ci->session->userdata('email')){
- $mailreg = $this->_ci->session->userdata('email');
- }else{
- $mailreg = $_SESSION['mailreg'];
- }
- $data = array(
- 'nome'=>$nomeins,
- 'cognome'=>$cognomeins,
- 'sesso'=>$this->_ci->input->post('csesso'),
- 'datanascita'=>date("Y-m-d", strtotime($this->_ci->input->post('cdnascita'))),
- 'luogonascita'=>$this->_ci->input->post('ccnascita'),
- 'provincianascita'=>$idprovnasc,
- 'statonascita'=>$this->_ci->input->post('csnascita'),
- 'indirizzoresidenza'=>$this->_ci->input->post('ciresidenza'),
- 'capresidenza'=>$this->_ci->input->post('ccapresidenza'),
- 'cittaresidenza'=>$this->_ci->input->post('ccresidenza'),
- 'provinciaresidenza'=>$idprovres,
- 'statoresidenza'=>$this->_ci->input->post('csresidenza'),
- 'indirizzodomicilio'=>$this->_ci->input->post('cidomicilio'),
- 'capdomicilio'=>$this->_ci->input->post('ccapdomicilio'),
- 'cittadomicilio'=>$this->_ci->input->post('ccdomicilio'),
- 'provinciadomicilio'=> $idprovdom,
- 'statodomicilio'=>$this->_ci->input->post('csdomicilio'),
- 'cittadinanza'=>$this->_ci->input->post('ccittadinanza'),
- 'permessosoggiorno'=>$this->_ci->input->post('psoggiorno'),
- 'codicefiscale'=>$this->_ci->input->post('ccodfis'),
- 'partitaiva'=>$this->_ci->input->post('cpiva'),
- 'telefono'=>$this->_ci->input->post('ctel'),
- 'telefono2'=>' ',
- 'cellulare'=>$this->_ci->input->post('ccel'),
- 'cellulare2'=>' ',
- //'email'=>$this->_ci->input->post('cemail'),
- 'email'=>$mailreg,
- 'email2'=>' ',
- 'patente'=>$this->_ci->input->post('cpatente'),
- 'automunito'=>$this->_ci->input->post('automunito'),
- 'altezza'=>$this->_ci->input->post('caltezza'),
- 'peso'=>$this->_ci->input->post('cpeso'),
- 'tagliamaglia'=>$this->_ci->input->post('cmaglia'),
- 'tagliagonnapantaloni'=>$this->_ci->input->post('cpantalone'),
- 'misurascarpe'=>$this->_ci->input->post('cscarpe'),
- 'certificatoHACCP'=>$this->_ci->input->post('haccpsino'),
- 'titolostudio'=>$this->_ci->input->post('titolo'),
- 'voto'=>$this->_ci->input->post('cvoto'),
- 'master'=>$this->_ci->input->post('mastersino'),
- 'inglese'=>$this->_ci->input->post('cinglese'),
- 'francese'=>$this->_ci->input->post('cfrancese'),
- 'spagnolo'=>$this->_ci->input->post('cspagnolo'),
- 'tedesco'=>$this->_ci->input->post('ctedesco'),
- 'altralingua'=>$this->_ci->input->post('caltra'),
- 'conoscenzaaltralingua'=>$this->_ci->input->post('caltraliv'),
- 'corsoinglese'=>$corsoinglese,
- 'corsofrancese'=>$corsofrancese,
- 'corsospagnolo'=>$corsospagnolo,
- 'corsotedesco'=>$corsotedesco,
- 'livellocorsoinglese'=>$this->_ci->input->post('ccinglese'),
- 'livellocorsofrancese'=>$this->_ci->input->post('ccfrancese'),
- 'livellocorsospagnolo'=>$this->_ci->input->post('ccspagnolo'),
- 'livellocorsotedesco'=>$this->_ci->input->post('cctedesco'),
- 'corsoaltralingua'=>$this->_ci->input->post('ccaltra'),
- 'livellocorsoaltralingua'=>$this->_ci->input->post('ccaltraliv'),
- 'esperienza'=>$this->_ci->input->post('esperienza'),
- 'anniesperienza'=>$this->_ci->input->post('caesperienza'),
- 'addettovendita'=>$this->_ci->input->post('addvendite'),
- 'allestitore'=>$this->_ci->input->post('allestitore'),
- 'hostess'=>$this->_ci->input->post('hostess'),
- 'hostessecm'=>$this->_ci->input->post('hostessecm'),
- 'hostessfiera'=>$this->_ci->input->post('hostessfiera'),
- 'promoter'=>$this->_ci->input->post('promoter'),
- 'steward'=>$this->_ci->input->post('steward'),
- 'modello'=>$this->_ci->input->post('modello'),
- 'merchandiser'=>$this->_ci->input->post('merchandiser'),
- 'musicista'=>$this->_ci->input->post('cmusicista'),
- 'altrafigura'=>$this->_ci->input->post('espaltro'),
- 'agenzialavorato'=>$this->_ci->input->post('cespprec'),
- //'foto1'=>$this->_ci->input->post('pic1'),
- 'foto1'=>$_SESSION['pic1'],
- //'curriculum'=>$this->_ci->input->post('currfile'),
- 'curriculum'=>$_SESSION['currfile'],
- 'password'=>$this->_ci->input->post('cpassword'),
- //'foto2'=>$this->_ci->input->post('pic2'),
- 'foto2'=>$_SESSION['pic2'],
- //'foto3'=>$this->_ci->input->post('pic3'),
- 'foto3'=>$_SESSION['pic3'],
- 'progressivo'=>'$prog',
- 'codice'=>' ',
- 'noteinterne'=>' ');
- //print_r($data); die;
- $query = $this->_ci->db->insert('curriculum', $data);
- $query = $this->_ci->db->query('UPDATE utenti SET idcurr = \''.$this->_ci->db->insert_id().'\' where id = "'.$idsel.'"');
- $_SESSION['logged_in']['idcurr'] = $this->_ci->db->insert_id();
- if ($this->_ci->db->affected_rows() > 0) {
- $this->_ci->load->library('email');
- $this->_ci->email->set_mailtype("html");
- $this->_ci->email->set_newline("\r\n");
- $this->_ci->email->set_crlf("\r\n");
- $this->_ci->email->from('noreply@animania.it');
- if ($this->_ci->session->userdata('email')){
- $this->_ci->email->to($this->_ci->session->userdata('email')); // change it to yours
- $corpomess = 'Ciao,<br> La tua registrazione su Animania.it è stata accettata.<br> Le credenziali per accedere sono:<br>Username: '.$this->_ci->session->userdata('email').'<br> Password: '.$this->_ci->session->userdata('password').'<br> Animania.it ti augura una buona giornata! ';
- }else{
- $this->_ci->email->to($_SESSION['mailreg']);
- $corpomess = 'Ciao,<br> La tua registrazione su Animania.it è stata accettata.<br> Le credenziali per accedere sono:<br>Username: '.$_SESSION['mailreg'].'<br> Password: '.$_SESSION['passreg'].'<br> Animania.it ti augura una buona giornata! ';
- }
- //$this->email->to('ciro.latela@gmail.com'); // change it to yours
- $this->_ci->email->subject('Registrazione su Animania.it');
- //$corpomess = 'Ciao,<br> La tua registrazione su Animania.it è stata accettata.<br> Le credenziali per accedere sono:<br>Username: '.$this->session->userdata('email').'<br> Password: '.$this->session->userdata('password').'<br> Animania.it ti augura una buona giornata! ';
- $this->_ci->email->message($corpomess);
- if ($this->_ci->email->send()) {
- //$this->_ci->load->view('successreg');
- return TRUE;
- } else {
- show_error($this->_ci->email->print_debugger());
- return FALSE;
- }
- }else{
- return FALSE;
- }
- }
- }
- public function updatecurr() {
- $this->_ci->load->helper('form');
- $idprovnasc = $this->_ci->input->post('cpnascita');
- $idprovres = $this->_ci->input->post('cpresidenza');
- $idprovdom = $this->_ci->input->post('cpdomicilio');
- if ($this->_ci->input->post('ccinglese') != 0){//$_SESSION['ccinglese'] != 0){
- $corsoinglese = 0;
- }else{
- $corsoinglese = 1;
- }
- if ($this->_ci->input->post('ccfrancese') != 0){
- $corsofrancese = 0;
- }else{
- $corsofrancese = 1;
- }
- if ($this->_ci->input->post('ccspagnolo') != 0){
- $corsospagnolo = 0;
- }else{
- $corsospagnolo = 1;
- }
- if ($this->_ci->input->post('cctedesco') != 0){
- $corsotedesco = 0;
- }else{
- $corsotedesco = 1;
- }
- if (!isset($_SESSION['currfile'])){
- $curr = $this->_ci->input->post('currfile');
- }else{
- $curr = $_SESSION['currfile'];
- }
- if (!isset($_SESSION['pic1'])){
- $pic1 = $this->_ci->input->post('pic1');
- }else{
- $pic1 = $_SESSION['pic1'];
- }
- if (!isset($_SESSION['pic2'])){
- $pic2 = $this->_ci->input->post('pic2');
- }else{
- $pic2 = $_SESSION['pic2'];
- }
- if (!isset($_SESSION['pic3'])){
- $pic3 = $this->_ci->input->post('pic3');
- }else{
- $pic3 = $_SESSION['pic3'];
- }
- //echo 'foto3: >'.$pic3.'<';
- $data = array(
- 'nome'=>$this->_ci->input->post('cnome'),
- 'cognome'=>$this->_ci->input->post('ccognome'),
- 'sesso'=>$this->_ci->input->post('csesso'),
- 'datanascita'=>date("Y-m-d", strtotime($this->_ci->input->post('cdnascita'))),
- 'luogonascita'=>$this->_ci->input->post('ccnascita'),
- 'provincianascita'=>$idprovnasc,
- 'statonascita'=>$this->_ci->input->post('csnascita'),
- 'indirizzoresidenza'=>$this->_ci->input->post('ciresidenza'),
- 'capresidenza'=>$this->_ci->input->post('ccapresidenza'),
- 'cittaresidenza'=>$this->_ci->input->post('ccresidenza'),
- 'provinciaresidenza'=>$idprovres,
- 'statoresidenza'=>$this->_ci->input->post('csresidenza'),
- 'indirizzodomicilio'=>$this->_ci->input->post('cidomicilio'),
- 'capdomicilio'=>$this->_ci->input->post('ccapdomicilio'),
- 'cittadomicilio'=>$this->_ci->input->post('ccdomicilio'),
- 'provinciadomicilio'=> $idprovdom,
- 'statodomicilio'=>$this->_ci->input->post('csdomicilio'),
- 'cittadinanza'=>$this->_ci->input->post('ccittadinanza'),
- 'permessosoggiorno'=>$this->_ci->input->post('psoggiorno'),
- 'codicefiscale'=>$this->_ci->input->post('ccodfis'),
- 'partitaiva'=>$this->_ci->input->post('cpiva'),
- 'telefono'=>$this->_ci->input->post('ctel'),
- 'telefono2'=>' ',
- 'cellulare'=>$this->_ci->input->post('ccel'),
- 'cellulare2'=>' ',
- 'email'=>$_SESSION['logged_in']['user'],
- 'email2'=>' ',
- 'patente'=>$this->_ci->input->post('cpatente'),
- 'automunito'=>$this->_ci->input->post('automunito'),
- 'altezza'=>$this->_ci->input->post('caltezza'),
- 'peso'=>$this->_ci->input->post('cpeso'),
- 'tagliamaglia'=>$this->_ci->input->post('cmaglia'),
- 'tagliagonnapantaloni'=>$this->_ci->input->post('cpantalone'),
- 'misurascarpe'=>$this->_ci->input->post('cscarpe'),
- 'certificatoHACCP'=>$this->_ci->input->post('haccpsino'),
- 'titolostudio'=>$this->_ci->input->post('titolo'),
- 'voto'=>$this->_ci->input->post('cvoto'),
- 'master'=>$this->_ci->input->post('mastersino'),
- 'inglese'=>$this->_ci->input->post('cinglese'),
- 'francese'=>$this->_ci->input->post('cfrancese'),
- 'spagnolo'=>$this->_ci->input->post('cspagnolo'),
- 'tedesco'=>$this->_ci->input->post('ctedesco'),
- 'altralingua'=>$this->_ci->input->post('caltra'),
- 'conoscenzaaltralingua'=>$this->_ci->input->post('caltraliv'),
- 'corsoinglese'=>$corsoinglese,
- 'corsofrancese'=>$corsofrancese,
- 'corsospagnolo'=>$corsospagnolo,
- 'corsotedesco'=>$corsotedesco,
- 'livellocorsoinglese'=>$this->_ci->input->post('ccinglese'),
- 'livellocorsofrancese'=>$this->_ci->input->post('ccfrancese'),
- 'livellocorsospagnolo'=>$this->_ci->input->post('ccspagnolo'),
- 'livellocorsotedesco'=>$this->_ci->input->post('cctedesco'),
- 'corsoaltralingua'=>$this->_ci->input->post('ccaltra'),
- 'livellocorsoaltralingua'=>$this->_ci->input->post('ccaltraliv'),
- 'esperienza'=>$this->_ci->input->post('esperienza'),
- 'anniesperienza'=>$this->_ci->input->post('caesperienza'),
- 'addettovendita'=>$this->_ci->input->post('addvendite'),
- 'allestitore'=>$this->_ci->input->post('allestitore'),
- 'hostess'=>$this->_ci->input->post('hostess'),
- 'hostessecm'=>$this->_ci->input->post('hostessecm'),
- 'hostessfiera'=>$this->_ci->input->post('hostessfiera'),
- 'promoter'=>$this->_ci->input->post('promoter'),
- 'steward'=>$this->_ci->input->post('steward'),
- 'modello'=>$this->_ci->input->post('modello'),
- 'merchandiser'=>$this->_ci->input->post('merchandiser'),
- 'musicista'=>$this->_ci->input->post('cmusicista'),
- 'altrafigura'=>$this->_ci->input->post('espaltro'),
- 'agenzialavorato'=>$this->_ci->input->post('cespprec'),
- 'foto1'=>$pic1,
- 'curriculum'=>$curr,
- 'foto2'=>$pic2,
- 'foto3'=>$pic3,
- 'progressivo'=>$this->_ci->input->post('prog'),
- 'codice'=>' ',
- 'noteinterne'=>$this->_ci->input->post('note')
- );
- $query = $this->_ci->db->update('curriculum', $data, array('id' => $_SESSION['logged_in']['idcurr']));
- if ($this->_ci->db->affected_rows() > 0) {
- return TRUE;
- }else{
- $errore = $this->_ci->db->error();
- echo 'query: '.$this->_ci->db->last_query();
- echo 'codice: '.$errore['code'].'<br>';
- echo 'messaggio: '.$errore['message'];
- //print_r($this->_ci->db->error());
- //echo 'Codice: '.$this->_ci->db->_error_number();
- //echo 'Errore: '.$this->_ci->db->_error_message();
- return FALSE;
- }
- }
- public function createObjectFromData($row) {
- $provincia = new Prov_Model();
- $provincia->setId($row->id);
- $provincia->setIdregione($row->idregione);
- $provincia->setProvincia($row->provincia);
- $provincia->setSigla($row->sigla);
- $provincia->setRegione($row->regione);
- return $provincia;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement