Add php files

This commit is contained in:
2025-05-12 15:44:39 +00:00
parent c951760058
commit 82d5804ac4
9534 changed files with 2638137 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
<?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".
*/
$dashletStrings['ChartsDashlet'] = array('LBL_TITLE' => 'Charts',
'LBL_DESCRIPTION' => 'A dashlet to display charts',
'LBL_CONFIGURE_TITLE' => 'Title', );
?>

View File

@@ -0,0 +1,44 @@
<?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".
*/
$dashletStrings['ChartsDashlet'] = array('LBL_TITLE' => 'Diagramme',
'LBL_DESCRIPTION' => 'Ein Dashlet um Diagramme anzuzeigen',
'LBL_CONFIGURE_TITLE' => 'Titel', );
?>

View 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, $current_language;
$dashletMeta['ChartsDashlet'] = array('title' => 'LBL_TITLE', // array index in language pack
'description' => 'LBL_DESCRIPTION', // array index in language pack
'category' => 'Charts',
'hidden' => true,
);
?>

View File

@@ -0,0 +1,187 @@
<?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/Dashlet.php');
require_once('include/Sugar_Smarty.php');
class ChartsDashlet extends Dashlet {
var $width = '400';
var $height = '480';
var $report_id;
/**
* Constructor
*
* @global string current language
* @param guid $id id for the current dashlet (assigned from Home module)
* @param report_id $report_id id of the saved report
* @param array $def options saved for this dashlet
*/
function ChartsDashlet($id, $report_id, $def) {
$this->report_id = $report_id;
$this->loadLanguage('ChartsDashlet'); // load the language strings here
parent::Dashlet($id); // call parent constructor
$this->searchFields = array();
$this->isConfigurable = true; // dashlet is configurable
$this->hasScript = true; // dashlet has javascript attached to it
}
/**
* Displays the dashlet
*
* @return string html to display dashlet
*/
function display() {
require_once("modules/Reports/Report.php");
require_once("modules/Reports/SavedReport.php");
ajaxInit();
$chartReport = new SavedReport();
$chartExists = $chartReport->retrieve($this->report_id, false);
if (!is_null($chartExists)){
$this->title = $chartReport->name;
$reporter = new Report($chartReport->content);
$reporter->is_saved_report = true;
$reporter->saved_report_id = $chartReport->id;
$reporter->run_chart_queries();
require_once("modules/Reports/templates/templates_chart.php");
ob_start();
template_chart($reporter, true, true, $this->id);
$str = ob_get_contents();
ob_end_clean();
$xmlFile = get_cache_file_name($reporter);
$html = parent::display() . "<div align='center'>" . $str . "</div>" . "<br />"; // return parent::display for title and such
$ss = new Sugar_Smarty();
$ss->assign('chartName', $this->id);
$ss->assign('chartXMLFile', $xmlFile);
$script = $ss->fetch('modules/Home/Dashlets/ChartsDashlet/ChartsDashletScript.tpl');
$json = getJSONobj();
return parent::display() . "<div align='center'>" . $str . "</div>" . "<br />"; // return parent::display for title and such
}
}
/**
* Displays the javascript for the dashlet
*
* @return string javascript to use with this dashlet
*/
function displayScript() {
require_once("modules/Reports/Report.php");
require_once("modules/Reports/SavedReport.php");
$chartReport = new SavedReport();
$chartExists = $chartReport->retrieve($this->report_id, false);
if (!is_null($chartExists)){
$this->title = $chartReport->name;
require_once("modules/Reports/templates/templates_chart.php");
$reporter = new Report($chartReport->content);
$reporter->is_saved_report = true;
$reporter->saved_report_id = $chartReport->id;
$xmlFile = get_cache_file_name($reporter);
$ss = new Sugar_Smarty();
$ss->assign('chartName', $this->id);
$ss->assign('chartXMLFile', $xmlFile);
$ss->assign('chartStyleCSS', chartStyle());
$ss->assign('chartColorsXML', chartColors());
$ss->assign('chartLangFile', $GLOBALS['sugar_config']['tmp_dir'].'chart_strings.' . $GLOBALS['current_language'] .'.lang.xml');
$str = $ss->fetch('modules/Home/Dashlets/ChartsDashlet/ChartsDashletScript.tpl');
return $str;
}
}
/**
* Displays the configuration form for the dashlet
*
* @return string html to display form
*/
function displayOptions() {
}
/**
* called to filter out $_REQUEST object when the user submits the configure dropdown
*
* @param array $req $_REQUEST
* @return array filtered options to save
*/
function saveOptions($req) {
}
function setConfigureIcon(){
global $image_path;
if($this->isConfigurable)
$additionalTitle = '<td nowrap width="1%"><div style="width: 100%;text-align:right"><a href="index.php?module=Reports&record=' . $this->report_id . '&action=ReportCriteriaResults&page=report" class="chartToolsLink">'
. get_image($image_path.'edit','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" alt="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0" align="absmiddle"').'</a> '
. '';
else
$additionalTitle = '<td nowrap width="1%"><div style="width: 100%;text-align:right">';
return $additionalTitle;
}
function setRefreshIcon(){
global $image_path;
$additionalTitle = '';
if($this->isRefreshable)
$additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\''
. $this->id . '\', \'chart\'); return false;"><img width="13" height="13" border="0" align="absmiddle" title="' . translate('LBL_DASHLET_REFRESH', 'Home') . '" alt="' . translate('LBL_DASHLET_REFRESH', 'Home') . '" src="'
. $image_path . 'refresh.gif"/></a> ';
return $additionalTitle;
}
}
?>

View File

@@ -0,0 +1,36 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* The contents of this file are subject to the SugarCRM Professional Subscription
* Agreement ("License") which can be viewed at
* http://www.sugarcrm.com/crm/products/sugar-professional-eula.html
* By installing or using this file, You have unconditionally agreed to the
* terms and conditions of the License, and You may not use this file except in
* compliance with the License. Under the terms of the license, You shall not,
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
* or otherwise transfer Your rights to the Software, and 2) use the Software
* for timesharing or service bureau purposes such as hosting the Software for
* commercial gain and/or for the benefit of a third party. Use of the Software
* may be subject to applicable fees and any use of the Software without first
* paying applicable fees is strictly prohibited. You do not have the right to
* remove SugarCRM copyrights from the source code or user interface.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* Your Warranty, Limitations of liability and Indemnity are expressly stated
* in the License. Please refer to the License for the specific language
* governing these rights and limitations under the License. Portions created
* by SugarCRM are Copyright (C) 2004-2007 SugarCRM, Inc.; All Rights Reserved.
*/
$dashletStrings['ChartsDashlet'] = array('LBL_TITLE' => 'Wykresy',
'LBL_DESCRIPTION' => 'Zakładka Wyświetlająca Wykresy',
'LBL_CONFIGURE_TITLE' => 'Tytuł', );
?>

View File

@@ -0,0 +1,46 @@
<?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".
*/
$dashletStrings['InvadersDashlet'] = array('LBL_TITLE' => 'Invaders!',
'LBL_DESCRIPTION' => 'A little way to pass the time',
'LBL_DBLCLICK_HELP' => 'Use A and D to move, S to fire.',
);
?>

View File

@@ -0,0 +1,46 @@
<?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".
*/
$dashletStrings['InvadersDashlet'] = array('LBL_TITLE' => 'Invaders!',
'LBL_DESCRIPTION' => 'Ein bisschen was zum Spielen',
'LBL_DBLCLICK_HELP' => 'A und D um zu bewegen, S um zu feuern.',
);
?>

View 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, $current_language;
$dashletMeta['InvadersDashlet'] = array('title' => 'LBL_TITLE', // array index in language pack
'description' => 'LBL_DESCRIPTION', // array index in language pack
'icon' => 'themes/default/images/icon_Invaders_32.gif',
'category' => 'Tools',
);
?>

View 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/Dashlet.php');
require_once('include/Sugar_Smarty.php');
class InvadersDashlet extends Dashlet {
var $savedText; // users's saved text
var $height = '100'; // height of the pad
/**
* Constructor
*
* @global string current language
* @param guid $id id for the current dashlet (assigned from Home module)
* @param array $def options saved for this dashlet
*/
function InvadersDashlet($id, $def) {
$this->loadLanguage('InvadersDashlet'); // load the language strings here
if(!empty($def['height'])) // set a default height if none is set
$this->height = $def['height'];
parent::Dashlet($id); // call parent constructor
$this->isConfigurable = false; // dashlet is configurable
$this->hasScript = true; // dashlet has javascript attached to it
// if no custom title, use default
if(empty($def['title'])) $this->title = $this->dashletStrings['LBL_TITLE'];
else $this->title = $def['title'];
}
/**
* Displays the dashlet
*
* @return string html to display dashlet
*/
function display() {
$ss = new Sugar_Smarty();
$ss->assign('id', $this->id);
$ss->assign('height', $this->height);
$str = $ss->fetch('modules/Home/Dashlets/InvadersDashlet/InvadersDashlet.tpl');
return parent::display($this->dashletStrings['LBL_DBLCLICK_HELP']) . $str . '<br />'; // return parent::display for title and such
}
/**
* Displays the javascript for the dashlet
*
* @return string javascript to use with this dashlet
*/
function displayScript() {
$ss = new Sugar_Smarty();
$ss->assign('id', $this->id);
$str = $ss->fetch('modules/Home/Dashlets/InvadersDashlet/InvadersDashletScript.tpl');
return $str; // return parent::display for title and such
}
/**
* Displays the configuration form for the dashlet
*
* @return string html to display form
*/
function displayOptions() {
global $app_strings;
$ss = new Sugar_Smarty();
$ss->assign('titleLbl', $this->dashletStrings['LBL_CONFIGURE_TITLE']);
$ss->assign('heightLbl', $this->dashletStrings['LBL_CONFIGURE_HEIGHT']);
$ss->assign('saveLbl', $app_strings['LBL_SAVE_BUTTON_LABEL']);
$ss->assign('title', $this->title);
$ss->assign('height', $this->height);
$ss->assign('id', $this->id);
return parent::displayOptions() . $ss->fetch('modules/Home/Dashlets/InvadersDashlet/InvadersOptions.tpl');
}
/**
* called to filter out $_REQUEST object when the user submits the configure dropdown
*
* @param array $req $_REQUEST
* @return array filtered options to save
*/
function saveOptions($req) {
global $sugar_config, $timedate, $current_user, $theme;
$options = array();
$options['title'] = $_REQUEST['title'];
if(is_numeric($_REQUEST['height'])) {
if($_REQUEST['height'] > 0 && $_REQUEST['height'] <= 300) $options['height'] = $_REQUEST['height'];
elseif($_REQUEST['height'] > 300) $options['height'] = '300';
else $options['height'] = '100';
}
// $options['savedText'] = br2nl($this->savedText);
$options['savedText'] = $this->savedText;
return $options;
}
/**
* Used to save text on textarea blur. Accessed via Home/CallMethodDashlet.php
* This is an example of how to to call a custom method via ajax
*/
function saveText() {
if(isset($_REQUEST['savedText'])) {
$optionsArray = $this->loadOptions();
// _pp($_REQUEST['savedText']);
$optionsArray['savedText'] = nl2br($_REQUEST['savedText']);
$this->storeOptions($optionsArray);
}
else {
$optionsArray['savedText'] = '';
}
$json = getJSONobj();
echo 'result = ' . $json->encode(array('id' => $_REQUEST['id'],
'savedText' => $optionsArray['savedText']));
}
}
?>

