本文整理匯總了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();
}
}
}