static function getAppearancesSectionHTML(Episode $Episode) : string { global $CGDb, $Color; $HTML = ''; $EpTagIDs = Episodes::getTagIDs($Episode); if (!empty($EpTagIDs)) { $TaggedAppearances = $CGDb->rawQuery("SELECT p.id, p.label, p.private\n\t\t\t\tFROM tagged t\n\t\t\t\tLEFT JOIN appearances p ON t.ponyid = p.id\n\t\t\t\tWHERE t.tid IN (" . implode(',', $EpTagIDs) . ") && p.ishuman = ?\n\t\t\t\tORDER BY p.label", array($Episode->isMovie)); if (!empty($TaggedAppearances)) { $hidePreviews = UserPrefs::get('ep_noappprev'); $pages = CoreUtils::makePlural('page', count($TaggedAppearances)); $HTML .= "<section class='appearances'><h2>Related <a href='/cg'>{$Color} Guide</a> {$pages}</h2>"; $LINKS = '<ul>'; $isStaff = Permission::sufficient('staff'); foreach ($TaggedAppearances as $p) { $safeLabel = Appearances::getSafeLabel($p); if (Appearances::isPrivate($p, true)) { $preview = "<span class='typcn typcn-" . ($isStaff ? 'lock-closed' : 'time') . " color-" . ($isStaff ? 'orange' : 'darkblue') . "'></span> "; } else { if ($hidePreviews) { $preview = ''; } else { $preview = Appearances::getPreviewURL($p); $preview = "<img src='{$preview}' class='preview'>"; } } $LINKS .= "<li><a href='/cg/v/{$p['id']}-{$safeLabel}'>{$preview}{$p['label']}</a></li>"; } $HTML .= "{$LINKS}</ul></section>"; } } return $HTML; }