本文整理汇总了PHP中DynamicField::getFieldWidget方法的典型用法代码示例。如果您正苦于以下问题:PHP DynamicField::getFieldWidget方法的具体用法?PHP DynamicField::getFieldWidget怎么用?PHP DynamicField::getFieldWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynamicField
的用法示例。
在下文中一共展示了DynamicField::getFieldWidget方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function uninstall_relationships($include_studio_relationships = false)
{
$relationships = array();
//Find and remove studio created relationships.
global $beanList, $beanFiles, $dictionary;
//Load up the custom relationship definitions.
if (file_exists('custom/application/Ext/TableDictionary/tabledictionary.ext.php')) {
include 'custom/application/Ext/TableDictionary/tabledictionary.ext.php';
}
//Find all the relatioships/relate fields involving this module.
$rels_to_remove = array();
foreach ($beanList as $mod => $bean) {
//Some modules like cases have a bean name that doesn't match the object name
$bean = BeanFactory::getObjectName($mod);
VardefManager::loadVardef($mod, $bean);
//We can skip modules that are in this package as they will be removed anyhow
if (!in_array($mod, $this->modulesInPackage) && !empty($dictionary[$bean]) && !empty($dictionary[$bean]['fields'])) {
$field_defs = $dictionary[$bean]['fields'];
foreach ($field_defs as $field => $def) {
//Weed out most fields first
if (isset($def['type'])) {
//Custom relationships created in the relationship editor
if ($def['type'] == "link" && !empty($def['relationship']) && !empty($dictionary[$def['relationship']])) {
$rel_name = $def['relationship'];
$rel_def = $dictionary[$rel_name]['relationships'][$rel_name];
//Check against mods to be removed.
foreach ($this->modulesInPackage as $removed_mod) {
if ($rel_def['lhs_module'] == $removed_mod || $rel_def['rhs_module'] == $removed_mod) {
$dictionary[$rel_name]['from_studio'] = true;
$relationships[$rel_name] = $dictionary[$rel_name];
}
}
}
//Custom "relate" fields created in studio also need to be removed
if ($def['type'] == 'relate' && isset($def['module'])) {
foreach ($this->modulesInPackage as $removed_mod) {
if ($def['module'] == $removed_mod) {
require_once 'modules/ModuleBuilder/Module/StudioModule.php';
$studioMod = new StudioModule($mod);
$studioMod->removeFieldFromLayouts($field);
if (isset($def['custom_module'])) {
require_once 'modules/DynamicFields/DynamicField.php';
require_once $beanFiles[$bean];
$seed = new $bean();
$df = new DynamicField($mod);
$df->setup($seed);
//Need to load the entire field_meta_data for some field types
$field_obj = $df->getFieldWidget($mod, $field);
$field_obj->delete($df);
}
}
}
}
}
}
}
}
$this->uninstall_relationship(null, $relationships);
if (isset($this->installdefs['relationships'])) {
$relationships = $this->installdefs['relationships'];
$this->log(translate('LBL_MI_UN_RELATIONSHIPS'));
foreach ($relationships as $relationship) {
// remove the metadata entry
$filename = basename($relationship['meta_data']);
$pathname = file_exists("custom/metadata/{$filename}") ? "custom/metadata/{$filename}" : "metadata/{$filename}";
if (isset($GLOBALS['mi_remove_tables']) && $GLOBALS['mi_remove_tables']) {
$this->uninstall_relationship($pathname);
}
if (file_exists($pathname)) {
unlink($pathname);
}
}
}
if (file_exists("custom/Extension/application/Ext/TableDictionary/{$this->id_name}.php")) {
unlink("custom/Extension/application/Ext/TableDictionary/{$this->id_name}.php");
}
Relationship::delete_cache();
$this->rebuild_tabledictionary();
}
示例2: DynamicField
function action_DeleteField()
{
require_once 'modules/DynamicFields/FieldCases.php';
$field = get_widget($_REQUEST['type']);
$field->name = $_REQUEST['name'];
if (!isset($_REQUEST['view_package'])) {
if (!empty($_REQUEST['name']) && !empty($_REQUEST['view_module'])) {
require_once 'modules/DynamicFields/DynamicField.php';
$moduleName = $_REQUEST['view_module'];
// bug 51325 make sure we make this switch or delete will not work
if ($moduleName == 'Employees') {
$moduleName = 'Users';
}
$class_name = $GLOBALS['beanList'][$moduleName];
require_once $GLOBALS['beanFiles'][$class_name];
$seed = new $class_name();
$df = new DynamicField($moduleName);
$df->setup($seed);
//Need to load the entire field_meta_data for some field types
$field = $df->getFieldWidget($moduleName, $field->name);
$field->delete($df);
$GLOBALS['mod_strings']['LBL_ALL_MODULES'] = 'all_modules';
$_REQUEST['execute_sql'] = true;
include_once 'modules/Administration/QuickRepairAndRebuild.php';
$repair = new RepairAndClear();
$repair->repairAndClearAll(array('rebuildExtensions', 'clearVardefs', 'clearTpls'), array($class_name), true, false);
require_once 'modules/ModuleBuilder/Module/StudioModuleFactory.php';
$module = StudioModuleFactory::getStudioModule($moduleName);
}
} else {
$mb = new ModuleBuilder();
$module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']);
$field = $module->getField($field->name);
$field->delete($module);
$mb->save();
}
$module->removeFieldFromLayouts($field->name);
$this->view = 'modulefields';
if (isset($GLOBALS['current_language']) && isset($_REQUEST['label']) && isset($_REQUEST['labelValue']) && isset($_REQUEST['view_module'])) {
$this->DeleteLabel($GLOBALS['current_language'], $_REQUEST['label'], $_REQUEST['labelValue'], $_REQUEST['view_module']);
}
}
示例3: DynamicField
function action_DeleteField()
{
require_once 'modules/DynamicFields/FieldCases.php';
$field = get_widget($_POST['type']);
$field->name = $_REQUEST['name'];
if (!isset($_REQUEST['view_package'])) {
if (!empty($_REQUEST['name']) && !empty($_REQUEST['view_module'])) {
require_once 'modules/DynamicFields/DynamicField.php';
$moduleName = $_REQUEST['view_module'];
$class_name = $GLOBALS['beanList'][$moduleName];
require_once $GLOBALS['beanFiles'][$class_name];
$seed = new $class_name();
$df = new DynamicField($moduleName);
$df->setup($seed);
//Need to load the entire field_meta_data for some field types
$field = $df->getFieldWidget($moduleName, $field->name);
$field->delete($df);
require_once 'modules/ModuleBuilder/Module/StudioModule.php';
$module = new StudioModule($moduleName);
}
} else {
$mb = new ModuleBuilder();
$module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']);
$field->delete($module);
$mb->save();
}
$module->removeFieldFromLayouts($field->name);
$this->view = 'modulefields';
}
示例4: delete
/**
* Delete field
*
* @param DynamicField $df
*/
public function delete($df)
{
if ($df instanceof DynamicField) {
$fieldId = $df->getFieldWidget($df->module, $this->id_name);
} elseif ($df instanceof MBModule) {
$fieldId = $df->getField($this->id_name);
} else {
Log::fatal('Unsupported DynamicField type');
}
$this->deleteIdLabel($fieldId, $df);
$fieldId->delete($df);
parent::delete($df);
}
示例5: removeCustomFields
/**
* Removes all custom fields created in studio
*
* @return html output record of the field deleted
*/
function removeCustomFields()
{
$moduleName = $this->module;
$class_name = $GLOBALS['beanList'][$moduleName];
require_once $GLOBALS['beanFiles'][$class_name];
$seed = new $class_name();
$df = new DynamicField($moduleName);
$df->setup($seed);
$module = StudioModuleFactory::getStudioModule($moduleName);
$customFields = array();
foreach ($seed->field_defs as $def) {
if (isset($def['source']) && $def['source'] == 'custom_fields') {
$field = $df->getFieldWidget($moduleName, $def['name']);
$field->delete($df);
$module->removeFieldFromLayouts($def['name']);
$customFields[] = $def['name'];
}
}
$out = "";
foreach ($customFields as $field) {
$out .= "Removed field {$field}<br/>";
}
return $out;
}
示例6: action_DeleteField
public function action_DeleteField()
{
$field = get_widget($_REQUEST['type']);
$field->name = $_REQUEST['name'];
if (!isset($_REQUEST['view_package'])) {
if (!empty($_REQUEST['name']) && !empty($_REQUEST['view_module'])) {
$moduleName = $_REQUEST['view_module'];
// bug 51325 make sure we make this switch or delete will not work
if ($moduleName == 'Employees') {
$moduleName = 'Users';
}
$seed = BeanFactory::getBean($moduleName);
$df = new DynamicField($moduleName);
$df->setup($seed);
//Need to load the entire field_meta_data for some field types
$field = $df->getFieldWidget($moduleName, $field->name);
$field->delete($df);
$GLOBALS['mod_strings']['LBL_ALL_MODULES'] = 'all_modules';
$_REQUEST['execute_sql'] = true;
include_once 'modules/Administration/QuickRepairAndRebuild.php';
$repair = new RepairAndClear();
$repair->repairAndClearAll(array('rebuildExtensions', 'clearVardefs', 'clearTpls'), array($moduleName), true, false);
require_once 'modules/ModuleBuilder/Module/StudioModuleFactory.php';
$module = StudioModuleFactory::getStudioModule($moduleName);
}
} else {
$mb = new ModuleBuilder();
$module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']);
$field = $module->getField($field->name);
$field->delete($module);
$mb->save();
}
$module->removeFieldFromLayouts($field->name);
$this->view = 'modulefields';
if (isset($GLOBALS['current_language']) && isset($_REQUEST['label']) && isset($_REQUEST['labelValue']) && isset($_REQUEST['view_module'])) {
$this->DeleteLabel($GLOBALS['current_language'], $_REQUEST['label'], $_REQUEST['labelValue'], $_REQUEST['view_module']);
$this->metadataApiCacheCleared = true;
}
// Clear the metadata cache if it hasn't been done already
if (!$this->metadataApiCacheCleared && !empty($moduleName)) {
// This removes the labels associated with the field and rebuilds
// the api cache for the module
$repair->module_list = array($moduleName);
$repair->repairMetadataAPICache('labels');
}
}
示例7: removeCustomFields
/**
* Removes all custom fields created in studio
*
* @return html output record of the field deleted
*/
function removeCustomFields()
{
$moduleName = $this->module;
$seed = BeanFactory::getBean($moduleName);
$df = new DynamicField($moduleName);
$df->setup($seed);
$module = StudioModuleFactory::getStudioModule($moduleName);
$customFields = array();
foreach ($seed->field_defs as $def) {
if (isset($def['custom_module']) && $def['custom_module'] === $moduleName) {
$field = $df->getFieldWidget($moduleName, $def['name']);
// the field may have already been deleted
if ($field) {
$field->delete($df);
}
$module->removeFieldFromLayouts($def['name']);
$customFields[] = $def['name'];
}
}
$out = "";
foreach ($customFields as $field) {
$out .= "Removed field {$field}<br/>";
}
return $out;
}
示例8: delete
/**
* Delete field
*
* @param DynamicField $df
*/
public function delete($df)
{
$fieldId = null;
if ($df instanceof DynamicField) {
$fieldId = $df->getFieldWidget($df->module, $this->id_name);
} elseif ($df instanceof MBModule) {
$fieldId = $df->getField($this->id_name);
} else {
$GLOBALS['log']->fatal('Unsupported DynamicField type');
}
// the field may have already been deleted
if ($fieldId) {
$this->deleteIdLabel($fieldId, $df);
$fieldId->delete($df);
}
parent::delete($df);
}