Example #1
0
<?php

$_SESSION['direct_to'] = BASE_URL . "curriculum_vitae/";
include_once 'sessioninc.php';
$req = return_url();
$action = $req[1];
$id = $req[2];
$review = $req[3];
$username = $session->get_username();
$user_id = $session->get_user_id();
$employee = Employee::find_by_id($user_id);
$cv_setting = new CVSetting();
$cv_setting->fk_employee_id = $user_id;
$total_max_cv = CVSetting::count_all_by_employee($user_id);
$smarty->assign('total_max_cv', $total_max_cv);
function check_total()
{
    global $total_max_cv, $session;
    if ($total_max_cv >= MAX_CV) {
        $session->message("<div class='error'>" . format_lang('errormsg', 52) . "</div>");
        redirect_to(BASE_URL . "curriculum_vitae/");
        die;
    }
}
$lang["max_file_size"] = size_as_text(MAX_CV_SIZE);
//Are you sure you want to do this? You will lose this CV.
switch ($action) {
    case "add":
        check_total();
        if (isset($_POST['bt_cv_add'])) {
            $_SESSION['addcv']['name'] = $cv_setting->cv_title = $_POST['txt_title'];