diff --git a/theme/wowpress/Frontend/ToggleButton.php b/theme/wowpress/Frontend/ToggleButton.php
index 0fb4022..b603a6f 100644
--- a/theme/wowpress/Frontend/ToggleButton.php
+++ b/theme/wowpress/Frontend/ToggleButton.php
@@ -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");
}
}
\ No newline at end of file
diff --git a/theme/wowpress/Frontend/Widgets/CharacterSearch.php b/theme/wowpress/Frontend/Widgets/CharacterSearch.php
index b187849..f958199 100644
--- a/theme/wowpress/Frontend/Widgets/CharacterSearch.php
+++ b/theme/wowpress/Frontend/Widgets/CharacterSearch.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) {
?>
-
- ">
- " name="get_field_name("classes[$class][$spec]]")); ?>" value="">
-
-/style.css">
+
+
+
+ ">
+
+
+
+
+ classes as $class => $specs) {
+ $classname = sanitize($class);
+
+ ?>
+
+
+
+
+
= translate_string($class) ?>
+
+
+
+
+
+
= translate_string($spec) ?>
+
+
+
+
+ '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();
+ ?>
+ '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();
+ ?>
+ '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();
+ ?>
+ '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();
+ ?>
+
+
+
+
+
+
+
+
+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]) : '';
}
}
diff --git a/theme/wowpress/Models/Character.php b/theme/wowpress/Models/Character.php
index b2559da..643b285 100644
--- a/theme/wowpress/Models/Character.php
+++ b/theme/wowpress/Models/Character.php
@@ -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");
}
}
diff --git a/theme/wowpress/Models/Signup.php b/theme/wowpress/Models/Signup.php
index d40b85c..7d71f46 100644
--- a/theme/wowpress/Models/Signup.php
+++ b/theme/wowpress/Models/Signup.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];
}