View File

@@ -0,0 +1,38 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* The contents of this file are subject to the SugarCRM Professional Subscription
* Agreement ("License") which can be viewed at
* http://www.sugarcrm.com/crm/products/sugar-professional-eula.html
* By installing or using this file, You have unconditionally agreed to the
* terms and conditions of the License, and You may not use this file except in
* compliance with the License. Under the terms of the license, You shall not,
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
* or otherwise transfer Your rights to the Software, and 2) use the Software
* for timesharing or service bureau purposes such as hosting the Software for
* commercial gain and/or for the benefit of a third party. Use of the Software
* may be subject to applicable fees and any use of the Software without first
* paying applicable fees is strictly prohibited. You do not have the right to
* remove SugarCRM copyrights from the source code or user interface.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* Your Warranty, Limitations of liability and Indemnity are expressly stated
* in the License. Please refer to the License for the specific language
* governing these rights and limitations under the License. Portions created
* by SugarCRM are Copyright (C) 2004-2007 SugarCRM, Inc.; All Rights Reserved.
*/
$dashletStrings['InvadersDashlet'] = array('LBL_TITLE' => 'Najeźdźcy!',
'LBL_DESCRIPTION' => 'Ciekawy sposób spędzania czasu :)',
'LBL_DBLCLICK_HELP' => 'Użyj A i D, do poruszania się i S aby strzelać.',
);
?>

View File

@@ -0,0 +1,64 @@
<?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".
*/
$defaultText = "";
$dashletStrings['JotPadDashlet'] = array('LBL_TITLE' => 'JotPad',
'LBL_DESCRIPTION' => 'A dashlet to keep your notes',
'LBL_SAVING' => 'Saving JotPad ...',
'LBL_SAVED' => 'Saved',
'LBL_CONFIGURE_TITLE' => 'Title',
'LBL_CONFIGURE_HEIGHT' => 'Height (1 - 300)',
'LBL_DBLCLICK_HELP' => 'Double click below to Edit.',
'LBL_DEFAULT_TEXT' => $defaultText,
);
?>

View File

@@ -0,0 +1,87 @@
<?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".
*/
$defaultText =
<<<EOQ
<b>Wilkommen bei Sugar 5.2!</b><br /><br />
Klicken Sie auf <b>Mein Konto</b> um Ihre persönlichen Einstellungen zu verändern.<br>
Klicken Sie auf das <b>Fragezeichen</b> Icon um die Hilfeseiten für jedes Modul aufzurufen (tlw. Englisch).<br><br>
Bei Fragen bitte info@iscongroup.net oder +43 720 504177 bzw. +49 1801 995500 6042</b>.<br />
EOQ
;
$dashletStrings['JotPadDashlet'] = array('LBL_TITLE' => 'JotPad',
'LBL_DESCRIPTION' => 'Ein Dashlet für Ihre Notizen',
'LBL_SAVING' => 'Speichere JotPad ...',
'LBL_SAVED' => 'Gespeichert.',
'LBL_CONFIGURE_TITLE' => 'Titel',
'LBL_CONFIGURE_HEIGHT' => 'Höhe (1 - 300)',
'LBL_DBLCLICK_HELP' => 'Doppelklicken Sie unten um zu bearbeiten.',
'LBL_DEFAULT_TEXT' => $defaultText,
);
?>

View File

@@ -0,0 +1,46 @@
<?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, $current_language;
$dashletMeta['JotPadDashlet'] = array('title' => 'LBL_TITLE', // array index in language pack
'description' => 'LBL_DESCRIPTION', // array index in language pack
'icon' => 'themes/default/images/icon_JotPad_32.gif',
'category' => 'Tools');
?>

View File

@@ -0,0 +1,176 @@
<?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/Dashlet.php');
require_once('include/Sugar_Smarty.php');
class JotPadDashlet extends Dashlet {
var $savedText; // users's saved text
var $height = '200'; // height of the pad
/**
* Constructor
*
* @global string current language
* @param guid $id id for the current dashlet (assigned from Home module)
* @param array $def options saved for this dashlet
*/
function JotPadDashlet($id, $def) {
$this->loadLanguage('JotPadDashlet'); // load the language strings here
if(!empty($def['savedText'])) // load default text is none is defined
$this->savedText = $def['savedText'];
else
$this->savedText = $this->dashletStrings['LBL_DEFAULT_TEXT'];
if(!empty($def['height'])) // set a default height if none is set
$this->height = $def['height'];
parent::Dashlet($id); // call parent constructor
$this->isConfigurable = true; // dashlet is configurable
$this->hasScript = true; // dashlet has javascript attached to it
// if no custom title, use default
if(empty($def['title'])) $this->title = $this->dashletStrings['LBL_TITLE'];
else $this->title = $def['title'];
}
/**
* Displays the dashlet
*
* @return string html to display dashlet
*/
function display() {
$ss = new Sugar_Smarty();
$xss = clean_xss($this->savedText, false);
if(!empty($xss)) {
$this->savedText = str_replace($xss, "", $this->savedText);
}
$ss->assign('savedText', $this->savedText);
$ss->assign('saving', $this->dashletStrings['LBL_SAVING']);
$ss->assign('saved', $this->dashletStrings['LBL_SAVED']);
$ss->assign('id', $this->id);
$ss->assign('height', $this->height);
$str = $ss->fetch('modules/Home/Dashlets/JotPadDashlet/JotPadDashlet.tpl');
return parent::display($this->dashletStrings['LBL_DBLCLICK_HELP']) . $str . '<br />'; // return parent::display for title and such
}
/**
* Displays the javascript for the dashlet
*
* @return string javascript to use with this dashlet
*/
function displayScript() {
$ss = new Sugar_Smarty();
$ss->assign('saving', $this->dashletStrings['LBL_SAVING']);
$ss->assign('saved', $this->dashletStrings['LBL_SAVED']);
$ss->assign('id', $this->id);
$str = $ss->fetch('modules/Home/Dashlets/JotPadDashlet/JotPadDashletScript.tpl');
return $str; // return parent::display for title and such
}
/**
* Displays the configuration form for the dashlet
*
* @return string html to display form
*/
function displayOptions() {
global $app_strings;
$ss = new Sugar_Smarty();
$ss->assign('titleLbl', $this->dashletStrings['LBL_CONFIGURE_TITLE']);
$ss->assign('heightLbl', $this->dashletStrings['LBL_CONFIGURE_HEIGHT']);
$ss->assign('saveLbl', $app_strings['LBL_SAVE_BUTTON_LABEL']);
$ss->assign('title', $this->title);
$ss->assign('height', $this->height);
$ss->assign('id', $this->id);
return parent::displayOptions() . $ss->fetch('modules/Home/Dashlets/JotPadDashlet/JotPadDashletOptions.tpl');
}
/**
* called to filter out $_REQUEST object when the user submits the configure dropdown
*
* @param array $req $_REQUEST
* @return array filtered options to save
*/
function saveOptions($req) {
global $sugar_config, $timedate, $current_user, $theme;
$options = array();
$options['title'] = $_REQUEST['title'];
if(is_numeric($_REQUEST['height'])) {
if($_REQUEST['height'] > 0 && $_REQUEST['height'] <= 300) $options['height'] = $_REQUEST['height'];
elseif($_REQUEST['height'] > 300) $options['height'] = '300';
else $options['height'] = '100';
}
// $options['savedText'] = br2nl($this->savedText);
$options['savedText'] = $this->savedText;
return $options;
}
/**
* Used to save text on textarea blur. Accessed via Home/CallMethodDashlet.php
* This is an example of how to to call a custom method via ajax
*/
function saveText() {
$json = getJSONobj();
if(isset($_REQUEST['savedText'])) {
$optionsArray = $this->loadOptions();
// _pp($_REQUEST['savedText']);
$optionsArray['savedText']=$json->decode(html_entity_decode($_REQUEST['savedText']));
$optionsArray['savedText']=nl2br($optionsArray['savedText']['jsonObject']);
$xss = clean_xss($optionsArray['savedText'], false);
if(!empty($xss)) {
$optionsArray['savedText'] = str_replace($xss, "", $optionsArray['savedText']);
}
$this->storeOptions($optionsArray);
}
else {
$optionsArray['savedText'] = '';
}
echo 'result = ' . $json->encode(array('id' => $_REQUEST['id'],
'savedText' => $optionsArray['savedText']));
}
}
?>

View File

@@ -0,0 +1,14 @@
<?php
$dashletStrings['JotPadDashlet'] = array('LBL_TITLE' => 'Pomocnik Edycji Widoku',
'LBL_DESCRIPTION' => 'Pasek Twoich Notatek',
'LBL_SAVING' => 'Zapisuję Twój Widok ...',
'LBL_SAVED' => 'Zapisano',
'LBL_CONFIGURE_TITLE' => 'Tytuł',
'LBL_CONFIGURE_HEIGHT' => 'Wysokość (1 - 300)',
'LBL_DBLCLICK_HELP' => 'Kliknij dwa razy poniżej, aby edytować.',
'LBL_DEFAULT_TEXT' => "Witaj w SugarCRM!\n\nMożesz dowolnie zmienić wygląd Twojej Strony Głównej, aby pasowała do Twoich Potrzeb.\n\n" .
"* Dodawaj nowe Belki, klikając na \"Dodaj Belkę\" w lewym górnym rogu ekranu.\n" .
"* Zmieniaj każdą z Belek, klikając na Ikonce Konfiguracji w prawym górnym rogu każdej z Belek\n" .
"* Usuń Belkę klikając na znaku X");
?>

View File

@@ -0,0 +1,49 @@
<?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".
*/
$dashletStrings['MyEcmCalendarsDashlets'] = array('LBL_TITLE' => 'Calendar',
'LBL_DESCRIPTION' => 'A Calendar Dashlet',
'LBL_SAVING' => 'Saving Calendar ...',
'LBL_SAVED' => 'Saved',
'LBL_CONFIGURE_TITLE' => 'Title',
'LBL_CONFIGURE_STATUS' => 'Default status',
'LBL_CONFIGURE_USER' => 'Activity user',
'LBL_CONFIGURE_TYPE' => 'Activity type',
'LBL_DBLCLICK_HELP' => 'Double click below to Edit.',
'LBL_DEFAULT_TEXT' => '',
);
?>

View File

@@ -0,0 +1,46 @@
<?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, $current_language;
$dashletMeta['MyEcmCalendarsDashlets'] = array('title' => 'LBL_TITLE', // array index in language pack
'description' => 'LBL_DESCRIPTION', // array index in language pack
'icon' => 'themes/default/images/EcmCalendars.gif',
'category' => 'Tools');
?>

View File

