self = $hooks->wrap( $this ); $this->ui = $hooks->wrap( $ui ); $this->auth = $hooks->wrap( $auth ); $this->permission = $hooks->wrap($permission); $this->notificator = $hooks->wrap($notificator); $this->enqueuer = $enqueuer; } public function render( $return ) { $out = array(); $out[] = $this->self->renderInput(); $out = $this->ui->makeListInline( $out )->gutter(1); $to = 'admin/notifications/turnonoff'; $out = $this->ui->makeForm( $to, $out ); $out = $this->ui->makeBlock( $out ) ->addAttr('class', 'sh4-skip-notifications') ; if( isset($return[3]) ){ $return[3] = $this->ui->makeList( array($return[3], $out) ); } else { $return[3] = $out; } return $return; } public function renderInput() { $return = NULL; $currentUser = $this->auth->getCurrentUser(); $isAdmin = $this->permission->isAdmin( $currentUser ); if( ! $isAdmin ){ return $return; } $this->enqueuer->addScript('notifications', 'sh4/notifications/assets/js/skip-notifications.js?hcver=' . SH4_VERSION); $isOff = $this->notificator->isOff(); $return = $this->ui->makeInputCheckbox( 'notifications_turnoff', '__Skip Notifications__', 1, $isOff ); return $return; } }