本文整理汇总了PHP中ViewDetail::preDisplay方法的典型用法代码示例。如果您正苦于以下问题:PHP ViewDetail::preDisplay方法的具体用法?PHP ViewDetail::preDisplay怎么用?PHP ViewDetail::preDisplay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewDetail
的用法示例。
在下文中一共展示了ViewDetail::preDisplay方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preDisplay
function preDisplay()
{
global $current_user, $app_strings, $sugar_config;
if (!isset($this->bean->id)) {
// No reason to set everything up just to have it fail in the display() call
return;
}
parent::preDisplay();
$viewHelper = new UserViewHelper($this->ss, $this->bean, 'DetailView');
$viewHelper->setupAdditionalFields();
$errors = "";
$msgGood = false;
if (isset($_REQUEST['pwd_set']) && $_REQUEST['pwd_set'] != 0) {
if ($_REQUEST['pwd_set'] == '4') {
require_once 'modules/Users/password_utils.php';
$errors .= canSendPassword();
} else {
$errors .= translate('LBL_NEW_USER_PASSWORD_' . $_REQUEST['pwd_set'], 'Users');
$msgGood = true;
}
} else {
//IF BEAN USER IS LOCKOUT
if ($this->bean->getPreference('lockout') == '1') {
$errors .= translate('ERR_USER_IS_LOCKED_OUT', 'Users');
}
}
$this->ss->assign("ERRORS", $errors);
$this->ss->assign("ERROR_MESSAGE", $msgGood ? translate('LBL_PASSWORD_SENT', 'Users') : translate('LBL_CANNOT_SEND_PASSWORD', 'Users'));
$buttons = "";
if ((is_admin($current_user) || $_REQUEST['record'] == $current_user->id) && !empty($sugar_config['default_user_name']) && $sugar_config['default_user_name'] == $this->bean->user_name && isset($sugar_config['lock_default_user_name']) && $sugar_config['lock_default_user_name']) {
$buttons .= "<input id='edit_button' title='" . $app_strings['LBL_EDIT_BUTTON_TITLE'] . "' accessKey='" . $app_strings['LBL_EDIT_BUTTON_KEY'] . "' class='button primary' onclick=\"this.form.return_module.value='Users'; this.form.return_action.value='DetailView'; this.form.return_id.value='" . $this->bean->id . "'; this.form.action.value='EditView'\" type='submit' name='Edit' value='" . $app_strings['LBL_EDIT_BUTTON_LABEL'] . "'> ";
} elseif (is_admin($current_user) || $GLOBALS['current_user']->isAdminForModule('Users') && !$this->bean->is_admin || $_REQUEST['record'] == $current_user->id) {
$buttons .= "<input id='edit_button' title='" . $app_strings['LBL_EDIT_BUTTON_TITLE'] . "' accessKey='" . $app_strings['LBL_EDIT_BUTTON_KEY'] . "' class='button primary' onclick=\"this.form.return_module.value='Users'; this.form.return_action.value='DetailView'; this.form.return_id.value='" . $this->bean->id . "'; this.form.action.value='EditView'\" type='submit' name='Edit' value='" . $app_strings['LBL_EDIT_BUTTON_LABEL'] . "'> ";
if (is_admin($current_user) || $GLOBALS['current_user']->isAdminForModule('Users')) {
if (!$current_user->is_group) {
$buttons .= "<input title='" . $app_strings['LBL_DUPLICATE_BUTTON_TITLE'] . "' accessKey='" . $app_strings['LBL_DUPLICATE_BUTTON_KEY'] . "' class='button' onclick=\"this.form.return_module.value='Users'; this.form.return_action.value='DetailView'; this.form.isDuplicate.value=true; this.form.action.value='EditView'\" type='submit' name='Duplicate' value='" . $app_strings['LBL_DUPLICATE_BUTTON_LABEL'] . "'> ";
if ($this->bean->id != $current_user->id) {
$buttons .= "<input type='button' class='button' onclick='confirmDelete();' value='" . $app_strings['LBL_DELETE_BUTTON_LABEL'] . "' /> ";
}
if (!$this->bean->portal_only && !$this->bean->is_group && !$this->bean->external_auth_only && isset($sugar_config['passwordsetting']['SystemGeneratedPasswordON']) && $sugar_config['passwordsetting']['SystemGeneratedPasswordON']) {
$buttons .= "<input title='" . translate('LBL_GENERATE_PASSWORD_BUTTON_TITLE', 'Users') . "' accessKey='" . translate('LBL_GENERATE_PASSWORD_BUTTON_KEY', 'Users') . "' class='button' LANGUAGE=javascript onclick='generatepwd(\"" . $this->bean->id . "\");' type='button' name='password' value='" . translate('LBL_GENERATE_PASSWORD_BUTTON_LABEL', 'Users') . "'> ";
}
}
}
}
$this->ss->assign('EDITBUTTONS', $buttons);
$show_roles = !($this->bean->is_group == '1' || $this->bean->portal_only == '1');
$this->ss->assign('SHOW_ROLES', $show_roles);
//Mark whether or not the user is a group or portal user
$this->ss->assign('IS_GROUP_OR_PORTAL', $this->bean->is_group == '1' || $this->bean->portal_only == '1' ? true : false);
if ($show_roles) {
ob_start();
echo "<div>";
require_once 'modules/ACLRoles/DetailUserRole.php';
echo "</div></div>";
$role_html = ob_get_contents();
ob_end_clean();
$this->ss->assign('ROLE_HTML', $role_html);
}
}
示例2: preDisplay
function preDisplay()
{
global $mod_strings;
if (isset($this->bean->campaign_type) && strtolower($this->bean->campaign_type) == 'newsletter') {
$mod_strings['LBL_MODULE_NAME'] = $mod_strings['LBL_NEWSLETTERS'];
}
parent::preDisplay();
}
示例3: preDisplay
public function preDisplay()
{
parent::preDisplay();
if (ACLController::checkAccess('KBDocuments', 'edit', true)) {
array_push($this->dv->defs['templateMeta']['form']['buttons'], array('customCode' => '<input title="{$MOD.LBL_CREATE_KB_DOCUMENT}" accessKey="M" class="button" onclick="this.form.return_module.value=\'Cases\'; this.form.return_action.value=\'DetailView\';this.form.action.value=\'EditView\';this.form.module.value=\'KBDocuments\';" type="submit" name="button" value="{$MOD.LBL_CREATE_KB_DOCUMENT}">', 'sugar_html' => array('type' => 'submit', 'value' => '{$MOD.LBL_CREATE_KB_DOCUMENT}', 'htmlOptions' => array('title' => '{$MOD.LBL_CREATE_KB_DOCUMENT}', 'accessKey' => 'M', 'class' => 'button', 'onclick' => 'this.form.return_module.value=\'Cases\'; this.form.return_action.value=\'DetailView\';this.form.action.value=\'EditView\';this.form.module.value=\'KBDocuments\';', 'name' => 'button'))));
}
$this->dv->th->deleteTemplate($this->dv->module, $this->dv->view);
}
示例4: preDisplay
public function preDisplay()
{
//$this->bean contains all the information on the Case
//use that information to grab the related account bean, something like:
// $a = new daik_jiekuangren_info();
// $a->retrieve($this->bean->daik_jiekuangren_info_id_c); //check but I believe that's the account id relate field in the case
// $jiekuangren_bianhao_value = $a->danang_bianhao;
// $this->bean->jiekuangren_bianhao_c = $jiekuangren_bianhao_value;
// similarly for the second field
parent::preDisplay();
}
示例5: testdisplay
public function testdisplay()
{
error_reporting(E_ERROR | E_PARSE);
//execute the method with essential parameters set. it should return some html.
$view = new ViewDetail();
$view->module = 'Users';
$view->bean = new User();
$view->bean->id = 1;
$view->ss = new Sugar_Smarty();
$view->preDisplay();
ob_start();
$view->display();
$renderedContent = ob_get_contents();
ob_end_clean();
$this->assertGreaterThan(0, strlen($renderedContent));
}
示例6: preDisplay
public function preDisplay()
{
global $app_list_strings;
parent::preDisplay();
$this->ss->assign('report_module', $this->bean->report_module);
$this->bean->user_parameters = requestToUserParameters();
$reportHTML = $this->bean->build_group_report(0, true) . '<br />';
$reportHTML .= $this->bean->build_report_chart(null, AOR_Report::CHART_TYPE_CHARTJS);
$this->ss->assign('report_content', $reportHTML);
echo "<input type='hidden' name='report_module' id='report_module' value='{$this->bean->report_module}'>";
if (!is_file('cache/jsLanguage/AOR_Conditions/' . $GLOBALS['current_language'] . '.js')) {
require_once 'include/language/jsLanguage.php';
jsLanguage::createModuleStringsCache('AOR_Conditions', $GLOBALS['current_language']);
}
echo '<script src="cache/jsLanguage/AOR_Conditions/' . $GLOBALS['current_language'] . '.js"></script>';
$params = $this->getReportParameters();
echo "<script>var reportParameters = " . json_encode($params) . ";</script>";
}
示例7: preDisplay
function preDisplay()
{
parent::preDisplay();
}
示例8: preDisplay
public function preDisplay()
{
global $app_list_strings;
parent::preDisplay();
$this->ss->assign('report_module', $this->bean->report_module);
$this->bean->user_parameters = requestToUserParameters();
//$reportHTML = $this->bean->build_group_report(0,true);
$reportHTML = $this->bean->buildMultiGroupReport(0, true);
$chartsHTML = $this->bean->build_report_chart(null, AOR_Report::CHART_TYPE_RGRAPH);
$chartsPerRow = $this->bean->graphs_per_row;
$this->ss->assign('charts_content', $chartsHTML);
$this->ss->assign('report_content', $reportHTML);
echo "<input type='hidden' name='report_module' id='report_module' value='{$this->bean->report_module}'>";
if (!is_file('cache/jsLanguage/AOR_Conditions/' . $GLOBALS['current_language'] . '.js')) {
require_once 'include/language/jsLanguage.php';
jsLanguage::createModuleStringsCache('AOR_Conditions', $GLOBALS['current_language']);
}
echo '<script src="cache/jsLanguage/AOR_Conditions/' . $GLOBALS['current_language'] . '.js"></script>';
$params = $this->getReportParameters();
echo "<script>var reportParameters = " . json_encode($params) . ";</script>";
$resizeGraphsPerRow = <<<EOD
<script>
function resizeGraphsPerRow()
{
var maxWidth = 900;
var maxHeight = 500;
var maxTextSize = 10;
var divWidth = \$("#detailpanel_report").width();
var graphWidth = Math.floor(divWidth / {$chartsPerRow});
var graphs = document.getElementsByClassName('resizableCanvas');
for(var i = 0; i < graphs.length; i++)
{
if(graphWidth * 0.9 > maxWidth)
graphs[i].width = maxWidth;
else
graphs[i].width = graphWidth * 0.9;
if(graphWidth * 0.9 > maxHeight)
graphs[i].height = maxHeight;
else
graphs[i].height = graphWidth * 0.9;
/*
var text_size = Math.min(12, (graphWidth / 1000) * 12 );
if(text_size < 6)text_size=6;
if(text_size > maxTextSize) text_size = maxTextSize;
if( graphs[i] !== undefined
&& graphs[i].__object__ !== undefined
&& graphs[i].__object__["properties"] !== undefined
&& graphs[i].__object__["properties"]["chart.text.size"] !== undefined
&& graphs[i].__object__["properties"]["chart.key.text.size"] !== undefined)
{
graphs[i].__object__["properties"]["chart.text.size"] = text_size;
graphs[i].__object__["properties"]["chart.key.text.size"] = text_size;
}
//http://www.rgraph.net/docs/issues.html
//As per Google Chrome not initially drawing charts
RGraph.redrawCanvas(graphs[i]);
*/
}
if (typeof RGraph !== 'undefined') {
RGraph.redraw();
}
}
</script>
EOD;
echo $resizeGraphsPerRow;
echo "<script> \$(document).ready(function(){resizeGraphsPerRow();}); </script>";
echo "<script> \$(window).resize(function(){resizeGraphsPerRow();}); </script>";
}
示例9: preDisplay
function preDisplay()
{
parent::preDisplay();
$this->options['show_subpanels'] = false;
//eggsurplus: will display subpanels twice otherwise
}