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; }
function get_list_filter($filter = array()) { $filter["username"] and $sql[] = sprintf_implode("username = '******'", $filter["username"]); $filter["personActive"] and $sql[] = sprintf_implode("personActive = %d", $filter["personActive"]); $filter["firstName"] and $sql[] = sprintf_implode("firstName = '%s'", $filter["firstName"]); $filter["surname"] and $sql[] = sprintf_implode("surname = '%s'", $filter["surname"]); $filter["personID"] and $sql[] = sprintf_implode("personID = %d", $filter["personID"]); $filter["skill"] and $sql["skill"] = sprintf_implode("skillID=%d", $filter["skill"]); if ($filter["skill_class"]) { $q = prepare("SELECT * FROM skill WHERE skillClass='%s'", $filter["skill_class"]); $db = new db_alloc(); $db->query($q); while ($db->next_record()) { $skill = new skill(); $skill->read_db_record($db); $sql2[] = prepare("(skillID=%d)", $skill->get_id()); } } $filter["expertise"] and $sql[] = sprintf_implode("skillProficiency='%s'", $filter["expertise"]); return array($sql, $sql2); }
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, ""); } }
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 </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"; } }