title = translate('LBL_DASHLET_MY_EMAILS', 'Emails'); if(isset($def['ie_id'])) $this->ie_id = $def['ie_id']; else $this->ie_id = array_keys($this->getInbounds()); $this->searchFields = $dashletData['MyEcmEmailsDashlet']['searchFields']; $this->columns = $dashletData['MyEcmEmailsDashlet']['columns']; $this->configureTpl = 'modules/EcmEmails/Dashlets/MyEcmEmailsDashlet/MyEcmEmailsDashletGenericConfigure.tpl'; $this->seedBean = new EmailCache(); $this->myItemsOnly = true; $this->checkEmails(); } function getTitle($text) { global $image_path, $app_strings, $sugar_config; $this->checkEmails(); if($this->isConfigurable) $additionalTitle = '
| ' . $text . ' | '
. get_image($image_path.'edit','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" alt="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0" align="absmiddle"').' '
. '';
else
$additionalTitle = '
id . '">' . get_form_header($this->title, $additionalTitle, false) . ' ';
global $current_language;
$str .= "";
return $str;
}
function checkEmails() {
if(isset($this->ie_id) && is_array($this->ie_id)) {
foreach($this->ie_id as $key => $ie_id) $this->checkEmail($ie_id);
}
}
function checkEmail($ie_id) {
/*
$post_tmp = $_POST;
$get_tmp = $_GET;
$request_tmp = $_REQUEST;
ob_start();
$arr_tmp = array();
$arr_tmp['module'] = "Emails";
$arr_tmp['action'] = "EmailUIAjax";
$arr_tmp['emailUIAction'] = "checkEmailProgress";
$arr_tmp['currentCount'] = "0";
$arr_tmp['ieId'] = $ie_id;
$arr_tmp['sugar_body_only'] = "true";
$arr_tmp['to_pdf'] = "true";
$_POST = $arr_tmp;
$_REQUEST = $arr_tmp;
global $current_user;
include('index.php');
$out2 = ob_get_contents();
ob_end_clean();
$_POST = $post_tmp;
$_GET = $get_tmp;
$_REQUEST = $request_tmp;
*/
}
function buildWhere() {
$where = array();
$where[] = "`ie_id` IN ('".implode("', '", $this->ie_id)."')";
$where[] = "`mbox` != 'INBOX.Trash'";
return $where;
}
function getInbounds() {
global $current_user;
$GLOBALS['db'] = new MysqlManager();
$GLOBALS['db']->connect();
$query = "SELECT `id`, `name` FROM `inbound_email` WHERE `deleted`=0 AND `group_id` = '$current_user->id' 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'];
return $arr;
}
function displayOptions() {
$this->processDisplayOptions();
global $app_list_strings;
$arr = $this->getInbounds();
$this->currentSearchFields['ie_id']['input'] = '';
$this->configureSS->assign('searchFields', $this->currentSearchFields);
return $this->configureSS->fetch($this->configureTpl);
}
function saveOptions($req) {
$options = parent::saveOptions($req);
$options['ie_id'] = !is_array($req['ie_id']) ? array('') : $req['ie_id'];
return $options;
}
}
?>
|