function createCV() { $error = ""; $cv = new CV(); if (isset($_POST['fname']) && !empty($_POST['fname'])) { $cv->cv_fname = $_POST['fname']; } else { $error .= "First Name "; } if (isset($_POST['lname']) && !empty($_POST['lname'])) { $cv->cv_lname = $_POST['lname']; } else { $error .= "Last Name "; } if (isset($_POST['email']) && !empty($_POST['email']) && checkEmail($_POST['email']) == true) { $cv->cv_email = $_POST['email']; } else { $error .= "Email "; } if (isset($_POST['phone']) && !empty($_POST['phone']) && checkPhone($_POST['phone']) == true) { $cv->cv_phone = $_POST['phone']; } else { $error .= "Phone Number "; } if (isset($_POST['role']) && !empty($_POST['role'])) { $cv->cv_role = $_POST['role']; } $preferred = ""; for ($i = 1; $i <= 38; $i++) { $checkbox = "cb" . $i; if (isset($_POST[$checkbox])) { $preferred .= $_POST[$checkbox] . ", "; } } if ($preferred == "") { $cv->cv_preferred = "Any"; } else { $cv->cv_preferred = $preferred; } $upload = $this->upload_cv(); if ($upload != 3 && $upload != 2) { $cv->cv_doc_path = $upload; } elseif ($upload == 1) { $error .= "Document Upload Problem "; } elseif ($upload == 2) { $error .= "File type not acceptable "; } if ($error == "") { if ($cv->create()) { return 1; } else { return 2; } } else { return $error; } }
/** * Funzione che ascolta il form di inserimento Curriculum */ public function listenerCvForm() { //se è stato inviato un cv attivo l'ascoltatore if (isset($_POST['invia-cv'])) { //controllo lato server dei campi obbligatori: Nome, Cognome, Email, Categoria, CV if ($this->checkData($_POST)) { //print_r($_POST); // print_r($_FILES); //impongo un path dove salvare il cv $folder = 'upload_CV'; //controllo se il path esiste $this->checkFolder($folder); //carico nel filesystem /*MODIFICA PER CAMBIARE IL NOME DEL FILE SALVATO */ $nameFile = str_replace('.', '-', strip_tags(trim($_POST['email']))); $nameFile .= '-' . strip_tags($_POST['categoria']); //ottengo l'estensione del file $temp = explode('.', $_FILES['carica-cv']['name']); $extension = $temp[count($temp) - 1]; $nameFile .= '.' . $extension; /*FINE MODIFICA */ $check_upload = $this->uploadCvOnFileSystem($_FILES['carica-cv'], $folder, $nameFile); if ($check_upload) { //se l'upload è avvenuto correttamente, salvo i dati nel database $cv = new CV(); //campi obbligatori $cv->setCategoria(strip_tags($_POST['categoria'])); $cv->setCognome(strip_tags(trim($_POST['cognome']))); $cv->setCv($folder . '/' . $nameFile); $cv->setEmail(strip_tags(trim($_POST['email']))); $cv->setNome(strip_tags(trim($_POST['nome']))); //campi non obbligatori if (isset($_POST['ruolo']) && $_POST['ruolo'] != '') { $cv->setRuolo($_POST['ruolo']); } //se l'utente inserisce un ruolo che non è stato confermato dall'amministratore //il processo di associazione di quel ruolo al cv avviene con un precedente inserimento del ruolo indicato nel db //il ruolo verrà aggiunto nel db e sarà associato all'attuale cv if (isset($_POST['altro-ruolo']) && $_POST['altro-ruolo'] != '') { $ruolo = new Ruolo(); $ruolo->setCategoria(strip_tags($_POST['categoria'])); $ruolo->setNome(strip_tags(trim($_POST['altro-ruolo']))); //imposto il ruolo come non ancora pubblicato $ruolo->setPubblicato(0); //salvo il ruolo nel db e ottengo l'id appena salvato $idNuovoRuolo = $this->ruoloController->saveRuolo($ruolo); if (!(isset($_POST['ruolo']) && $_POST['ruolo'] != '')) { //se non ho un ruolo già salvato dal campo $_POST['ruolo'] (ha la precedenza su questo), lo salvo $cv->setRuolo($idNuovoRuolo); } } if (isset($_POST['regione'])) { $cv->setRegione($_POST['regione']); } if (isset($_POST['provincia'])) { $cv->setProvincia($_POST['provincia']); } //eseguo il controllo se pubblicare o meno il cv //ciò è dato dalla pubblicazione del RUOLO. Se il Ruolo è pubblicato, pubblico anche il CV if ($cv->getRuolo() != null) { //se il ruolo è stato inserito allora bisogna che questo venga controllato //se il ruolo esiste ed è pubblicato allora il cv può essere pubblicato //se il ruolo non è presente oppure non è ancora stato approvato, il cv non può essere pubblicato if ($this->ruoloController->isRuoloPubblicato($cv->getRuolo())) { //AGGIUNTA --> Il CV viene pubblicato anche se non è associato al ruolo. $cv->setPubblicato(1); } else { $cv->setPubblicato(0); } } else { //se il ruolo non è presente nel cv inviato, allora questo può essere pubblicato tranquillamente. $cv->setPubblicato(1); } //salvo il cv nel db $valueSaveCV = $this->cvController->saveCV($cv); if ($valueSaveCV == 1) { echo '<div class="ok">Il Curriculum è stato caricato correttamente nel sistema!</div>'; } else { if ($valueSaveCV == 2) { echo '<div class="ok">Il Curriculum per la categoria occupazionale indicata è già presente nel sistema. Abbiamo provveduto ad aggiornare con l\'ultimo Curriculum fornito.</div>'; } else { echo '<div class="ko">Sono sopraggiunti errori nel caricare il Curriculum nel sistema.</div>'; } } } } else { echo '<div class="ko">Abbiamo riscontrato un errore nel caricamento per il seguente motivo:'; if (isset($_SESSION['errorEntry'])) { echo $_SESSION['errorEntry']; } echo '</div>'; } } }
public function createCV($lastID, $i) { if ($lastID == null) { $newCV = new CV("CV001"); } else { ++$lastID; $newCV = new CV("{$lastID}"); } $filePath = $newCV->fileUpload($i); if ($filePath != null) { $newCV->submittedCV = $filePath; $newCV->submittedDate = date("Y-m-d"); return $newCV; } else { return null; } }
/** * Funzione che invia una mail di conferma */ public function sendConfirmEmail($type, CV $cv) { //type identifica il tipo di mail da spedire //type == 'user' --> Invia una mail di conferma all'utente //type == 'admin' --> invia una mail di notifica all'amministratore $msg = ''; $title = ''; $email = ''; switch ($type) { case 'user': $email = $cv->getEmail(); $title = $this->language->getTranslation('email-save-title-user'); $msg = $this->language->getTranslation('msg-save-email-user'); break; case 'admin': $email = get_option('admin_email'); $title = $this->language->getTranslation('email-save-title-admin') . ' - ' . $cv->getCognome() . ' ' . $cv->getNome(); if ($cv->getPubblicato() == 0) { $msg = $this->language->getTranslation('msg-save-email-admin-cv-to-approve'); } else { $msg = $this->language->getTranslation('msg-save-email-admin'); } break; case 'update': $email = $cv->getEmail(); $title = $this->language->getTranslation('msg-approved-email-title'); $msg = $this->language->getTranslation('msg-approved-email-msg'); break; } try { //aggiungo il filtro per l'html sulla mail add_filter('wp_mail_content_type', create_function('', 'return "text/html"; ')); //invio la mail wp_mail($email, $title, $msg); return true; } catch (Exception $ex) { _e($ex); return false; } }
/** * La funzione aggiorna i campi di un cv esistente riconosciuto tramite l'ID * * @param CV $cv * @param type $idCV * @return boolean */ public function updateCV(CV $cv, $idCV) { try { //imposto il timezone date_default_timezone_set('Europe/Rome'); $timestamp = date('Y-m-d H:i:s', strtotime("now")); $this->wpdb->update($this->table, array('data_inserimento' => $timestamp, 'nome' => addslashes($cv->getNome()), 'cognome' => addslashes($cv->getCognome()), 'ruolo' => addslashes($cv->getRuolo()), 'regione' => addslashes($cv->getRegione()), 'provincia' => addslashes($cv->getProvincia()), 'cv' => addslashes($cv->getCv()), 'pubblicato' => addslashes($cv->getPubblicato())), array('ID' => $idCV), array('%s', '%s', '%s', '%d', '%s', '%s', '%s'), array('%d')); return true; } catch (Exception $ex) { _e($ex); return false; } }
<?php //controller user if (!isset($_REQUEST['action'])) { $_REQUEST['action'] = 'default'; } $action = $_REQUEST['action']; require_once 'modeles/m_cv.php'; switch ($action) { case 'ajoutExperience': $idUser = $_SESSION['id_user']; $intitule = $_POST['intitule']; $date_debut = $_POST['date_debut']; $date_fin = $_POST['date_fin']; $description = $_POST['description']; CV::ajoutExp($intitule, $date_debut, $date_fin, $description, $idUser); // header('Location: ./index.php'); break; /*default: header('Location: ./index.php'); break;*/ }
/** * Get all of the cvs for a given user. * * @param User $user * @return Collection */ public function forUser(User $user) { return CV::where('user_id', $user->id)->orderBy('created_at', 'asc')->get(); }
/** * Display the specified resource. * * @param Request $request * @param CV $cv * @return \Illuminate\Http\Response */ public function show(Request $request, CV $cv) { // Get the cv sections. $sections = $cv->sections()->get(); // Build empty subsections. $workSection = array(); $languageSection = array(); $educationSection = array(); $hobbySection = array(); $skillSection = array(); // For each section, determine it's type, and append it's data to the corresponding subsection. foreach ($sections as $section) { $w = Work::whereSectionId($section->id)->get(['name', 'location', 'title', 'description', 'start_date', 'end_date'])->toArray(); $l = Language::whereSectionId($section->id)->get(['name', 'level', 'creditation'])->toArray(); $e = Education::whereSectionId($section->id)->get(['name', 'location', 'title', 'description', 'start_date', 'end_date'])->toArray(); $h = Hobby::whereSectionId($section->id)->get(['text'])->toArray(); $s = Skill::whereSectionId($section->id)->get(['name', 'level', 'description'])->toArray(); if (count($w) != 0) { array_push($workSection, $w); } if (count($l) != 0) { array_push($languageSection, $l); } if (count($e) != 0) { array_push($educationSection, $e); } if (count($h) != 0) { array_push($hobbySection, $h); } if (count($s) != 0) { array_push($skillSection, $s); } } return view('pages.cvs.show', ['cv' => $cv, 'user' => $request->user(), 'workSection' => $workSection, 'languageSection' => $languageSection, 'educationSection' => $educationSection, 'hobbySection' => $hobbySection, 'skillSection' => $skillSection]); }
public function putProfile() { $cre = ['profile_image' => Input::get('profile_image')]; $rules = ['profile_image' => 'required']; $validator = Validator::make($cre, $rules); if ($validator->passes()) { $profiles = Nysc::find(input::get('profile_id')); $cv = CV::select('id')->where('cv_code', Input::get('cv_code'))->first(); if ($cv->id == $profiles->cv_id) { $profiles->profile_image = Input::get('profile_image'); $profiles->save(); $data["message"] = 'Profile details are succefully updated'; $data["profile_image"] = Input::get('profile_image'); } else { $data["message"] = 'Error in editing image'; } return json_encode($data); } else { return 'Please upload the image'; } }