@@ -0,0 +1,250 @@
<?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/Dashlet.php');
require_once('include/Sugar_Smarty.php');
class MyEcmCalendarsDashlets extends Dashlet {
var $height = '200';
var $act_status;
var $act_user;
var $act_type;
function MyEcmCalendarsDashlets($id, $def) {
$this->loadLanguage('MyEcmCalendarsDashlets'); // load the language strings here
if (!empty($def['savedText'])) // load default text is none is defined
$this->savedText = $def['savedText'];
else
$this->savedText = $this->dashletStrings['LBL_DEFAULT_TEXT'];
if (!empty($def['height'])) // set a default height if none is set
$this->height = $def['height'];
$this->act_status = $def['act_status'];
$this->act_user = $def['act_user'];
$this->act_type = $def['act_type'];
parent::Dashlet($id); // call parent constructor
$this->isConfigurable = true; // dashlet is configurable
$this->hasScript = true; // dashlet has javascript attached to it
// if no custom title, use default
if (empty($def['title']))
$this->title = $this->dashletStrings['LBL_TITLE'];
else
$this->title = $def['title'];
}
/**
* Displays the dashlet
*
* @return string html to display dashlet
*/
function display() {
$ss = new Sugar_Smarty();
$ss->assign('savedText', $this->savedText);
$ss->assign('saving', $this->dashletStrings['LBL_SAVING']);
$ss->assign('saved', $this->dashletStrings['LBL_SAVED']);
$ss->assign('id', $this->id);
$ss->assign('height', $this->height);
$str = $ss->fetch('modules/Home/Dashlets/MyEcmCalendarsDashlets/MyEcmCalendarsDashlets.tpl');
require_once("modules/EcmCalendars/Calendar.php");
// require_once("modules/EcmCalendars/language/en_us.lang.php");
$cal = new Calendar();
if ($_REQUEST['date']) {
$exp = explode("-", $_REQUEST['date']);
$cal->year = $exp[0];
$cal->month = $exp[1];
} else {
$cal->year = date("Y");
$cal->month = date("m");
}
$cal->act_status = $this->act_status;
$cal->act_user = $this->act_user;
$cal->act_type = $this->act_type;
if (!$this->act_type)
$cal->act_type = "All";
$_SESSION['calendar_dashlet_id'] = $this->id;
$str = '
<link href="modules/EcmCalendars/style.css" rel="stylesheet" type="text/css">
<script src="modules/EcmCalendars/helper.js" language="javascript"></script>
<script src="modules/EcmCalendars/Calendar.js" language="javascript"></script>
<div id="calendar_dashlet">' . $cal->showTableDashlet($cal->month, $cal->year) . '</div>
';
return parent::display("") . $str . '<br />'; // return parent::display for title and such
}
/**
* Displays the javascript for the dashlet
*
* @return string javascript to use with this dashlet
*/
function displayScript() {
$ss = new Sugar_Smarty();
$ss->assign('saving', $this->dashletStrings['LBL_SAVING']);
$ss->assign('saved', $this->dashletStrings['LBL_SAVED']);
$ss->assign('id', $this->id);
$str = $ss->fetch('modules/Home/Dashlets/MyEcmCalendarsDashlets/MyEcmCalendarsDashletsScript.tpl');
return $str; // return parent::display for title and such
}
/**
* Displays the configuration form for the dashlet
*
* @return string html to display form
*/
function displayOptions() {
global $current_language;
$app_list_strings = return_app_list_strings_language($current_language);
global $app_strings;
$ss = new Sugar_Smarty();
$as = '<option value="All"';
if ($this->act_status == 'All')
$as.=' selected';
$as.='>'.$app_strings['LBL_ALL'].'</option>';
foreach ($app_list_strings['meeting_status_dom'] as $k => $v) {
$as.='<option value="' . $k . '"';
if ($this->act_status == $k)
$as.=" selected";
$as.='>' . $v . '</option>';
}
$ss->assign('act_status_options', $as);
//TO DO
$arr = array("Calls" => "Rozmowy telefoniczne", "Meetings" => "Spotkania", "Tasks" =>"Zadania");
$at = '<option value="All"';
if ($this->act_status == 'All')
$at.=' selected';
$at.='>'.$app_strings['LBL_ALL'].'</option>';
foreach ($arr as $ar => $v) {
$at.='<option value="' . $ar . '"';
if ($this->act_type == $ar)
$at.=' selected';
$at.='>' . $v . '</option>';
}
$ss->assign('act_type_options', $at);
//gotowe
$ua = '<option value="All"';
if ($this->act_user == 'All')
$ua.=' selected';
$ua.='>'.$app_strings['LBL_ALL'].'</option>';
$db = $GLOBALS ['db'];
$q = "select CONCAT(ifnull(first_name,'') , ' ', ifnull(last_name,'')) as user_name,id from users where deleted='0' order by user_name asc";
$rs = $db->query($q);
$result = array();
if ($rs->num_rows > 0) {
while ($r = $db->fetchByAssoc($rs)) {
$ua.='<option value="' . $r['id'] . '"';
if ($r['id'] == $this->act_user)
$ua.=' selected';
$ua.='>' . $r['user_name'] . '</option>';
}
}
$ss->assign('act_user_options', $ua);
$ss->assign('titleLbl', $this->dashletStrings['LBL_CONFIGURE_TITLE']);
$ss->assign('statusLbl', $this->dashletStrings['LBL_CONFIGURE_STATUS']);
$ss->assign('userLbl', $this->dashletStrings['LBL_CONFIGURE_USER']);
$ss->assign('typeLbl', $this->dashletStrings['LBL_CONFIGURE_TYPE']);
$ss->assign('saveLbl', $app_strings['LBL_SAVE_BUTTON_LABEL']);
$ss->assign('title', $this->title);
$ss->assign('height', $this->height);
$ss->assign('id', $this->id);
return parent::displayOptions() . $ss->fetch('modules/Home/Dashlets/MyEcmCalendarsDashlets/MyEcmCalendarsDashletsOptions.tpl');
}
/**
* called to filter out $_REQUEST object when the user submits the configure dropdown
*
* @param array $req $_REQUEST
* @return array filtered options to save
*/
function saveOptions($req) {
global $sugar_config, $timedate, $current_user, $theme;
$options = array();
$options['title'] = $_REQUEST['title'];
$options['act_status'] = $_REQUEST['act_status'];
$options['act_user'] = $_REQUEST['act_user'];
$options['act_type'] = $_REQUEST['act_type'];
if (is_numeric($_REQUEST['height'])) {
if ($_REQUEST['height'] > 0 && $_REQUEST['height'] <= 300)
$options['height'] = $_REQUEST['height'];
elseif ($_REQUEST['height'] > 300)
$options['height'] = '300';
else
$options['height'] = '100';
}
// $options['savedText'] = br2nl($this->savedText);
$options['savedText'] = $this->savedText;
return $options;
}
/**
* Used to save text on textarea blur. Accessed via Home/CallMethodDashlet.php
* This is an example of how to to call a custom method via ajax
*/
function saveText() {
$json = getJSONobj();
if (isset($_REQUEST['savedText'])) {
$optionsArray = $this->loadOptions();
// _pp($_REQUEST['savedText']);
$optionsArray['savedText'] = $json->decode(html_entity_decode($_REQUEST['savedText']));
$optionsArray['savedText'] = nl2br($optionsArray['savedText']['jsonObject']);
$this->storeOptions($optionsArray);
} else {
$optionsArray['savedText'] = '';
}
echo 'result = ' . $json->encode(array('id' => $_REQUEST['id'],
'savedText' => $optionsArray['savedText']));
}
}
?>

View File

@@ -0,0 +1,51 @@
<?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".
*/
$dashletStrings['MyEcmCalendarsDashlets'] = array(
'LBL_TITLE' => 'Kalendarz',
'LBL_DESCRIPTION' => 'A Calendar Dashlet',
'LBL_SAVING' => 'Zapisuje kalendarz ...',
'LBL_SAVED' => 'Zapisane',
'LBL_CONFIGURE_TITLE' => 'Tytuł',
'LBL_CONFIGURE_STATUS' => 'Domyślny status',
'LBL_CONFIGURE_USER' => 'Aktywny urzytkownik',
'LBL_CONFIGURE_TYPE' => 'Typ aktywności',
'LBL_DBLCLICK_HELP' => 'Kliknij podwójnie by edytować',
'LBL_DEFAULT_TEXT' => '',
);
?>

View File

@@ -0,0 +1,49 @@
<?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".
*/
$dashletStrings['MyEcmCallsMoreDashlets'] = array('LBL_TITLE' => 'Calls summary',
'LBL_DESCRIPTION' => 'A user calls summary dashlet',
'LBL_SAVING' => 'Saving calls summary ...',
'LBL_SAVED' => 'Saved',
'LBL_CONFIGURE_TITLE' => 'Title',
'LBL_CONFIGURE_STATUS' => 'Default status',
'LBL_CONFIGURE_USER' => 'User',
'LBL_CONFIGURE_TYPE' => 'Type',
'LBL_DBLCLICK_HELP' => 'Double click below to Edit.',
'LBL_DEFAULT_TEXT' => '',
);
?>

View File

@@ -0,0 +1,46 @@
<?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, $current_language;
$dashletMeta['MyEcmCallsMoreDashlets'] = array('title' => 'LBL_TITLE', // array index in language pack
'description' => 'LBL_DESCRIPTION', // array index in language pack
'icon' => 'themes/default/images/EcmCallsMore.gif',
'category' => 'Tools');
?>

View File

