本文整理汇总了PHP中SugarController::setup方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarController::setup方法的具体用法?PHP SugarController::setup怎么用?PHP SugarController::setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarController
的用法示例。
在下文中一共展示了SugarController::setup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: setup
/**
* @see SugarController::setup($module = '')
*/
public function setup($module = '')
{
$result = parent::setup($module);
// bug 41860 fix
if (!empty($_REQUEST['id'])) {
$this->record = $_REQUEST['id'];
}
// end bugfix
return $result;
}
示例3: testsetup
public function testsetup()
{
$SugarController = new SugarController();
$default_module = $SugarController->module;
//first test with empty parameter and check for default values being used
$SugarController->setup('');
$this->assertAttributeEquals($default_module, 'module', $SugarController);
$this->assertAttributeEquals(null, 'target_module', $SugarController);
//secondly test with module name and check for correct assignment.
$SugarController->setup('Users');
$this->assertAttributeEquals('Users', 'module', $SugarController);
$this->assertAttributeEquals(null, 'target_module', $SugarController);
}
示例4: 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;
}