Created
May 24, 2012 19:43
-
-
Save MadeMyDay/2783787 to your computer and use it in GitHub Desktop.
Dashboard Process module for PW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ProcessWire Home Process | |
* | |
* Placeholder Process for the admin root. May add version and update checks to this in the future, | |
* or dashboard type functionality for those that want it. | |
* | |
* For more details about how Process modules work, please see: | |
* /wire/core/Process.php | |
* | |
* ProcessWire 2.x | |
* Copyright (C) 2012 by Ryan Cramer | |
* Licensed under GNU/GPL v2, see LICENSE.TXT | |
* | |
* http://www.processwire.com | |
* http://www.ryancramer.com | |
* | |
*/ | |
class ProcessDashboard extends Process { | |
static public function getModuleInfo() { | |
return array( | |
'title' => __('Dashboard', __FILE__), // getModuleInfo title | |
'summary' => __('Acts as a admin dashboard with configurable widgets.', __FILE__), // getModuleInfo summary | |
'version' => 001, | |
'permission' => 'page-view', | |
'permanent' => true, | |
); | |
} | |
public function ___execute() { | |
// for now, generate the desired Widgets by hand | |
$output = '<div id="dashboard">'; | |
$output .='<div class="widgetCol c6">'; // columns for widgets, 12 column layout. c8 means 3/4 of screen estate. | |
// Pagelist | |
$pl = $this->modules->get("WidgetPageList"); | |
//$pl->set('parentid',1001); //which node to open | |
$pl->set('headline','Page tree'); //Title of the widget | |
$output .= $pl->render(); | |
// List of pages 6 | |
$lp6 = $this->modules->get("WidgetListPages"); | |
$lp6->set('sortby','-created'); | |
$lp6->set('headline','Latest news:'); //Title of the widget | |
$lp6->set('parentid',1001); | |
$lp6->set('createNew', true); | |
$lp6->set('createNewParent', 1001); | |
$lp6->set('createNewLabel', 'Create news'); | |
$output .= $lp6->render(); | |
$output .='</div>'; | |
$output .='<div class="widgetCol c6">'; | |
// List of pages 3 | |
$lp3 = $this->modules->get("WidgetListPages"); | |
$lp3->set('headline','You created and/or edited lately:'); //Title of the widget | |
$lp3->set('ownCreated', true); | |
$lp3->set('ownModified', true); | |
$output .= $lp3->render(); | |
// List of pages 1 | |
$lp = $this->modules->get("WidgetListPages"); | |
$lp->set('headline','You edited lately:'); //Title of the widget | |
$lp->set('ownModified', true); | |
$lp->set('collapsed', true); | |
$output .= $lp->render(); | |
// List of pages 2 | |
$lp2 = $this->modules->get("WidgetListPages"); | |
$lp2->set('headline','You created lately:'); //Title of the widget | |
$lp2->set('ownCreated', true); | |
$lp->set('collapsed', true); | |
$output .= $lp2->render(); | |
// List of pages 4 | |
$lp4 = $this->modules->get("WidgetListPages"); | |
$lp4->set('parentid',1001); | |
$lp4->set('limit',3); | |
$lp4->set('sortby','-created'); | |
$lp4->set('headline','Latest job listings:'); //Title of the widget | |
$lp4->set('createNew', true); | |
$lp4->set('createNewParent', 1001); | |
$lp4->set('createNewLabel', 'create job'); | |
$output .= $lp4->render(); | |
$output .= '</div>'; | |
$output .= '</div>'; | |
return $output; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment