| @@ -45,21 +45,14 @@ | ||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | class HC3_Ui implements HC3_Ui_ |
| 48 | 48 | { |
| 49 | - public $t, $settings, $request, $enqueuer; | |
| 49 | + protected $t = NULL; | |
| 50 | 50 | |
| 51 | - public function __construct( | |
| 52 | - HC3_Request $request, | |
| 53 | - HC3_Enqueuer $enqueuer, | |
| 54 | - HC3_Time $t, | |
| 55 | - HC3_Settings $settings | |
| 56 | - ) | |
| 51 | + public function __construct( HC3_Time $t, HC3_Settings $settings ) | |
| 57 | 52 | { |
| 58 | 53 | $this->t = $t; |
| 59 | 54 | $this->settings = $settings; |
| 60 | - $this->request = $request; | |
| 61 | - $this->enqueuer = $enqueuer; | |
| 62 | 55 | } |
| 63 | 56 | |
| 64 | 57 | public function helperActionsFromArray( array $menu, $hidden = FALSE ) |
| 65 | 58 | { |
| @@ -66,15 +59,11 @@ | ||
| 66 | 59 | $return = array(); |
| 67 | 60 | |
| 68 | 61 | foreach( $menu as $k => $item ){ |
| 69 | 62 | // form |
| 70 | - if( count($item) >= 3 ){ | |
| 71 | - $href = $item[0]; | |
| 72 | - $formContent = $item[1]; | |
| 73 | - $btnLabel = $item[2]; | |
| 63 | + if( count($item) == 3 ){ | |
| 64 | + list( $href, $formContent, $btnLabel ) = $item; | |
| 74 | 65 | |
| 75 | - $confirm = ( isset($item[3]) && $item[3] ) ? true : false; | |
| 76 | - | |
| 77 | 66 | if( ! $hidden ){ |
| 78 | 67 | $btn = $this->makeInputSubmit($btnLabel) |
| 79 | 68 | ->tag('nice-link') |
| 80 | 69 | // ->tag('secondary') |
| @@ -79,13 +68,8 @@ | ||
| 79 | 68 | ->tag('nice-link') |
| 80 | 69 | // ->tag('secondary') |
| 81 | 70 | // ->tag('align', 'left') |
| 82 | 71 | ; |
| 83 | - | |
| 84 | - if( $confirm ){ | |
| 85 | - $btn->addAttr( 'onclick', ' return confirm(\'' . $btnLabel . '?\')' ); | |
| 86 | - } | |
| 87 | - | |
| 88 | 72 | $formContent = $formContent ? $this->makeListInline( array($formContent, $btn) ) : $btn; |
| 89 | 73 | } |
| 90 | 74 | |
| 91 | 75 | $item = $this->makeForm( $href, $formContent ); |
| @@ -99,15 +83,8 @@ | ||
| 99 | 83 | // continue; |
| 100 | 84 | // } |
| 101 | 85 | list( $href, $btnLabel ) = $item; |
| 102 | 86 | |
| 103 | - // display just label | |
| 104 | - // if (false === $href) { | |
| 105 | - // $item = $btnLabel; | |
| 106 | - // $return[$k] = $item; | |
| 107 | - // continue; | |
| 108 | - // } | |
| 109 | - | |
| 110 | 87 | if( is_array($href) ){ |
| 111 | 88 | $finalHref = str_replace( '--ID--', $href[1], $href[0] ); |
| 112 | 89 | } |
| 113 | 90 | else { |
| @@ -232,11 +209,10 @@ | ||
| 232 | 209 | $return = new HC3_Ui_Element_Element( $el, $content ); |
| 233 | 210 | return $return; |
| 234 | 211 | } |
| 235 | 212 | |
| 236 | - public function makeLongText( $content = '', $length = 40 ) | |
| 213 | + public function makeLongText( $content = NULL, $length = 40 ) | |
| 237 | 214 | { |
| 238 | - if( null === $content ) $content = ''; | |
| 239 | 215 | $contentView = $content; |
| 240 | 216 | |
| 241 | 217 | $shortContentView = $contentView; |
| 242 | 218 | if( strlen($contentView) > $length ){ |
| @@ -374,14 +350,8 @@ | ||
| 374 | 350 | $return = new HC3_Ui_Element_Input_Text( $this, $name, $label, $value ); |
| 375 | 351 | return $return; |
| 376 | 352 | } |
| 377 | 353 | |
| 378 | - public function makeInputNumber( $name, $label = NULL, $value = NULL ) | |
| 379 | - { | |
| 380 | - $return = new HC3_Ui_Element_Input_Number( $this, $name, $label, $value ); | |
| 381 | - return $return; | |
| 382 | - } | |
| 383 | - | |
| 384 | 354 | public function makeInputPassword( $name, $label = NULL ) |
| 385 | 355 | { |
| 386 | 356 | $return = new HC3_Ui_Element_Input_Password( $this, $name, $label ); |
| 387 | 357 | return $return; |
| @@ -418,13 +388,8 @@ | ||
| 418 | 388 | } |
| 419 | 389 | |
| 420 | 390 | public function makeInputColorpicker( $name, $label, $value = NULL ) |
| 421 | 391 | { |
| 422 | - if( ! $this->request->isPrintView() ){ | |
| 423 | - $this->enqueuer | |
| 424 | - ->addScript('colorpicker', 'hc3/ui/element/input/colorpicker/assets/input.js?hcver=' . SH4_VERSION); | |
| 425 | - ; | |
| 426 | - } | |
| 427 | 392 | $return = new HC3_Ui_Element_Input_Colorpicker( $this, $name, $label, $value ); |
| 428 | 393 | return $return; |
| 429 | 394 | } |
| 430 | 395 | |
| @@ -429,15 +394,8 @@ | ||
| 429 | 394 | } |
| 430 | 395 | |
| 431 | 396 | public function makeInputDatepicker( $name, $label = NULL, $value = NULL ) |
| 432 | 397 | { |
| 433 | - if( ! $this->request->isPrintView() ){ | |
| 434 | - $this->enqueuer | |
| 435 | - ->addScript('datepicker', 'hc3/ui/element/input/datepicker/assets/input.js?hcver=' . SH4_VERSION) | |
| 436 | - ->addStyle('datepicker', 'hc3/ui/element/input/datepicker/assets/input.css?hcver=' . SH4_VERSION) | |
| 437 | - ; | |
| 438 | - } | |
| 439 | - | |
| 440 | 398 | if( $value === NULL ){ |
| 441 | 399 | $this->t->setNow(); |
| 442 | 400 | $value = $this->t->formatDateDb(); |
| 443 | 401 | } |