本文整理汇总了PHP中ACLController::moduleSupportsACL方法的典型用法代码示例。如果您正苦于以下问题:PHP ACLController::moduleSupportsACL方法的具体用法?PHP ACLController::moduleSupportsACL怎么用?PHP ACLController::moduleSupportsACL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACLController
的用法示例。
在下文中一共展示了ACLController::moduleSupportsACL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($defines)
{
global $app_strings;
global $currentModule;
$title = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_TITLE'];
$accesskey = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_KEY'];
$value = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_LABEL'];
$this->module = 'Emails';
$to_addrs = '';
$additionalFormFields = array();
$additionalFormFields['type'] = 'out';
// cn: bug 5727 - must override the parents' parent for contacts (which could be an Account)
$additionalFormFields['parent_type'] = $defines['focus']->module_dir;
$additionalFormFields['parent_id'] = $defines['focus']->id;
$additionalFormFields['parent_name'] = $defines['focus']->name;
if (isset($defines['focus']->email1)) {
$to_addrs = $defines['focus']->email1;
} elseif ($defines['focus']->object_name == 'Case') {
require_once 'modules/Accounts/Account.php';
$acct = new Account();
$acct->retrieve($defines['focus']->account_id);
$to_addrs = $acct->email1;
}
if (!empty($to_addrs)) {
$additionalFormFields['to_email_addrs'] = $to_addrs;
}
if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)) {
$button = "<input title='{$title}' class='button' type='button' name='button' value=' {$value} '/>\n";
return $button;
}
$button = $this->_get_form($defines, $additionalFormFields);
$button .= "<input title='{$title}' accesskey='{$accesskey}' class='button' type='submit' name='button' value=' {$value} '/>\n";
$button .= "</form>";
return $button;
}
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:35,代码来源:SugarWidgetSubPanelTopComposeEmailButton.php
示例2: display
function display($defines)
{
if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)) {
$temp = '';
return $temp;
}
global $app_strings;
global $mod_strings;
global $currentModule;
$title = $app_strings['LBL_TRACK_EMAIL_BUTTON_TITLE'];
$accesskey = $app_strings['LBL_TRACK_EMAIL_BUTTON_KEY'];
$value = $app_strings['LBL_TRACK_EMAIL_BUTTON_LABEL'];
$this->module = 'Emails';
$additionalFormFields = array();
$additionalFormFields['type'] = 'archived';
// cn: bug 5727 - must override the parents' parent for contacts (which could be an Account)
$additionalFormFields['parent_type'] = $defines['focus']->module_dir;
$additionalFormFields['parent_id'] = $defines['focus']->id;
$additionalFormFields['parent_name'] = $defines['focus']->name;
if (isset($defines['focus']->email1)) {
$additionalFormFields['to_email_addrs'] = $defines['focus']->email1;
}
if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)) {
$button = "<input title='{$title}' class='button' type='button' name='button' value=' {$value} ' disabled/>\n";
return $button;
}
$button = $this->_get_form($defines, $additionalFormFields);
$button .= "<input title='{$title}' accesskey='{$accesskey}' class='button' type='submit' name='button' value=' {$value} '/>\n";
$button .= "</form>";
return $button;
}
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:SugarWidgetSubPanelTopArchiveEmailButton.php
示例3: template_pagination
function template_pagination(&$args)
{
$smarty = new Sugar_Smarty();
$reporter = $args['reporter'];
global $mod_strings;
// disable export if configured to
global $current_user, $sugar_config, $app_strings;
$smarty->assign('mod_strings', $mod_strings);
$smarty->assign('app_strings', $app_strings);
$is_owner = true;
if (isset($args['reporter']->saved_report) && $args['reporter']->saved_report->assigned_user_id != $current_user->id) {
$is_owner = false;
}
// if
$isExportAccess = false;
if (!ACLController::checkAccess('Reports', 'export', $is_owner) || $sugar_config['disable_export'] || !empty($sugar_config['admin_export_only']) && !(is_admin($current_user) || ACLController::moduleSupportsACL($reporter->module) && ACLAction::getUserAccessLevel($current_user->id, $reporter->module, 'access') == ACL_ALLOW_ENABLED && ACLAction::getUserAccessLevel($current_user->id, $reporter->module, 'admin') == ACL_ALLOW_ADMIN)) {
// no op
} else {
$smarty->assign('exportImagePath', SugarThemeRegistry::current()->getImage('export', " border='0' align='absmiddle'", null, null, '.gif', translate('LBL_EXPORT')));
$isExportAccess = true;
}
// else
$smarty->assign('isExportAccess', $isExportAccess);
$smarty->assign('start_link_ImagePath', SugarThemeRegistry::current()->getImage("start_off", " border='0' align='absmiddle'", null, null, '.gif', $app_strings['LNK_LIST_START']));
$smarty->assign('prev_link_ImagePath', SugarThemeRegistry::current()->getImage("previous_off", "border='0' align='absmiddle'", null, null, '.gif', $app_strings['LNK_LIST_PREVIOUS']));
$smarty->assign('end_link_ImagePath', SugarThemeRegistry::current()->getImage("end_off", "border='0' align='absmiddle'", null, null, '.gif', $app_strings['LNK_LIST_END']));
$smarty->assign('next_link_ImagePath', SugarThemeRegistry::current()->getImage("next_off", "border='0' align='absmiddle'", null, null, '.gif', $app_strings['LNK_LIST_NEXT']));
$smarty->assign('start_link_disabled', true);
$smarty->assign('prev_link_disabled', true);
$smarty->assign('end_link_disabled', true);
$smarty->assign('next_link_disabled', true);
$next = $reporter->row_end + $reporter->report_offset;
if ($reporter->report_offset > 0) {
$prev = $reporter->report_offset - $reporter->report_max;
$smarty->assign('start_link_ImagePath', SugarThemeRegistry::current()->getImage("start", " border='0' align='absmiddle'", null, null, '.gif', $app_strings['LNK_LIST_START']));
$smarty->assign('start_link_onclick', "onClick=javascript:set_offset(0);");
$smarty->assign('start_link_disabled', false);
$smarty->assign('prev_link_ImagePath', SugarThemeRegistry::current()->getImage("previous", "border='0' align='absmiddle'", null, null, '.gif', $app_strings['LNK_LIST_PREVIOUS']));
$smarty->assign('prev_link_onclick', "onClick=javascript:set_offset({$prev});");
$smarty->assign('prev_link_disabled', false);
}
// if
if ($next < $reporter->total_count) {
$end = ceil($reporter->total_count / $reporter->report_max - 1) * $reporter->report_max;
$smarty->assign('end_link_ImagePath', SugarThemeRegistry::current()->getImage("end", " border='0' align='absmiddle'", null, null, '.gif', $app_strings['LNK_LIST_END']));
$smarty->assign('end_link_disabled', false);
$smarty->assign('end_link_onclick', "onClick=javascript:set_offset({$end});");
$smarty->assign('next_link_ImagePath', SugarThemeRegistry::current()->getImage("next", " border='0' align='absmiddle'", null, null, '.gif', $app_strings['LNK_LIST_NEXT']));
$smarty->assign('next_link_disabled', false);
$smarty->assign('next_link_onclick', "onClick=javascript:set_offset({$next});");
}
// if
$start_range = $reporter->report_offset > 0 ? $reporter->row_start + $reporter->report_offset : ($reporter->total_count == 0 ? 0 : 1);
$end_range = $reporter->row_end + $reporter->report_offset;
$smarty->assign('start_range', $start_range);
$smarty->assign('end_range', $end_range);
$smarty->assign('total_count', $reporter->total_count);
return $smarty->fetch("modules/Reports/templates/_template_pagination.tpl");
}
示例4: checkDashletDisplay
function checkDashletDisplay()
{
if (!in_array($this->type, $GLOBALS['moduleList']) && !in_array($this->type, $GLOBALS['modInvisList']) && (!in_array('Activities', $GLOBALS['moduleList']) || !in_array($this->type, $GLOBALS['modInvisListActivities']))) {
$displayDashlet = false;
} elseif (ACLController::moduleSupportsACL($this->type) && !ACLController::checkAccess($this->type, 'list', true)) {
$displayDashlet = false;
} else {
$displayDashlet = true;
}
return $displayDashlet;
}
示例5: listviewACLHelper
/**
* Extends SugarBean::listviewACLHelper
*
* @return array
*/
public function listviewACLHelper()
{
$array_assign = parent::listviewACLHelper();
$is_owner = false;
if (!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner)) {
$array_assign['ACCOUNT'] = 'a';
} else {
$array_assign['ACCOUNT'] = 'span';
}
return $array_assign;
}
示例6: getJavascript
function getJavascript()
{
global $action;
if (!ACLController::moduleSupportsACL($this->module)) {
return '';
}
$script = "<SCRIPT>\n//BEGIN ACL JAVASCRIPT\n";
if ($action == 'DetailView') {
if (!ACLController::checkAccess($this->module, 'edit', $this->is_owner)) {
$script .= <<<EOQ
\t\t\t\t\t\tif(typeof(document.DetailView) != 'undefined'){
\t\t\t\t\t\t\tif(typeof(document.DetailView.elements['Edit']) != 'undefined'){
\t\t\t\t\t\t\t\tdocument.DetailView.elements['Edit'].disabled = 'disabled';
\t\t\t\t\t\t\t}
\t\t\t\t\t\t\tif(typeof(document.DetailView.elements['Duplicate']) != 'undefined'){
\t\t\t\t\t\t\t\tdocument.DetailView.elements['Duplicate'].disabled = 'disabled';
\t\t\t\t\t\t\t}
\t\t\t\t\t\t}
EOQ;
}
if (!ACLController::checkAccess($this->module, 'delete', $this->is_owner)) {
$script .= <<<EOQ
\t\t\t\t\t\tif(typeof(document.DetailView) != 'undefined'){
\t\t\t\t\t\t\tif(typeof(document.DetailView.elements['Delete']) != 'undefined'){
\t\t\t\t\t\t\t\tdocument.DetailView.elements['Delete'].disabled = 'disabled';
\t\t\t\t\t\t\t}
\t\t\t\t\t\t}
EOQ;
}
}
if (file_exists('modules/' . $this->module . '/metadata/acldefs.php')) {
include 'modules/' . $this->module . '/metadata/acldefs.php';
foreach ($acldefs[$this->module]['forms'] as $form_name => $form) {
foreach ($form as $field_name => $field) {
if ($field['app_action'] == $action) {
switch ($form_name) {
case 'by_id':
$script .= $this->getFieldByIdScript($field_name, $field);
break;
case 'by_name':
$script .= $this->getFieldByNameScript($field_name, $field);
break;
default:
$script .= $this->getFieldByFormScript($form_name, $field_name, $field);
break;
}
}
}
}
}
$script .= '</SCRIPT>';
return $script;
}
示例7: displayList
function displayList(&$layout_def)
{
$module = '';
$record = '';
if (isset($layout_def['varname'])) {
$key = strtoupper($layout_def['varname']);
} else {
$key = $this->_get_column_alias($layout_def);
$key = strtoupper($key);
}
if (empty($layout_def['fields'][$key])) {
return "";
} else {
$value = $layout_def['fields'][$key];
}
if (empty($layout_def['target_record_key'])) {
$record = $layout_def['fields']['ID'];
} else {
$record_key = strtoupper($layout_def['target_record_key']);
$record = $layout_def['fields'][$record_key];
}
if (!empty($layout_def['target_module_key'])) {
if (!empty($layout_def['fields'][strtoupper($layout_def['target_module_key'])])) {
$module = $layout_def['fields'][strtoupper($layout_def['target_module_key'])];
}
}
if (empty($module)) {
if (empty($layout_def['target_module'])) {
$module = $layout_def['module'];
} else {
$module = $layout_def['target_module'];
}
}
$action = 'DetailView';
$value = $layout_def['fields'][$key];
global $current_user;
if (isset($layout_def['custom']) && $layout_def['custom'] == true && $key == "BEAN_NAME") {
$productlog = new ProductLog();
$productlog->retrieve($layout_def['fields']['ID']);
$module = $productlog->bean_name;
if ($productlog->bean_name == 'Quote') {
$module = 'Quotes';
}
$record = $layout_def['fields']['BEAN_ID'];
return '<a href="index.php?module=' . $module . '&action=' . $action . '&record=' . $record . '" class="listViewTdLinkS1">' . "{$value}</a>";
} elseif ($layout_def['DetailView'] && !$layout_def['owner_module'] || $layout_def['DetailView'] && !ACLController::moduleSupportsACL($layout_def['owner_module']) || ACLController::checkAccess($layout_def['owner_module'], 'view', $layout_def['owner_id'] == $current_user->id)) {
return '<a href="index.php?module=' . $module . '&action=' . $action . '&record=' . $record . '" class="listViewTdLinkS1">' . "{$value}</a>";
} else {
return $value;
}
}
示例8: checkDashletDisplay
function checkDashletDisplay()
{
if (!in_array($this->type, $GLOBALS['moduleList']) && !in_array($this->type, $GLOBALS['modInvisList']) && !in_array('Activities', $GLOBALS['moduleList'])) {
$displayDashlet = false;
} elseif (ACLController::moduleSupportsACL($this->type)) {
$bean = SugarModule::get($this->type)->loadBean();
if (!ACLController::checkAccess($this->type, 'list', true, $bean->acltype)) {
$displayDashlet = false;
}
$displayDashlet = true;
} else {
$displayDashlet = true;
}
return $displayDashlet;
}
示例9: displayList
function displayList(&$layout_def)
{
$module = 'Supplies';
$record = '';
if (isset($layout_def['varname'])) {
$key = strtoupper($layout_def['varname']);
} else {
$key = $this->_get_column_alias($layout_def);
$key = strtoupper($key);
}
if (empty($layout_def['fields'][$key])) {
return "";
} else {
$value = $layout_def['fields'][$key];
}
if (empty($layout_def['target_record_key'])) {
$record = $layout_def['fields']['SUPPLYID'];
} else {
$record_key = strtoupper($layout_def['target_record_key']);
$record = $layout_def['fields'][$record_key];
}
/*if(!empty($layout_def['target_module_key'])) {
if (!empty($layout_def['fields'][strtoupper($layout_def['target_module_key'])])) {
$module=$layout_def['fields'][strtoupper($layout_def['target_module_key'])];
}
}
*/
/*if (empty($module)) {
if(empty($layout_def['target_module']))
{
$module = $layout_def['module'];
}
else
{
$module = $layout_def['target_module'];
}
}*/
$action = 'DetailView';
$value = $layout_def['fields'][$key];
global $current_user;
if ($layout_def['DetailView'] && !$layout_def['owner_module'] || $layout_def['DetailView'] && !ACLController::moduleSupportsACL($layout_def['owner_module']) || ACLController::checkAccess($layout_def['owner_module'], 'view', $layout_def['owner_id'] == $current_user->id)) {
return '<a href="index.php?module=' . $module . '&action=' . $action . '&record=' . $record . '" class="listViewTdLinkS1">' . "{$value}</a>";
} else {
return $value;
}
}
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:46,代码来源:SugarWidgetSubPanelDetailViewSuppliesLink.php
示例10: display
function display($defines)
{
if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true) || $defines['module'] == "Activities" & !ACLController::checkAccess("Emails", 'edit', true)) {
$temp = '';
return $temp;
}
/**
* if module is hidden or subpanel for the module is hidden - doesn't show quick create button
*/
if (SugarWidget::isModuleHidden('Emails')) {
return '';
}
global $app_strings, $current_user, $sugar_config, $beanList, $beanFiles;
$title = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_TITLE'];
//$accesskey = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_KEY'];
$value = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_LABEL'];
$parent_type = $defines['focus']->module_dir;
$parent_id = $defines['focus']->id;
//martin Bug 19660
$userPref = $current_user->getPreference('email_link_type');
$defaultPref = $sugar_config['email_default_client'];
if ($userPref != '') {
$client = $userPref;
} else {
$client = $defaultPref;
}
if ($client != 'sugar') {
$bean = $defines['focus'];
// awu: Not all beans have emailAddress property, we must account for this
if (isset($bean->emailAddress)) {
$to_addrs = $bean->emailAddress->getPrimaryAddress($bean);
$button = "<input class='button' type='button' value='{$value}' id='" . $this->getWidgetId() . "' name='" . preg_replace('[ ]', '', $value) . "' title='{$title}' onclick=\"location.href='mailto:{$to_addrs}';return false;\" />";
} else {
$button = "<input class='button' type='button' value='{$value}' id='" . $this->getWidgetId() . "' name='" . preg_replace('[ ]', '', $value) . "' title='{$title}' onclick=\"location.href='mailto:';return false;\" />";
}
} else {
//Generate the compose package for the quick create options.
$composeData = array("parent_id" => $parent_id, "parent_type" => $parent_type);
require_once 'modules/Emails/EmailUI.php';
$eUi = new EmailUI();
$j_quickComposeOptions = $eUi->generateComposePackageForQuickCreate($composeData, http_build_query($composeData), false, $defines['focus']);
$button = "<input title='{$title}' id='" . $this->getWidgetId() . "' onclick='SUGAR.quickCompose.init({$j_quickComposeOptions});' class='button' type='submit' name='" . preg_replace('[ ]', '', $value) . "_button' value='{$value}' />";
}
return $button;
}
示例11: display
function display($widget_data)
{
global $app_strings;
global $currentModule;
$popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array());
$json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data);
$title = $app_strings['LBL_ACCUMULATED_HISTORY_BUTTON_TITLE'];
//$accesskey = $app_strings['LBL_ACCUMULATED_HISTORY_BUTTON_KEY'];
$value = $app_strings['LBL_ACCUMULATED_HISTORY_BUTTON_LABEL'];
$module_name = 'Activities';
$id = $widget_data['focus']->id;
$initial_filter = "&record={$id}&module_name={$currentModule}";
if (ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'detail', true)) {
$temp = '<input disabled type="button" name="summary_button" id="summary_button"' . ' class="button"' . ' title="' . $title . '"' . ' value="' . $value . '"';
return $temp;
}
return '<input type="button" name="summary_button" id="summary_button"' . ' class="button"' . ' title="' . $title . '"' . ' value="' . $value . '"' . " onclick='open_popup(\"{$module_name}\",600,400,\"{$initial_filter}\",false,false,{$json_encoded_php_array});' />\n";
}
示例12: display
function display($defines)
{
global $app_strings;
global $currentModule;
$title = $app_strings['LBL_NEW_BUTTON_TITLE'];
//$accesskey = $app_strings['LBL_NEW_BUTTON_KEY'];
$value = $app_strings['LBL_NEW_BUTTON_LABEL'];
$this->module = 'Contacts';
/**
* if module is hidden or subpanel for the module is hidden - doesn't show select button
*/
if (SugarWidget::isModuleHidden($this->module)) {
return '';
}
if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)) {
$button = "<input title='{$title}'class='button' type='button' name='button' value=' {$value} ' disabled/>\n";
return $button;
}
$additionalFormFields = array();
if (isset($defines['focus']->billing_address_street)) {
$additionalFormFields['primary_address_street'] = $defines['focus']->billing_address_street;
}
if (isset($defines['focus']->billing_address_city)) {
$additionalFormFields['primary_address_city'] = $defines['focus']->billing_address_city;
}
if (isset($defines['focus']->billing_address_state)) {
$additionalFormFields['primary_address_state'] = $defines['focus']->billing_address_state;
}
if (isset($defines['focus']->billing_address_country)) {
$additionalFormFields['primary_address_country'] = $defines['focus']->billing_address_country;
}
if (isset($defines['focus']->billing_address_postalcode)) {
$additionalFormFields['primary_address_postalcode'] = $defines['focus']->billing_address_postalcode;
}
if (isset($defines['focus']->phone_office)) {
$additionalFormFields['phone_work'] = $defines['focus']->phone_office;
}
$button = $this->_get_form($defines, $additionalFormFields);
$button .= "<input title='{$title}' class='button' type='submit' name='{$this->getWidgetId()}' id='{$this->getWidgetId()}' value=' {$value} '/>\n";
$button .= "</form>";
return $button;
}
示例13: display
function display($defines)
{
global $app_strings;
if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true) || $defines['module'] == "History" & !ACLController::checkAccess("Emails", 'edit', true)) {
$temp = '';
return $temp;
}
// if module is hidden or subpanel for the module is hidden - doesn't show quick create button
if (SugarWidget::isModuleHidden('Emails')) {
return '';
}
$title = $app_strings['LBL_TRACK_EMAIL_BUTTON_TITLE'];
$value = $app_strings['LBL_TRACK_EMAIL_BUTTON_LABEL'];
$this->module = 'Emails';
if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)) {
$button = "<input id='" . preg_replace('[ ]', '', $value) . "_button' title='{$title}' class='button' type='button' name='" . preg_replace('[ ]', '', strtolower($value)) . "_button' value='{$value}' disabled/>\n";
} else {
$button = "<input id='" . preg_replace('[ ]', '', $value) . "_button' title='{$title}' class='button' type='button' onClick=\"javascript:subp_archive_email();\" name='" . preg_replace('[ ]', '', strtolower($value)) . "_button' value='{$value}'/>\n";
}
return $button;
}
示例14: display
function display($defines)
{
global $app_strings;
global $currentModule;
$title = $app_strings['LBL_NEW_BUTTON_TITLE'];
//$accesskey = $app_strings['LBL_NEW_BUTTON_KEY'];
$value = $app_strings['LBL_NEW_BUTTON_LABEL'];
$this->module = 'RealtyTemplates';
if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)) {
$button = "<input title='{$title}'class='button' type='button' name='button' value=' {$value} ' disabled/>\n";
return $button;
}
$additionalFormFields = array();
//from Buildings
if ($defines['focus']->object_name == 'Buildings') {
if (isset($defines['focus']->id)) {
$additionalFormFields['building_id'] = $defines['focus']->id;
}
if (isset($defines['focus']->number_of_floors)) {
$additionalFormFields['number_of_floors'] = $defines['focus']->number_of_floors;
}
if (isset($defines['focus']->address_country)) {
$additionalFormFields['address_country'] = $defines['focus']->address_country;
}
if (isset($defines['focus']->address_city)) {
$additionalFormFields['address_city'] = $defines['focus']->address_city;
}
if (isset($defines['focus']->address_street)) {
$additionalFormFields['address_street'] = $defines['focus']->address_street;
}
if (isset($defines['focus']->address_region)) {
$additionalFormFields['address_region'] = $defines['focus']->address_region;
}
}
$button = $this->_get_form($defines, $additionalFormFields);
$button .= "<input title='{$title}' class='button' type='submit' name='{$this->getWidgetId()}_button' id='{$this->getWidgetId()}' value=' {$value} '/>\n";
$button .= "</form>";
return $button;
}
示例15: export
/**
* Export API
*
* @param $api ServiceBase The API class of the request, used in cases where the API changes how the fields are pulled from the args array.
* @param $args array The arguments array passed in from the API
* @return String
*/
public function export(ServiceBase $api, array $args)
{
$seed = BeanFactory::newBean($args['module']);
if (!$seed->ACLAccess('export')) {
throw new SugarApiExceptionNotAuthorized($GLOBALS['app_strings']['ERR_EXPORT_DISABLED']);
}
ob_start();
global $sugar_config;
global $current_user;
global $app_list_strings;
$theModule = clean_string($args['module']);
if ($sugar_config['disable_export'] || !empty($sugar_config['admin_export_only']) && !(is_admin($current_user) || ACLController::moduleSupportsACL($theModule) && ACLAction::getUserAccessLevel($current_user->id, $theModule, 'access') == ACL_ALLOW_ENABLED && (ACLAction::getUserAccessLevel($current_user->id, $theModule, 'admin') == ACL_ALLOW_ADMIN || ACLAction::getUserAccessLevel($current_user->id, $theModule, 'admin') == ACL_ALLOW_ADMIN_DEV))) {
throw new SugarApiExceptionNotAuthorized($GLOBALS['app_strings']['ERR_EXPORT_DISABLED']);
}
//check to see if this is a request for a sample or for a regular export
if (!empty($args['sample'])) {
//call special method that will create dummy data for bean as well as insert standard help message.
$content = exportSampleFromApi($args);
} else {
$content = exportFromApi($args);
}
$filename = $args['module'];
//use label if one is defined
if (!empty($app_list_strings['moduleList'][$args['module']])) {
$filename = $app_list_strings['moduleList'][$args['module']];
}
//strip away any blank spaces
$filename = str_replace(' ', '', $filename);
if (isset($args['members']) && $args['members'] == true) {
$filename .= '_' . 'members';
}
///////////////////////////////////////////////////////////////////////////////
//// BUILD THE EXPORT FILE
ob_end_clean();
return $this->doExport($api, $filename, $content);
}