コード例 #1
0
ファイル: Experts.php プロジェクト: johnwinsor/SubjectsPlus
 public function outputExperts()
 {
     global $mod_rewrite;
     global $PublicPath;
     global $guide_types;
     // let's use our Pretty URLs if mod_rewrite = TRUE or 1
     if ($mod_rewrite == 1) {
         $guide_path = "";
     } else {
         $guide_path = $PublicPath . "guide.php?subject=";
     }
     // get all of our librarian experts into an array
     $q = "SELECT DISTINCT (s.staff_id), CONCAT(s.fname, ' ', s.lname) AS fullname, s.email, s.tel, s.title, sub.subject  FROM staff s, staff_subject ss, subject sub\n          WHERE s.staff_id = ss.staff_id\n          AND ss.subject_id = sub.subject_id\n          AND s.active = 1\n          AND sub.active = 1\n          AND ptags LIKE '%librarian%'\n    \t    GROUP BY s.staff_id\n    \t    ORDER BY RAND()\n          LIMIT 0,4";
     $expertArray = $this->db->query($q);
     // init list item
     $expert_item = "";
     // additional text
     $bonus_text = _("Need help?  Ask an expert.");
     // additional text - button
     $button_text = _("See all experts");
     foreach ($expertArray as $key => $value) {
         $exp_image = getHeadshotFull($value['email']);
         $librarian_email = $value['email'];
         $name_id = explode("@", $librarian_email);
         $exp_profile = "<li><div class=\"expert-img\">" . $exp_image . "</div><div class=\"expert-label\"><a href=\"" . PATH_TO_SP . "subjects/staff_details.php?name=" . $name_id[0] . "\">" . $value['fullname'] . "</a><br /><div class=\"expert-subject-min\">" . $value['subject'] . "</div></div><div class=\"expert-tooltip\" id=\"tooltip-" . $name_id[0] . "\"><div class=\"expert-title\">" . $value['title'] . "</div><div class=\"expert-subjects\"><strong>Subjects:</strong> " . $value['subject'] . " ...</div></div></li>";
         $expert_item .= $exp_profile;
     }
     $guide_experts = "{$expert_item}";
     $list_guide_experts = "<div class=\"find-expert-area-circ\">{$bonus_text}<br /><ul class=\"expert-list-circ\">{$guide_experts}</ul><div class=\"expert-btn-area\"><a href=\"" . PATH_TO_SP . "subjects/staff.php?letter=Subject Librarians A-Z\" class=\"expert-button\">" . $button_text . "</a></div></div>";
     return $list_guide_experts;
 }
コード例 #2
0
ファイル: index.php プロジェクト: johnwinsor/SubjectsPlus
//end foreach
//EXPERTS
//**************************************
// get all of our librarian experts into an array
$qexperts = "SELECT DISTINCT (s.staff_id), CONCAT(s.fname, ' ', s.lname) AS fullname, s.email, s.tel, s.title, sub.subject  FROM staff s, staff_subject ss, subject sub\n          WHERE s.staff_id = ss.staff_id\n          AND ss.subject_id = sub.subject_id\n          AND s.active = 1\n          AND sub.active = 1\n          AND ptags LIKE '%librarian%'\n          AND sub.type = 'Subject'\n          GROUP BY s.staff_id\n          ORDER BY RAND()\n          LIMIT 0,4";
$statement = $connection->prepare($qexperts);
$statement->execute();
$expertArray = $statement->fetchAll();
// init list item
$expert_item = "";
// additional text
$bonus_text = _("Need help? Ask an expert!");
// additional text
$button_text = _("See all experts");
foreach ($expertArray as $key => $value) {
    $exp_image = getHeadshotFull($value['email']);
    //$exp_profile = "<div class=\"expert-img\">" . $exp_image . "</div><div class=\"expert-label\">" . $value['fullname'] . "</div><div class=\"expert-title\">" . $value['title'] ."</div><div class=\"expert-subjects\">" . $value['subject'] ."</div>";
    $librarian_email = $value['email'];
    $name_id = explode("@", $librarian_email);
    $exp_profile = "<li><div class=\"expert-img\">" . $exp_image . "</div><div class=\"expert-label\"><a href=\"" . PATH_TO_SP . "subjects/staff_details.php?name=" . $name_id[0] . "\">" . $value['fullname'] . "</a><br /><div class=\"expert-subject-min\">" . $value['subject'] . "</div></div><div class=\"expert-tooltip\" id=\"tooltip-" . $name_id[0] . "\"><div class=\"expert-title\">" . $value['title'] . "</div><div class=\"expert-subjects\"><strong>Subjects:</strong> " . $value['subject'] . " ...</div></div></li>";
    $expert_item .= $exp_profile;
}
$guide_experts = "{$expert_item}";
// ANCHOR buttons for guide types
//**************************************
$guide_type_btns = "<ul>";
// We don't want our placeholder
if (in_array('Placeholder', $guide_types)) {
    unset($guide_types[array_search('Placeholder', $guide_types)]);
}
foreach ($guide_types as $key) {