-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
218 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
namespace abrain\Einsatzverwaltung\Frontend; | ||
|
||
/** | ||
* Einstellungsobjekt für die ReportList | ||
* | ||
* @author Andreas Brain | ||
* @package abrain\Einsatzverwaltung\Frontend | ||
*/ | ||
class ReportListSettings | ||
{ | ||
const DEFAULT_NTHCHILD = 'even'; | ||
const DEFAULT_ZEBRACOLOR = '#eee'; | ||
|
||
/** | ||
* Eine Farbe der Zebrastreifen, die nicht vom Theme vorgegeben wird | ||
* | ||
* @return string | ||
*/ | ||
public function getZebraColor() | ||
{ | ||
return get_option('einsatzvw_list_zebracolor', self::DEFAULT_ZEBRACOLOR); | ||
} | ||
|
||
/** | ||
* Gibt das Argument für den :nth-child()-Selektor für die Zebrastreifen zurück | ||
* | ||
* @return string | ||
*/ | ||
public function getZebraNthChildArg() | ||
{ | ||
$option = get_option('einsatzvw_list_zebra_nth', self::DEFAULT_NTHCHILD); | ||
return $this->sanitizeZebraNthChildArg($option); | ||
} | ||
|
||
/** | ||
* Gibt an, ob die Zeilen der Tabelle abwechselnd eingefärbt werden sollen | ||
* | ||
* @return boolean | ||
*/ | ||
public function isZebraTable() | ||
{ | ||
return (bool) get_option('einsatzvw_list_zebra', true); | ||
} | ||
|
||
/** | ||
* Stellt sicher, dass das Argument für den :nth-child()-Selektor für die Zebrastreifen gültig ist | ||
* | ||
* @param string $input Der zu prüfende Wert | ||
* | ||
* @return string | ||
*/ | ||
public function sanitizeZebraNthChildArg($input) | ||
{ | ||
if (!in_array($input, array('odd', 'even'))) { | ||
return self::DEFAULT_NTHCHILD; | ||
} | ||
|
||
return $input; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.