Available Widgets

This guide describes:

1 UserStatusWidget

Displays current user. If user is not logged in, it is hidden.


<?php $this->widget('user.widgets.UserStatusWidget')?>

2 UserLoginWidget

Shows a login mask. Gives possibility to select login method.


<?php $this->widget('user.widgets.UserLoginWidget', array('recoveryUrl'=> 'Content.Node/service/Password-Recovery.en.html'))?>

Parameters:

  • recoveryUrl – page URL where the UserRecoveryWidget is placed. If not specified in widget call, the portal tries to get it from application config

Login is configurable whether we take the username or the email for logging in.

Config parameters are:


'modules'=> array(
    .....................
    'user'=> array(
        ...................................
        //define which user field will be used in login process. 'email' or 'username'. If field != 'email' then username will be used
        'authField' => 'email',
        //define if username will be shown in register process
        'usernameRequired' => true,
        //define if username should be unique during registration
        'usernameUnique' => true,
        ...................................
    )

Users can use the checkbox “stay logged in”. In the configuration you can define for how long users can stay logged in (i.e. 30 days).


'modules'=> array(
    .....................
    'user'=> array(
        ...................................
        //int number of seconds that the user can remain in logged-in status.
        //Defaults to 0, meaning login till the user closes the browser.
        //If greater than 0, cookie-based login will be used.
        'loggedInDuration' => 60 * 60 * 24 * 30,
        ...................................
    )

UserLoginWidget will not be displayed if you don’t have any authentication services in your configuration.

At least you should have one (i.e. ‘standard’). More you can read here


'components'=> array(
    .............
    'eauth' => array(
            //currenly using services for authentication
            'services' => array(
                'standard' => array(
                    'title' => 'With username/password'
                ),
            )
        ),
)

3 UserLogoutWidget

Shows link which is used to log out users. If user is not logged in, it is hidden.


<?php $this->widget('user.widgets.UserLogoutWidget')?>

4 UserRegistrationWidget

The registration form for registering new users.


<?php $this->widget('user.widgets.UserRegistrationWidget')?>

5 UserRecoveryWidget

Shows the form where users can input their login/email and reset their forgotten password.


<?php $this->widget('user.widgets.UserRecoveryWidget')?>

6 UserRecoveryPasswordChangeWidget

Used in pair with UserRecoveryWidget. Checked generated key and allows user to change forgotten password.


<?php $this->widget('user.widgets.UserRecoveryPasswordChangeWidget') ?>

In configuration it specified


'modules' => array(
    ............................
    'user'=>array(
        ............................
        'recoveryChangePasswordUrl' => array(
            'en' => '/widgetsTests/recoveryChangePassword',
        ),
    )
)

7 UserProfileEditWidget

Shows form, where user can edit his profile


<?php $this->widget('user.widgets.UserProfileEditWidget')?>

8 UserProfileWidget

Shows user profile data


<?php $this->widget('user.widgets.UserProfileWidget')?>

9 UserPasswordChangeWidget

Shows the form for password changing


<?php $this->widget('user.widgets.UserPasswordChangeWidget')?>

10 CommentsFormWidget


<?php $this->widget('comments.widgets.CommentsFormWidget', array(
        'contentId' => 'C102',
        'moderatorEmail' => 'moderator@example.com',
        'notifyModeratorOnNew' => true,
        'allowAnonymous' => true,
        'dontNeedApprove' => true)
)?>

Parameters:

  • contentId – id of content
  • moderatorEmail – moderator email. It needs for managing comments
  • notifyModeratorOnNew – notify moderator on new comments. By default is true
  • allowAnonymous – allow not logged in user to write comments. By default is true
  • dontNeedApprove – if true comments approved automatically. By default is false
Preview

<portal>/comments/preview/commentsFormWidget?contentId=C102&allowAnonymous=true

Parameters:

  • contentId – id of content
  • allowAnonymous – allow not logged in user to write comments. If true comments form will be shown

You can call this preview via a local proxy on the CMS-server with an ajax request and display the content in the CMS page.

with ajax-calls you can not request content from a different domain (this is forbidden for security reasons).

11 CommentsListWidget

Shows a list of comments for contentId


<?php $this->widget('user.widgets.CommentsListWidget', array(
            'contentId'=>'C102',
            'oneLevelReply'=> true,
            'commentsPerPage'=> 10,
            'paginationPagesCount'=>5))
?>

Parameters:

  • contentId – id of content
  • moderatorEmail – moderator email
  • oneLevelReply – If threaded commenting showed (only 1 level). By default is false.
  • commentsPerPage – comments per page. By default is 5
  • paginationPagesCount – how many pagination pages numbers will be displayed at the same time. By default is 5
Preview

<portal>/comments/preview/CommentsListWidget?contentId=C102

Parameters:

  • contentId – id of content. Comments related to this id will be displayed in preview

12 CommentsWidget

This widget is a combination of CommentsFormWidget and CommentsListWidget


<?php $this->widget('comments.widgets.CommentsWidget', array(
    'contentId' => 'C102',
    'moderatorEmail' => 'moderator@example.com',
    'notifyModeratorOnNew' => true,
    'allowAnonymous' => true,
    'dontNeedApprove' => true,
    'oneLevelReply'=> true,
    'commentsPerPage'=> 10,
    'paginationPagesCount'=>5)
)?>

Parameters:

  • contentId – id of content
  • moderatorEmail – moderator email. It needs for managing comments
  • notifyModeratorOnNew – notify moderator on new comments. By default is true
  • allowAnonymous – allow not logged in user to write comments. By default is true
  • dontNeedApprove – if true comments approved automatically. By default is false
  • oneLevelReply – If threaded commenting showed (only 1 level). By default is false.
  • commentsPerPage – comments per page. By default is 5
  • paginationPagesCount – how many pagination pages numbers will be displayed at the same time. By default is 5
Preview

<portal>/comments/preview/CommentsWidget?contentId=C102&allowAnonymous=true

Parameters:

  • contentId – id of content
  • allowAnonymous – allow not logged in user to write comments. If true comments form will be shown

13 CommentsAmountWidget

Shows amount of comments for different content ids.

First step is preload comments amount. Then get amount from widget object for each content id.


<?php $commentsAmount = $this->widget('comments.widgets.CommentsAmountWidget', array(
'contentId' => array('12300124', '12300123'))) ?>
12300123: <?php $commentsAmount->forContent('12300123') ?>
12300124: <?php $commentsAmount->forContent('12300124') ?>

Parameters:

  • contentId – can be string, or array of content id values

14 LikeWidget

If user is authorized: Shows “Like” button,if user has not ”Liked” this content before and “Unlike” button, if he did.

If user is not authorized: Shows link to page where user can log in. After logging in, user will be redirected exactly where the like widget is placed.

In both cases it shows the list of first and last names of users who ”liked” the content.


<?php $this->widget('like.widgets.LikeWidget', array('contentId'=>'C102'))?>

Parameters:

  • contentId – id of content
Preview

<portal>/like/preview?contentId=C102

Displays navigation tree depending on given settings


<?php $this->widget('navigation.widgets.NavigationWidget', array(
    'startfolderId'=>'15001','activeElement'=>'15233' ,
    'isSitemap'=>false, 'isBreadcrumb'=>false, 'cssClass'=>'navigation-custom',
    'maxLvl'=>2, 'hideFirstLevel'=>false)
)?>

Parameters:

  • startfolderId – Id of the folder that should be treated as root. Required
  • activeElement – defines current active element. Required if isSitemap=false
  • isSitemap – is this parameter is set then all branches will get class=”opened”
  • isBreadcrumb -defines if widget is in breadcrumb mode. If it is – then only elements from active path will be shown
  • cssClass – if this parameter is set, then it will be added to all
      tags as a class. Default value is “navigation”
    • maxLvl – if this parameter is set and it is more than zero, then category tree depth will be limited by its value
    • hideFirstLevel(bool) – if this parameter set to true, then the navigation tree will be shown same way as startfolderId=activeElement

    16 FriendsSearchWidget

    Executes search for users which exist in DB. Fields which will used for search are configurable.

    
    <?php $this->widget('friends.widgets.FriendsSearchWidget', array(
        'userFields'=>array('username'),
        'profileFields'=> array('lastname', 'gender', 'searchResultPageUrl'=> '/Content.Node/service/Login.en.html'))
    )?>
    

    Parameters:

    • userFields – array of User model fields names which will used for search
    • profileFields – Array of Profile model fields which will used for search
    • searchResultPageUrl – page where FriendsListWidget placed

    17 FriendsSearchResultWidget

    Shows user search result. Use in pair with FriendsSearchWidget

    
    <?php $this->widget('friends.widgets.FriendsSearchResultWidget', array('contentId'=>'C102'))?>
    

    18 FriendsListWidget

    Shows current user friends. Allows accept/cancel friendship. Shows current friendship status

    
    <?php $this->widget('friends.widgets.FriendsListWidget', array('contentId'=>'C102'))?>
    

    19 GenticsImageStoreWidget

    Allows you to resize images during page load and cache them. This is a pure PHP implementation and therefore doesn’t require a Java servlet. This works with Content repository (CMS) objects, images on the filesystem, URLS and any PHP fopen wrappers.

    The given image will be resized, cached and a user-friendly frontend URL will be generated that links to the GenticsImageStoreController.

    
    <?php $this->widget('genticsimagestore.widgets.GenticsImageStoreWidget', array(
        'id'            => 185,
        'publishPath'   => "/Content.Node/exampleimage.jpg",
        'resizeOptions' => array('width' => 100, 'height' => 100, 'mode' => "prop")
        'cropOptions'   => array('width' => 100, 'height' => 100, 'mode' => "prop")
    ); ?>
    

    Parameters:

    • id – The ID of the image in the content repository, you don’t have to prepend “10008”
    • publishPath – Optional: The publish URL in the content repository. This is pure performance optimization, when this is specified, no CR lookup is necessary to get the image path.
    • filePath – Instead of the id and the publishPath, you can also set this to specificy a path on the local filesystem or you can also specify a HTTP URL. However changes on remote files can’t be detected automatically as long as the cache file exists.
    • resizeOptions – Resize options, as explained in the GenticsImageStore documentation of Gentics Content.Node
    • cropOptions – Crop options, as explained in the GenticsImageStore documentation of Gentics Content.Node

    The Gentics Content.Node #gtx_gis Velocity directive can automatically render this widget when publishing pages. See the Gentics Content.Node GenticsImageStore documentation for more information.

    See the GenticsImageStoreModule documentation for more information on the module itself.

    20 CreateShortUrlWidget

    See: CreateShortUrlWidget