@@ -0,0 +1,458 @@
<?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/Dashlet.php');
require_once('include/Sugar_Smarty.php');
class MyEcmCallsMoreDashlets extends Dashlet {
var $height = '200';
var $user=array();
function MyEcmCallsMoreDashlets($id, $def) {
$this->loadLanguage('MyEcmCallsMoreDashlets');
if(!empty($def['height']))
$this->height = $def['height'];
$this->user = $def['user'];
if($def['date'])$this->date = $GLOBALS['timedate']->to_display_date($def['date']);
else $this->date=$GLOBALS['timedate']->to_display_date(date("Y-m-d"));
if(count($this->user)==0){
$w=mysql_query("select id from users where deleted='0' and status='Active' and phone_work!=''");
while($r=mysql_fetch_array($w)){
$this->user[]=$r['id'];
}
}
parent::Dashlet($id); // call parent constructor
$this->isConfigurable = true; // dashlet is configurable
$this->hasScript = true; // dashlet has javascript attached to it
// if no custom title, use default
if(empty($def['title'])) $this->title = $this->dashletStrings['LBL_TITLE'];
else $this->title = $def['title'];
}
function display() {
$ss = new Sugar_Smarty();
$ss->assign('savedText', $this->savedText);
$ss->assign('saving', $this->dashletStrings['LBL_SAVING']);
$ss->assign('saved', $this->dashletStrings['LBL_SAVED']);
$ss->assign('id', $this->id);
$ss->assign('height', $this->height);
$str='';
//echo $this->date;
$exp=explode("-",$GLOBALS['timedate']->to_db_date($this->date));
//echo $GLOBALS['timedate']->to_db_date($this->date)."mm";
$dm=$exp[1];
$dd=$exp[2];
$dy=$exp[0];
$trd=array(
6=>0,
0=>1,
1=>2,
2=>3,
3=>4,
4=>5,
5=>6,
);
//echo "<br>".$dy." ".$dm." ".$dd;
$no_actual_day=date("w",mktime(0,0,0,$dm,$dd,$dy));
//echo $no_actual_day;
$date_first=date("Y-m-d",mktime(0,0,0,$dm,$dd,$dy)-($no_actual_day)*(3600*24)+3600*24);
//echo $date_first;
$expl=explode("-",$date_first);
$ds=array(0,1,2,3,4);
$m=0;
foreach($ds as $dss){
$days[$m]=date("Y-m-d",mktime(0,0,0,$expl[1],$expl[2],$expl[0])+$m*3600*24);
$m++;
}
//print_r($days);
/*
$days[$no_actual_day]=$GLOBALS['timedate']->to_db_date($this->date);
//echo $this->date;die();
if($no_actual_day>0){
for($i=0;$i<$no_actual_day;$i++){
$days[$i]=date("Y-m-d",mktime(0,0,0,$dm,$dd,$dy)-($i+1)*(3600*24));
}
}
for($i=$no_actual_day+1;$i<=6;$i++){
$days[$i]=date("Y-m-d",mktime(0,0,0,$dm,$dd,$dy)+($i-$no_actual_day)*(3600*24));
}*/
//$this->user=array("178770a9-cd31-9f5e-6ee4-4acb40f6381c","dbf183f4-70da-2e17-1745-4acb40d0294b");
if(count($this->user)>0){
foreach($this->user as $u){
foreach($days as $ddd){
$w=mysql_query("select * from ecmcallsphones where bean_id='".$u."'");
while($r=mysql_fetch_array($w)){
/*$p[$r['bean_id'][$ddd]]['busy']=mysql_num_rows(mysql_query("select id from cdr where disposition='BUSY' and src='".$r['phone']."' and (calldate like '".$ddd."%')"));
$ww=mysql_query("select duration from cdr where disposition='BUSY' and src='".$r['phone']."' and (calldate like '".$ddd."%')");
while($rr=mysql_fetch_array($ww)){
$p[$r['bean_id']][$ddd]['busy_duration']+=$rr['duration'];
}*/
$p[$r['bean_id']][$ddd]['answered_up_60']=mysql_num_rows(mysql_query("select id from cdr where disposition like 'ANSWERED' and deleted='0' and duration>60 and src='".$r['phone']."' and (calldate like '".$ddd."%')"));
$ww=mysql_query("select duration,dst from cdr where disposition='ANSWERED' and deleted='0' and duration>60 and src='".$r['phone']."' and (calldate like '".$ddd."%')");
$temp=array();
$dttt=0;
while($rr=mysql_fetch_array($ww)){
$p[$r['bean_id']][$ddd]['answered_up_60_duration']+=$rr['duration'];
$temp[$rr['dst']]+=$rr['duration'];
}
$p[$r['bean_id']][$ddd]['answered_up_60_distinct']=count($temp);
foreach($temp as $tte)$dttt+=$tte;
$p[$r['bean_id']][$ddd]['answered_up_60_distinct_duration']=$dttt;
$temp_cnt=0;
$dur_tt=0;
if(count($temp)>0){
foreach($temp as $temp_key=>$temp_value){
$www=mysql_query("select dst,duration from cdr where disposition='ANSWERED' and deleted='0' and duration>60 and src='".$r['phone']."' and dst='".$temp_key."' and calldate like '".$ddd."%'");
if(mysql_num_rows(mysql_query("select dst,duration from cdr where disposition='ANSWERED' and deleted='0' and duration>60 and src='".$r['phone']."' and dst='".$temp_key."' and calldate<'".$ddd."'"))==0){
$temp_cnt++;
}
while($rrr=mysql_fetch_array($www))$dur_tt+=$rrr['duration'];
}
}
$p[$r['bean_id']][$ddd]['answered_up_60_new']=$temp_cnt;
$p[$r['bean_id']][$ddd]['answered_up_60_new_duration']=$dur_tt;
$p[$r['bean_id']][$ddd]['failed']=mysql_num_rows(mysql_query("select id from cdr where disposition like 'ANSWERED' and deleted='0' and duration<=60 and src='".$r['phone']."' and (calldate like '".$ddd."%')"));
$ww=mysql_query("select duration,dst from cdr where disposition like 'ANSWERED' and deleted='0' and duration<=60 and src='".$r['phone']."' and (calldate like '".$ddd."%')");
$temp=array();
$dttt=0;
while($rr=mysql_fetch_array($ww)){
$p[$r['bean_id']][$ddd]['failed_duration']+=$rr['duration'];
$temp[$rr['dst']]+=$rr['duration'];
}
$p[$r['bean_id']][$ddd]['failed_distinct']=count($temp);
foreach($temp as $tte)$dttt+=$tte;
$p[$r['bean_id']][$ddd]['failed_distinct_duration']=$dttt;
$temp_cnt=0;
$dur_tt=0;
if(count($temp)>0){
foreach($temp as $temp_key=>$temp_value){
$www=mysql_query("select dst,duration from cdr where disposition like 'ANSWERED' and deleted='0' and duration<=60 and src='".$r['phone']."' and dst='".$temp_key."' and calldate like '".$ddd."%'");
if(mysql_num_rows(mysql_query("select dst,duration from cdr where disposition like 'ANSWERED' and deleted='0' and duration<=60 and src='".$r['phone']."' and dst='".$temp_key."' and calldate<'".$ddd."'"))==0){
$temp_cnt++;
}
while($rrr=mysql_fetch_array($www))$dur_tt+=$rrr['duration'];
}
}
$p[$r['bean_id']][$ddd]['failed_new']=$temp_cnt;
$p[$r['bean_id']][$ddd]['failed_new_duration']=$dur_tt;
/*echo '<pre>';
print_r($p[$r['bean_id']]);
echo '</pre>';
$p[$r['bean_id']][$ddd]['failed']=mysql_num_rows(mysql_query("select id from cdr where disposition='FAILED' and src='".$r['phone']."' and (calldate like '".$ddd."%')"));
$ww=mysql_query("select duration from cdr where disposition='FAILED' and src='".$r['phone']."' and (calldate like '".$ddd."%')");
while($rr=mysql_fetch_array($ww)){
$p[$r['bean_id']][$ddd]['failed_duration']+=$rr['duration'];
}
$p[$r['bean_id']][$ddd]['no_answer']=mysql_num_rows(mysql_query("select id from cdr where disposition='NO ANSWER' and src='".$r['phone']."' and (calldate like '".$ddd."%')"));
$ww=mysql_query("select duration from cdr where disposition='NO ANSWER' and src='".$r['phone']."' and (calldate like '".$ddd."%')");
while($rr=mysql_fetch_array($ww)){
$p[$r['bean_id']][$ddd]['no_answer_duration']+=$rr['duration'];
}*/
}
}
}
}
$days=$this->multisort($days,array(array('key'=>0,'sort'=>'asc')));
//echo '<pre>';
//print_r($p);
//echo '</pre>';
$str.='<div style="border: 1px solid #cccccc;min-width:500px;max-width:700px;overflow:auto">';
$str.='<table cellspacing="0" cellpadding="0" border="0" width="100%">';
$str.='<tr class="listViewThLinkS1" align="center" valign="top">';
$str.='<td>&nbsp;</td>';
for($i=0;$i<count($days);$i++){
$str.='<td colspan="3" style="border: 1px solid #cccccc"><b>'.$GLOBALS['timedate']->to_display_date($days[$i]).'</b></td>';
}
$str.='<td colspan="3" style="border: 1px solid #cccccc"><b>Summary</b></td>';
$str.'</tr>';
$str.='<tr class="listViewThLinkS1" align="center" valign="top">';
$str.='<td class="listViewThS1">&nbsp;</td>';
for($i=0;$i<=count($days);$i++){
$str.='<td colspan="2" align="center" style="text-align: center;" class="listViewThS1"><img src="modules/Home/Dashlets/MyEcmCallsMoreDashlets/blue.png" border="0" /></td>';
//$str.='<td class="listViewThS1">&gt;60 (h:m)</td>';
$str.='<td class="listViewThS1"><img src="modules/Home/Dashlets/MyEcmCallsMoreDashlets/red.png" border="0" />test_mz</td>';
}
$str.='</tr>';
$type_arr=array("answered_up_60","failed");
$type_arr_distinct=array("answered_up_60_distinct","failed_distinct");
if(count($p)>0){
foreach($p as $k=>$v){
$r=mysql_fetch_array(mysql_query("select first_name,last_name,phone_work from users where id='".$k."'"));
if($k){
$str.='<tr align="center" valign="top">';
$str.='<td style="width:60px;padding:2px;border-bottom: 1px solid #cccccc;">'.$r['first_name'].' '.$r['last_name'].' ('.$r['phone_work'].')</td>';
foreach($v as $kk=>$vv){
foreach($type_arr as $ta){
if($ta=="answered_up_60")$sty="border-left: 1px solid #cccccc";
else $sty="";
if($vv[$ta])$str.='<td style="'.$sty.';padding:2px;border-bottom: 1px solid #cccccc;">'.$vv[$ta].'<br><span alt="distinct" title="distinct">'.$vv[$ta.'_distinct'].'</span><br><span alt="new" title="new">'.$vv[$ta.'_new'].'</span></td>';
else $str.='<td style="'.$sty.';padding:2px;border-bottom: 1px solid #cccccc;">0<br><span alt="distinct" title="distinct">0</span><br><span alt="new" title="new">0</span></td>';
if($ta!="failed"){
if($vv[$ta.'_duration']){
$m=floor($vv[$ta.'_duration']/60);
$h=floor($vv[$ta.'_duration']/3600);
$m=$m-60*$h;
$m2=floor($vv[$ta.'_distinct_duration']/60);
$h2=floor($vv[$ta.'_distinct_duration']/3600);
$m2=$m2-60*$h2;
$m3=floor($vv[$ta.'_new_duration']/60);
$h3=floor($vv[$ta.'_new_duration']/3600);
$m3=$m3-60*$h3;
$str.='<td style="padding:2px;border-bottom: 1px solid #cccccc;">'.$h.'h '.$m.'m</td>';
}
else $str.='<td style="padding:2px;border-bottom: 1px solid #cccccc;">0h 0m</td>';
}
$all[$k][$ta]+=$vv[$ta];
$all[$k][$ta."_distinct"]+=$vv[$ta."_distinct"];
$all[$k][$ta."_new"]+=$vv[$ta."_new"];
if($ta!="failed")$all[$k][$ta.'_duration']+=$vv[$ta.'_duration'];
if($ta!="failed")$all[$k][$ta.'_distinct_duration']+=$vv[$ta.'_distinct_duration'];
if($ta!="failed")$all[$k][$ta.'_new_duration']+=$vv[$ta.'_new_duration'];
$alla[$kk][$ta]+=$vv[$ta];
$alla[$kk][$ta."_distinct"]+=$vv[$ta."_distinct"];
$alla[$kk][$ta."_new"]+=$vv[$ta."_new"];
if($ta!="failed")$alla[$kk][$ta.'_duration']+=$vv[$ta.'_duration'];
if($ta!="failed")$alla[$kk][$ta.'_distinct_duration']+=$vv[$ta.'_distinct_duration'];
if($ta!="failed")$alla[$kk][$ta.'_new_duration']+=$vv[$ta.'_new_duration'];
$allaa[$ta]+=$vv[$ta];
$allaa[$ta."_distinct"]+=$vv[$ta."_distinct"];
$allaa[$ta."_new"]+=$vv[$ta."_new"];
if($ta!="failed")$allaa[$ta.'_duration']+=$vv[$ta.'_duration'];
if($ta!="failed")$allaa[$ta.'_distinct_duration']+=$vv[$ta.'_distinct_duration'];
if($ta!="failed")$allaa[$ta.'_new_duration']+=$vv[$ta.'_new_duration'];
}
}
foreach($type_arr as $ta){
if($ta=="answered_up_60")$sty="border-left: 1px solid #cccccc";
else $sty="";
if($all[$k][$ta])$str.='<td style="'.$sty.';padding:2px;border-bottom: 1px solid #cccccc;"><b>'.$all[$k][$ta].'<br><span alt="distinct" title="distinct">'.$all[$k][$ta."_distinct"].'</span><br><span alt="new" title="new">'.$all[$k][$ta."_new"].'</span></b></td>';
else $str.='<td style="'.$sty.';padding:2px;border-bottom: 1px solid #cccccc;"><b>0<br><span alt="distinct" title="distinct">0</span><br><span alt="new" title="new">0</span></b></td>';
if($ta!="failed"){
if($all[$k][$ta.'_duration']){
$m=floor($all[$k][$ta.'_duration']/60);
$h=floor($all[$k][$ta.'_duration']/3600);
$m=$m-60*$h;
$m2=floor($all[$k][$ta.'_distinct_duration']/60);
$h2=floor($all[$k][$ta.'_distinct_duration']/3600);
$m2=$m2-60*$h2;
$m3=floor($all[$k][$ta.'_new_duration']/60);
$h3=floor($all[$k][$ta.'_new_duration']/3600);
$m3=$m3-60*$h3;
$str.='<td style="padding:2px;border-bottom: 1px solid #cccccc;"><b>'.$h.'h '.$m.'m</b></td>';
}
else $str.='<td style="padding:2px;border-bottom: 1px solid #cccccc;"><b>0h 0m</b></td>';
}
}
$str.='</tr>';
}
}
}
$str.='<tr align="center" valign="top"><td><b>Summary</b></td>';
if(count($alla)>0){
foreach($alla as $al){
foreach($type_arr as $ta){
if($ta=="answered_up_60")$sty="border-left: 1px solid #cccccc";
else $sty="";
if($al[$ta])$str.='<td style="'.$sty.';padding:2px;border-bottom: 1px solid #cccccc;"><b>'.$al[$ta].'<br><span alt="distinct" title="distinct">'.$al[$ta."_distinct"].'</span><br><span alt="new" title="new">'.$al[$ta."_new"].'</span></b></td>';
else $str.='<td style="'.$sty.';padding:2px;border-bottom: 1px solid #cccccc;"><b>0<br><span alt="distinct" title="distinct">0</span><br><span alt="new" title="new">0</span></b></td>';
if($ta=="failed")continue;
if($al[$ta.'_duration']){
$m=floor($al[$ta.'_duration']/60);
$h=floor($al[$ta.'_duration']/3600);
$m=$m-60*$h;
$m2=floor($al[$ta.'_distinct_duration']/60);
$h2=floor($al[$ta.'_distinct_duration']/3600);
$m2=$m2-60*$h2;
$m3=floor($al[$ta.'_new_duration']/60);
$h3=floor($al[$ta.'_new_duration']/3600);
$m3=$m3-60*$h3;
$str.='<td style="padding:2px;border-bottom: 1px solid #cccccc;"><b>'.$h.'h '.$m.'m</b></td>';
}
else $str.='<td style="padding:2px;border-bottom: 1px solid #cccccc;"><b>0h 0m</b></td>';
}
}
}
foreach($type_arr as $ta){
if($ta=="answered_up_60")$sty="border-left: 1px solid #cccccc";
else $sty="";
if($allaa[$ta])$str.='<td style="'.$sty.';padding:2px;border-bottom: 1px solid #cccccc;"><b>'.$allaa[$ta].'<br><span alt="distinct" title="distinct">'.$allaa[$ta."_distinct"].'</span><br><span alt="new" title="new">'.$allaa[$ta."_new"].'</span></b></td>';
else $str.='<td style="'.$sty.';padding:2px;border-bottom: 1px solid #cccccc;"><b>0<br><span alt="distinct" title="distinct">0</span><br><span alt="new" title="new">0</span></b></td>';
if($ta=="failed")continue;
if($allaa[$ta.'_duration']){
$m=floor($allaa[$ta.'_duration']/60);
$h=floor($allaa[$ta.'_duration']/3600);
$m=$m-60*$h;
$m2=floor($allaa[$ta.'_distinct_duration']/60);
$h2=floor($allaa[$ta.'_distinct_duration']/3600);
$m2=$m2-60*$h2;
$m3=floor($allaa[$ta.'_new_duration']/60);
$h3=floor($allaa[$ta.'_new_duration']/3600);
$m3=$m3-60*$h3;
$str.='<td style="padding:2px;border-bottom: 1px solid #cccccc;"><b>'.$h.'h '.$m.'m</b></td>';
}
else $str.='<td style="padding:2px;border-bottom: 1px solid #cccccc;"><b>0h 0m</b></td>';
}
$str.='</tr>';
$str.='</table>';
$str.='</div>';
return parent::display("") . $str . '<br />'; // return parent::display for title and such
}
/**
* Displays the javascript for the dashlet
*
* @return string javascript to use with this dashlet
*/
function multisort($data,$keys)
{
if(count($data)>0)
{
foreach($data as $key => $row)
{
foreach($keys as $k)
{
$cols[$k['key']][$key] = $row[$k['key']];
}
}
$idkeys=@array_keys($data);
$i=0;
foreach($keys as $k)
{
if($i>0)$sort.=',';
$sort.='$cols['.$k['key'].']';
if($k['sort'])$sort.=',SORT_'.strtoupper($k['sort']);
if($k['type'])$sort.=',SORT_'.strtoupper($k['type']);
$i++;
}
$sort.=',$idkeys';
$sort='@array_multisort('.$sort.');';
eval($sort);
foreach($idkeys as $idkey)
{
$result[$idkey]=$data[$idkey];
}
return $result;
}
}
function displayScript() {
$ss = new Sugar_Smarty();
$ss->assign('saving', $this->dashletStrings['LBL_SAVING']);
$ss->assign('saved', $this->dashletStrings['LBL_SAVED']);
$ss->assign('id', $this->id);
$str = $ss->fetch('modules/Home/Dashlets/MyEcmCallsMoreDashlets/MyEcmCallsMoreDashletsScript.tpl');
return $str; // return parent::display for title and such
}
/**
* Displays the configuration form for the dashlet
*
* @return string html to display form
*/
function displayOptions() {
global $app_strings;
$ss = new Sugar_Smarty();
$ua='<option value="All"';
if($this->user[0]=='All' || $this->user[0]=='')$ua.=' selected';
$ua.='>All</option>';
$w=mysql_query("select first_name,last_name,id from users where deleted='0' and status='Active' and phone_work!='' order by user_name asc");
while($r=mysql_fetch_array($w))
{
$ua.='<option value="'.$r['id'].'"';
if(is_array($this->user)){
if(in_array($r['id'],$this->user)){
$ua.=' selected';
}
}
$ua.='>'.$r['first_name'].' '.$r['last_name'].'</option>';
}
$ss->assign('user_options', $ua);
$ss->assign('date', $this->date);
$ss->assign('titleLbl', $this->dashletStrings['LBL_CONFIGURE_TITLE']);
$ss->assign('statusLbl', $this->dashletStrings['LBL_CONFIGURE_STATUS']);
$ss->assign('userLbl', $this->dashletStrings['LBL_CONFIGURE_USER']);
$ss->assign('typeLbl', $this->dashletStrings['LBL_CONFIGURE_TYPE']);
$ss->assign('saveLbl', $app_strings['LBL_SAVE_BUTTON_LABEL']);
$ss->assign('title', $this->title);
$ss->assign('height', $this->height);
$arr=array("d","m","Y","y");
$arrp=array("%d","%m","%Y","%y");
$ss->assign('format', str_replace($arr,$arrp,$GLOBALS['timedate']->get_date_format()));
$ss->assign('id', $this->id);
return parent::displayOptions() . $ss->fetch('modules/Home/Dashlets/MyEcmCallsMoreDashlets/MyEcmCallsMoreDashleOptions.tpl');
}
function saveOptions($req) {
global $sugar_config, $timedate, $current_user, $theme;
$options = array();
$options['title'] = $_REQUEST['title'];
$options['user'] = $_REQUEST['user'];
$exp=explode("-",$GLOBALS['timedate']->to_db_date($_REQUEST['date']));
$options['date'] = date("Y-m-d",mktime(0,0,0,$exp[1],$exp[2],$exp[0])+3600*24);
if(is_numeric($_REQUEST['height'])) {
if($_REQUEST['height'] > 0 && $_REQUEST['height'] <= 300) $options['height'] = $_REQUEST['height'];
elseif($_REQUEST['height'] > 300) $options['height'] = '300';
else $options['height'] = '100';
}
return $options;
}
}
?>

