init
This commit is contained in:
163
modules/EcmCalls/Dashlets/MyEcmCallsDashlet/MyEcmCallsDashlet.data.php
Executable file
163
modules/EcmCalls/Dashlets/MyEcmCallsDashlet/MyEcmCallsDashlet.data.php
Executable file
@@ -0,0 +1,163 @@
|
||||
<?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 - 2007 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['MyEcmCallsDashlet']['searchFields'] = array(
|
||||
'calldate' => array('query_type'=>'') ,
|
||||
'parent_from' => array('query_type' => ''),
|
||||
'call_type' => array('query_type'=>''),
|
||||
'call_disposition' => array('query_type'=>''),
|
||||
);
|
||||
$dashletData['MyEcmCallsDashlet']['columns'] = array(
|
||||
|
||||
|
||||
'TYPE_IMG' => array(
|
||||
'width' => 2,
|
||||
'default' => true,
|
||||
'label' => ' ',
|
||||
'sortable' => false,
|
||||
),
|
||||
|
||||
'DISPOSITION' => array(
|
||||
'width' => 5,
|
||||
'default' => true,
|
||||
'label' => 'LBL_DISPOSITION',
|
||||
),
|
||||
|
||||
'CALLDATE' => array(
|
||||
'width' => 10,
|
||||
'default' => true,
|
||||
'label' => 'LBL_CALLDATE',
|
||||
),
|
||||
|
||||
'CLID' => array(
|
||||
'width' => 20,
|
||||
'default' => false,
|
||||
'label' => 'LBL_CLID',
|
||||
),
|
||||
|
||||
'SRC' => array(
|
||||
'width' => 15,
|
||||
'default' => true,
|
||||
'label' => 'LBL_SRC',
|
||||
),
|
||||
|
||||
'DST' => array(
|
||||
'width' => 15,
|
||||
'default' => true,
|
||||
'label' => 'LBL_DST',
|
||||
),
|
||||
|
||||
'ACCOUNT' => array(
|
||||
'width' => 15,
|
||||
'default' => true,
|
||||
'label' => 'Account',
|
||||
),
|
||||
|
||||
'DCONTEXT' => array(
|
||||
'width' => 10,
|
||||
'default' => false,
|
||||
'label' => 'LBL_DCONTEXT',
|
||||
),
|
||||
|
||||
'CHANNEL' => array(
|
||||
'width' => 20,
|
||||
'default' => false,
|
||||
'label' => 'LBL_CHANNEL',
|
||||
),
|
||||
|
||||
'DSTCHANNEL' => array(
|
||||
'width' => 20,
|
||||
'default' => false,
|
||||
'label' => 'LBL_DSTCHANNEL',
|
||||
),
|
||||
|
||||
'LASTAPP' => array(
|
||||
'width' => 20,
|
||||
'default' => false,
|
||||
'label' => 'LBL_LASTAPP',
|
||||
),
|
||||
|
||||
'LASTDATA' => array(
|
||||
'width' => 20,
|
||||
'default' => false,
|
||||
'label' => 'LBL_LASTDATA',
|
||||
),
|
||||
|
||||
'DURATION' => array(
|
||||
'width' => 5,
|
||||
'default' => true,
|
||||
'align' => 'center',
|
||||
'label' => 'LBL_DURATION',
|
||||
),
|
||||
|
||||
'BILLSEC' => array(
|
||||
'width' => 5,
|
||||
'default' => true,
|
||||
'align' => 'center',
|
||||
'label' => 'LBL_BILLSEC',
|
||||
),
|
||||
|
||||
'AMAFLAGS' => array(
|
||||
'width' => 20,
|
||||
'default' => false,
|
||||
'label' => 'LBL_AMAFLAGS',
|
||||
),
|
||||
|
||||
'ACCOUNTCODE' => array(
|
||||
'width' => 20,
|
||||
'default' => false,
|
||||
'label' => 'LBL_ACCOUNTCODE',
|
||||
),
|
||||
|
||||
'USERFIELD' => array(
|
||||
'width' => 20,
|
||||
'default' => false,
|
||||
'label' => 'LBL_USERFIELD',
|
||||
),
|
||||
'HINT' => array(
|
||||
'width' => 2,
|
||||
'default' => true,
|
||||
'label' => ' ',
|
||||
'sortable' => false,
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
47
modules/EcmCalls/Dashlets/MyEcmCallsDashlet/MyEcmCallsDashlet.meta.php
Executable file
47
modules/EcmCalls/Dashlets/MyEcmCallsDashlet/MyEcmCallsDashlet.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 - 2007 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['MyEcmCallsDashlet'] = array('module' => 'EcmCalls',
|
||||
'title' => translate('LBL_DASHLET_MY_ECMCALLS', 'EcmCalls'),
|
||||
'description' => 'A customizable view into EcmCalls',
|
||||
'category' => 'Module Views',
|
||||
'hidden' => true);
|
||||
?>
|
||||
206
modules/EcmCalls/Dashlets/MyEcmCallsDashlet/MyEcmCallsDashlet.php
Executable file
206
modules/EcmCalls/Dashlets/MyEcmCallsDashlet/MyEcmCallsDashlet.php
Executable file
@@ -0,0 +1,206 @@
|
||||
<?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 - 2007 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/EcmCalls/EcmCall.php');
|
||||
|
||||
class MyEcmCallsDashlet extends DashletGeneric {
|
||||
|
||||
var $parent_from;
|
||||
var $call_type;
|
||||
|
||||
function MyEcmCallsDashlet($id, $def = null) {
|
||||
global $current_user, $app_strings;
|
||||
require('modules/EcmCalls/Dashlets/MyEcmCallsDashlet/MyEcmCallsDashlet.data.php');
|
||||
|
||||
parent::DashletGeneric($id, $def);
|
||||
|
||||
if(!empty($def['parent_from'])) $this->parent_from = $def['parent_from'];
|
||||
if(!empty($def['call_type'])) $this->call_type = $def['call_type'];
|
||||
if(!empty($def['call_disposition'])) $this->call_disposition = $def['call_disposition'];
|
||||
if(!empty($def['call_duration'])) $this->call_duration = $def['call_duration'];
|
||||
if(!empty($def['call_duration_type'])) $this->call_duration_type = $def['call_duration_type'];
|
||||
|
||||
if(empty($def['title'])) $this->title = translate('LBL_DASHLET_MY_ECMCALLS', 'EcmCalls');
|
||||
|
||||
$this->searchFields = $dashletData['MyEcmCallsDashlet']['searchFields'];
|
||||
$this->columns = $dashletData['MyEcmCallsDashlet']['columns'];
|
||||
|
||||
$this->seedBean = new EcmCall();
|
||||
$this->lvs->quickViewLinks = false;
|
||||
//var_dump($this->parent_from);
|
||||
}
|
||||
function buildWhere() {
|
||||
global $current_user;
|
||||
|
||||
$returnArray = array();
|
||||
|
||||
if(!is_array($this->filters)) {
|
||||
// use defaults
|
||||
$this->filters = array();
|
||||
foreach($this->searchFields as $name => $params) {
|
||||
if(!empty($params['default']))
|
||||
$this->filters[$name] = $params['default'];
|
||||
}
|
||||
}
|
||||
foreach($this->filters as $name=>$params) {
|
||||
if(!empty($params)) {
|
||||
if($name == 'assigned_user_id' && $this->myItemsOnly) continue; // don't handle assigned user filter if filtering my items only
|
||||
$widgetDef = $this->seedBean->field_defs[$name];
|
||||
|
||||
$widgetClass = $this->layoutManager->getClassFromWidgetDef($widgetDef, true);
|
||||
$widgetDef['table'] = $this->seedBean->table_name;
|
||||
$widgetDef['table_alias'] = $this->seedBean->table_name;
|
||||
|
||||
switch($widgetDef['type']) {// handle different types
|
||||
case 'date':
|
||||
case 'datetime':
|
||||
if(!empty($params['date']))
|
||||
$widgetDef['input_name0'] = $params['date'];
|
||||
$_REQUEST['calldate_advanced'] = $params['type'];
|
||||
break;
|
||||
default:
|
||||
$widgetDef['input_name0'] = $params;
|
||||
if(is_array($params) && !empty($params)) { // handle array query
|
||||
array_push($returnArray, $widgetClass->queryFilterone_of($widgetDef, false));
|
||||
}
|
||||
else {
|
||||
array_push($returnArray, $widgetClass->queryFilterStarts_With($widgetDef, true));
|
||||
}
|
||||
$widgetDef['input_name0'] = $params;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$_REQUEST['searchFormTab'] = "advanced_search";
|
||||
if($this->call_type == "incoming") {
|
||||
$_REQUEST['parent_to_advanced'] = "Users";
|
||||
if($this->myItemsOnly)
|
||||
$_REQUEST['parent_to_id_advanced'] = array($current_user->id);
|
||||
else
|
||||
$_REQUEST['parent_to_id_advanced'] = $this->parent_from;
|
||||
}
|
||||
else if($this->call_type == "outgoing" || $this->call_type == "both") {
|
||||
$_REQUEST['parent_from_advanced'] = "Users";
|
||||
if($this->myItemsOnly)
|
||||
$_REQUEST['parent_from_id_advanced'] = array($current_user->id);
|
||||
else
|
||||
$_REQUEST['parent_from_id_advanced'] = $this->parent_from;
|
||||
}
|
||||
if($this->call_type == "both") $_REQUEST['in_out_advanced'] = 'on';
|
||||
if($this->call_disposition) $_REQUEST['disposition_advanced'] = $this->call_disposition;
|
||||
if($this->call_duration) $_REQUEST['duration_advanced'] = $this->call_duration;
|
||||
if($this->call_duration_type) $_REQUEST['duration_type_advanced'] = $this->call_duration_type;
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
|
||||
function saveOptions($req) {
|
||||
$options = parent::saveOptions($req);
|
||||
$options['parent_from'] = $req['parent_from'];
|
||||
$options['call_type'] = $req['call_type'];
|
||||
$options['call_disposition'] = $req['call_disposition'];
|
||||
$options['call_duration'] = $req['call_duration'];
|
||||
$options['call_duration_type'] = $req['call_duration_type'];
|
||||
return $options;
|
||||
}
|
||||
|
||||
function displayOptions() {
|
||||
$this->processDisplayOptions();
|
||||
require_once('modules/EcmCalls/EcmCall.php');
|
||||
global $app_list_strings;
|
||||
$this->currentSearchFields['calldate']['input'] = '<select name="type_calldate">'.get_select_options_with_id($app_list_strings['search_date_type_dom'],(empty($this->filters['calldate']) ? '' : $this->filters['calldate'])).'</select>';
|
||||
|
||||
|
||||
$GLOBALS['db'] = new MysqlManager();
|
||||
$GLOBALS['db']->connect();
|
||||
$query = "SELECT `id`, CONCAT(IFNULL(CONCAT(`first_name`,' '),''), '', `last_name`) as `name` FROM `users` WHERE `status`='Active' and `deleted`=0 ORDER BY `name`";
|
||||
$results = $GLOBALS['db']->query($query);
|
||||
$arr = array();
|
||||
if(is_resource($results)) {
|
||||
while($row = $GLOBALS['db']->fetchByAssoc($results)) $arr[$row['id']] = $row['name'];
|
||||
}
|
||||
$this->currentSearchFields['parent_from']['input'] = '<select id="parent_from" name="parent_from[]" multiple="multiple" size="5" style="width:150px;">'.get_select_options_with_id($arr,(empty($this->parent_from) ? '' : $this->parent_from)).'</select>';
|
||||
|
||||
$this->currentSearchFields['call_type']['input'] = '<select id="call_type" name="call_type" style="width:150px;">'.get_select_options_with_id($app_list_strings['ecmcalls_chart_call_type_dom'],(empty($this->call_type) ? '' : $this->call_type)).'</select>';
|
||||
|
||||
$disp_arr=array(
|
||||
''=>'select',
|
||||
'ANSWERED'=>'Answered',
|
||||
'BUSY'=>'Busy',
|
||||
'FAILED'=>'Failed',
|
||||
'NO ANSWER'=>'No answer',
|
||||
);
|
||||
$sel='<select name="call_disposition">';
|
||||
foreach($disp_arr as $k=>$v){
|
||||
$sel.='<option value="'.$k.'"';
|
||||
if($this->call_disposition==$k)$sel.=' selected';
|
||||
$sel.='>'.$v.'</option>';
|
||||
}
|
||||
$sel.='</select>';
|
||||
$this->currentSearchFields['call_disposition']['input'] = $sel;
|
||||
$this->currentSearchFields['call_disposition']['label'] = 'Disposition';
|
||||
|
||||
$cdt=array(
|
||||
''=>'select',
|
||||
'less'=>'<=',
|
||||
'more'=>'>',
|
||||
);
|
||||
$sel='<select name="call_duration_type">';
|
||||
foreach($cdt as $k=>$v){
|
||||
$sel.='<option value="'.$k.'"';
|
||||
if($this->call_duration_type==$k)$sel.=' selected';
|
||||
$sel.='>'.$v.'</option>';
|
||||
}
|
||||
$sel.='</select>';
|
||||
|
||||
$this->currentSearchFields['call_duration']['input']=$sel.'<input name="call_duration" size="3" type="text" value="'.$this->call_duration.'"> s';
|
||||
$this->currentSearchFields['call_duration']['label'] = 'Duration';
|
||||
|
||||
$this->configureSS->assign('searchFields', $this->currentSearchFields);
|
||||
return $this->configureSS->fetch($this->configureTpl);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user