function display() { $ss = new Sugar_Smarty(); $ss->assign('lbl_campaign_name', translate('LBL_TOP_CAMPAIGNS_NAME', 'Campaigns')); $ss->assign('lbl_revenue', translate('LBL_TOP_CAMPAIGNS_REVENUE', 'Campaigns')); $ss->assign('top_campaigns', $this->top_campaigns); return parent::display() . $ss->fetch('modules/Campaigns/Dashlets/TopCampaignsDashlet/TopCampaignsDashlet.tpl'); }
public function addDashlet(Dashlet $dashlet) { $dashlet->ParentID = $this->ID; // get all dashlets and figure out a posX and posY $all = $this->Widgets(); $maxY = 0; foreach ($all as $d) { if ($d->PosY > $maxY) { $maxY = $d->PosY + 1; } } $dashlet->PosY = $maxY > 1 ? $maxY : 1; $dashlet->write(); }
public function getDashletFields() { $fields = parent::getDashletFields(); $fields->push(MultiSelect2Field::create('Calendars', 'Calendars')->setSource(Calendar::get()->map()->toArray())->setMultiple(true)); $fields->push(CheckboxField::create('OnlyUpcoming')); return $fields; }
public function getDashletFields() { $fields = parent::getDashletFields(); $all = PostTag::get()->map('Title', 'Title')->toArray(); $fields->insertAfter(MultiValueTextField::create('FilterTags', 'Tags to filter by', $all), 'Title'); return $fields; }
public function getDashletFields() { $fields = parent::getDashletFields(); $input = new TextField('Days', 'Past Number of Days'); $input->setAttribute('Placeholder', 'Days'); $fields->push($input); return $fields; }
public function onBeforeWrite() { parent::onBeforeWrite(); $defaults = $this->config()->default_feeds; if (!count($this->RSSFeeds->getValues())) { $this->RSSFeeds = $defaults; } }
/** * @see Dashlet::display() */ public function display() { $ss = new Sugar_Smarty(); $ss->assign('lblTotalOpportunities', translate('LBL_TOTAL_OPPORTUNITIES', 'Opportunities')); $ss->assign('lblClosedWonOpportunities', translate('LBL_CLOSED_WON_OPPORTUNITIES', 'Opportunities')); $ss->assign('total_opportunities', $this->total_opportunities); $ss->assign('total_opportunities_won', $this->total_opportunities_won); return parent::display() . $ss->fetch('modules/Opportunities/Dashlets/MyClosedOpportunitiesDashlet/MyClosedOpportunitiesDashlet.tpl'); }
function displayOptions() { global $app_strings, $mod_strings; $ss = new Sugar_Smarty(); $ss->assign('MOD', $this->dashletStrings); $ss->assign('title', $this->title); $ss->assign('view', $this->view); $ss->assign('id', $this->id); return parent::displayOptions() . $ss->fetch('modules/Calendar/Dashlets/CalendarDashlet/CalendarDashletOptions.tpl'); }
public function getDashletFields() { $fields = parent::getDashletFields(); $input = new TextField('PageName', 'Page'); $input->setAttribute('Placeholder', 'Page Name'); $fields->push($input); $static = new CheckboxField('DisplayLinks', 'Display Selected Links?'); $fields->push($static); return $fields; }
public function getDashletFields() { $fields = parent::getDashletFields(); if (Permission::check('ADMIN')) { $types = ClassInfo::subclassesFor('Page'); $types = array_combine($types, $types); ksort($types); $fields->push(new DropdownField('ListType', _t('RecentDashlet.LIST_TYPE', 'List Items of Type'), $types)); } return $fields; }
public function display() { $data = array(); $ss = new Sugar_Smarty(); $focus = BeanFactory::getBean('TeamNotices'); $today = db_convert("'" . TimeDate::getInstance()->nowDbDate() . "'", 'date'); $query = $focus->create_new_list_query("date_start", $focus->table_name . ".date_start <= {$today} and " . $focus->table_name . ".date_end >= {$today} and " . $focus->table_name . '.status=\'Visible\''); if ($result = $focus->db->query($query)) { while ($row = $focus->db->fetchByAssoc($result)) { $data[] = $row; } } $ss->assign("data", $data); return parent::display() . $ss->fetch('modules/TeamNotices/Dashlets/TeamNoticesDashlet/TeamNoticesDashlet.tpl'); }
function displayOptions() { global $app_strings; $ss = new Sugar_Smarty(); $ss->assign('titleLbl', $this->dashletStrings['LBL_CONFIGURE_TITLE']); $ss->assign('countLbl', $this->dashletStrings['LBL_CONFIGURE_COUNT']); $ss->assign('containerLbl', $this->dashletStrings['LBL_CONFIGURE_CONTAINER']); $ss->assign('saveLbl', $app_strings['LBL_SAVE_BUTTON_LABEL']); $ss->assign('title', $this->title); $container = ReportContainer::get_category_select_options(); asort($container); $ss->assign('containerSelect', get_select_options_with_id($container, $this->container_id)); $ss->assign('count', $this->count); $ss->assign('id', $this->id); return parent::displayOptions() . $ss->fetch('modules/ZuckerReports/Dashlets/ZuckerReportContainerDashlet/ZuckerReportContainerDashletOptions.tpl'); }
/** * Displays the configuration form for the dashlet * * @return string html to display form */ public function displayOptions() { global $app_strings; $ss = new Sugar_Smarty(); $this->dashletStrings['LBL_SAVE'] = $app_strings['LBL_SAVE_BUTTON_LABEL']; $ss->assign('lang', $this->dashletStrings); $ss->assign('id', $this->id); $ss->assign('title', $this->title); $ss->assign('titleLbl', $this->dashletStrings['LBL_CONFIGURE_TITLE']); if ($this->isAutoRefreshable()) { $ss->assign('isRefreshable', true); $ss->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']); $ss->assign('autoRefreshOptions', $this->getAutoRefreshOptions()); $ss->assign('autoRefreshSelect', $this->autoRefresh); } $str = $ss->fetch('modules/SugarFavorites/Dashlets/SugarFavoritesDashlet/SugarFavoritesDashletOptions.tpl'); return Dashlet::displayOptions() . $str; }
function displayOptions() { global $app_strings; $seed = new RunnableReport(); $list = $seed->get_full_list("name", "report_result_type='INLINE'"); $select = array(); if (!empty($list)) { foreach ($list as $bean) { $select[$bean->id] = $bean->get_summary_text(); } } asort($select); $ss = new Sugar_Smarty(); $ss->assign('runnableLbl', $this->dashletStrings['LBL_CONFIGURE_RUNNABLE']); $ss->assign('runnableSelect', get_select_options_with_id($select, $this->runnable_id)); $ss->assign('id', $this->id); return parent::displayOptions() . $ss->fetch('modules/ZuckerReports/Dashlets/ZuckerReportDisplayDashlet/ZuckerReportDisplayDashletOptions.tpl'); }
function AORReportsDashlet($id, $def = array()) { global $current_user, $app_strings; parent::Dashlet($id); $this->isConfigurable = true; $this->def = $def; if (empty($def['dashletTitle'])) { $this->title = translate('LBL_AOR_REPORTS_DASHLET', 'AOR_Reports'); } else { $this->title = $def['dashletTitle']; } $this->params = array(); if (!empty($def['parameter_id'])) { foreach ($def['parameter_id'] as $key => $parameterId) { $this->params[$parameterId] = array('id' => $parameterId, 'operator' => $def['parameter_operator'][$key], 'type' => $def['parameter_type'][$key], 'value' => $def['parameter_value'][$key]); } } if (!empty($def['aor_report_id'])) { $this->report = BeanFactory::getBean('AOR_Reports', $def['aor_report_id']); $this->report->user_parameters = $this->params; } $this->onlyCharts = !empty($def['onlyCharts']); $this->charts = !empty($def['charts']) ? $def['charts'] : array(); }
/** * Displays the dashlet * * @return string html to display dashlet */ function display() { require_once "modules/Reports/Report.php"; // ini_set('display_errors', 'false'); $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->get_total_header_row(); $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 } }
public function processAutoRefresh() { return parent::processAutoRefresh(); }
/** * Displays the Dashlet, must call process() prior to calling this * * @return string HTML that displays Dashlet */ public function display() { return parent::display() . $this->processAutoRefresh(); }
/** * Displays the Dashlet, must call process() prior to calling this * * @return string HTML that displays Dashlet */ function display() { return parent::display() . $this->lvs->display(false) . $this->processAutoRefresh(); }
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>"; }
function display() { $sugar_edition = 'PRO'; $sugar_edition = 'ENT'; $out_url = str_replace(array('@@LANG@@', '@@VER@@', '@@EDITION@@'), array($GLOBALS['current_language'], $GLOBALS['sugar_config']['sugar_version'], $sugar_edition), $this->url); $title = $this->title; if (empty($title)) { $title = 'empty'; } return parent::display() . "<iframe class='teamNoticeBox' title='{$title}' src='{$out_url}' height='{$this->height}px'></iframe>"; }
public function loadDashletInstance($dasInsUid) { try { $dashletInstance = $this->load($dasInsUid); //Load data from the serialized field $dashlet = new Dashlet(); $dashletFields = $dashlet->load($dashletInstance['DAS_UID']); if (is_null($dashletFields)) { $dashletFields = array(); } return array_merge($dashletFields, $dashletInstance); } catch (Exception $error) { throw $error; } }
/** * 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'); }
/** * Handles displaying the chart dashlet configuration popup window * * @return string HTML to return to the browser */ public function displayOptions() { $currentSearchFields = array(); if (is_array($this->_searchFields)) { foreach ($this->_searchFields as $name => $params) { if (!empty($name)) { $name = strtolower($name); $currentSearchFields[$name] = array(); $widgetDef = $params; if (isset($this->getSeedBean()->field_defs[$name])) { $widgetDef = $this->getSeedBean()->field_defs[$name]; } if ($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') { $widgetDef['remove_blank'] = true; } // remove the blank option for the dropdown if (empty($widgetDef['input_name0'])) { $widgetDef['input_name0'] = empty($this->{$name}) ? '' : $this->{$name}; } $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], $this->getSeedBean()->module_dir); if ($currentSearchFields[$name]['label'] == $widgetDef['vname']) { $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], 'Charts'); } $currentSearchFields[$name]['input'] = $this->layoutManager->widgetDisplayInput($widgetDef, true, empty($this->{$name}) ? '' : $this->{$name}); } else { // ability to create spacers in input fields $currentSearchFields['blank' + $count]['label'] = ''; $currentSearchFields['blank' + $count]['input'] = ''; $count++; } } } $this->currentSearchFields = $currentSearchFields; $this->getConfigureSmartyInstance()->assign('title', translate('LBL_TITLE', 'Charts')); $this->getConfigureSmartyInstance()->assign('save', $GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL']); $this->getConfigureSmartyInstance()->assign('id', $this->id); $this->getConfigureSmartyInstance()->assign('searchFields', $this->currentSearchFields); $this->getConfigureSmartyInstance()->assign('dashletTitle', $this->title); $this->getConfigureSmartyInstance()->assign('dashletType', 'predefined_chart'); $this->getConfigureSmartyInstance()->assign('module', $_REQUEST['module']); return parent::displayOptions() . $this->getConfigureSmartyInstance()->fetch($this->_configureTpl); }
public function getAdditionalFields($data) { $this->setResponseType('json'); $result = new stdclass(); $result->status = 'OK'; try { $dashlet = new Dashlet(); $dashletFields = $dashlet->load($data->DAS_UID); if (!is_null($dashletFields)) { $result->additionalFields = PMDashlet::getAdditionalFields($dashletFields['DAS_CLASS']); } else { throw new Exception('Dashlet "' . $data->DAS_UID . '" does not exist.'); } } catch (Exception $error) { $result->status = 'ERROR'; $result->message = $error->getMessage(); } return $result; }
/** * Displays the Dashlet, must call process() prior to calling this * * @return string HTML that displays Dashlet */ function display() { return parent::display() . $this->lvs->display(false); }
public function testCanLoadCustomEnglishLanguageAppStringsWhenCurrentLanguageDoesNotExist() { $GLOBALS['current_language'] = 'FR_fr'; sugar_mkdir("modules/{$this->_moduleName}/Dashlets/TestModuleDashlet/", null, true); sugar_file_put_contents("modules/{$this->_moduleName}/Dashlets/TestModuleDashlet/TestModuleDashlet.en_us.lang.php", '<?php $dashletStrings["TestModuleDashlet"]["foo"] = "bar"; ?>'); create_custom_directory("modules/{$this->_moduleName}/Dashlets/TestModuleDashlet/"); sugar_file_put_contents("custom/modules/{$this->_moduleName}/Dashlets/TestModuleDashlet/TestModuleDashlet.en_us.lang.php", '<?php $dashletStrings["TestModuleDashlet"]["foo"] = "barbarbar"; ?>'); $dashlet = new Dashlet(0); $dashlet->loadLanguage('TestModuleDashlet', "modules/{$this->_moduleName}/Dashlets/"); $this->assertEquals("barbarbar", $dashlet->dashletStrings["foo"]); }
/** * 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'); }
public function testLoadOptionsReturnsEmptyArrayIfNoPreferencesSet() { $dashlet = new Dashlet('unit_test_run'); $this->assertEquals(array(), $dashlet->loadOptions()); }
/** * Displays the dashlet * * @return string html to display dashlet */ function display() { require_once "modules/Reports/Report.php"; $chartReport = BeanFactory::getBean('Reports', $this->report_id, array('encode' => false, 'strict_retrieve' => true)); if (!empty($chartReport)) { $title = getReportNameTranslation($chartReport->name); $this->title = $title; $reporter = new Report($chartReport->content); $reporter->is_saved_report = true; $reporter->saved_report_id = $chartReport->id; $reporter->get_total_header_row(); $reporter->run_chart_queries(); ob_start(); require_once "include/SugarCharts/ChartDisplay.php"; $chartDisplay = new ChartDisplay(); $chartDisplay->setReporter($reporter); echo $chartDisplay->legacyDisplay($this->id, true); $str = ob_get_contents(); ob_end_clean(); $xmlFile = $chartDisplay->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 } }