View File

@@ -0,0 +1,46 @@
<?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".
*/
$dashletStrings['MyEcmReportDashlets'] = array('LBL_TITLE' => 'Reports summary',
'LBL_DESCRIPTION' => 'A reports summary dashlet',
'LBL_SAVING' => 'Saving calls summary ...',
'LBL_SAVED' => 'Saved',
'LBL_CONFIGURE_TITLE' => 'Title',
'LBL_CONFIGURE_SAVE' => 'Save',
'LBL_DEFAULT_TEXT' => '',
);
?>

View File

@@ -0,0 +1,46 @@
<?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 fre e 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, $current_language;
$dashletMeta['MyEcmReportDashlets'] = array('title' => 'LBL_TITLE', // array index in language pack
'description' => 'LBL_DESCRIPTION', // array index in language pack
'icon' => 'themes/default/images/EcmReport.gif',
'category' => 'Tools');
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,154 @@
<?php
if(!defined('sugarEntry'))define('sugarEntry', true);
$startTime = microtime(true);
require_once('/var/www/html/e5crm/include/entryPoint.php');
ob_start();
require_once("/var/www/html/e5crm/config.php");
require_once('/var/www/html/e5crm/include/MVC/SugarApplication.php');
$mm = new MysqlManager();
$mm->connect();
/*$app = new SugarApplication();
$app->startSession();
$app->execute();
*/
include_once( '/var/www/html/e5crm/include/ECM/open_flash_chart/ofc-library/open-flash-chart.php' );
include_once("/var/www/html/e5crm/modules/EcmReports/cache.php");
include_once("/var/www/html/e5crm/modules/EcmReports/class.sales.php");
$mmm=(int)date("m")-1;
if($mmm==0)$mmm=12;
$year_month=$_SESSION['EcmReports_Dashlet_sales'];
$e=explode("-",$_SESSION['EcmReports_Dashlet_sales']);
$year=$e[0];
$month=$e[1];
$s=new Sales();
$s->date_from=$year."-".$month."-01";
$s->date_to=$year."-".$month."-31";
$sdata=$s->getSalesByCategory();
$pred=new Sales();
$pred->date_from=$year."-01-01";
$pred->date_to=$year."-12-31";
$pred=$pred->getSalesByCategory();
function repl($t){
$a1=array("ą","ś","ę","ż","ź","ć","ń","ó","ł","Ą","Ś","Ę","Ż","Ź","Ć","Ń","Ó","Ł");
$a2=array("a","s","e","z","z","c","n","o","l","A","S","E","Z","Z","C","N","O","L");
return str_replace($a1,$a2,$t);
}
function salesPercent($category_id,$date){
$w=$GLOBALS['db']->query("select value_wz as swz,value_sale as ssale from ecmproductcategories_realisation where product_category_id='".$category_id."' and date='".$date."'");
$r=$GLOBALS['db']->fetchByAssoc($w);
return @100*$r['swz']/$r['ssale'];
}
$year_month=$_SESSION['EcmReports_Dashlet_sales'];
$e=explode("-",$_SESSION['EcmReports_Dashlet_sales']);
$year=$e[0];
$month=$e[1];
$s=sum($year_month,"","","","");
$sy=sum($year,"","","","");
$w=$GLOBALS['db']->query("select id,name from ecmproductcategories where deleted='0' and name!='' order by name asc");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$ss=$sdata[$month][$r['id']];
$pp=$pred[$month][$r['id']];
$v_s=$ss['sales'];
if($v_s>$temp)$temp=$v_s;
$sum_s+=$v_s;
$v_p=$ss['purchase'];
if($v_p>$temp)$temp=$v_p;
$sum_p+=$v_p;
$v_l=$pp['sales']/$mmm;
if($v_l>$temp)$temp=$v_l;
$sum_l+=$v_l;
$v_r=salesPercent($r['id'],$year_month);
$arr_s[]=array(
"name"=>repl($r['name']),
"value"=>$v_s,
);
$arr_p[]=array(
"value"=>$v_p,
);
$arr_l[]=array(
"value"=>$v_l,
);
$arr_r[]=array(
"value"=>$v_r,
);
}
//$arr_s=multisort($arr_s,array(array('key'=>'value','sort'=>'desc')));
for($i=0;$i<count($arr_s);$i++){
$data_1[]=$arr_l[$i]['value'];
$data_2[]=$arr_s[$i]['value'];
$data_3[]=$arr_p[$i]['value'];
$data_4[]=$arr_r[$i]['value'];
$cats[]=$arr_s[$i]['name'];
}
$g = new graph();
//$g->title( 'Sales: '.$year_month, '{font-size:20px; color: #000000; margin: 5px; background-color: #ffffff; padding:5px; padding-left: 20px; padding-right: 20px;}' );
$g->bg_colour = '#ffffff';
$d1 = new bar( 75, '#999999' );
$d2 = new bar( 75, '#D54C78' );
$d3 = new bar( 75, '#3334AD' );
$d1->key( 'Forecast', 10 );
$d2->key( 'Sales', 10 );
$d3->key( 'Margin', 10 );
for($i=0;$i<count($data_1);$i++){
$d1->add_data_tip($data_1[$i],"Margin: ".round($data_3[$i],2)."\nSales: ".round($data_2[$i],2)."\nForecast: ".round($data_1[$i],2)."\nFullfillment: ".round($data_4[$i],2)."%");
$d2->add_data_tip($data_2[$i],"Margin: ".round($data_3[$i],2)."\nSales: ".round($data_2[$i],2)."\nForecast: ".round($data_1[$i],2)."\nFullfillment: ".round($data_4[$i],2)."%");
$d3->add_data_tip($data_3[$i],"Margin: ".round($data_3[$i],2)."\nSales: ".round($data_2[$i],2)."\nForecast: ".round($data_1[$i],2)."\nFullfillment: ".round($data_4[$i],2)."%");
}
$g->data_sets[]=$d1;
$g->data_sets[]=$d2;
$g->data_sets[]=$d3;
$g->set_tool_tip( '#x_label#<br>#tip#<br>' );
//$g->set_data($data_1);
//$g->bar( 75, '#D54C78', '', 10 );
//$g->set_data($data_2);
//$g->bar( 75, '#3334AD', '', 10 );
//$g->attach_to_y_right_axis(2);
$g->x_axis_colour( '#909090', '#ADB5C7' );
$g->y_axis_colour( '#909090', '#ADB5C7' );
$g->y_right_axis_colour( '#909090' );
$g->set_x_labels( $cats );
$g->set_x_label_style( 10, '#000000', 2 );
$g->set_y_max( $temp );
$g->set_y_right_max( $temp);
$g->y_label_steps( 20 );
//$g->y_right_label_steps( 5 );
$g->set_y_legend( '', 12, '#736AFF' );
$g->set_y_right_legend( 'Free Ram (MB)' ,12 , '#164166' );
echo $g->render();
$exit_on_cleanup = true;
sugar_cleanup($exit_on_cleanup);
?>

