Skip to content

Instantly share code, notes, and snippets.

@dtbaker
Created August 12, 2014 04:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dtbaker/3f92abe32b8d813cb8a0 to your computer and use it in GitHub Desktop.
Save dtbaker/3f92abe32b8d813cb8a0 to your computer and use it in GitHub Desktop.
Sample PHP for AdminLTE UCM Dashboard Widget
<?php
// this sample widget will show how many jobs were started in the last 7 days:
if(class_exists('module_job',false) && module_job::can_i('view','Jobs')){
$jobs = module_job::get_jobs(array(
'date_start_after'=>date('Y-m-d',strtotime('-7 days'))
),array('columns'=>'u.job_id'));
ob_start();
// icons from http://ionicons.com/
?>
<div class="small-box bg-aqua">
<div class="inner">
<h3>
<?php echo count($jobs); ?>
</h3>
<p>
<?php _e('Incomplete Jobs');?>
</p>
</div>
<div class="icon">
<i class="ion ion-document-text"></i>
</div>
<a href="<?php echo module_job::link_open(false);?>" class="small-box-footer">
<?php _e('View Jobs');?> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
<?php
$widgets[] = array(
'id' => 'jobs_started',
'columns' => 4, // 1, 2, 3 or 4 - which column group to add this widget to
'raw' => true, // output the raw HTML above as the widget. If this is false then the widget will get wrapped in a default box with a title.
'content' => ob_get_clean(),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment