Пример #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);
    }
}