View File

@@ -0,0 +1,106 @@
<?php
session_start();
//error_reporting(0);
include_once( '/var/www/html/e5crm/config.php');
$sql=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
mysql_select_db($sugar_config['dbconfig']['db_name']);
mysql_query("set names utf8");
include_once( '/var/www/html/e5crm/include/ECM/open_flash_chart/ofc-library/open-flash-chart.php' );
include_once("/var/www/html/e5crm/modules/EcmReports/cache.php");
function repl($t){
$a1=array("ą","ś","ę","ż","ź","ć","ń","ó","ł","Ą","Ś","Ę","Ż","Ź","Ć","Ń","Ó","Ł");
$a2=array("a","s","e","z","z","c","n","o","l","A","S","E","Z","Z","C","N","O","L");
return str_replace($a1,$a2,$t);
}
function getSalesYear($year){
for($i=1;$i<=12;$i++){
if($i<10)$n="0".$i;
else $n=$i;
$r=mysql_fetch_array(mysql_query("select if(e.currency_value>0 and e.currency_value is not null,sum(i.quantity*i.price*e.currency_value),sum(i.quantity*i.price)) as s,sum(i.quantity*i.purchase_price) as p from ecminvoiceouts as e inner join ecminvoiceoutitems as i on e.id=i.ecminvoiceout_id inner join ecmproducts as p on p.id=i.ecmproduct_id inner join ecmstockdocouts as w on w.id=e.wz_id inner join ecmproductcategories as pc on pc.id=p.product_category_id where e.register_date like '".$year."-".$n."%' and e.type!='correct' and e.status='accepted' and i.deleted='0' and e.deleted='0'"));
$arr[$i]=$r;
$w=mysql_query("select i.price,i.quantity,i.ecminvoiceoutitem_id,e.currency_value from ecminvoiceouts as e inner join ecminvoiceoutitems as i on e.id=i.ecminvoiceout_id inner join ecmproducts as p on p.id=i.ecmproduct_id inner join ecmproductcategories as pc on pc.id=p.product_category_id where e.register_date like '".$year."-".$n."%' and e.type='correct' and e.status='accepted' and i.deleted='0' and e.deleted='0'");
while($r=mysql_fetch_array($w)){
if(!$r['currency_value'])$r['currency_value']=1;
$arr[$i]['s']+=$r['currency_value']*$r['price']*$r['quantity'];
$rr=mysql_fetch_array(mysql_query("select price,quantity,purchase_price from ecminvoiceoutitems where id='".$r['ecminvoiceoutitem_id']."'"));
$arr[$i]['s']-=$rr['price']*$rr['quantity'];
$arr[$i]['p']+=$rr['purchase_price']*$r['quantity'];
$arr[$i]['p']-=$rr['purchase_price']*$rr['quantity'];
}
}
return $arr;;
}
$year_month=$_SESSION['EcmReports_Dashlet_sales_year'];
$e=explode("-",$_SESSION['EcmReports_Dashlet_sales_year']);
$year=$e[0];
$month=$e[1];
$months=array("January","February","March","April","May","June","July","August","September","October","November","Dezember");
for($i=1;$i<=12;$i++){
$s=getSalesYear($year);
if($temp<$s[$i]['s'])$temp=$s[$i]['s'];
$arr_s[]=array(
"name"=>repl($months[$i-1]),
"value"=>$s[$i]['s'],
);
$arr_p[]=array(
"name"=>repl($months[$i-1]),
"value"=>$s[$i]['p'],
);
}
for($i=0;$i<count($arr_s);$i++){
$data_1[]=$arr_s[$i]['value'];
$data_2[]=$arr_s[$i]['value']-$arr_p[$i]['value'];
$cats[]=$arr_s[$i]['name']." ".$year;
}
$g = new graph();
//$g->title( 'Sales: '.$year_month, '{font-size:20px; color: #000000; margin: 5px; background-color: #ffffff; padding:5px; padding-left: 20px; padding-right: 20px;}' );
$g->bg_colour = '#ffffff';
//$g->bg_colour = '#000000';
$d1 = new bar( 75, '#D54C78' );
$d2 = new bar( 75, '#3334AD' );
$d1->key( 'Sales', 10 );
$d2->key( 'PLN Margin', 10 );
for($i=0;$i<count($data_1);$i++){
$d1->add_data_tip($data_1[$i],"Sales: ".round($data_1[$i],2)."\nPLN Margin: ".round($data_2[$i],2)."\nMargin: ".@round(100*($data_2[$i])/$data_1[$i],2)."%");
$d2->add_data_tip($data_2[$i],"Sales: ".round($data_1[$i],2)."\nPLN Margin: ".round($data_2[$i],2)."\nMargin: ".@round(100*($data_2[$i])/$data_1[$i],2)."%");
}
$g->data_sets[]=$d1;
$g->data_sets[]=$d2;
$g->set_tool_tip( '#x_label#<br>#tip#<br>' );
//$g->set_data($data_1);
//$g->bar( 75, '#D54C78', '', 10 );
//$g->set_data($data_2);
//$g->bar( 75, '#3334AD', '', 10 );
//$g->attach_to_y_right_axis(2);
$g->x_axis_colour( '#909090', '#ADB5C7' );
$g->y_axis_colour( '#909090', '#ADB5C7' );
$g->y_right_axis_colour( '#909090' );
$g->set_x_labels( $cats );
$g->set_x_label_style( 10, '#000000', 2 );
$g->set_y_max( $temp );
$g->set_y_right_max( $temp);
$g->y_label_steps( 20 );
//$g->y_right_label_steps( 5 );
$g->set_y_legend( '', 12, '#736AFF' );
$g->set_y_right_legend( '' ,12 , '#164166' );
echo $g->render();
mysql_close($sql);
?>

View File

@@ -0,0 +1,106 @@
<?php
session_start();
include_once( '/var/www/html/e5crm/config.php');
$sql=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
mysql_select_db($sugar_config['dbconfig']['db_name']);
mysql_query("set names utf8");
include_once( '/var/www/html/e5crm/include/ECM/open_flash_chart/ofc-library/open-flash-chart.php' );
//include_once('/var/www/html/e5crm/modules/EcmCharts/chartHelper.php');
include_once("/var/www/html/e5crm/modules/EcmReports/cache.php");
function repl($t){
$a1=array("ą","ś","ę","ż","ź","ć","ń","ó","ł","Ą","Ś","Ę","Ż","Ź","Ć","Ń","Ó","Ł");
$a2=array("a","s","e","z","z","c","n","o","l","A","S","E","Z","Z","C","N","O","L");
return str_replace($a1,$a2,$t);
}
function getStock($category_id){
$ww=mysql_query("select sum(h.value) as sum from ecmproducts_history_states as h inner join ecmproducts as p on p.id=h.ecmproduct_id where p.product_category_id='".$category_id."' and p.deleted='0' and h.ecmstock_id='c7afd71a-4c3a-bde4-138d-4acaee1644e4' and p.product_active='1'");
$rr=mysql_fetch_array($ww);
$i=mysql_num_rows(mysql_query("select distinct date from ecmproducts_history_states"));
$v=$rr['sum'];
return $v/$i;
}
if((int)date("m")==1){
$mmm=12;
$year=date("Y")-1;
}
else{
$mmm=(int)date("m")-1;
$year=date("Y");
}
$s=sum($year,"","","","");
//$w=mysql_query("select id,name from ecmproductcategories where deleted='0' and name!=''");
//while($r=mysql_fetch_array($w)){
//$ss=getSum($s,$year,"",$r['id']);
//@$rot[$r['id']]=12*($ss['total_purchase']/$mmm)/getStock($r['id']);
//if($tempr<$rot[$r['id']])$tempr=$rot[$r['id']];
//}
//echo '<pre>';
//print_r($rot);
//echo '</pre>';m
$w=mysql_query("select p.id,p.product_category_id from ecmproducts as p inner join ecmproductcategories as c on c.id=p.product_category_id where p.deleted='0' order by c.name asc");
while($r=mysql_fetch_array($w)){
$qty=0;
$ww=mysql_query("select quantity,price from ecmstockstates where deleted='0' and product_id='".$r['id']."'");
while($rrr=mysql_fetch_array($ww)){
$qty+=$rrr['quantity']*$rrr['price'];
}
$cats[$r['product_category_id']]+=$qty;
if($cats[$r['product_category_id']]>$temp)$temp=$cats[$r['product_category_id']];
}
//$arr_s=multisort($arr_s,array(array('key'=>'value','sort'=>'desc')));
$i=0;
foreach($cats as $k=>$v){
$r=mysql_fetch_array(mysql_query("select name from ecmproductcategories where id='".$k."' and deleted='0'"));
if($r['name']){
$data_1[$i]=$v;
if($v)$data_2[$i]=$rot[$k];
else $data_2[$i]=0;
$cn[$i]=repl($r['name']);
$i++;
}
}
$g = new graph();
//$g->title( 'Stocks', '{font-size:20px; color: #000000; margin: 5px; background-color: #ffffff; padding:5px; padding-left: 20px; padding-right: 20px;}' );
$g->bg_colour = '#ffffff';
$d1 = new bar( 75, '#D54C78' );
$d2 = new bar( 75, '#3334AD' );
$d1->key( 'Inventory valueee', 10 );
$d2->key( 'Rotation', 10 );
for($i=0;$i<count($data_1);$i++){
$d1->add_data_tip($data_1[$i],"Value: ".$data_1[$i]."\nRotation: ".round($data_2[$i],2));
//$d2->add_data_tip($data_2[$i],"Value: ".$data_1[$i]."\nRotation: ".round($data_2[$i],2));
}
$g->data_sets[]=$d1;
//$g->data_sets[]=$d2;
$g->set_tool_tip( '#x_label#<br>#tip#<br>' );
$g->attach_to_y_right_axis(2);
$g->x_axis_colour( '#909090', '#ADB5C7' );
$g->y_axis_colour( '#909090', '#ADB5C7' );
$g->y_right_axis_colour( '#909090' );
$g->set_x_labels( $cn );
$g->set_x_label_style( 10, '#000000', 2 );
$g->set_y_max( $temp );
$g->set_y_right_max( $tempr);
$g->y_label_steps( 20 );
//$g->y_right_label_steps( 5 );
$g->set_y_legend( 'Inventory value', 12, '#D54C78' );
$g->set_y_right_legend( 'Rotation' ,12 , '#3334AD' );
echo $g->render();
mysql_close($sql);
?>

View File

@@ -0,0 +1,35 @@
<?php
session_start();
include_once( '/var/www/html/e5crm/vserver/e5crm.more7.com/www/config.php');
include_once( '/var/www/html/e5crm/vserver/e5crm.more7.com/www/guid.php');
$sql=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
mysql_select_db($sugar_config['dbconfig']['db_name']);
mysql_query("set names utf8");
//mysql_query("truncate table ecmproducts_history_states");
$date="2010-08-02";
$www=mysql_query("select id,name from ecmstocks where deleted='0' and no='1'");
while($rrr=mysql_fetch_array($www)){
$stock_id=$rrr['id'];
$ww=mysql_query("select id,code from ecmproducts where deleted='0' and code!='' order by code");
while($rr=mysql_fetch_array($ww)){
$v=0;
$product_id=$rr['id'];
$w=mysql_query("select type,quantity,price from ecmstockoperations where stock_id='".$stock_id."' and product_id='".$product_id."' and deleted='0'");
while($r=mysql_fetch_array($w)){
if($r['type']==0)$v+=$r['price']*$r['quantity'];
else $v-=$r['price']*$r['quantity'];
}
if($v<0)$v=0;
$set="date='".$date."',ecmproduct_id='".$product_id."',ecmstock_id='".$stock_id."',value='".$v."'";
if(mysql_num_rows(mysql_query("select id from ecmproducts_history_states where ecmstock_id='".$stock_id."' and ecmproduct_id='".$product_id."' and date='".$date."'"))==0){
mysql_query("insert into ecmproducts_history_states set id='".create_guid()."',".$set);
}
else{
mysql_query("update ecmproducts_history_states set value='".$v."' where ecmstock_id='".$stock_id."' and ecmproduct_id='".$product_id."' and date='".$date."'");
}
echo $rr['code']." ".$v."\n";
}
}
mysql_close($sql);
?>

View File

@@ -0,0 +1,86 @@
<?php
session_start();
include_once( '/var/www/html/e5crm/config.php');
include_once( '/var/www/html/e5crm/guid.php');
$sql=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
mysql_select_db($sugar_config['dbconfig']['db_name']);
mysql_query("set names utf8");
//mysql_query("truncate table ecmproductcategories_realisation");
$mdate=date("Y-m");
//$w=mysql_query("select * from ecmsales where delivery_date like '".$mdate."%' and deleted='0' and status='s30' and type='sales_order'");
$w=mysql_query("select e.* from ecmsales as e inner join ecmstockdocouts as w on w.so_id=e.id inner join ecminvoiceouts as inv on inv.wz_id=w.id where e.deleted='0' and inv.register_date like '".$mdate."%' and e.type='sales_order' and e.status!='s10'");
while($r=mysql_fetch_array($w)){
$rsale=mysql_fetch_array(mysql_query("select sum(quantity*price) as qty from ecmsaleitems where ecmsale_id='".$r['id']."'"));
$rwz=mysql_fetch_array(mysql_query("select id from ecmstockdocouts where so_id='".$r['id']."'"));
$rwzi=mysql_fetch_array(mysql_query("select sum(quantity*selling_price) as qty from ecmstockdocoutitems where ecmstockdocout_id='".$rwz['id']."'"));
$ecmstockdocout_id=$rwz['id'];
if(mysql_num_rows(mysql_query("select id from ecminvoiceouts where wz_id='".$ecmstockdocout_id."' and deleted='0'"))==0)continue;
if($ecmstockdocout_id){
$sum_wz_qty+=$rwzi['qty'];
$sum_sale_qty+=$rsale['qty'];
}
$qty_diff=$rwzi['qty']-$rsale['qty'];
$diff_minus=$diff_plus=0;
$rst=$rsale['qty'];
$rwt=$rwzi['qty'];
if($ecmstockdocout_id){
$wsale=mysql_query("select quantity,price,code,ecmproduct_id from ecmsaleitems where deleted='0' and ecmsale_id='".$r['id']."' order by code");
while($rsale=mysql_fetch_array($wsale)){
$qty=0;
$wwz=mysql_query("select quantity,selling_price from ecmstockdocoutitems where deleted='0' and ecmproduct_id='".$rsale['ecmproduct_id']."' and ecmstockdocout_id='".$ecmstockdocout_id."'");
while($rwz=mysql_fetch_array($wwz)){
$qty+=$rwz['quantity']*$rwz['selling_price'];
}
if($rsale['quantity']*$rsale['price']>$qty)$diff_minus+=$qty-$rsale['quantity']*$rsale['price'];
if($rsale['quantity']*$rsale['price']<$qty)$diff_plus+=$qty-$rsale['quantity']*$rsale['price'];
$sum[$rsale['ecmproduct_id']]['wz']+=$qty;
$sum[$rsale['ecmproduct_id']]['sale']+=$rsale['quantity']*$rsale['price'];
}
}
}
$percent=number_format((100*$sum_wz_qty/$sum_sale_qty),2,",",".")."%";
$rst=0;
$rwt=0;
$diff_plus=$diff_minus=0;
$ww=mysql_query("select id,product_category_id from ecmproducts where deleted='0' order by code asc");
while($rr=mysql_fetch_array($ww)){
$k=$rr['id'];
if(!$sum[$k])continue;
$rst+=$sum[$k]['sale'];
$rwt+=$sum[$k]['wz'];
$cst[$rr['product_category_id']]+=$sum[$k]['sale'];
$cwt[$rr['product_category_id']]+=$sum[$k]['wz'];
if($sum[$k]['sale']>$sum[$k]['wz'])$diff_minus+=$sum[$k]['wz']-$sum[$k]['sale'];
if($sum[$k]['sale']<$sum[$k]['wz'])$diff_plus+=$sum[$k]['wz']-$sum[$k]['sale'];
}
$ww=mysql_query("select id,name from ecmproductcategories where deleted='0' order by name asc");
while($rr=mysql_fetch_array($ww)){
$k=$rr['id'];
if($cwt[$k]<$cst[$k])$color="red";
elseif($cwt[$k]>$cst[$k])$color="green";
else $color="black";
$set="date='".$mdate."',product_category_id='".$rr['id']."',value_sale='".$cst[$k]."',value_wz='".$cwt[$k]."'";
if(mysql_num_rows(mysql_query("select id from ecmproductcategories_realisation where product_category_id='".$rr['id']."' and date like '".$mdate."%'"))==0){
mysql_query("insert into ecmproductcategories_realisation set id='".create_guid()."',".$set);
}
else mysql_query("update ecmproductcategories_realisation set ".$set." where product_category_id='".$rr['id']."' and date like '".$mdate."%'");
echo $rr['name']."\n";
}
$set="date='".$mdate."',product_category_id='diff_minus',value_sale='".$diff_minus."'";
if(mysql_num_rows(mysql_query("select id from ecmproductcategories_realisation where product_category_id='diff_minus' and date like '".$mdate."%'"))==0){
mysql_query("insert into ecmproductcategories_realisation set id='".create_guid()."',".$set);
}
else mysql_query("update ecmproductcategories_realisation set ".$set." where product_category_id='diff_minus' and date like '".$mdate."%'");
$set="date='".$mdate."',product_category_id='diff_plus',value_sale='".$diff_plus."'";
if(mysql_num_rows(mysql_query("select id from ecmproductcategories_realisation where product_category_id='diff_plus' and date like '".$mdate."%'"))==0){
mysql_query("insert into ecmproductcategories_realisation set id='".create_guid()."',".$set);
}
else mysql_query("update ecmproductcategories_realisation set ".$set." where product_category_id='diff_plus' and date like '".$mdate."%'");
mysql_close($sql);
?>

View File

