PluginProbe
ShiftController Employee Shift Scheduling / trunk
ShiftController Employee Shift Scheduling vtrunk
4.9.97 4.9.96 4.9.95 4.9.74 4.9.75 4.9.76 4.9.77 4.9.78 4.9.84 4.9.85 4.9.87 4.9.91 4.9.92 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.2.4 All 38 releases
shiftcontroller / hc3 / ui / element / listinline.php

listinline.php in ShiftController Employee Shift Scheduling trunk, at hc3/ui/element/listinline.php

96 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (! defined('ABSPATH')) exit; // Exit if accessed directly
2 class HC3_Ui_Element_ListInline extends HC3_Ui_Abstract_Collection
3 {
4 protected $htmlFactory = NULL;
5 protected $valign = 'middle';
6
7 public function __construct( HC3_Ui $htmlFactory, array $items = array() )
8 {
9 $this->htmlFactory = $htmlFactory;
10 parent::__construct( $items );
11 }
12
13 public function valign( $set )
14 {
15 $this->valign = $set;
16 return $this;
17 }
18
19 public function render()
20 {
21 $out = NULL;
22
23 // content
24 $out = '';
25
26 if( $this->separated ){
27 $separator = ($this->separated === TRUE) ? '&#124;' : $this->separated; // &vert;
28 $separator = $this->htmlFactory->makeBlock($separator)
29 ->addAttr('class', 'hc-gray')
30 ->render()
31 ;
32
33 $children = array();
34 $ii = 0;
35 foreach( $this->children as $child ){
36 $child = '' . $child;
37 if( ! strlen($child) ){
38 continue;
39 }
40
41 if( $ii ){
42 $children[] = $separator;
43 // $children[] = '&bull;';
44 }
45
46 $children[] = $child;
47 $ii++;
48 }
49 }
50 else {
51 $children = $this->children;
52 }
53
54 $ii = 0;
55 $count = count($children);
56 foreach( $children as $child ){
57 $dataPw = '';
58 if( is_object($child) && method_exists($child, 'getAttr') ){
59 $dataPw = $child->getAttr( 'data-pw' );
60 if( is_array($dataPw) ) $dataPw = current( $dataPw );
61 }
62
63 $child = '' . $child;
64 if( ! strlen($child) ){
65 continue;
66 }
67
68 $child = $this->htmlFactory->makeBlock( $child )
69 // ->addAttr('class', 'hc-inline-block')
70 ->addAttr('class', 'hc-valign-' . $this->valign)
71 ;
72
73 if( $dataPw ){
74 $child->addAttr( 'data-pw', $dataPw );
75 }
76
77 if( $this->gutter && ($ii < ($count-1)) ){
78 // $child->addAttr('class', 'hc-mr' . $this->gutter);
79 // $child->addAttr('class', 'hc-me' . $this->gutter);
80 }
81 $out .= '' . $child;
82
83 $ii++;
84 }
85
86 if( strlen($out) ){
87 $out = $this->htmlFactory->makeBlock( $out )
88 ->addAttr( 'class', 'pw-flex' )
89 ->addAttr( 'class', 'pw-gap' . $this->gutter )
90 // ->addAttr('class', 'hc-nowrap')
91 ;
92 }
93
94 return $out;
95 }
96 }