/**
  * @param Request $request
  * @param Application $app
  * @param $idbio
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function addAction(Request $request, Application $app, $idbio)
 {
     $skill = new skill();
     $skill->setBio($idbio);
     $skillForm = $app['form.factory']->create(new SkillForm(), $skill);
     $skillForm->handleRequest($request);
     if ($skillForm->isValid()) {
         $this->repository['skillRepository']->save($skill);
         $app['session']->getFlashBag()->add('success', 'The skill was successfully created.');
         return $app->redirect($app["url_generator"]->generate('listBio'));
     }
     return $app['twig']->render('Pages/Skill/Add.html.twig', array('title' => 'New skill', 'skillForm' => $skillForm->createView()));
 }
Beispiel #2
0
 function get_skills()
 {
     global $TPL;
     global $skill_class;
     $skills = array("" => "Any Skill");
     $query = "SELECT * FROM skill";
     if ($skill_class != "") {
         $query .= prepare(" WHERE skillClass='%s'", $skill_class);
     }
     $query .= " ORDER BY skillClass,skillName";
     $db = new db_alloc();
     $db->query($query);
     while ($db->next_record()) {
         $skill = new skill();
         $skill->read_db_record($db);
         $skills[$skill->get_id()] = sprintf("%s - %s", $skill->get_value('skillClass'), $skill->get_value('skillName'));
     }
     return $skills;
 }
Beispiel #3
0
require 'path.php';
init_cobalt('Delete skill');
if (isset($_GET['skill_id'])) {
    $skill_id = urldecode($_GET['skill_id']);
    require_once 'form_data_skill.php';
}
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_delete']);
    require 'components/query_string_standard.php';
    if ($_POST['btn_cancel']) {
        log_action('Pressed cancel button');
        redirect("listview_skill.php?{$query_string}");
    } elseif ($_POST['btn_delete']) {
        log_action('Pressed delete button');
        require_once 'subclasses/skill.php';
        $dbh_skill = new skill();
        $object_name = 'dbh_skill';
        require 'components/create_form_data.php';
        $dbh_skill->delete($arr_form_data);
        redirect("listview_skill.php?{$query_string}");
    }
}
require 'subclasses/skill_html.php';
$html = new skill_html();
$html->draw_header('Delete Skill', $message, $message_type);
$html->draw_listview_referrer_info($filter_field_used, $filter_used, $page_from, $filter_sort_asc, $filter_sort_desc);
$html->draw_hidden('skill_id');
$html->detail_view = TRUE;
$html->draw_controls('delete');
$html->draw_footer();
Beispiel #4
0
            $failed = TRUE;
        }
    }
    if ($_POST["other_new_skill_name"] != "") {
        $skill->set_value('skillName', $_POST["other_new_skill_name"]);
        // description for now can be the same as the name
        $skill->set_value('skillDescription', $_POST["other_new_skill_name"]);
    } else {
        $failed = TRUE;
    }
    if ($failed == FALSE && $skill->skill_exists() == FALSE) {
        $skill->save();
    }
}
if ($_POST["delete_skill"]) {
    $skill = new skill();
    if ($_POST["new_skill_name"] != "") {
        $skill->set_id($_POST["new_skill_name"]);
        $skill->delete();
    }
}
$skill_classes = skill::get_skill_classes();
$skill_classes[""] = ">> OTHER >>";
$TPL["new_skill_classes"] = page::select_options($skill_classes, $_POST["skill_class"]);
$skills = skill::get_skills();
// if a skill class is selected and a skill that is not in that class is also selected, clear the skill as this is what the filter options will do
if ($skill_class && !in_array($skills[$_POST["skill"]], $skills)) {
    $_POST["skill"] = "";
}
$skills[""] = ">> NEW >>";
$TPL["new_skills"] = page::select_options($skills, $_POST["skill"]);
<?php

require 'components/get_listview_referrer.php';
require 'subclasses/skill.php';
$dbh_skill = new skill();
$dbh_skill->set_where("skill_id='" . quote_smart($skill_id) . "'");
if ($result = $dbh_skill->make_query()->result) {
    $data = $result->fetch_assoc();
    extract($data);
}
Beispiel #6
0
function show_skills_list()
{
    global $TPL;
    global $personID;
    global $skills;
    $db = new db_alloc();
    $query = prepare("SELECT * FROM proficiency WHERE personID=%d", $personID);
    $db->query($query);
    $skills_got = array();
    while ($db->next_record()) {
        $skill = new skill();
        $skill->read_db_record($db);
        array_push($skills_got, $skill->get_id());
    }
    $query = "SELECT * FROM skill ORDER BY skillClass";
    $db->query($query);
    while ($db->next_record()) {
        $skill = new skill();
        $skill->read_db_record($db);
        if (in_array($skill->get_id(), $skills_got)) {
            // dont show this item
        } else {
            $skills[$skill->get_id()] = sprintf("%s - %s", $skill->get_value('skillClass'), $skill->get_value('skillName'));
        }
    }
    if (count($skills) > 0) {
        $TPL["skills"] = page::select_options($skills, "");
    }
}
 private function insertCustomSkill($project_id, $skill_name)
 {
     // Create an object for skill
     $objSkill = new skill();
     // First check if it a duplicate skill, if yes, add that skill in the project table
     $skill_id = $objSkill->getSkillId($skill_name);
     if ($skill_id <= 0) {
         // It is a new skill and not fond in DB, so insert it
         $skill_id = $objSkill->insertSkill($skill_name);
     } else {
         // If skill_id>0, use it to insert below...
         // No need to do anything, this block is just for info
     }
     $result = $this->insertProjectSkill($project_id, $skill_id);
     return $result;
 }
Beispiel #8
0
//****************************************************************************************
//Generated by Cobalt, a rapid application development framework. http://cobalt.jvroig.com
//Cobalt developed by JV Roig (jvroig@jvroig.com)
//****************************************************************************************
require 'path.php';
init_cobalt('Edit skill');
if (isset($_GET['skill_id'])) {
    $skill_id = urldecode($_GET['skill_id']);
    require 'form_data_skill.php';
}
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_submit']);
    require 'components/query_string_standard.php';
    require 'subclasses/skill.php';
    $dbh_skill = new skill();
    $object_name = 'dbh_skill';
    require 'components/create_form_data.php';
    extract($arr_form_data);
    if ($_POST['btn_cancel']) {
        log_action('Pressed cancel button');
        redirect("listview_skill.php?{$query_string}");
    }
    if ($_POST['btn_submit']) {
        log_action('Pressed submit button');
        $message .= $dbh_skill->sanitize($arr_form_data)->lst_error;
        extract($arr_form_data);
        if ($dbh_skill->check_uniqueness_for_editing($arr_form_data)->is_unique) {
            //Good, no duplicate in database
        } else {
            $message = "Record already exists with the same primary identifiers!";
Beispiel #9
0
<?php

//****************************************************************************************
//Generated by Cobalt, a rapid application development framework. http://cobalt.jvroig.com
//Cobalt developed by JV Roig (jvroig@jvroig.com)
//****************************************************************************************
require 'path.php';
init_cobalt('Add skill');
require 'components/get_listview_referrer.php';
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_submit']);
    require 'components/query_string_standard.php';
    require 'subclasses/skill.php';
    $dbh_skill = new skill();
    $object_name = 'dbh_skill';
    require 'components/create_form_data.php';
    extract($arr_form_data);
    if ($_POST['btn_cancel']) {
        log_action('Pressed cancel button');
        redirect("listview_skill.php?{$query_string}");
    }
    if ($_POST['btn_submit']) {
        log_action('Pressed submit button');
        $message .= $dbh_skill->sanitize($arr_form_data)->lst_error;
        extract($arr_form_data);
        if ($dbh_skill->check_uniqueness($arr_form_data)->is_unique) {
            //Good, no duplicate in database
        } else {
            $message = "Record already exists with the same primary identifiers!";
        }
Beispiel #10
0
 function load_person_filter($_FORM)
 {
     global $TPL;
     $current_user =& singleton("current_user");
     $db = new db_alloc();
     $_FORM["showSkills"] and $rtn["show_skills_checked"] = " checked";
     $_FORM["showHours"] and $rtn["show_hours_checked"] = " checked";
     $_FORM["personActive"] and $rtn["show_all_users_checked"] = " checked";
     $employee_expertise = array("" => "Any Expertise", "Novice" => "Novice", "Junior" => "Junior", "Intermediate" => "Intermediate", "Advanced" => "Advanced", "Senior" => "Senior");
     $rtn["employee_expertise"] = page::select_options($employee_expertise, $_FORM["expertise"]);
     $skill_classes = skill::get_skill_classes();
     $rtn["skill_classes"] = page::select_options($skill_classes, $_FORM["skill_class"]);
     $skills = skill::get_skills();
     // if a skill class is selected and a skill that is not in that class is also selected,
     // clear the skill as this is what the filter options will do
     if ($skill_class && !in_array($skills[$_FORM["skill"]], $skills)) {
         $_FORM["skill"] = "";
     }
     $rtn["skills"] = page::select_options($skills, $_FORM["skill"]);
     return $rtn;
 }
Beispiel #11
0
//Generated by Cobalt, a rapid application development framework. http://cobalt.jvroig.com
//Cobalt developed by JV Roig (jvroig@jvroig.com)
//****************************************************************************************
require 'path.php';
init_cobalt('View skill');
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_submit']);
    if ($_POST['btn_cancel']) {
        log_action('Pressed cancel button');
        redirect("listview_skill.php");
    }
    if ($_POST['btn_submit']) {
        log_action('Pressed submit button');
        require 'subclasses/skill.php';
        $dbh_skill = new skill();
        if ($message == "") {
            log_action('Exported table data to CSV');
            $timestamp = date('Y-m-d');
            $token = generate_token(0, 'fs');
            $csv_name = $token . $_SESSION['user'] . '_skill_' . $timestamp . '.csv';
            $filename = TMP_DIRECTORY . '/' . $csv_name;
            $csv_contents = $dbh_skill->export_to_csv();
            $csv_file = fopen($filename, "wb");
            fwrite($csv_file, $csv_contents);
            fclose($csv_file);
            chmod($filename, 0755);
            $csv_name = urlencode($csv_name);
            $message = 'CSV file successfully generated: <a href="/' . BASE_DIRECTORY . '/download_generic.php?filename=' . $csv_name . '">Download the CSV file.</a>';
            $message_type = 'system';
        }
Beispiel #12
0
function show_skill_expertise()
{
    global $TPL;
    global $people_ids;
    global $people_header;
    global $talent;
    global $skill_class;
    $currSkillClass = null;
    $db = new db_alloc();
    $query = "SELECT * FROM proficiency";
    $query .= " LEFT JOIN skill ON proficiency.skillID=skill.skillID";
    if ($talent != "" || $skill_class != "") {
        if ($talent != "") {
            $query .= prepare(" WHERE proficiency.skillID=%d", $talent);
        } else {
            $query .= prepare(" WHERE skillClass='%s'", $skill_class);
        }
    }
    $query .= " GROUP BY skillName ORDER BY skillClass,skillName";
    $db->query($query);
    while ($db->next_record()) {
        $skill = new skill();
        $skill->read_db_record($db);
        $thisSkillClass = $skill->get_value('skillClass');
        if ($currSkillClass != $thisSkillClass) {
            $currSkillClass = $thisSkillClass;
            if (!isset($people_header)) {
                get_people_header();
            }
            $class_header = sprintf("<tr class=\"highlighted\">\n<th width=\"5%%\">%s&nbsp;&nbsp;&nbsp;</th>\n", $skill->get_value('skillClass', DST_HTML_DISPLAY));
            print $class_header . $people_header . "</tr>\n";
        }
        print sprintf("<tr>\n<th>%s</th>\n", $skill->get_value('skillName', DST_HTML_DISPLAY));
        for ($i = 0; $i < count($people_ids); $i++) {
            $db2 = new db_alloc();
            $query = "SELECT * FROM proficiency";
            $query .= prepare(" WHERE skillID=%d AND personID=%d", $skill->get_id(), $people_ids[$i]);
            $db2->query($query);
            if ($db2->next_record()) {
                $proficiency = new proficiency();
                $proficiency->read_db_record($db2);
                $p = sprintf("<td align=\"center\"><img src=\"../images/skill_%s.png\" alt=\"%s\"/></td>\n", strtolower($proficiency->get_value('skillProficiency')), substr($proficiency->get_value('skillProficiency'), 0, 1));
                print $p;
            } else {
                print "<td align=\"center\">-</td>\n";
            }
        }
        print "</tr>\n";
    }
}