本文整理汇总了PHP中SugarView::renderJavascript方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarView::renderJavascript方法的具体用法?PHP SugarView::renderJavascript怎么用?PHP SugarView::renderJavascript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarView
的用法示例。
在下文中一共展示了SugarView::renderJavascript方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
function save($check_notify = false)
{
$isUpdate = !empty($this->id) && !$this->new_with_id;
// this will cause the logged in admin to have the licensed user count refreshed
if (isset($_SESSION)) {
unset($_SESSION['license_seats_needed']);
}
$query = "SELECT count(id) as total from users WHERE " . self::getLicensedUsersWhere();
global $sugar_flavor;
$admin = Administration::getSettings();
if (isset($sugar_flavor) && $sugar_flavor != null && ($sugar_flavor == 'CE' || isset($admin->settings['license_enforce_user_limit']) && $admin->settings['license_enforce_user_limit'] == 1)) {
// Begin Express License Enforcement Check
// this will cause the logged in admin to have the licensed user count refreshed
if (isset($_SESSION['license_seats_needed'])) {
unset($_SESSION['license_seats_needed']);
}
if ($this->portal_only != 1 && $this->is_group != 1 && (empty($this->fetched_row) || $this->fetched_row['status'] == 'Inactive' || $this->fetched_row['status'] == '') && $this->status == 'Active') {
global $sugar_flavor;
//if((isset($sugar_flavor) && $sugar_flavor != null) && ($sugar_flavor=='CE')){
$license_users = $admin->settings['license_users'];
if ($license_users != '') {
global $db;
//$query = "SELECT count(id) as total from users WHERE status='Active' AND deleted=0 AND is_group=0 AND portal_only=0";
$result = $db->query($query, true, "Error filling in user array: ");
$row = $db->fetchByAssoc($result);
$license_seats_needed = $row['total'] - $license_users;
} else {
$license_seats_needed = -1;
}
if ($license_seats_needed >= 0) {
// displayAdminError( translate('WARN_LICENSE_SEATS_MAXED', 'Administration'). ($license_seats_needed + 1) . translate('WARN_LICENSE_SEATS2', 'Administration') );
if (isset($_REQUEST['action']) && $_REQUEST['action'] != 'MassUpdate' && $_REQUEST['action'] != 'Save') {
die(translate('WARN_LICENSE_SEATS_EDIT_USER', 'Administration') . ' ' . translate('WARN_LICENSE_SEATS2', 'Administration'));
} else {
if (isset($_REQUEST['action'])) {
// When this is not set, we're coming from the installer.
$sv = new SugarView();
$sv->init('Users');
$sv->renderJavascript();
$sv->displayHeader();
$sv->errors[] = translate('WARN_LICENSE_SEATS_EDIT_USER', 'Administration') . ' ' . translate('WARN_LICENSE_SEATS2', 'Administration');
$sv->displayErrors();
$sv->displayFooter();
die;
}
}
}
//}
}
}
// End Express License Enforcement Check
// wp: do not save user_preferences in this table, see user_preferences module
$this->user_preferences = '';
// if this is an admin user, do not allow is_group or portal_only flag to be set.
if ($this->is_admin) {
$this->is_group = 0;
$this->portal_only = 0;
}
// set some default preferences when creating a new user
$setNewUserPreferences = empty($this->id) || !empty($this->new_with_id);
// If the 'Primary' team changed then the team widget has set 'team_id' to a new value and we should
// assign the same value to default_team because User module uses it for setting the 'Primary' team
if (!empty($this->team_id)) {
$this->default_team = $this->team_id;
}
// track the current reports to id to be able to use it if it has changed
$old_reports_to_id = isset($this->fetched_row['reports_to_id']) ? $this->fetched_row['reports_to_id'] : '';
parent::save($check_notify);
$GLOBALS['sugar_config']['disable_team_access_check'] = true;
if ($this->status != 'Reserved' && !$this->portal_only) {
// If this is not an update, then make sure the new user logic is executed.
if (!$isUpdate) {
// If this is a new user, make sure to add them to the appriate default teams
if (!$this->team_exists) {
$team = BeanFactory::getBean('Teams');
$team->new_user_created($this);
}
} else {
if (empty($GLOBALS['sugar_config']['noPrivateTeamUpdate'])) {
//if this is an update, then we need to ensure we keep the user's
//private team name and name_2 in sync with their name.
$team_id = $this->getPrivateTeamID();
if (!empty($team_id)) {
$team = BeanFactory::getBean('Teams', $team_id);
Team::set_team_name_from_user($team, $this);
$team->save();
}
}
}
}
// If reports to has changed, call update team memberships to correct the membership tree
if ($old_reports_to_id != $this->reports_to_id) {
$this->update_team_memberships($old_reports_to_id);
}
// set some default preferences when creating a new user
if ($setNewUserPreferences) {
$this->setPreference('reminder_time', 1800);
if (!$this->getPreference('calendar_publish_key')) {
$this->setPreference('calendar_publish_key', create_guid());
}
//.........这里部分代码省略.........
示例2: testrenderJavascript
public function testrenderJavascript()
{
$SugarView = new SugarView();
//execute the method and check if it works and doesn't throws an exception
//secondly check if it outputs any content to browser
try {
ob_start();
$SugarView->renderJavascript();
$renderedContent = ob_get_contents();
ob_end_clean();
$this->assertGreaterThan(0, strlen($renderedContent));
} catch (Exception $e) {
$this->fail();
}
}