1: <?php
2: namespace Azalea\Selenium\EHR\UI;
3:
4: class CheckboxGrid extends \Azalea\Selenium\EHR\UI\Grid
5: {
6: protected static $checkboxSelector = "";
7:
8: 9: 10: 11:
12: public function hasCheckboxes()
13: {
14: $checkboxes = $this->getElementsByCss($this->getSelector()." ".static::$checkboxSelector);
15: return (count($checkboxes) > 0);
16: }
17:
18: 19: 20: 21:
22: public function getCheckboxes()
23: {
24: return $this->getElementsByCss($this->getSelector()." ".static::$checkboxSelector);
25: }
26:
27: 28: 29: 30:
31: public function isAllCheckboxesChecked()
32: {
33: $checkboxes = $this->getCheckboxes();
34: foreach($checkboxes as $checkbox) {
35: if (!$checkbox->selected()) {
36: return false;
37: }
38: }
39: return true;
40: }
41:
42: 43: 44: 45:
46: public function checkAll()
47: {
48: $checkboxes = $this->getCheckboxes();
49: foreach($checkboxes as $checkbox) {
50: if (!$checkbox->selected()) {
51: $checkbox->click();
52: }
53: }
54: }
55:
56: 57: 58: 59:
60: public function uncheckAll()
61: {
62: $checkboxes = $this->getCheckboxes();
63: foreach($checkboxes as $checkbox) {
64: if ($checkbox->selected()) {
65: $checkbox->click();
66: }
67: }
68: }
69: }