info@ektanjali.com +91 99276-99286

CakePHP 3.x User Management Premium Plugin Version 3.0.x

Miscellaneous

1. Plugin Routing

All URLS related to this plugin are routed from routes.php yourapp/plugins/Usermgmt/config/routes.php

Basically in CakePHP 3.x version plugin's URL are lengthy. If you want to call plugin's controller's function then you have to use URL
http://CakePHP3-user-management.ektanjali.com/usermgmt/Users/index/

So I have shorten the long URLS by CakePHP routing feature. For more clarification see plugin's routes.php

2. Get all controller names and their function names
If you want to get all controller's names and their function names of your application any where for that we have a component.
How to use this component
Include ControllerList Component in controller's Component variable for e.g.
public $components = ['Usermgmt.ControllerList'];a. If you want all controller's names add their function names you should call
$result = $this->ControllerList->getControllerAndActions();b. If you want all controller's names you should call
$result = $this->ControllerList->getControllerClasses();

3. User's Dashboard
For now plugin's dashboard contains links only. You can customize this according your need. Location is yourapp/plugins/Usermgmt/src/Template/Users/dashboard.ctp

4. Dashboard Menu
Plugin has dashboard menu system it contains all links. This can be added on any page by calling dashboard element. Location is yourapp/plugins/Usermgmt/src/Template/Element/dashboard.ctp
<?php echo $this->element('Usermgmt.dashboard'); ?>

5. User Auth Helper
As we cannot access component's functions in Template file so I have re-declared some functions of User Auth Component in User Auth Helper. for e.g. If you want logged in user id then you can get by following syntax in any controller as well as in any view.
$userId = $this->UserAuth->getUserId();

6. some useful function which can be used in any controller and template view file

// get logged in user id
$userId = $this->UserAuth->getUserId();

// check whether user is logged in or not
$isLogged = $this->UserAuth->isLogged();

// check whether user is admin or not
$isAdmin = $this->UserAuth->isAdmin();

// check whether user is guest or not
$isGuest = $this->UserAuth->isGuest();

// get logged in user information
$user = $this->UserAuth->getUser();

// get logged in user groups ids (comma separated)
$userGroupId = $this->UserAuth->getGroupId();

// get logged in user groups names (comma separated)
$userGroupName = $this->UserAuth->getGroupName();

// get logged in user last login time, you can pass datetime format
$lastLoginTime = $this->UserAuth->getLastLoginTime($format);

For more information see
yourapp/plugins/Usermgmt/src/View/Helper/UserAuthHelper.php and
yourapp/plugins/Usermgmt/src/Controller/Component/UserAuthComponent.php

7. $var variable for View
This variable is set from beforeRender function of User Auth Component yourapp/app/Plugin/Usermgmt/Controller/Component/UserAuthComponent.php
This contains logged in user's current information.
for e.g. if you want to print logged in user's name then you should use following syntax.
<?php echo h($var['User']['first_name']).' '.h($var['User']['last_name']); ?>For more information you can use pr($var); for what information this variable have.

8. Browser Cache Control
this plugin has a feature to control browser cache. Do you know what happens?? when user browse your site with diff-diff browsers then browsers stores CSS and JS cache internally. Now if you make any changes in CSS or JS file then next time user's browse your site then they do not see changes due to browser cache. So plugin has a solution for this issue. we have added a setting in All Setting page for query string no. You have to increase this no by 1 every time you make changes in any CSS or JS file

How to use this feature
<link href="/umpremium/usermgmt/css/umstyle.css?q=12345678" type="text/css" rel="stylesheet"> OR
<?php echo $this->Html->css(array('/usermgmt/css/umstyle.css?q='.QRDN)); ?>

<script src="/umpremium/usermgmt/js/um.autocomplete.js?q=12345678" type="text/javascript"> OR
<?php echo $this->Html->script(array('/usermgmt/js/um.autocomplete.js?q='.QRDN)); ?>
Where
q is query string
QRDN is query string value which can be managed from All Settings page.

9. Send Emails
You can send emails to registered users, group users and other email addresses. For this click on Send Emails link in admin area now you will have input fields for email information. All input fields are self explanatory. Rich text editor is added for message like gmail. You can send HTML message with the help of this editor. You also have a quick option to send email to any registered user from All Users page.

10. Send Emailer
With the help of this rich text editor you can send your company emailer (a html templates) to registered users, group users and other email addresses. For this you need to click on Tools icon then click on Source code in rich text editor then a pop up window will open and you have to paste html code of emailer in that. Now you are ready to send the mail.

11. A small CMS for creating Static Pages
You can add/edit/delete/view static pages from admin area. For this you need to click on All Pages link. After adding a page you will get a link and you can put this link anywhere on the site.

12. A contact us form
we have contact us enquiry form element in this plugin. You can put it any where in the site. for e.g.
<?php echo $this->element('Usermgmt.contact_us'); ?>All contact enquiries will be saved in database and will be mailed to admin email address. Please update Admin Email Address in All Settings page. You can reply to any enquiry from All Contact Enquiries page.

13. Tinymce Editor
You can use Tinymce editor in following way
Include Tinymce helper in controller's Helper variable for e.g.
public $helpers = ['Usermgmt.Tinymce'];In View file you can use tinymce editor for textarea

<?php  echo $this->Tinymce->textarea('UserEmails.message', array('type'=>'textarea',  'label'=>false, 'div'=>false, 'style'=>'height:800px'), array('language'=>'en'), 'umcode');?>

where 'umcode' is configurable for textarea toolbar. Possible values are 'full', 'basic', 'simple', 'umcode'

14. Ckeditor Editor
You can use Ckeditor editor in following way
Include Ckeditor helper in controller's Helper variable for e.g.
public $helpers = array['Usermgmt.Ckeditor'];In View file you can use Ckeditor editor for textarea

<?php  echo $this->Ckeditor->textarea('UserEmail.message', array('type' => 'textarea',  'label' => false, 'div' => false, 'style'=>'height:400px'), array('language'=>'en', 'uiColor'=> '#14B8C4'), 'full');?>

where 'full' is configurable for textarea toolbar. Possible values are 'basic', 'standard', 'full'

15. Flash Messages CSS
You can use Flash Messages css following way
In controller you can set error, warning, info and success flash messages-
For success-
$this->Flash->success(__('Flash Text Message'));

For error
$this->Flash->error(__('Flash Text Message'));

For warning
$this->Flash->warning(__('Flash Text Message'));

For info
$this->Flash->info(__('Flash Text Message'));

16. Link Based on Permission
You can display a link in view based on permission.
for e.g. If you want to display send mail link in view file based on loggedin user permission or in other words If a loggedin user has permission to send mails then only the user can see the 'Send Mail' link in view.
For this you have to check UserEmails controller's send function permission for loggedin user

if($this->UserAuth->HP('UserEmails', 'send', 'Usermgmt')) {
    echo $this->Html->link(__('Send Mail'), ['controller'=>'UserEmails', 'action'=>'send', 'plugin'=>'Usermgmt'], ['class'=>'btn btn-default um-btn']);
}

HP function arguments are controller, action, plugin name. if controller is from main src then plugin name is false.

17. Date picker in text input
You can now display date picker in any text input by adding 'datepicker' class

<?php echo $this->Form->input('Users.bday', ['type'=>'text', 'label'=>false, 'div'=>false, 'class'=>'form-control datepicker']);?>

18. Datetime picker in text input
You can now display datetime picker in any text input by adding 'datepicker' class

<?php echo $this->Form->input('Users.bday', ['type'=>'text', 'label'=>false, 'div'=>false, 'class'=>'form-control datetimepicker']);?>