Yii 1.1: dashboard

This module used to build a iGoole like dashboard page which let user drag/drop/add/remove portlets in.

...overview of the extension...


Yii 1.1.5 or above.


  1. Add in config/main.php:
    'dashboard' => array(
      'debug' => true,
      'portlets' => array(
        'News' => array('class' => 'News', 'visible' => true, 'weight' => 0), 
        'Forums' => array('class' => 'Forums', 'visible' => true, 'weight' => 1), 
        'Videos' => array('class' => 'Videos', 'visible' => true, 'weight' => 2), 
        'Blogs' => array('class' => 'Blogs', 'visible' => true, 'weight' => 3), 
        'Friends' => array('class' => 'Friends', 'visible' => true, 'weight' => 4),
  1. Access the dashboard page by index.php/dashboard

  2. User can create own portlet.


class Blogs extends DPortlet
  protected function renderContent()
    echo 'Blogs Content';
  protected function getTitle()
    return 'Blogs';
  protected function getClassName()
    return __CLASS__;

b: Put this portlet file into /modules/dashboard/portlets directory.

c: Add this portlet into dashboard configuration like step 1.

Total 11 comments

#17423 report it
VictorG at 2014/06/09 05:10pm
Some Changes

Great extension, it is a shame that it has not been updated in a long time. I have used it for one of my projects, for which I made some changes that maybe will be useful to someone. I altered the style sheet so that the columns would be responsive, and so that a close icon would be displayed next to the icon to minimize / maximize. Here is the complete code (dashboard.css):

.column {
    width: 31%;
    float: left;
    padding-bottom: 100px;
.dashboard-portlet {
    margin: 0 1em 1em 0;
.dashboard-portlet-invisible {
    display: none;
.dashboard-portlet-header {
    margin: 0.3em;
    padding-bottom: 4px;
    padding-left: 0.2em;
    cursor: move;
.dashboard-portlet-header .ui-icon {
    float: right;
.dashboard-portlet > .dashboard-portlet-header {
    font-size: 14px !important;
.dashboard-portlet > .portlet-decoration {
    font-family: 'Carrois Gothic',sans-serif;
#dash-header, .dashboard-portlet-header {
    font-weight: normal;
    border-bottom: 1px solid #DDD;
    background-color: #F1F1F1;
    background-image: linear-gradient(to bottom, #F1F1F1, #DBDBDB);
    background-repeat: repeat-x;
    padding: 8px;
#dash-header {
    font-weight: bold;
.ui-icon:hover {
    cursor: pointer;
.dashboard-portlet-content {
    padding: 0.4em;
.ui-sortable-placeholder {
    border: 1px dotted black;
    visibility: visible !important;
    height: 50px !important;
.ui-sortable-placeholder * {
    visibility: hidden;
#portlets-toggler-popup ul {
    list-style-type: none;
@media only screen and (min-width:300px) and (max-width: 600px){
    .column {
        width: 100%;
        margin: 0 auto;
        padding-bottom: 0;
@media only screen and (min-width:600px) and (max-width: 768px){
    .column {
        width: 580px;
        margin: 0 auto;
        padding-bottom: 0;
@media only screen and (min-width:768px){
    .column {
        width: 31%;
        margin: 0 auto;

In order for the Javascript to respond to the close event, I have added the following (dashboard.js, just before $columns.disableSelection();):

$( ".dashboard-portlet-header .ui-icon-close" ).click(function() {
    $(this).parents( ".dashboard-portlet:first").addClass("dashboard-portlet-invisible");
    var columns = $('#dashboard').find('>div.column');
    Dashboard.fn.savePortlets(params, columns);
    $('#' + $(this).parents( ".dashboard-portlet:first").attr("id") + '-toggler').prop('checked', false);
#7577 report it
yiimike at 2012/03/31 06:00am
dashboard needs default value

Add 'DEFAULT 0' to table def in DashboardModule.php to avoid save error

 $sql = "CREATE TABLE IF NOT EXISTS `dashboard_portlet` (
                 `id` int unsigned NOT NULL auto_increment,
                 `dashboard` int unsigned NOT NULL DEFAULT 0 ,
                 `uid` int unsigned,
                 `settings` text character set utf8 default NULL,
                  PRIMARY KEY  (`id`)
                    ) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";

Otherwise great little module!

#6062 report it
suriyansuresh at 2011/12/09 02:04am
The CSRF token could not be verified.

I got the following message while moving portlets, i have set enableSsrfValidation=true in my config file. how do get fix this issue?. any help appreciated

Error message : "The CSRF token could not be verified."

#6005 report it
NewUser at 2011/12/05 07:59am
Problem in using dashboard extension

Hello All, I have done the same steps just like Add in config/main.php:

    'dashboard' => array(
      'debug' => true,
      'portlets' => array(
        'News' => array('class' => 'News', 'visible' => true, 'weight' => 0), 
        'Forums' => array('class' => 'Forums', 'visible' => true, 'weight' => 1), 
        'Videos' => array('class' => 'Videos', 'visible' => true, 'weight' => 2), 
        'Blogs' => array('class' => 'Blogs', 'visible' => true, 'weight' => 3), 
        'Friends' => array('class' => 'Friends', 'visible' => true, 'weight' => 4),

But not getting any results when going to the url index.php/dashboard. Any help and suggestions will be highly appreciable.

#5210 report it
koukiya at 2011/09/22 05:57am

thank you for the extension baut it doesn't work with me, oleaase can someone help me, i have followed the steps here but it doesn't work when i access the page index.php/dashboard

#5105 report it
rrbot at 2011/09/14 03:00pm
Updating Total Portlets

I think I've made some changes that address my last comment:

in DefaultController.php change the last half to:

        $deaultSettings = $this->getModule()->portlets;
        foreach ($deaultSettings as $class => $properties) {
            $column = isset($properties['column']) ? $properties['column'] : 0;
            $allPortlets[$column][$properties['weight']] = array(
                'class' => $class,
                'visible' => isset($properties['visible']) ? $properties['visible'] : true,
                'weight' => $properties['weight']
        // Use the default portlets settings if user did not set any portlet before.
        if (empty($settings)) {
            $settings = $allPortlets;
        $this->render('index', array(
            'portlets' => $settings,
            'allPortlets' => $allPortlets,

Line 25 of dashboard.php iterate over the new $allPortlets var

<?php foreach ($allPortlets as $column) : ?>

IN views/default/index.php add the allPortlets var

<?php $this->widget('DWidget', array('portlets' => $portlets, 'allPortlets'=>$allPortlets)); ?>
#5103 report it
rrbot at 2011/09/14 02:37pm
Updating Portlets Isn't Reflected in existing users portlet list


First, cool extension. I got it up and running painlessly!

I started out with 2 portlets and viewed my admin user's dashboard. Then I went back to config and added more Portlets. These new portlets did not appear in the toggle portlets screen.

I got them to appear by deleting settings in the DB for that user.

I'm trying to figure out where to query the config to list all portlets now.

Thanks, hope this helps.

#2902 report it
Vincent Dong at 2011/02/23 09:44pm
reply aabughazaleh

First, Thank you for your comments.

For issue 1: your must control user access by your site access control. This is access control is prior to action. Your can try srbac module to do this.

For issue 2: I will check this and fix this bug if it exists.

#2891 report it
ahmad at 2011/02/23 01:43am

First thank you very much for your sharing. I have two things:

1- You must check in the default controller if the user is guest or not, otherwise an exception will be thrown if the user is not logged in.

public function actionIndex()
        if (Yii::app()->user->isGuest)
            throw new CHttpException(403,'You are not authorized to see this page.');
.... // rest of the code

2- I found a bug, when you press "Toggle Portlet" a pop up window will appear ask you to hide or show portlet, ok, uncheck the first one and press "save" button, nothing happen! I supposed when uncheck or check one of the available Portlet in pop up window, and pressed "save" button something happen, but no.

thats it, and thank you again for your sharing.

#2890 report it
Vincent Dong at 2011/02/22 09:51pm
reply phreak

Thanks for your suggestion. This is in project plan. I will achieve this functionality in 1.2.

#2879 report it
phreak at 2011/02/21 02:48am

very nice module. what do you think about extending it a bit. for example - adding extra buttons to the title - like "settings". And persisting Widget config and state in DB. I'll give it a try myself. thanks for sharing :)

Leave a comment

Please to leave your comment.

Create extension