@@ -0,0 +1,53 @@
<?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-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero 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 Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero 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".
********************************************************************************/
$dashletStrings['RSSDashlet'] = array('LBL_TITLE' => 'News Feed',
'LBL_DESCRIPTION' => 'News Feed',
'LBL_SAVING' => 'Parsing ...',
'LBL_SAVED' => 'Complete',
'LBL_AUTO_SCROLL' => 'Auto Scroll',
'LBL_SCROLL_SPEED' => 'Scroll Speed (%)',
'LBL_CONFIGURE_TITLE' => 'Title',
'LBL_CONFIGURE_HEIGHT' => 'Height (1 - 300)',
'LBL_CONFIGURE_RSSURL' => 'RSS Url',
'LBL_DBLCLICK_HELP' => '',
'ERR_LOADING_FEED' => 'Failed loading RSS Feed',
);
?>

View File

@@ -0,0 +1,45 @@
<?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-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero 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 Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero 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, $current_language;
$dashletMeta['RSSDashlet'] = array('title' => 'LBL_TITLE', // array index in language pack
'description' => 'LBL_DESCRIPTION', // array index in language pack
'category' => 'Web');
?>

View File

@@ -0,0 +1,175 @@
<?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-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero 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 Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero 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/Dashlet.php');
require_once('include/Sugar_Smarty.php');
class RSSDashlet extends Dashlet
{
protected $url = 'http://www.sugarcrm.com/crm/aggregator/rss/1';
protected $height = '200'; // height of the pad
protected $images_dir = 'modules/Home/Dashlets/RSSDashlet/images';
/**
* Constructor
*
* @global string current language
* @param guid $id id for the current dashlet (assigned from Home module)
* @param array $def options saved for this dashlet
*/
public function __construct($id, $def)
{
$this->loadLanguage('RSSDashlet', 'modules/Home/Dashlets/'); // load the language strings here
if(!empty($def['height'])) // set a default height if none is set
$this->height = $def['height'];
if(!empty($def['url']))
$this->url = $def['url'];
if(!empty($def['title']))
$this->title = $def['title'];
else
$this->title = $this->dashletStrings['LBL_TITLE'];
parent::Dashlet($id); // call parent constructor
$this->isConfigurable = true; // dashlet is configurable
$this->hasScript = false; // dashlet has javascript attached to it
}
/**
* Displays the dashlet
*
* @return string html to display dashlet
*/
public function display()
{
$ss = new Sugar_Smarty();
$ss->assign('saving', $this->dashletStrings['LBL_SAVING']);
$ss->assign('saved', $this->dashletStrings['LBL_SAVED']);
$ss->assign('id', $this->id);
$ss->assign('height', $this->height);
$ss->assign('rss_output', $this->getRSSOutput($this->url));
$str = $ss->fetch('modules/Home/Dashlets/RSSDashlet/RSSDashlet.tpl');
return parent::display($this->dashletStrings['LBL_DBLCLICK_HELP']) . $str; // return parent::display for title and such
}
/**
* Displays the configuration form for the dashlet
*
* @return string html to display form
*/
public function displayOptions() {
global $app_strings, $sugar_version, $sugar_config;
$ss = new Sugar_Smarty();
$ss->assign('titleLbl', $this->dashletStrings['LBL_CONFIGURE_TITLE']);
$ss->assign('heightLbl', $this->dashletStrings['LBL_CONFIGURE_HEIGHT']);
$ss->assign('rssUrlLbl', $this->dashletStrings['LBL_CONFIGURE_RSSURL']);
$ss->assign('saveLbl', $app_strings['LBL_SAVE_BUTTON_LABEL']);
$ss->assign('title', $this->title);
$ss->assign('height', $this->height);
$ss->assign('url', $this->url);
$ss->assign('id', $this->id);
return parent::displayOptions() . $ss->fetch('modules/Home/Dashlets/RSSDashlet/RSSDashletOptions.tpl');
}
/**
* called to filter out $_REQUEST object when the user submits the configure dropdown
*
* @param array $req $_REQUEST
* @return array filtered options to save
*/
public function saveOptions(
array $req
)
{
$options = array();
$options['title'] = $req['title'];
$options['url'] = $req['url'];
$options['height'] = $req['height'];
return $options;
}
protected function getRSSOutput(
$url
)
{
// suppress XML errors
libxml_use_internal_errors(true);
$rssdoc = simplexml_load_file($url);
// return back the error message if the loading wasn't successful
if (!$rssdoc)
return $this->dashletStrings['ERR_LOADING_FEED'];
$output = "<table class='edit view'>";
if ( isset($rssdoc->channel) ) {
foreach ( $rssdoc->channel as $channel ) {
if ( isset($channel->item ) ) {
foreach ( $channel->item as $item ) {
$output .= <<<EOHTML
<tr>
<td>
<h3><a href="{$item->link}" target="_child">{$item->title}</a></h3>
{$item->description}
</td>
</tr>
EOHTML;
}
}
}
}
else {
foreach ( $rssdoc->entry as $entry ) {
$output .= <<<EOHTML
<tr>
<td>
<h3><a href="{$entry->link}" target="_child">{$entry->title}</a></h3>
{$entry->summary}
</td>
</tr>
EOHTML;
}
}
$output .= "</table>";
return $output;
}
}

View File

@@ -0,0 +1,44 @@
<?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-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero 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 Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero 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['SugarNewsDashlet'] = array('module' => 'Home',
'title' => translate('LBL_DASHLET_SUGAR_NEWS', 'Home'),
'description' => 'A customizeable portal page',
'icon' => 'themes/default/images/icon_SugarNews_32.gif',
'category' => 'Tools');

View File

@@ -0,0 +1,110 @@
<?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-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero 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 Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero 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/Dashlet.php');
class SugarNewsDashlet extends Dashlet {
var $displayTpl = 'modules/Home/Dashlets/SugarNewsDashlet/display.tpl';
var $configureTpl = 'modules/Home/Dashlets/SugarNewsDashlet/configure.tpl';
var $defaultURL = 'http://apps.sugarcrm.com/dashlet/sugarcrm-news-dashlet.html?lang=@@LANG@@&edition=@@EDITION@@&ver=@@VER@@';
var $url;
function SugarNewsDashlet($id, $options = null) {
parent::Dashlet($id);
$this->isConfigurable = true;
if(empty($options['title'])) {
$this->title = translate('LBL_DASHLET_SUGAR_NEWS', 'Home');
} else {
$this->title = $options['title'];
}
if(empty($options['url'])) {
$this->url = $this->defaultURL;
} else {
$this->url = $options['url'];
}
if(empty($options['height']) || (int)$options['height'] < 1 ) {
$this->height = 315;
} else {
$this->height = (int)$options['height'];
}
}
function displayOptions() {
global $app_strings;
$ss = new Sugar_Smarty();
$ss->assign('titleLBL', translate('LBL_DASHLET_OPT_TITLE', 'Home'));
$ss->assign('urlLBL', translate('LBL_DASHLET_OPT_URL', 'Home'));
$ss->assign('heightLBL', translate('LBL_DASHLET_OPT_HEIGHT', 'Home'));
$ss->assign('title', $this->title);
$ss->assign('url', $this->url);
$ss->assign('id', $this->id);
$ss->assign('height', $this->height);
$ss->assign('saveLBL', $app_strings['LBL_SAVE_BUTTON_LABEL']);
return $ss->fetch('modules/Home/Dashlets/SugarNewsDashlet/configure.tpl');
}
function saveOptions($req) {
$options = array();
if ( isset($req['title']) ) {
$options['title'] = $req['title'];
}
if ( isset($req['url']) ) {
$options['url'] = $req['url'];
}
if ( isset($req['height']) ) {
$options['height'] = (int)$req['height'];
}
return $options;
}
function display(){
$sugar_edition = 'COM';
$out_url = str_replace(
array('@@LANG@@','@@VER@@','@@EDITION@@'),
array($GLOBALS['current_language'],$GLOBALS['sugar_config']['sugar_version'],$sugar_edition),
$this->url);
return parent::display() . "<iframe class='teamNoticeBox' src='".$out_url."' height='".$this->height."px'></iframe>";
}
}

View File

@@ -0,0 +1,44 @@
<?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-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero 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 Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero 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['iFrameDashlet'] = array('module' => 'Home',
'title' => translate('LBL_DASHLET_TITLE', 'Home'),
'description' => 'A customizeable portal page',
'icon' => 'themes/default/images/icon_iFrames_32.gif',
'category' => 'Web');

View File

@@ -0,0 +1,124 @@
<?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-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero 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 Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero 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/Dashlet.php');
class iFrameDashlet extends Dashlet {
var $displayTpl = 'modules/Home/Dashlets/iFrameDashlet/display.tpl';
var $configureTpl = 'modules/Home/Dashlets/iFrameDashlet/configure.tpl';
var $defaultURL = 'http://apps.sugarcrm.com/dashlet/sugarcrm-news-dashlet.html?lang=@@LANG@@&edition=@@EDITION@@&ver=@@VER@@';
var $url;
protected $allowed_schemes = array("http", "https");
function iFrameDashlet($id, $options = null) {
parent::Dashlet($id);
$this->isConfigurable = true;
if(empty($options['title'])) {
$this->title = translate('LBL_DASHLET_TITLE', 'Home');
$this->title = translate('LBL_DASHLET_DISCOVER_SUGAR_PRO', 'Home');
} else {
$this->title = $options['title'];
}
if(empty($options['url'])) {
$this->url = $this->defaultURL;
$this->url = 'http://apps.sugarcrm.com/dashlet/go-pro.html?lang=@@LANG@@&edition=@@EDITION@@&ver=@@VER@@';
} else {
$this->url = $options['url'];
}
$this->checkURL();
if(empty($options['height']) || (int)$options['height'] < 1 ) {
$this->height = 315;
} else {
$this->height = (int)$options['height'];
}
}
protected function checkURL()
{
$scheme = parse_url($this->url, PHP_URL_SCHEME);
if(!in_array($scheme, $this->allowed_schemes)) {
$this->url = 'about:blank';
}
}
function displayOptions() {
global $app_strings;
$ss = new Sugar_Smarty();
$ss->assign('titleLBL', translate('LBL_DASHLET_OPT_TITLE', 'Home'));
$ss->assign('urlLBL', translate('LBL_DASHLET_OPT_URL', 'Home'));
$ss->assign('heightLBL', translate('LBL_DASHLET_OPT_HEIGHT', 'Home'));
$ss->assign('title', $this->title);
$ss->assign('url', $this->url);
$ss->assign('id', $this->id);
$ss->assign('height', $this->height);
$ss->assign('saveLBL', $app_strings['LBL_SAVE_BUTTON_LABEL']);
return $ss->fetch('modules/Home/Dashlets/iFrameDashlet/configure.tpl');
}
function saveOptions($req) {
$options = array();
if ( isset($req['title']) ) {
$options['title'] = $req['title'];
}
if ( isset($req['url']) ) {
$options['url'] = $req['url'];
}
if ( isset($req['height']) ) {
$options['height'] = (int)$req['height'];
}
return $options;
}
function display(){
$sugar_edition = 'COM';
$out_url = str_replace(
array('@@LANG@@','@@VER@@','@@EDITION@@'),
array($GLOBALS['current_language'],$GLOBALS['sugar_config']['sugar_version'],$sugar_edition),
$this->url);
return parent::display() . "<iframe class='teamNoticeBox' src='".$out_url."' height='".$this->height."px'></iframe>";
}
}