';
return parent::display("") . $str . ' '; // 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 $app_strings,$GLOBALS;
$ss = new Sugar_Smarty();
$arr=array("All","Planned","Held","Not Held");
$as='';
global $app_list_strings;
$as.='';
foreach ($app_list_strings['activity_status_dom'] as $k=>$v) {
$as.='';
}
$ss->assign('act_status_options', $as);
$arr=array("All","Calls","Meetings","Tasks");
$at='';
$at.='';
$ss->assign('act_type_options', $at);
$ua='';
$w=mysql_query("select user_name,id from users where deleted='0' order by user_name asc");
while($r=mysql_fetch_array($w))
{
$ua.='';
}
$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']));
}
}
?>