Code:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* Skeleton Task Dashlet
*
* Author: Blake Robertson
* Date: December 15th, 2010
*
* How to use this file...
* - Change anywhere the text skeleton (two occurances class name and constructor name)
* - Change anywhere CHANGEME appears to the appropriate values.
* - Customize the where
*
********************************************************************************/
require_once('include/Dashlets/DashletGeneric.php');
class MyTasksAssignedByOthersDashlet extends DashletGeneric {
function process() {
global $current_language, $app_list_strings, $image_path, $current_user;
// NOTE: date_*_flag = 1 when the date is NULL which is the opposite you'd think...
// DATES Past Start Date
// 'custom_where' => ' AND ((Date(tasks.date_start) <= Date(Now())) OR (tasks.date_start_flag=1)))',
// OVERDUE TASKS
// 'custom_where' => ' AND ((Date(tasks.date_start) <= Date(Now()) AND (tasks.date_due_flag=1)) OR (Date(tasks.date_due) <= Date(Now())) )',
// Tasks assigned to me by other people!
// Other changes, show the column "Created By" instead of Start Date.
// 'custom_where' => ' AND tasks.created_by != "' . $current_user->id . '"',
// Tasks I created for other people.
// Other changes, show the column assigned_to instead of start date., uncheck the "My Items" by default
// 'custom_where' => ' AND tasks.created_by = "' . $current_user->id . '" AND tasks.assigned_user_id != "' . $current_user->id . '"',
$lvsParams = array(
'custom_select' => '',
'custom_from' => '',
'custom_where' => ' AND tasks.created_by != "' . $current_user->id . '"',
'distinct' => true
);
parent::process($lvsParams);
}
function MyTasksAssignedByOthersDashlet($id, $def = null) {
global $current_user, $app_strings;
// Uncomment line below if you don't want dashlet restricted to items you own
// $def = array( 'myItemsOnly' => false );
parent::DashletGeneric($id, $def);
if(empty($def['title'])) $this->title = 'Tasks - Created by a Team Member';
// This is the filter criteria, it's usually in a .data.php file, i moved it here so i'd have less files to modify.
$this->searchFields = array('name' => array('default' => ''),
'priority' => array('default' => ''),
'status' => array('default' => array('Not Started', 'In Progress', 'Pending Input')),
'date_entered' => array('default' => ''),
'date_start' => array('default' => ''),
'date_due' => array('default' => ''),
'team_id' => array('default' => '', 'label' => 'LBL_TEAMS'),
'assigned_user_id' => array('type' => 'assigned_user_name',
'label' => 'LBL_ASSIGNED_TO',
'default' => $current_user->name));
// This is the columns that show up in the list view, customize accordinly.
$this->columns = array('set_complete' => array('width' => '1',
'label' => 'LBL_LIST_CLOSE',
'default' => true,
'sortable' => false),
'name' => array('width' => '40',
'label' => 'LBL_SUBJECT',
'link' => true,
'default' => true),
'priority' => array('width' => '10',
'label' => 'LBL_PRIORITY',
'default' => true),
'status' => array('width' => '8',
'label' => 'LBL_STATUS',
'default' => true),
'date_start' => array('width' => '15',
'label' => 'LBL_START_DATE',
'default' => false),
'time_start' => array('width' => '15',
'label' => 'LBL_START_TIME',
'default' => false),
'date_due' => array('width' => '15',
'label' => 'LBL_DUE_DATE',
'default' => true),
'date_entered' => array('width' => '15',
'label' => 'LBL_DATE_ENTERED'),
'date_modified' => array('width' => '15',
'label' => 'LBL_DATE_MODIFIED'),
'created_by' => array('width' => '8',
'label' => $GLOBALS['app_strings']['LBL_CREATED'],
'sortable' => true,
'default' => true),
'assigned_user_name' => array('width' => '8',
'label' => 'LBL_LIST_ASSIGNED_USER'),
'contact_name' => array('width' => '8',
'label' => 'LBL_LIST_CONTACT'),
'team_name' => array('width' => '15',
'label' => 'LBL_LIST_TEAM',
'sortable' => false),
);
$this->seedBean = new Task();
}
}
?>
Bookmarks