From a8edd06011274c89e30bae4f43c837a0d719d48e Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Mon, 1 Aug 2022 21:46:24 +0200 Subject: [PATCH 1/3] app/controllers/UserController.php: typofix, should be paginate() and not pageinate() --- app/controllers/UserController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/UserController.php b/app/controllers/UserController.php index 3439c00..414f406 100644 --- a/app/controllers/UserController.php +++ b/app/controllers/UserController.php @@ -105,10 +105,10 @@ class UserController extends ControllerBase $paginator = ActivityLog::getPaginationList($user->getId(), $page); - $this->view->page = $paginator->pageinate(); + $this->view->page = $paginator->paginate(); $this->view->pagination_url = '/user/activity/'; } - + public function oauthDisconnectAction($provider, $last_unlink_confirmed = false) { $user = $this->_getAuth()->getUser(); From 9cd10581d806b8cff43ffa9a27ca52084321c95d Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Tue, 2 Aug 2022 12:36:45 +0200 Subject: [PATCH 2/3] app/library/Form.php: Phalcon\Forms\Element is renamed to Phalcon\Forms\Element\AbstractElement --- app/library/Form.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/library/Form.php b/app/library/Form.php index ebbb8bc..7efbc32 100644 --- a/app/library/Form.php +++ b/app/library/Form.php @@ -3,7 +3,7 @@ namespace Httpcb; use Phalcon\Forms\Form as FormBase, - Phalcon\Forms\Element as FormElement; + Phalcon\Forms\Element\AbstractElement; class Form extends FormBase { @@ -45,7 +45,7 @@ class Form extends FormBase return $this->_render($ele, $options); } - protected function _render(FormElement $ele, $opt) + protected function _render(AbstractElement $ele, $opt) { $xhtml = ''; From 8ff5b5cd1e547d465c01f9470a4658e94eac54a0 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Tue, 2 Aug 2022 12:37:56 +0200 Subject: [PATCH 3/3] app/forms/UserSettings.php: extend Httpcb\Form instead of Phalcon\Forms\Form and delete renderDecorated() and _render() as they exists in Httpcb\Form --- app/forms/UserSettings.php | 64 ++------------------------------------ 1 file changed, 2 insertions(+), 62 deletions(-) diff --git a/app/forms/UserSettings.php b/app/forms/UserSettings.php index 91c022a..1142081 100644 --- a/app/forms/UserSettings.php +++ b/app/forms/UserSettings.php @@ -8,10 +8,9 @@ namespace App\Form; use App\Model\Data\User as UserModel; /** - * Phalcon Form + * Form */ -use Phalcon\Forms\Form as FormBase, - Phalcon\Forms\Element\AbstractElement; +use Httpcb\Form as FormBase; /** * Element types @@ -173,63 +172,4 @@ class UserSettings extends FormBase 'with' => 'passwordNew', ])); } - - public function renderDecorated($name, $opt = []) - { - $options = [ - 'label-class' => 'control-label', - 'class' => 'col-sm-10', - 'message' => '' - ]; - - $ele = $this->get($name); - - if (isset($opt['label-length'])) { - $length = (int) $opt['label-length']; - } else { - $length = 2; - } - $options['label-class'] .= ' col-sm-' . $length; - - if (isset($opt['length'])) { - - $len = $opt['length']; - - if ($len === 'full') { - $options['class'] = ''; - } else { - $options['class'] = 'col-sm-' . $opt['length']; - } - } - - if ($ele->hasMessages()) { - $options['class'] .= ' has-error'; - $options['message'] = $ele->getMessages()->current(); - } - - return $this->_render($ele, $options); - } - - protected function _render(AbstractElement $ele, $opt) - { - $xhtml = ''; - - if (strlen($ele->getLabel()) > 0) { - - $xhtml .= sprintf( - '', - $opt['label-class'], $ele->getName(), $ele->getLabel()); - } - - $xhtml .= '
' - . $ele->render(); - - if (strlen($opt['message']) > 0) { - $xhtml .= '' . $opt['message'] . ''; - } - - $xhtml .= '
'; - - return $xhtml; - } }