use App\ColorGroups; use App\CoreUtils; /** @var $heading string */ /** @var $Appearance array */ /** @var $Colors array */ /** @var $Map array */ /** @var $AllColors array */ /** @var $ColorGroups array */ ?> <div id="content"> <h1>Sprite Color Checker</h1> <p><a href="/cg/v/<?php echo $Appearance['id']; ?> "><span class="typcn typcn-arrow-back"></span> Back to appearrance page</a></p> <section class="checker"> <div id="svg-cont"></div> <div id="input-cont"><h3>JavaScript is required to use the viewer</h3></div> </section> <section class="color-list"> <ul id="colors" class="colors"><?php foreach ($ColorGroups as $cg) { echo ColorGroups::getHTML($cg, $AllColors, WRAP, NO_COLON, OUTPUT_COLOR_NAMES, FORCE_EXTRA_INFO); } ?> </ul> </section> </div> <?php echo CoreUtils::exportVars(array('AppearanceID' => $Appearance['id'], 'AppearanceColors' => $Colors, 'SpriteColorList' => $Map['colors']));
$Appearance = $CGDb->where('id', intval($_match[1], 10))->getOne('appearances', 'id,label'); if (empty($Appearance)) { CoreUtils::notFound(); } $Map = CGUtils::getSpriteImageMap($Appearance['id']); if (empty($Map)) { CoreUtils::notFound(); } $Colors = array(); foreach (array(0, $Appearance['id']) as $AppearanceID) { $ColorGroups = ColorGroups::get($AppearanceID); $SortedColorGroups = array(); foreach ($ColorGroups as $cg) { $SortedColorGroups[$cg['groupid']] = $cg; } $AllColors = ColorGroups::getColorsForEach($ColorGroups); foreach ($AllColors as $cg) { foreach ($cg as $c) { $Colors[] = array('hex' => $c['hex'], 'label' => $SortedColorGroups[$c['groupid']]['label'] . ' | ' . $c['label']); } } } $Colors = array_merge($Colors, array(array('hex' => '#D8D8D8', 'label' => 'Mannequin | Outline'), array('hex' => '#E6E6E6', 'label' => 'Mannequin | Fill'), array('hex' => '#BFBFBF', 'label' => 'Mannequin | Shadow Outline'), array('hex' => '#CCCCCC', 'label' => 'Mannequin | Shdow Fill'))); $SafeLabel = Appearances::getSafeLabel($Appearance); CoreUtils::fixPath("{$CGPath}/sprite/{$Appearance['id']}-{$SafeLabel}"); CoreUtils::loadPage(array('view' => "{$do}-sprite", 'title' => "Sprite of {$Appearance['label']}", 'css' => "{$do}-sprite", 'js' => "{$do}-sprite")); } else { if ($data === 'full') { $GuideOrder = !isset($_REQUEST['alphabetically']) && !$EQG; if (!$GuideOrder) { $CGDb->orderBy('label', 'ASC');
</section> <? } ?> <section class="color-list"> <h2 class="admin">Color groups</h2> <div class="admin"> <button class="darkblue typcn typcn-arrow-unsorted reorder-cgs">Re-order groups</button> <button class="green typcn typcn-plus create-cg">Create group</button> </div> <? if ($placehold = Appearances::getPendingPlaceholderFor($Appearance)) echo $placehold; else { ?> <ul id="colors" class="colors"><?php $CGs = ColorGroups::get($Appearance['id']); $AllColors = ColorGroups::getColorsForEach($CGs); foreach ($CGs as $cg) echo ColorGroups::getHTML($cg, $AllColors, WRAP, NO_COLON, OUTPUT_COLOR_NAMES); ?></ul> </section> <?=Appearances::getRelatedHTML(Appearances::getRelated($Appearance['id']))?> </div> <? } ?> </div> <? $export = array( 'Color' => $Color, 'color' => $color, 'EQG' => $EQG, 'AppearancePage' => true, ); if (Permission::sufficient('staff')) $export = array_merge($export, array(
/** * Returns the markup of the color list for a specific appearance * * @param array $Appearance * @param bool $wrap * @param bool $colon * @param bool $colorNames * * @return string */ static function getColorsHTML($Appearance, bool $wrap = WRAP, $colon = true, $colorNames = false) { global $CGDb; if ($placehold = self::getPendingPlaceholderFor($Appearance)) { return $placehold; } $ColorGroups = ColorGroups::get($Appearance['id']); $AllColors = ColorGroups::getColorsForEach($ColorGroups); $HTML = ''; if (!empty($ColorGroups)) { foreach ($ColorGroups as $cg) { $HTML .= ColorGroups::getHTML($cg, $AllColors, WRAP, $colon, $colorNames); } } return $wrap ? "<ul class='colors'>{$HTML}</ul>" : $HTML; }