init
This commit is contained in:
94
modules/Calls/Dashlets/MyCallsDashlet/MyCallsDashlet.data.php
Executable file
94
modules/Calls/Dashlets/MyCallsDashlet/MyCallsDashlet.data.php
Executable file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $current_user;
|
||||
|
||||
$dashletData['MyCallsDashlet']['searchFields'] = array('date_start' => array('default' => ''),
|
||||
'direction' => array('default' => ''),
|
||||
'status' => array('default' => array('Planned')),
|
||||
'name' => array('default' => ''),
|
||||
|
||||
|
||||
|
||||
'assigned_user_id' => array('type' => 'assigned_user_name',
|
||||
'default' => $current_user->name));
|
||||
$dashletData['MyCallsDashlet']['columns'] = array('set_complete' => array('width' => '5',
|
||||
'label' => 'LBL_LIST_CLOSE',
|
||||
'default' => true,
|
||||
'sortable' => false,
|
||||
'related_fields' => array('status')),
|
||||
'name' => array('width' => '40',
|
||||
'label' => 'LBL_SUBJECT',
|
||||
'link' => true,
|
||||
'default' => true),
|
||||
'parent_name' => array('width' => '29',
|
||||
'label' => 'LBL_LIST_RELATED_TO',
|
||||
'sortable' => false,
|
||||
'dynamic_module' => 'PARENT_TYPE',
|
||||
'link' => true,
|
||||
'id' => 'PARENT_ID',
|
||||
'ACLTag' => 'PARENT',
|
||||
'related_fields' => array('parent_id', 'parent_type')),
|
||||
'duration' => array('width' => '10',
|
||||
'label' => 'LBL_DURATION',
|
||||
'default' => true,
|
||||
'sortable' => false,
|
||||
'related_fields' => array('duration_hours', 'duration_minutes')),
|
||||
'direction' => array('width' => '10',
|
||||
'label' => 'LBL_DIRECTION'),
|
||||
'date_start' => array('width' => '15',
|
||||
'label' => 'LBL_DATE',
|
||||
'default' => true,
|
||||
'related_fields' => array('time_start')),
|
||||
'status' => array('width' => '8',
|
||||
'label' => 'LBL_STATUS'),
|
||||
'date_entered' => array('width' => '15',
|
||||
'label' => 'LBL_DATE_ENTERED'),
|
||||
'date_modified' => array('width' => '15',
|
||||
'label' => 'LBL_DATE_MODIFIED'),
|
||||
'created_by' => array('width' => '8',
|
||||
'label' => 'LBL_CREATED'),
|
||||
'assigned_user_name' => array('width' => '8',
|
||||
'label' => 'LBL_LIST_ASSIGNED_USER'),
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
?>
|
||||
47
modules/Calls/Dashlets/MyCallsDashlet/MyCallsDashlet.meta.php
Executable file
47
modules/Calls/Dashlets/MyCallsDashlet/MyCallsDashlet.meta.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings;
|
||||
|
||||
$dashletMeta['MyCallsDashlet'] = array('module' => 'Calls',
|
||||
'title' => translate('LBL_LIST_MY_CALLS', 'Calls'),
|
||||
'description' => 'A customizable view into Calls',
|
||||
'category' => 'Module Views',
|
||||
'hidden' => true);
|
||||
?>
|
||||
157
modules/Calls/Dashlets/MyCallsDashlet/MyCallsDashlet.php
Executable file
157
modules/Calls/Dashlets/MyCallsDashlet/MyCallsDashlet.php
Executable file
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
require_once('include/Dashlets/DashletGeneric.php');
|
||||
require_once('modules/Calls/Call.php');
|
||||
|
||||
class MyCallsDashlet extends DashletGeneric {
|
||||
function MyCallsDashlet($id, $def = null) {
|
||||
global $current_user, $app_strings;
|
||||
require('modules/Calls/Dashlets/MyCallsDashlet/MyCallsDashlet.data.php');
|
||||
|
||||
parent::DashletGeneric($id, $def);
|
||||
|
||||
if(empty($def['title'])) $this->title = translate('LBL_LIST_MY_CALLS', 'Calls');
|
||||
$this->searchFields = $dashletData['MyCallsDashlet']['searchFields'];
|
||||
if(empty($def['filters'])){
|
||||
if(isset($this->searchFields['status'])){
|
||||
if(!empty($this->searchFields['status']['default'])){
|
||||
$this->filters['status'] = $this->searchFields['status']['default'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->columns = $dashletData['MyCallsDashlet']['columns'];
|
||||
$this->columns['set_accept_links']= array('width' => '10',
|
||||
'label' => translate('LBL_ACCEPT_THIS', 'Meetings'),
|
||||
'sortable' => false,
|
||||
'related_fields' => array('status'),
|
||||
'default' => 'true');
|
||||
$this->seedBean = new Call();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function process() {
|
||||
global $current_language, $app_list_strings, $image_path, $current_user;
|
||||
$mod_strings = return_module_language($current_language, 'Calls');
|
||||
|
||||
if($this->myItemsOnly) { // handle myitems only differently
|
||||
$lvsParams = array(
|
||||
'custom_from' => ' INNER JOIN calls_users ON calls.id = calls_users.call_id ',
|
||||
'custom_where' => ' AND calls_users.deleted = 0 AND (calls.assigned_user_id = \'' . $current_user->id . '\' OR calls_users.user_id = \'' . $current_user->id . '\') ',
|
||||
'distinct' => true
|
||||
);
|
||||
} else {
|
||||
$lvsParams = array();
|
||||
}
|
||||
$this->myItemsOnly = false;
|
||||
|
||||
parent::process($lvsParams);
|
||||
|
||||
$keys = array();
|
||||
foreach($this->lvs->data['data'] as $num => $row) {
|
||||
$keys[] = $row['ID'];
|
||||
}
|
||||
|
||||
|
||||
if(!empty($keys)){
|
||||
$query = "SELECT call_id, accept_status FROM calls_users WHERE user_id = '" . $current_user->id . "' AND call_id IN ('" . implode("','", $keys ). "')";
|
||||
$result = $GLOBALS['db']->query($query);
|
||||
|
||||
while($row = $GLOBALS['db']->fetchByAssoc($result)) {
|
||||
$rowNums = $this->lvs->data['pageData']['idIndex'][$row['call_id']]; // figure out which rows have this guid
|
||||
foreach($rowNums as $rowNum) {
|
||||
$this->lvs->data['data'][$rowNum]['ACCEPT_STATUS'] = $row['accept_status'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($this->lvs->data['data'] as $rowNum => $row) {
|
||||
if(empty($this->lvs->data['data'][$rowNum]['DURATION_HOURS'])) $this->lvs->data['data'][$rowNum]['DURATION'] = '0' . $mod_strings['LBL_HOURS_ABBREV'];
|
||||
else $this->lvs->data['data'][$rowNum]['DURATION'] = $this->lvs->data['data'][$rowNum]['DURATION_HOURS'] . $mod_strings['LBL_HOURS_ABBREV'];
|
||||
|
||||
if(empty($this->lvs->data['data'][$rowNum]['DURATION_MINUTES']) || empty($this->seedBean->minutes_values[$this->lvs->data['data'][$rowNum]['DURATION_MINUTES']])) {
|
||||
$this->lvs->data['data'][$rowNum]['DURATION'] .= '00';
|
||||
}
|
||||
else {
|
||||
$this->lvs->data['data'][$rowNum]['DURATION'] .= $this->seedBean->minutes_values[$this->lvs->data['data'][$rowNum]['DURATION_MINUTES']];
|
||||
}
|
||||
if ($this->lvs->data['data'][$rowNum]['STATUS'] == $app_list_strings['meeting_status_dom']['Planned'])
|
||||
{
|
||||
if ($this->lvs->data['data'][$rowNum]['ACCEPT_STATUS'] == '' ||
|
||||
$this->lvs->data['data'][$rowNum]['ACCEPT_STATUS'] == 'none')
|
||||
{
|
||||
$this->lvs->data['data'][$rowNum]['SET_ACCEPT_LINKS'] = "<div id=\"accept".$this->id."\"><a title=\"".
|
||||
"\" href=\"javascript:SUGAR.util.retrieveAndFill('index.php?module=Activities&to_pdf=1&action=SetAcceptStatus&id=".$this->id."&object_type=Call&object_id=".$this->lvs->data['data'][$rowNum]['ID'] . "&accept_status=accept', null, null, SUGAR.mySugar.retrieveDashlet, '{$this->id}');\">".
|
||||
get_image($image_path."accept_inline","alt='".$app_list_strings['dom_meeting_accept_options']['accept'].
|
||||
"' border='0'"). "</a> <a title=\"".$app_list_strings['dom_meeting_accept_options']['tentative'].
|
||||
"\" href=\"javascript:SUGAR.util.retrieveAndFill('index.php?module=Activities&to_pdf=1&action=SetAcceptStatus&id=".$this->id."&object_type=Call&object_id=".$this->lvs->data['data'][$rowNum]['ID'] . "&accept_status=tentative', null, null, SUGAR.mySugar.retrieveDashlet, '{$this->id}');\">".
|
||||
get_image($image_path."tentative_inline","alt='".$app_list_strings['dom_meeting_accept_options']['tentative']."' border='0'").
|
||||
"</a> <a title=\"".$app_list_strings['dom_meeting_accept_options']['decline'].
|
||||
"\" href=\"javascript:SUGAR.util.retrieveAndFill('index.php?module=Activities&to_pdf=1&action=SetAcceptStatus&id=".$this->id."&object_type=Call&object_id=".$this->lvs->data['data'][$rowNum]['ID'] . "&accept_status=decline', null, null, SUGAR.mySugar.retrieveDashlet, '{$this->id}');\">".
|
||||
get_image($image_path."decline_inline","alt='".$app_list_strings['dom_meeting_accept_options']['decline'].
|
||||
"' border='0'")."</a></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->lvs->data['data'][$rowNum]['SET_ACCEPT_LINKS'] = $app_list_strings['dom_meeting_accept_status'][$this->lvs->data['data'][$rowNum]['ACCEPT_STATUS']];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$this->lvs->data['data'][$rowNum]['DURATION'] .= $mod_strings['LBL_MINSS_ABBREV'];
|
||||
}
|
||||
$this->displayColumns[]= "set_accept_links";
|
||||
}
|
||||
|
||||
function displayOptions() {
|
||||
$this->processDisplayOptions();
|
||||
$this->configureSS->assign('strings', array('general' => $GLOBALS['mod_strings']['LBL_DASHLET_CONFIGURE_GENERAL'],
|
||||
'filters' => $GLOBALS['mod_strings']['LBL_DASHLET_CONFIGURE_FILTERS'],
|
||||
'myItems' => translate('LBL_LIST_MY_CALLS', 'Calls'),
|
||||
'displayRows' => $GLOBALS['mod_strings']['LBL_DASHLET_CONFIGURE_DISPLAY_ROWS'],
|
||||
'title' => $GLOBALS['mod_strings']['LBL_DASHLET_CONFIGURE_TITLE'],
|
||||
'save' => $GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL']));
|
||||
return $this->configureSS->fetch($this->configureTpl);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user