statusList = [ 'Unknown' => (object)[ 'selectable' => false, 'name' => 'Keine Rückmeldung', 'icon' => 'o-no-symbol', 'color' => 'slate-500', ], 'Present' => (object)[ 'selectable' => true, 'name' => 'Anwesend', 'icon' => 'o-check-circle', 'color' => 'green-500', ], 'Absent' => (object)[ 'selectable' => true, 'name' => 'Abwesend', 'icon' => 'o-x-circle', 'color' => 'red-500', ], 'Late' => (object)[ 'selectable' => true, 'name' => 'Verspätet', 'icon' => 'o-clock', 'color' => 'orange-500', ], 'Tentative' => (object)[ 'selectable' => true, 'name' => 'Ersatzbank', 'icon' => 'o-question-mark-circle', 'color' => 'yellow-500', ], 'Selected' => (object)[ 'selectable' => false, 'name' => 'Bestätigt', 'icon' => 's-star', 'color' => 'paladin', ], ]; $this->roleList = [ 'Unknown' => (object)[ 'selectable' => false, 'name' => 'Keine Rolle', 'icon' => 'o-no-symbol', 'color' => 'slate-500', ], 'Tank' => (object)[ 'selectable' => true, 'name' => 'Tank', 'icon' => 'o-shield-exclamation', 'color' => 'white', ], 'Heal' => (object)[ 'selectable' => true, 'name' => 'Heilung', 'icon' => 'o-heart', 'color' => 'white', ], 'Ranged' => (object)[ 'selectable' => true, 'name' => 'Ranged', 'icon' => 'o-bolt', 'color' => 'white', ], 'Melee' => (object)[ 'selectable' => true, 'name' => 'Melee', 'icon' => 'o-hand-raised', 'color' => 'white', ], ]; } public function character(){ return $this->belongsTo(Character::class); } public function raid(){ return $this->belongsTo(Raid::class); } public function showForm($showRole = false, $showStatus = false,$vertical = false,$doSignup = true){ require(get_template_directory()."/components/raid-signup.php"); } public function getStatusList($selectable = false){ $out = []; foreach($this->statusList as $key => $status){ if($selectable){ if($status->selectable){ $out[$key] = $status; } }else{ $out[$key] = $status; } } return $out; } public function getRoleList(){ $out = []; foreach($this->roleList as $key => $status){ if($status->selectable){ $out[$key] = $status; } } return $out; } public function getStatus(){ if (key_exists($this->status, $this->statusList)) { return $this->statusList[$this->status]; } return $this->statusList['Unknown']; } public function getRole(){ if (key_exists($this->role, $this->roleList)) { return $this->roleList[$this->role]; } return $this->roleList['Unknown']; } public function setStatus($status){ if (key_exists($status, $this->statusList)) { $this->status = $status; return true; } return false; } public function setRole($role){ if (key_exists($role, $this->roleList)) { $this->role = $role; return true; } return false; } }