本文整理汇总了PHP中Vtiger_Field::getAllForModule方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Field::getAllForModule方法的具体用法?PHP Vtiger_Field::getAllForModule怎么用?PHP Vtiger_Field::getAllForModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Field
的用法示例。
在下文中一共展示了Vtiger_Field::getAllForModule方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFields
/**
* Get all the fields of the module or block
* @param Vtiger_Block Instance of block to use to get fields, false to get all the block fields
*/
function getFields($blockInstance = false)
{
$fields = false;
if ($blockInstance) {
$fields = Vtiger_Field::getAllForBlock($blockInstance, $this);
} else {
$fields = Vtiger_Field::getAllForModule($this);
}
return $fields;
}
示例2: update_Fields
/**
* Update Fields of the module
* @access private
*/
function update_Fields($blocknode, $blockInstance, $moduleInstance)
{
if (empty($blocknode->fields) || empty($blocknode->fields->field)) {
return;
}
foreach ($blocknode->fields->field as $fieldnode) {
$this->listFields[] = strval($fieldnode->fieldname);
$fieldInstance = Vtiger_Field::getInstance((string) $fieldnode->fieldname, $moduleInstance);
if (!$fieldInstance) {
$fieldInstance = $this->import_Field($blocknode, $blockInstance, $moduleInstance, $fieldnode);
} else {
$this->update_Field($blocknode, $blockInstance, $moduleInstance, $fieldnode, $fieldInstance);
}
$this->__AddModuleFieldToCache($moduleInstance, $fieldInstance->name, $fieldInstance);
}
// Deleting removed fields
$listFieldBeforeUpdate = Vtiger_Field::getAllForModule($moduleInstance);
foreach ($listFieldBeforeUpdate as $fieldInstance) {
if (!in_array($fieldInstance->name, $this->listFields)) {
$fieldInstance->delete();
}
}
}
示例3: getAllForModule
/**
* Function to retrieve field model for specific block and module
* @param <Vtiger_Module_Model> $blockModel - block instance
* @return <array> List of field model
*/
public static function getAllForModule($moduleModel)
{
$fieldModelList = Vtiger_Cache::get('ModuleFields', $moduleModel->id);
if (!$fieldModelList) {
$fieldObjects = parent::getAllForModule($moduleModel);
$fieldModelList = array();
//if module dont have any fields
if (!is_array($fieldObjects)) {
$fieldObjects = array();
}
foreach ($fieldObjects as $fieldObject) {
$fieldModelObject = self::getInstanceFromFieldObject($fieldObject);
$fieldModelList[$fieldModelObject->get('block')->id][] = $fieldModelObject;
Vtiger_Cache::set('field-' . $moduleModel->getId(), $fieldModelObject->getId(), $fieldModelObject);
Vtiger_Cache::set('field-' . $moduleModel->getId(), $fieldModelObject->getName(), $fieldModelObject);
}
Vtiger_Cache::set('ModuleFields', $moduleModel->id, $fieldModelList);
}
return $fieldModelList;
}
示例4: update_Blocks
/**
* Update Blocks of the module
* @access private
*/
function update_Blocks($modulenode, $moduleInstance)
{
if (empty($modulenode->blocks) || empty($modulenode->blocks->block)) {
return;
}
foreach ($modulenode->blocks->block as $blocknode) {
$this->listBlocks[] = strval($blocknode->label);
$blockInstance = Vtiger_Block::getInstance((string) $blocknode->label, $moduleInstance);
if (!$blockInstance) {
$blockInstance = $this->import_Block($modulenode, $moduleInstance, $blocknode);
} else {
$this->update_Block($modulenode, $moduleInstance, $blocknode, $blockInstance);
}
$this->update_Fields($blocknode, $blockInstance, $moduleInstance);
}
// Deleting removed fields
$listFieldBeforeUpdate = Vtiger_Field::getAllForModule($moduleInstance);
foreach ($listFieldBeforeUpdate as $fieldInstance) {
if (!in_array($fieldInstance->name, $this->listFields)) {
$fieldInstance->delete();
}
}
// Deleting removed blocks
$listBlockBeforeUpdate = Vtiger_Block::getAllForModule($moduleInstance);
foreach ($listBlockBeforeUpdate as $blockInstance) {
if (!in_array($blockInstance->label, $this->listBlocks)) {
$blockInstance->delete();
}
}
}