CharSearch
parent
775966f0dd
commit
457701a907
|
@ -242,6 +242,7 @@ function wowpress_enqueue_block_editor_script()
|
|||
'wp-blocks',
|
||||
'wp-edit-post',
|
||||
),
|
||||
|
||||
WOWPRESS_VERSION,
|
||||
true
|
||||
);
|
||||
|
@ -295,7 +296,6 @@ require get_template_directory() . '/inc/template-tags.php';
|
|||
require get_template_directory() . '/inc/template-functions.php';
|
||||
require get_template_directory() . '/inc/config-functions.php';
|
||||
require get_template_directory() . '/plugins/wowpress-navwalker.php';
|
||||
require get_template_directory() . '/plugins/wowpress-icons.php';
|
||||
|
||||
/**
|
||||
* Hide Admin Bar
|
||||
|
@ -470,4 +470,12 @@ function wowpress_add_category_meta($taxonomy)
|
|||
|
||||
/** Avatar Filters */
|
||||
add_filter('get_avatar_url', '\WoWPress\Models\User::getAvatar', 10, 3);
|
||||
add_filter('asgarosforum_filter_username', '\WoWPress\Models\User::getUsername', 10, 2);
|
||||
add_filter('asgarosforum_filter_username', '\WoWPress\Models\User::getUsername', 10, 2);
|
||||
|
||||
/** Login redirect */
|
||||
add_filter('login_redirect', fn() => "/");
|
||||
|
||||
function sanitize($word){
|
||||
$char = new Character();
|
||||
return $char->sanitize($word);
|
||||
}
|
|
@ -33,17 +33,20 @@ global $user;
|
|||
<body <?php body_class('dark'); ?>>
|
||||
<?php if (get_sidebar_status('left')) : ?>
|
||||
<template x-data x-teleport="#sidebar_left">
|
||||
<div class="bg-glass shadow p-auto order-1">
|
||||
<div class="bg-glass shadow p-auto order-1 flex flex-col gap-2">
|
||||
<div class="flex flex-row justify-between">
|
||||
<div>Hallo <?= $user->username ?></div>
|
||||
<?php if (!$user->ID) : ?>
|
||||
<div>Bitte <a href="/wp-login.php" class="text-alliance underline">einloggen</a> :)</div>
|
||||
<?php else : ?>
|
||||
<div><a href="/wp-login.php?action=logout" class="text-alliance underline"><?= Icon::get('o-power') ?></a></div>
|
||||
<div><a href="<?=wp_logout_url('/')?>" class="text-alliance underline"><?= Icon::get('o-power') ?></a></div>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ($user->ID) : ?>
|
||||
<?php if(current_user_can('wowpress_edit_raids')): ?>
|
||||
<a href="/wp-admin" class="btn btn-red"><?=Icon::get('o-shield-exclamation')?> Admin-Bereich</a>
|
||||
<?php endif; ?>
|
||||
<div>
|
||||
<h5 class="text-center text-lg font-bold">Charakter-Liste</h5>
|
||||
<div class="flex flex-col gap-2">
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
get_header();
|
||||
?>
|
||||
|
||||
<section id="primary" <?php if(!get_sidebar_status('top')):?> style="margin-top:calc(-1 * var(--wowp-gap))" <?php endif; ?>>
|
||||
<section id="primary" <?php if(!get_sidebar_status('top') || !is_user_logged_in()):?> style="margin-top:calc(-1 * var(--wowp-gap))" <?php endif; ?>>
|
||||
<main id="main">
|
||||
|
||||
<?php
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Icon{
|
||||
|
||||
public static function getIcon($icon_name,$width="24px"){
|
||||
$fname = get_template_directory()."/plugins/heroicons/".$icon_name.".svg";
|
||||
if(file_exists($fname)){
|
||||
return "<div style='width:".$width."'>".file_get_contents($fname)."</div>";
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
139
theme/single.php
139
theme/single.php
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The template for displaying all single posts
|
||||
*
|
||||
|
@ -8,43 +9,121 @@
|
|||
*/
|
||||
|
||||
get_header();
|
||||
|
||||
use Wenprise\ORM\WP\Post;
|
||||
use WoWPress\Models\User;
|
||||
|
||||
the_post();
|
||||
$author = User::find(get_the_author_meta('ID'));
|
||||
$tp = Post::find(get_the_ID());
|
||||
?>
|
||||
|
||||
<section id="primary">
|
||||
<main id="main">
|
||||
<section id="primary">
|
||||
<main id="main">
|
||||
|
||||
<?php
|
||||
/* Start the Loop */
|
||||
while ( have_posts() ) :
|
||||
the_post();
|
||||
get_template_part( 'template-parts/content/content', 'single' );
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||
<div class="post-wrapper" style="--author-class:var(--color-<?= $author->color ?>)">
|
||||
<div class="post-title">
|
||||
<h1><?php the_title() ?></h1>
|
||||
</div>
|
||||
<div class="post-content"><?php the_content() ?></div>
|
||||
<div class="post-day"><?= get_the_date('d') ?></div>
|
||||
<div class="post-month"><?= get_the_date('F') ?></div>
|
||||
<?php
|
||||
$category = get_the_category();
|
||||
$category = array_pop($category);
|
||||
$color = get_term_meta($category->term_id, 'color', true);
|
||||
?>
|
||||
<div class="post-category ribbon" style="--color-ribbon:#<?= ctype_xdigit($color) ? $color : 'fff' ?>"><span><?= $category->name ?></span></div>
|
||||
<div class="post-avatar"><img src="<?= $author->avatar ?>"></div>
|
||||
<div class="post-author">
|
||||
<?php if (current_user_can('edit_post', $post->ID)) : ?>
|
||||
<a href="<?= get_edit_post_link($post->ID) ?>">
|
||||
<?= $author->username ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<?= $author->username ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</article><!-- #post-${ID} -->
|
||||
|
||||
if ( is_singular( 'post' ) ) {
|
||||
// Previous/next post navigation.
|
||||
the_post_navigation(
|
||||
array(
|
||||
'next_text' => '<span aria-hidden="true">' . __( 'Next Post', 'wowpress' ) . '</span> ' .
|
||||
'<span class="sr-only">' . __( 'Next post:', 'wowpress' ) . '</span> <br/>' .
|
||||
'<span>%title</span>',
|
||||
'prev_text' => '<span aria-hidden="true">' . __( 'Previous Post', 'wowpress' ) . '</span> ' .
|
||||
'<span class="sr-only">' . __( 'Previous post:', 'wowpress' ) . '</span> <br/>' .
|
||||
'<span>%title</span>',
|
||||
)
|
||||
);
|
||||
}
|
||||
<?php if (comments_open() || get_comments_number()) : ?>
|
||||
<div class="bg-glass shadow p-auto flex flex-col gap-3">
|
||||
<h3>Kommentare: <?= get_comments_number(); ?></h3>
|
||||
<?php foreach ($tp->comments as $comment) : if($comment->comment_approved && !$comment->comment_approved == "trash") :?>
|
||||
<?=dd($comment)?>
|
||||
<div class="flex flex-col lg:flex-row gap-2 border p-2">
|
||||
<div class="lg:w-1/12">
|
||||
<?php
|
||||
$comment_author = User::where('user_login',$comment->comment_author)->first();
|
||||
if(!empty($comment_author->ID)):
|
||||
?>
|
||||
<img src="<?=$comment_author->avatar?>" alt="" class="w-full hidden lg:block">
|
||||
<div class="flex flex-row justify-center items-center text-<?=$comment_author->color?>"><?=$comment_author->username?></div>
|
||||
<?php
|
||||
else:
|
||||
?>
|
||||
<?=$comment->comment_author?>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
<div class="bg-slate-500 bg-opacity-45 p-auto w-full text-white">
|
||||
<?= $comment->comment_content ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
// If comments are open, or we have at least one comment, load
|
||||
// the comment template.
|
||||
if ( comments_open() || get_comments_number() ) {
|
||||
comments_template();
|
||||
}
|
||||
<?php endif; endforeach; ?>
|
||||
</div>
|
||||
<?php if(is_user_logged_in() && comments_open()) :?>
|
||||
<div class="bg-glass shadow p-auto flex flex-col gap-2">
|
||||
<!--h3>Kommentar verfassen</h3>
|
||||
|
||||
<button class="btn btn-outline btn-alliance">Kommentar abschicken</button-->
|
||||
<?=comment_form([
|
||||
'class_container' => 'flex flex-col gap-2',
|
||||
'class_submit' => 'btn btn-outline btn-alliance',
|
||||
'title_reply' => "",
|
||||
'logged_in_as' => "",
|
||||
'comment_field' => '<textarea name="comment" id="comment" rows="10" class="w-full bg-glass border-alliance"></textarea>',
|
||||
])?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
// End the loop.
|
||||
endwhile;
|
||||
?>
|
||||
<?php
|
||||
/* Start the Loop */
|
||||
// while ( have_posts() ) :
|
||||
// the_post();
|
||||
// get_template_part( 'template-parts/content/content', 'single' );//
|
||||
|
||||
</main><!-- #main -->
|
||||
</section><!-- #primary -->
|
||||
|
||||
// if ( is_singular( 'post' ) ) {
|
||||
// // Previous/next post navigation.
|
||||
// the_post_navigation(
|
||||
// array(
|
||||
// 'next_text' => '<span aria-hidden="true">' . __( 'Next Post', 'wowpress' ) . '</span> ' .
|
||||
// '<span class="sr-only">' . __( 'Next post:', 'wowpress' ) . '</span> <br/>' .
|
||||
// '<span>%title</span>',
|
||||
// 'prev_text' => '<span aria-hidden="true">' . __( 'Previous Post', 'wowpress' ) . '</span> ' .
|
||||
// '<span class="sr-only">' . __( 'Previous post:', 'wowpress' ) . '</span> <br/>' .
|
||||
// '<span>%title</span>',
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
|
||||
// If comments are open, or we have at least one comment, load
|
||||
// the comment template.
|
||||
//if ( comments_open() || get_comments_number() ) {
|
||||
// comments_template();
|
||||
// }
|
||||
|
||||
// End the loop.
|
||||
// endwhile;
|
||||
?>
|
||||
|
||||
</main><!-- #main -->
|
||||
</section><!-- #primary -->
|
||||
|
||||
<?php
|
||||
get_footer();
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
use WoWPress\Frontend\Icon;
|
||||
?>
|
||||
<div>
|
||||
<label style="" for="tb_<?= $this->id ?>" class="w-full flex <?= $this->row ? 'flex-row gap-2' : 'flex-col' ?> items-center justify-center h-auto select-none cursor-pointer border py-3 px-6
|
||||
font-bold border-<?=$this->color_no?> transition-colors duration-200 ease-in-out has-[:checked]:bg-<?=$this->color_yes?> has-[:checked]:text-black has-[:checked]:border-<?=$this->color_yes?> ">
|
||||
<label style="" for="tb_<?= $this->id ?>" class="w-full <?=$this->fullHeight?"h-full":""?> flex <?= $this->row ? 'flex-row gap-2' : 'flex-col' ?> items-center justify-center h-auto select-none cursor-pointer border py-3 px-6
|
||||
font-bold border-<?=$this->color_no?> transition-colors duration-200 ease-in-out has-[:checked]:bg-<?=$this->color_yes?> has-[:checked]:text-black has-[:checked]:border-<?=$this->color_yes?>">
|
||||
<input type="<?= $this->type ?>" value="<?=$this->value?>" id="tb_<?= $this->id ?>" name="<?= $this->name ?>" class="peer group hidden" <?= $this->disabled ? 'disabled' : '' ?> <?= $this->checked ? 'checked' : '' ?> />
|
||||
<div class="peer-checked:block hidden">
|
||||
<?php
|
|
@ -17,7 +17,7 @@ $author = User::find(get_the_author_meta('ID'));
|
|||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||
<div class="post-wrapper" style="--author-class:var(--color-<?=$author->color?>)">
|
||||
<div class="post-title">
|
||||
<h1><?php the_title() ?></h1>
|
||||
<h1 class="underline"><a href="<?=the_permalink()?>"><?php the_title() ?></a></h1>
|
||||
</div>
|
||||
<div class="post-content"><?php the_content() ?></div>
|
||||
<div class="post-day"><?= get_the_date('d') ?></div>
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
* @package WowPress
|
||||
*/
|
||||
|
||||
use WoWPress\Frontend\Icon;
|
||||
|
||||
?>
|
||||
|
||||
<header id="masthead" class="bg-glass">
|
||||
|
@ -37,10 +39,10 @@
|
|||
<button class="btn btn-outline w-full" @click="open = !open">
|
||||
Menü
|
||||
<div x-show="!open">
|
||||
<?=Icon::getIcon('bars-3')?>
|
||||
<?=Icon::get('o-bars-3')?>
|
||||
</div>
|
||||
<div x-show="open">
|
||||
<?=Icon::getIcon('x-mark')?>
|
||||
<?=Icon::get('o-x-mark')?>
|
||||
|
||||
</div>
|
||||
</button>
|
||||
|
|
|
@ -1,5 +1,39 @@
|
|||
<?php
|
||||
|
||||
use WoWPress\Models\Character;
|
||||
|
||||
?>
|
||||
<div class="bg-glass shadow p-auto order-last">
|
||||
|
||||
<div class="bg-glass shadow p-auto order-last flex flex-col gap-1">
|
||||
<h1 class="text-xl font-bold text-center">Klassensuche</h1>
|
||||
<div class="grid grid-cols-5 gap-2">
|
||||
<?php if($instance['text']): ?>
|
||||
<div class="p-auto col-span-5 text-center">
|
||||
<?=$instance['text']?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($instance['classes'] as $class => $specs) : ?>
|
||||
<?php if($this->hasSpec($specs)): ?>
|
||||
<div class="col-span-1"><img src="<?=Character::classIconLink($class)?>" alt="" class="h-8"></div>
|
||||
<div class="col-span-4 grid grid-cols-subgrid">
|
||||
<?php foreach ($specs as $spec => $search) : ?>
|
||||
<div><img src="<?=Character::specIconLink($class,$spec)?>" alt=""
|
||||
<?php
|
||||
switch($search){
|
||||
case 3: ?>class="h-8 border border-red-500" title="Hoch"<?php
|
||||
break;
|
||||
case 2: ?>class="h-8 opacity-70 border border-yellow-500" title="Mittel"<?php
|
||||
break;
|
||||
case 1: ?>class="h-8 opacity-50 border border-green-500" title="Niedrig"<?php
|
||||
break;
|
||||
case 0:
|
||||
default: ?>class="h-8 opacity-10" title="Suche geschlossen"<?php
|
||||
break;
|
||||
}
|
||||
?>
|
||||
></div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
|
@ -13,13 +13,13 @@ $character = $user->raiders->first();
|
|||
?>
|
||||
|
||||
<div class="bg-glass shadow p-auto flex flex-col gap-auto order-last">
|
||||
<h3 class="text-xl font-bold text-center"><?= $this->title ?></h3>
|
||||
<h1 class="text-xl font-bold text-center"><?= $this->title ?></h1>
|
||||
<?php if(!empty($character->ID)): ?>
|
||||
<?php foreach ($raids as $raid) : ?>
|
||||
<?php
|
||||
?>
|
||||
<div class="border shadow p-auto flex flex-col gap-2" style="background-position:center;background-size: cover;background-image:url('<?=$raid->thumbnail?>')">
|
||||
<h1 class="text-xl font-bold text-center"><?= $raid->title ?></h1>
|
||||
<h2 class="text-xl font-bold text-center"><a href="<?=$raid->link?>"><?= $raid->title ?></a></h2>
|
||||
<div class="text-center text-<?= $raid->color ?>"><?= $raid->difficulty ?></div>
|
||||
|
||||
<div class="flex gap-1 justify-center">
|
||||
|
|
|
@ -20,6 +20,8 @@ class ToggleButton{
|
|||
public $color_yes = "monk";
|
||||
public $color_no = "monk";
|
||||
|
||||
public $fullHeight = false;
|
||||
|
||||
public function __construct($args)
|
||||
{
|
||||
|
||||
|
@ -46,7 +48,7 @@ class ToggleButton{
|
|||
|
||||
|
||||
public function render(){
|
||||
require(get_template_directory()."/components/toggle-button.php");
|
||||
require(get_template_directory()."/template-parts/components/toggle-button.php");
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
namespace WoWPress\Frontend\Widgets;
|
||||
|
||||
use Peast\Syntax\Node\Class_;
|
||||
use WoWPress\Frontend\ToggleButton;
|
||||
use WoWPress\Models\Character;
|
||||
|
||||
class CharacterSearch extends Widget
|
||||
{
|
||||
|
||||
|
@ -12,46 +16,206 @@ class CharacterSearch extends Widget
|
|||
protected $restricted = false;
|
||||
|
||||
protected $classes = [
|
||||
'Death Knight' => [
|
||||
'Frost',
|
||||
'Unholy',
|
||||
'Blood'
|
||||
],
|
||||
'Demon Hunter' => [
|
||||
'Havoc',
|
||||
'Vengeance',
|
||||
],
|
||||
'Druid' => [
|
||||
'Feral',
|
||||
'Balance',
|
||||
'Guardian',
|
||||
'Restoration',
|
||||
]
|
||||
],
|
||||
'Death Knight' => [
|
||||
'Frost',
|
||||
'Unholy',
|
||||
'Blood'
|
||||
],
|
||||
|
||||
|
||||
'Evoker' => [
|
||||
'Augmentation',
|
||||
'Devastation',
|
||||
'Preservation',
|
||||
],
|
||||
'Warrior' => [
|
||||
'Arms',
|
||||
'Fury',
|
||||
'Protection',
|
||||
],
|
||||
'Paladin' => [
|
||||
'Holy',
|
||||
'Protection',
|
||||
'Retribution',
|
||||
],
|
||||
'Hunter' => [
|
||||
'Beast Mastery',
|
||||
'Marksmanship',
|
||||
'Survival',
|
||||
],
|
||||
'Rogue' => [
|
||||
'Assassination',
|
||||
'Outlaw',
|
||||
'Subtlety',
|
||||
],
|
||||
'Priest' => [
|
||||
'Discipline',
|
||||
'Shadow',
|
||||
'Holy',
|
||||
],
|
||||
'Shaman' => [
|
||||
'Elemental',
|
||||
'Enhancement',
|
||||
'Restoration',
|
||||
],
|
||||
'Mage' => [
|
||||
'Arcane',
|
||||
'Fire',
|
||||
'Frost',
|
||||
],
|
||||
'Warlock' => [
|
||||
'Affliction',
|
||||
'Demonology',
|
||||
'Destruction',
|
||||
],
|
||||
|
||||
'Monk' => [
|
||||
'Brewmaster',
|
||||
'Mistweaver',
|
||||
'Windwalker',
|
||||
],
|
||||
'Demon Hunter' => [
|
||||
'Havoc',
|
||||
'Vengeance',
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
public function hasSpec($specs)
|
||||
{
|
||||
foreach ($specs as $search) {
|
||||
if ($search) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public function form($instance)
|
||||
{
|
||||
|
||||
foreach ($this->classes as $class => $specs) {
|
||||
foreach ($specs as $spec) {
|
||||
?>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr($this->get_field_id("classes[$class][$spec]")); ?>"><?php echo esc_html__("$spec - $class", 'wowpress'); ?></label>
|
||||
<input type="text" class="widefat" id="<?php echo esc_attr($this->get_field_id("classes[$class][$spec]")); ?>" name="<?php echo esc_attr($this->get_field_name("classes[$class][$spec]]")); ?>" value="<?php echo esc_attr($instance['classes'][$class][$spec]); ?>">
|
||||
</p>
|
||||
<?php
|
||||
<link rel="stylesheet" type="text/css" href="<?= get_template_directory_uri() ?>/style.css">
|
||||
<style>
|
||||
input[type=radio] {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="p-auto">
|
||||
<label for="<?php echo esc_attr($this->get_field_id("text")); ?>"><?php echo esc_html__('Freitext', 'wowpress'); ?></label>
|
||||
<textarea class="w-full" name="<?php echo esc_attr($this->get_field_name("text")); ?>" id="<?php echo esc_attr($this->get_field_id("text")); ?>" rows="10"><?=$instance['text']?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-2 p-auto">
|
||||
<?php
|
||||
foreach ($this->classes as $class => $specs) {
|
||||
$classname = sanitize($class);
|
||||
|
||||
?>
|
||||
<div class="bg-<?= $classname ?> bg-opacity-25 p-auto flex flex-col gap-2">
|
||||
<div class="text-center flex flex-col justify-center items-center p-auto">
|
||||
|
||||
<img src="<?= Character::classIconLink($class) ?>" alt="" class="h-8">
|
||||
<h2 class="text-xl font-bold text-<?= $classname ?>"><?= translate_string($class) ?></h2>
|
||||
</div>
|
||||
<?php
|
||||
foreach ($specs as $spec) {
|
||||
$specname = sanitize($spec);
|
||||
?>
|
||||
<div class="grid grid-cols-5 gap-2 p-auto border border-<?= $classname ?>">
|
||||
|
||||
<div class="col-span-5">
|
||||
<h3 class="text-lg font-bold text-<?= $classname ?>"><?= translate_string($spec) ?></h3>
|
||||
</div>
|
||||
|
||||
<img src="<?= Character::specIconLink($class, $spec) ?>" alt="" class="">
|
||||
|
||||
<?php
|
||||
(new ToggleButton([
|
||||
'type' => 'radio',
|
||||
'name' => esc_attr($this->get_field_name("classes[$class][$spec]]")),
|
||||
'id' => esc_attr($this->get_field_id("classes[$class][$spec]]")) . "_0",
|
||||
'value' => 0,
|
||||
'text' => "Kein Bedarf",
|
||||
'color' => $classname,
|
||||
'icon_yes' => 'o-check',
|
||||
'checked' => empty($instance['classes'][$class][$spec]),
|
||||
'row' => false,
|
||||
'fullHeight' => true,
|
||||
]))->render();
|
||||
?>
|
||||
<?php
|
||||
(new ToggleButton([
|
||||
'type' => 'radio',
|
||||
'name' => esc_attr($this->get_field_name("classes[$class][$spec]]")),
|
||||
'id' => esc_attr($this->get_field_id("classes[$class][$spec]]")) . "_1",
|
||||
'value' => 1,
|
||||
'text' => "Niedrig",
|
||||
'color' => $classname,
|
||||
'icon_yes' => 'o-check',
|
||||
'checked' => $instance['classes'][$class][$spec] == 1,
|
||||
'row' => false,
|
||||
'fullHeight' => true,
|
||||
]))->render();
|
||||
?>
|
||||
<?php
|
||||
(new ToggleButton([
|
||||
'type' => 'radio',
|
||||
'name' => esc_attr($this->get_field_name("classes[$class][$spec]]")),
|
||||
'id' => esc_attr($this->get_field_id("classes[$class][$spec]]")) . "_2",
|
||||
'value' => 2,
|
||||
'text' => "Mittel",
|
||||
'color' => $classname,
|
||||
'icon_yes' => 'o-check',
|
||||
'checked' => $instance['classes'][$class][$spec] == 2,
|
||||
'row' => false,
|
||||
'fullHeight' => true,
|
||||
]))->render();
|
||||
?>
|
||||
<?php
|
||||
(new ToggleButton([
|
||||
'type' => 'radio',
|
||||
'name' => esc_attr($this->get_field_name("classes[$class][$spec]]")),
|
||||
'id' => esc_attr($this->get_field_id("classes[$class][$spec]]")) . "_3",
|
||||
'value' => 3,
|
||||
'text' => "Hoch",
|
||||
'color' => $classname,
|
||||
'icon_yes' => 'o-check',
|
||||
'checked' => $instance['classes'][$class][$spec] == 3,
|
||||
'row' => false,
|
||||
'fullHeight' => true,
|
||||
]))->render();
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
public function update($new_instance, $old_instance)
|
||||
{
|
||||
$instance = array();
|
||||
$instance['text'] = (!empty($new_instance['text'])) ? strip_tags($new_instance['text']) : '';
|
||||
foreach ($this->classes as $class => $specs) {
|
||||
foreach ($specs as $spec) {
|
||||
$instance['classes'][$class][$spec] = (!empty($new_instance['classes'][$class][$spec])) ? strip_tags($new_instance['classes'][$class][$spec]) : '';
|
||||
|
||||
$instance['classes'][$class][$spec] = (!empty($new_instance['classes'][$class][$spec])) ? strip_tags($new_instance['classes'][$class][$spec]) : '';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class Character extends Model
|
|||
|
||||
|
||||
|
||||
protected function sanitize($string,$delimiter_space="")
|
||||
public function sanitize($string,$delimiter_space="")
|
||||
{
|
||||
$string = strtolower(str_replace(" ", $delimiter_space, $string));
|
||||
$string = strtolower(str_replace("'", "", $string));
|
||||
|
@ -77,6 +77,11 @@ class Character extends Model
|
|||
return get_template_directory_uri() . "/icons/class/$classname/$classname.png";
|
||||
}
|
||||
|
||||
public static function classIconLink($class){
|
||||
$classname = (new self())->sanitize($class);
|
||||
return get_template_directory_uri() . "/icons/class/$classname/$classname.png";
|
||||
}
|
||||
|
||||
public function getSpecIconAttribute()
|
||||
{
|
||||
$classname = $this->sanitize($this->class);
|
||||
|
@ -84,6 +89,12 @@ class Character extends Model
|
|||
return get_template_directory_uri() . "/icons/class/$classname/$specname.png";
|
||||
}
|
||||
|
||||
public static function specIconLink($class,$spec){
|
||||
$classname = (new self())->sanitize($class);
|
||||
$specname = (new self())->sanitize($spec);
|
||||
return get_template_directory_uri() . "/icons/class/$classname/$specname.png";
|
||||
}
|
||||
|
||||
public function updateFromAPI()
|
||||
{
|
||||
$realm = $this->sanitize($this->realm,"-");
|
||||
|
@ -134,6 +145,6 @@ class Character extends Model
|
|||
|
||||
|
||||
public function getClassButtonAttribute(){
|
||||
require(get_template_directory()."/components/class-button.php");
|
||||
require(get_template_directory()."/template-parts/components/class-button.php");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ class Signup extends Model
|
|||
$showRole = false;
|
||||
}
|
||||
|
||||
require(get_template_directory() . "/components/raid-signup.php");
|
||||
require(get_template_directory() . "/template-parts/components/raid-signup.php");
|
||||
}
|
||||
|
||||
public function getStatusList($selectable = false)
|
||||
|
@ -165,6 +165,12 @@ class Signup extends Model
|
|||
|
||||
public function getStatus()
|
||||
{
|
||||
$tooLate = $this->raid->status == "Locked";
|
||||
if($tooLate && $this->status == "Unknown"){
|
||||
$this->setStatus('Too Late');
|
||||
}
|
||||
|
||||
|
||||
if (key_exists($this->status, $this->statusList)) {
|
||||
return $this->statusList[$this->status];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue