Beispiel #1
0
function show_person_areasOfExpertise($template)
{
    global $TPL;
    global $personID;
    global $skill_header;
    global $skill_prof;
    global $skills_got;
    $TPL["personExpertiseItem_buttons"] = '
       <button type="submit" name="personExpertiseItem_delete" value="1" class="delete_button">Delete<i class="icon-trash"></i></button>
       <button type="submit" name="personExpertiseItem_save" value="1" class="save_button">Save<i class="icon-ok-sign"></i></button>
         ';
    $proficiencys = array("Novice" => "Novice", "Junior" => "Junior", "Intermediate" => "Intermediate", "Advanced" => "Advanced", "Senior" => "Senior");
    # step through the list of skills ordered by skillclass
    $db = new db_alloc();
    // $query = "SELECT * FROM skill ORDER BY skillClass,skillName";
    $query = "SELECT * FROM skill LEFT JOIN proficiency ON skill.skillID=proficiency.skillID";
    $query .= prepare(" WHERE proficiency.personID=%d", $personID);
    $query .= " ORDER BY skillClass,skillName";
    $db->query($query);
    $currSkillClass = null;
    while ($db->next_record()) {
        $skill = new skill();
        $skill->read_db_record($db);
        $skill->set_tpl_values();
        $skillProficiencys = new proficiency();
        $skillProficiencys->read_db_record($db);
        $skillProficiencys->set_values();
        # if they do and there is no heading for this segment put a heading
        $thisSkillClass = $skill->get_value('skillClass');
        if ($currSkillClass != $thisSkillClass) {
            $currSkillClass = $thisSkillClass;
            $skill_header = true;
        } else {
            $skill_header = false;
        }
        $skill_prof = $skillProficiencys->get_value('skillProficiency');
        $TPL["skill_proficiencys"] = page::select_options($proficiencys, $skill_prof);
        # display rating if there is one
        include_template($template);
    }
}
Beispiel #2
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";
    }
}