Пример #1
0
<?php

$_SESSION['direct_to'] = BASE_URL . "covering_letter/";
include_once 'sessioninc.php';
$req = return_url();
$action = $req[1];
$id = $req[2];
$username = $session->get_username();
$user_id = $session->get_user_id();
$employee = Employee::find_by_id($user_id);
$covingletter = new CovingLetter();
$total_max_cl = CovingLetter::count_all_by_employee($user_id);
$smarty->assign('total_max_cl', $total_max_cl);
switch ($action) {
    case "add":
        if ($total_max_cl >= MAX_COVER_LETTER) {
            $v = format_lang('errormsg', 8);
            //exit;
            $session->message("<div class='error'>" . format_lang('errormsg', 8) . "</div>");
            redirect_to(BASE_URL . "covering_letter/");
            die;
        }
        //when add button is clicked
        if (isset($_POST['bt_cl_add'])) {
            if ($total_max_cl >= MAX_COVER_LETTER) {
                $session->message("<div class='error'>" . format_lang('errormsg', 8) . "</div>");
                redirect_to(BASE_URL . "covering_letter/");
                die;
            }
            $_SESSION['cl']['title'] = $covingletter->cl_title = strip_html($_POST['txt_name']);
            $_SESSION['cl']['text'] = $covingletter->cl_text = strip_tags($_POST['txt_letter'], "\n\t");
Пример #2
0
 if (is_array($my_cvs) and !empty($my_cvs)) {
     $cv_t = array();
     $i = 1;
     foreach ($my_cvs as $my_cv) {
         if ($my_cv->default_cv == 'Y') {
             $_SESSION['apply']['cv_selected'] = $my_cv->id;
         }
         $cv_t[$i]["id"] = $my_cv->id;
         $cv_t[$i]["cv_title"] = $my_cv->cv_title;
         $cv_t[$i]["default_cv"] = empty($_SESSION['apply']['which_cv']) ? "N" : $my_cv->default_cv;
         $i++;
     }
     $smarty->assign('my_cv', $cv_t);
 }
 //get all coving letter
 $my_letters = CovingLetter::employee_find_all($user_id);
 if (is_array($my_letters) and !empty($my_letters)) {
     $cl_t = array();
     $i = 1;
     foreach ($my_letters as $my_letter) {
         if ($my_letter->is_defult == 'Y') {
             $_SESSION['apply']['cover_letter'] = empty($_SESSION['apply']['cover_letter']) ? $my_letter->cl_text : safe_output($_SESSION['apply']['cover_letter']);
         }
         $cl_t[$i]["id"] = $my_letter->id;
         $cl_t[$i]["cl_title"] = $my_letter->cl_title;
         $cl_t[$i]["cl_text"] = $my_letter->cl_text;
         $cl_t[$i]["is_defult"] = empty($_SESSION['apply']['which_letter']) ? 'N' : $my_letter->is_defult;
         $i++;
     }
     $smarty->assign('my_letters', $cl_t);
 }
<?php

require_once "../initialise_file_location.php";
$id = (int) $_GET['id'];
if (isset($id) && !empty($id) && $id != "" && is_numeric($id)) {
    $letter = CovingLetter::find_by_id($id);
    echo $letter->cl_text;
} else {
    echo "";
}
//die;