Yii 1.1: dashboard-controller

Extended controller with Dashboard
69 followers

jQueryUI based Dashboard controller.

You can:

  • drag/drop portlets
  • store user preference in your own table
  • set autosave portlets position on/off
  • write page's content before and after dashboard
  • apply any of jQuery UI theme
  • set dashboard columns count
  • show/hide dashboard header
  • show/hide dashboard

Requirements

Yii 1.1.5 or above

Usage

Extend your controller from this dashboard base controller

class DashController extends UIDashboardController

and have fun.

Sample controller is present.

dashboard

Donate to next release:

  • add feature to store portlet's state

Change log:

ver 1.1

(March 10, 2011)

  • Added polish translation

(March 4, 2011)

  • fixed autosave bug
  • fixed double ajax call during autosaving
  • rewrite store preference code. Now the record is not completely removed but only updates the "preference" field.

(Thanks Tobias B. for the help)

ver 1.0

  • initial release

Resources

See other extensions:

Total 14 comments

#13271 report it
ruderbytes at 2013/05/20 01:24am
yii cool dashboard

Wow So Cool

This is make beautiful dashboard

#12379 report it
Nur Rochim at 2013/03/17 10:24am
Support

Hi... Support yii 1.13?

#10340 report it
skworden at 2012/10/21 04:46am
How to install

To install you do the following:

This is an additional controller not a extension or module so you don't have to do much to get it to work.

I just used xNicox db table:

create this table in your database

CREATE TABLE `dashboard_page` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `title` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 PACK_KEYS=0;

Download and extract the files to their locations under your protected file.

i.e. in the download controllers file, put all of its contents in your protected/controllers file. You will do the same for the view and components files.

Go to yourdomainname/dashboard and you can see it. Use the peoples mods in this post to make your other portlets work.

#8656 report it
FlyBot at 2012/06/17 11:59am
How to set up

Please, extract all from archive under protected folder and use DashController or just extend your own controller from UIDashboardController. The Controllers init function must set up params for table (table name, user ID field name, user preference field name). Sample: $this->setTableParams('dashboard_table', 'user_id', 'prefference'); Then, set array of portlets (see sample in DashController). You may use $this->setAutosave(true) for saving user's prefference;

#8298 report it
eegnom1807 at 2012/05/23 02:54pm
Render any component inside portlet

Modify the code to render any component in the protlet

DashController:

$this->setPortlets(
    array(
        array('id'=>1, 'title'=>'Logs', 'renderContent'=>true, 'view'=>'application.views.info.logs', 'info'=>array('dataProvider'=>$this->logs()), 'flag'=>false)
    )
);
public function logs()
    {
        $dataProvider = new CActiveDataProvider('Logs');
        return $dataProvider;
    }

View showDash:

<div class="dash-portlet-content">
    <?php
        if ($row['renderContent']) {
            $dataProvider=$row['info']['dataProvider'];
            $this->renderPartial($row['view'], array('dataProvider'=>$dataProvider), $row['flag']);
         } else {
             echo $row['content'];
         }
    ?>
</div>
#7846 report it
jiaming at 2012/04/22 04:44pm
waiting for update...

Thanks so much for your ext.... Would you please write some database tutorial...

or.....any tutorial would be great.

Thanks so much.

#6412 report it
rei at 2012/01/08 09:55pm
Re: How to render CGridView Inside portlet?

I can't find a way to solve this problem without modifying the script a little.

In showDash.php:

<div class="dash-portlet-content">
  <?php 
  if ($row['renderPage']) 
    $this->renderpartial($row['content']);
  else
    echo $row['content'];
  ?>
</div>

To set the portlet:

$this->setPortlets(         
  array(
    array(
      'id'=>1, 
      'title'=>'Flight', 
      'renderPage'=>true,
      'content'=>'/flight/dashboard' (path of view to be rendered)
    ),
    array('id'=>2, 'title'=>'Maintenance', 'content'=>'Maintenance Summary'),
  )
);

If you use ajax update in your CGridView (like sorting/searching), you may need to use something like livequery plugin so that everything will work properly after ajax refresh. In dashboard.js I add something like:

$('#dash-column td').livequery(function() {
   $( "#dash-column td").sortable({
      opacity: 0.8,
      connectWith: "#dash-column td"
   });  
});

Hope this can help someone else in the future. Thanks for the great extension, anyway!

#6370 report it
rei at 2012/01/04 01:35am
How to render CGridView Inside portlet?

Is it possible to render CGridView inside the portlet? I tried something like this:

$this->setPortlets(         
  array(
    array(
      'id'=>1, 
      'title'=>'Flight', 
      'content'=>$this->renderpartial('...',null,true)
    ),
  )
);

but keep getting this error:

Fatal error: Call to a member function getId() on a non-object in /.../yii/framework/web/CController.php on line 963
#5849 report it
FlyBot at 2011/11/20 01:51pm
@peterjkambey

Portlet is array('id', 'title', 'content'). Example in controllers/DashController.php file. Portlets use jQuery UI theme from assets/themes. I just dont know how to use the dashboard_page table also :-)

#5835 report it
Peter JK at 2011/11/17 10:49pm
i just dont know how to use the dashboard_page table

Hai FlyBot

I just dont know how to use the dashboard_page table.. and how it customize the portlet..

#5466 report it
xNicox at 2011/10/14 08:47am
Create Database:

Hey guys I create this database:

CREATE TABLE `<prefix>dashboard_page` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `title` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 PACK_KEYS=0;

If your "prefix" is not blanks, yo should change: "app_roo_dir"/protected/controllers/DashController.php

$this->setTableParams('<prefix>dashboard_page', 'user_id', 'title');

Best regards

#3413 report it
FlyBot at 2011/04/11 12:16pm
How to use

Simple unzip this archive under protected folder and look http://localhost/dash in your browser.

#3210 report it
kyle z at 2011/03/25 10:43am
install

I know this may seem self explanatory, but Install instructions here or in the zip file would help us simple folk.

#2967 report it
stutteringp0et at 2011/03/03 04:52pm
Nice!

I have 2 projects that might use an extension like this. I'm looking forward to running some tests.

Leave a comment

Please to leave your comment.

Create extension