static function generate_widget_code($widgetId, $preview = 0) { $code = ''; $dynamic_content = FALSE; $data = CRM_Wci_BAO_Widget::getWidgetData($widgetId); $template = CRM_Core_Smarty::singleton(); $template->assign('wciform', $data); $template->assign('cpageId', $data['button_link_to']); $template->assign('preview', $preview); if ($data["override"] == '0') { $template->template_dir[] = getWciWidgetTemplatePath(); $wcidata = $template->fetch('WCIWidget.tpl'); } else { $template->security_settings['MODIFIER_FUNCS'] = array('number_format', 'count'); $wcidata = $template->fetch('string:' . html_entity_decode($data['custom_template'])); } $code = json_encode($wcidata); if ($data['progress_bar_id'] != 0) { $dynamic_content = TRUE; } return array('dynamic' => $dynamic_content, 'code' => $code); }
function getWidgets() { $options = array('' => ts('- select -')); $widgList = CRM_Wci_BAO_Widget::getWidgetList(); foreach ($widgList as $widg) { $options[$widg['id']] = $widg['title']; } return $options; }