本文整理汇总了PHP中SugarController类的典型用法代码示例。如果您正苦于以下问题:PHP SugarController类的具体用法?PHP SugarController怎么用?PHP SugarController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SugarController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getController
/**
* Obtain an instance of the correct controller.
*
* @return an instance of SugarController
*/
function getController($module)
{
$class = ucfirst($module) . 'Controller';
if (file_exists('custom/modules/' . $module . '/controller.php')) {
$customClass = 'Custom' . $class;
require_once 'custom/modules/' . $module . '/controller.php';
if (class_exists($customClass)) {
$controller = new $customClass();
} else {
if (class_exists($class)) {
$controller = new $class();
}
}
} elseif (file_exists('modules/' . $module . '/controller.php')) {
require_once 'modules/' . $module . '/controller.php';
if (class_exists($class)) {
$controller = new $class();
}
} else {
$controller = new SugarController();
}
//setup the controller
$controller->setup($module);
return $controller;
}
示例2: display
function display()
{
$this->dv->process();
echo '<style type="text/css">@import url("custom/modules/ACLRoles/styles/securitygroups.css"); </style>';
$file = SugarController::getActionFilename($this->action);
$this->includeClassicFile('modules/' . $this->module . '/' . $file . '.php');
}
示例3: getController
/**
* Obtain an instance of the correct controller.
*
* @return an instance of SugarController
*/
function getController($module)
{
if (SugarAutoLoader::requireWithCustom("modules/{$module}/controller.php")) {
$class = SugarAutoLoader::customClass(ucfirst($module) . 'Controller');
} else {
SugarAutoLoader::requireWithCustom('include/MVC/Controller/SugarController.php');
$class = SugarAutoLoader::customClass('SugarController');
}
if (class_exists($class, false)) {
$controller = new $class();
}
if (empty($controller)) {
$controller = new SugarController();
}
//setup the controller
$controller->setup($module);
return $controller;
}
示例4: display
/**
* @see SugarView::display()
*/
public function display()
{
// Call SugarController::getActionFilename to handle case sensitive file names
$file = SugarController::getActionFilename($this->action);
$classic = SugarAutoLoader::existingCustomOne('modules/' . $this->module . '/' . $file . '.php');
if ($classic) {
$this->includeClassicFile($classic);
return true;
}
return false;
}
示例5: display
/**
* @see SugarView::display()
*/
public function display()
{
// Call SugarController::getActionFilename to handle case sensitive file names
$file = SugarController::getActionFilename($this->action);
if (file_exists('custom/modules/' . $this->module . '/' . $file . '.php')) {
$this->includeClassicFile('custom/modules/' . $this->module . '/' . $file . '.php');
return true;
} elseif (file_exists('modules/' . $this->module . '/' . $file . '.php')) {
$this->includeClassicFile('modules/' . $this->module . '/' . $file . '.php');
return true;
}
return false;
}
示例6: display
/**
* @see SugarView::display()
*/
public function display()
{
if ($this->bean instanceof SugarBean && isset($this->view_object_map['remap_action']) && !$this->bean->ACLAccess($this->view_object_map['remap_action'])) {
ACLController::displayNoAccess(true);
return false;
}
// Call SugarController::getActionFilename to handle case sensitive file names
$file = SugarController::getActionFilename($this->action);
$classic_file = SugarAutoLoader::existingCustomOne('modules/' . $this->module . '/' . $file . '.php');
if ($classic_file) {
$this->includeClassicFile($classic_file);
return true;
}
return false;
}
示例7: process
function process()
{
if (!is_admin($GLOBALS['current_user']) && in_array($this->action, $this->admin_actions)) {
$this->hasAccess = false;
}
parent::process();
}
示例8: execute
/**
* Perform execution of the application. This method is called from index2.php
*
* @param Request $request
*/
function execute(Request $request)
{
global $sugar_config;
if (!empty($sugar_config['default_module'])) {
$this->default_module = $sugar_config['default_module'];
}
$module = $this->default_module;
if (!empty($_REQUEST['module'])) {
$module = $_REQUEST['module'];
}
insert_charset_header();
$this->setupPrint();
$this->controller = ControllerFactory::getController($module);
// if the entry point is defined to not need auth, then don't authenicate
if (!$request->has('entryPoint') || $this->controller->checkEntryPointRequiresAuth($request->query('entryPoint'))) {
$this->loadUser();
$this->ACLFilter();
$this->preProcess();
$this->getController()->preProcess();
$this->checkHTTPReferer();
}
SugarThemeRegistry::buildRegistry();
$this->loadLanguages();
$this->checkDatabaseVersion();
$this->loadDisplaySettings();
$this->loadLicense();
$this->loadGlobals();
$this->setupResourceManagement($module);
$this->getController()->execute();
sugar_cleanup();
}
示例9: pre_save
public function pre_save()
{
require_once 'include/upload_file.php';
$upload_file = new UploadFile('filename_file');
if (isset($_FILES['filename_file']) && $upload_file->confirm_upload()) {
$filename = $upload_file->get_stored_file_name();
$file_ext = $upload_file->file_ext;
if (empty($this->bean->id)) {
$this->bean->id = create_guid();
$this->bean->new_with_id = true;
}
$account = null;
if (isset($_POST['xphotobucketaccount_id'])) {
$account = BeanFactory::getBean('xPhotobucketAccounts', $_POST['xphotobucketaccount_id']);
}
// $resp = $account->upload_media('image', $upload_file->temp_file_location, "{$this->bean->id}.{$file_ext}", $_POST['name']);
$resp = $account->upload_media('base64', base64_encode(file_get_contents($upload_file->temp_file_location)), "{$this->bean->id}.{$file_ext}", $_POST['name']);
$this->bean->browse_url = $resp['browseurl'];
$this->bean->image_url = $resp['url'];
$this->bean->thumb_url = $resp['thumb'];
} else {
echo "Upload file error";
sugar_cleanup(true);
}
parent::pre_save();
}
示例10: process
public function process()
{
if (!is_admin($GLOBALS['current_user']) && !is_admin_for_module($GLOBALS['current_user'], 'Contracts')) {
$this->hasAccess = false;
}
parent::process();
}
示例11:
function action_listview()
{
if ($_REQUEST['state_in_chart']) {
$this->correctStateFilterFromChart();
}
parent::action_listview();
}
示例12: preProcess
public function preProcess()
{
parent::preProcess();
global $current_user;
if (!$current_user->isAdmin()) {
sugar_die("Non-admin users are not allowed to access the admin area.");
}
}
示例13: post_delete
protected function post_delete()
{
if (!empty($_REQUEST['return_url'])) {
$_REQUEST['return_url'] = urldecode($_REQUEST['return_url']);
$this->redirect_url = $_REQUEST['return_url'];
} else {
parent::post_delete();
}
}
示例14: process
function process()
{
$GLOBALS['log']->info(get_class($this) . ":");
global $current_user;
$access = $current_user->getDeveloperModules();
if ($current_user->isAdmin() || $current_user->isDeveloperForAnyModule() && !isset($_REQUEST['view_module']) && (isset($_REQUEST['action']) && $_REQUEST['action'] != 'package') || isset($_REQUEST['view_module']) && (in_array($_REQUEST['view_module'], $access) || empty($_REQUEST['view_module'])) || isset($_REQUEST['type']) && ($_REQUEST['type'] == 'dropdowns' && $current_user->isDeveloperForAnyModule() || $_REQUEST['type'] == 'studio' && displayStudioForCurrentUser() == true)) {
$this->hasAccess = true;
} else {
$this->hasAccess = false;
}
parent::process();
}
示例15: process
function process()
{
$GLOBALS['log']->info(get_class($this) . ":");
global $current_user;
$access = get_admin_modules_for_user($current_user);
if (is_admin($current_user) || is_admin_for_any_module($current_user) && !isset($_REQUEST['view_module']) && (isset($_REQUEST['action']) && $_REQUEST['action'] != 'package') || isset($_REQUEST['view_module']) && (in_array($_REQUEST['view_module'], $access) || empty($_REQUEST['view_module'])) || isset($_REQUEST['type']) && ($_REQUEST['type'] == 'dropdowns' && is_admin_for_any_module($current_user) || $_REQUEST['type'] == 'studio' && displayStudioForCurrentUser() == true)) {
$this->hasAccess = true;
} else {
$this->hasAccess = false;
}
parent::process();
}