本文整理汇总了PHP中ViewFactory::_buildFromFile方法的典型用法代码示例。如果您正苦于以下问题:PHP ViewFactory::_buildFromFile方法的具体用法?PHP ViewFactory::_buildFromFile怎么用?PHP ViewFactory::_buildFromFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewFactory
的用法示例。
在下文中一共展示了ViewFactory::_buildFromFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadView
/**
* load the correct view
*
* @param string $type View Type
*
* @param string $module
* @param SugarBean|null $bean
* @param array $view_object_map
* @param string $target_module
*
* @return SugarView
*/
public static function loadView($type = 'default', $module, SugarBean $bean = null, array $view_object_map = [], $target_module = '')
{
$type = strtolower($type);
//first let's check if the module handles this view
$view = null;
//Check to see if we should load a custom parent view instance
loadParentView($type);
if (!empty($target_module)) {
if (file_exists($path = DOCROOT . "custom/modules/{$target_module}/views/view.{$type}.php")) {
$view = ViewFactory::_buildFromFile($path, $bean, $view_object_map, $type, $target_module);
} else {
if (file_exists($path = DOCROOT . "modules/{$target_module}/views/view.{$type}.php")) {
$view = ViewFactory::_buildFromFile($path, $bean, $view_object_map, $type, $target_module);
}
}
}
if (!isset($view)) {
if (file_exists($path = DOCROOT . "custom/modules/{$module}/views/view.{$type}.php")) {
$view = ViewFactory::_buildFromFile($path, $bean, $view_object_map, $type, $module);
} else {
if (file_exists($path = DOCROOT . "modules/{$module}/views/view.{$type}.php")) {
$view = ViewFactory::_buildFromFile($path, $bean, $view_object_map, $type, $module);
} else {
if (file_exists($path = DOCROOT . "custom/include/MVC/View/views/view.{$type}.php")) {
$view = ViewFactory::_buildFromFile($path, $bean, $view_object_map, $type, $module);
} else {
if (file_exists($path = DOCROOT . "include/MVC/View/views/view.{$type}.php")) {
//it appears Sugar does have the proper logic for this file.
$view = ViewFactory::_buildFromFile($path, $bean, $view_object_map, $type, $module);
}
}
}
}
}
// Default to SugarView if still nothing found/built
if (is_null($view)) {
$view = new SugarView();
}
ViewFactory::_loadConfig($view, $type);
return $view;
}
示例2: loadView
/**
* load the correct view
* @param string $type View Type
* @return valid view
*/
function loadView($type = 'default', $module, $bean = null, $view_object_map = array(), $target_module = '')
{
$type = strtolower($type);
//first let's check if the module handles this view
$view = null;
//Check to see if we should load a custom parent view instance
loadParentView($type);
if (!empty($target_module)) {
$view_file = SugarAutoLoader::existingCustomOne('modules/' . $target_module . '/views/view.' . $type . '.php');
$view_module = $target_module;
} else {
$view_module = $module;
}
if (empty($view_file)) {
$view_file = SugarAutoLoader::existingCustomOne('modules/' . $module . '/views/view.' . $type . '.php');
}
if (empty($view_file)) {
$view_file = SugarAutoLoader::existingCustomOne('include/MVC/View/views/view.' . $type . '.php');
}
if (!empty($view_file)) {
$view = ViewFactory::_buildFromFile($view_file, $bean, $view_object_map, $type, $view_module);
}
if (empty($view)) {
// Default to SugarView if still nothing found/built
$view = new SugarView();
}
ViewFactory::_loadConfig($view, $type);
return $view;
}
示例3: loadView
/**
* load the correct view
* @param string $type View Type
* @return valid view
*/
function loadView($type = 'default', $module, $bean = null, $view_object_map = array())
{
$type = strtolower($type);
//first let's check if the module handles this view
$view = null;
if (file_exists('custom/modules/' . $module . '/views/view.' . $type . '.php')) {
$view = ViewFactory::_buildFromFile('custom/modules/' . $module . '/views/view.' . $type . '.php', $bean, $view_object_map, $type, $module);
} else {
if (file_exists('modules/' . $module . '/views/view.' . $type . '.php')) {
$view = ViewFactory::_buildFromFile('modules/' . $module . '/views/view.' . $type . '.php', $bean, $view_object_map, $type, $module);
} else {
if (file_exists('custom/include/MVC/View/views/view.' . $type . '.php')) {
$view = ViewFactory::_buildFromFile('custom/include/MVC/View/views/view.' . $type . '.php', $bean, $view_object_map, $type, $module);
} else {
//if the module does not handle this view, then check if Sugar handles it OOTB
$file = 'include/MVC/View/views/view.' . $type . '.php';
if (file_exists($file)) {
//it appears Sugar does have the proper logic for this file.
$view = ViewFactory::_buildFromFile($file, $bean, $view_object_map, $type, $module);
}
}
}
}
// Default to SugarView if still nothing found/built
if (!isset($view)) {
$view = new SugarView();
}
ViewFactory::_loadConfig($view, $type);
return $view;
}
示例4: test_buildFromFile
public function test_buildFromFile()
{
//checck with valid values and test if it returns correct view instance
$type = 'list';
$target_module = 'Users';
$bean = null;
$view = ViewFactory::_buildFromFile('modules/' . $target_module . '/views/view.' . $type . '.php', $bean, array(), $type, $target_module);
$this->assertInstanceOf('UsersViewList', $view);
//checck with valid values and test if it returns correct view instance
$type = 'detail';
$target_module = 'Users';
$bean = null;
$view = ViewFactory::_buildFromFile('modules/' . $target_module . '/views/view.' . $type . '.php', $bean, array(), $type, $target_module);
$this->assertInstanceOf('UsersViewDetail', $view);
}