public function processRecipientEmails($bean, $entry, $flowData) { global $beanList; $res = array(); $field = $entry->value; $module = $entry->module; if (!isset($beanList[$module])) { $bean = $this->pmseRelatedModule->getRelatedModule($bean, $module); } if (!empty($bean) && is_object($bean)) { $value = $bean->{$field}; } else { $value = ''; } $item = new stdClass(); $item->name = $value; $item->address = $value; $res[] = $item; return $res; }
/** * Returns relationships base on a module * @param $baseModule * @param $relationName * @param string $rel_type * @return null */ protected function getRelationshipData($baseModule, $relationName, $rel_type = 'all') { if (empty($this->relatedModules[$baseModule])) { $this->relatedModules[$baseModule] = array("all" => array(), "one-to-one" => array(), "one-to-many" => array()); } if (empty($this->relatedModules[$baseModule][$rel_type])) { require_once 'modules/pmse_Inbox/engine/PMSERelatedModule.php'; $relatedModule = new PMSERelatedModule(); $relatedModules = $relatedModule->getRelatedBeans($baseModule, $rel_type); $this->relatedModules[$baseModule][$rel_type] = array(); foreach ($relatedModules['result'] as $module) { $this->relatedModules[$baseModule][$rel_type][$module['relationship']] = $module['value']; } } return empty($this->relatedModules[$baseModule][$rel_type][$relationName]) ? null : $this->relatedModules[$baseModule][$rel_type][$relationName]; }
public function retrieveFields($filter, $orderBy, $limit, $offset, $baseModule) { global $beanList; $pmseRelatedModule = new PMSERelatedModule(); if (isset($beanList[$filter])) { $newModuleFilter = $filter; } else { $newModuleFilter = $pmseRelatedModule->getRelatedModuleName($baseModule, $filter); } $output = array(); $moduleBean = BeanFactory::getBean($newModuleFilter); $fieldsData = isset($moduleBean->field_defs) ? $moduleBean->field_defs : array(); foreach ($fieldsData as $field) { //$retrieveId = isset($additionalArgs['retrieveId']) && !empty($additionalArgs['retrieveId']) && $field['name'] == 'id' ? $additionalArgs['retrieveId'] : false; if (isset($field['vname']) && PMSEEngineUtils::isValidField($field, 'ET')) { $tmpField = array(); $tmpField['id'] = $field['name']; $tmpField['_module'] = $newModuleFilter; $tmpField['name'] = str_replace(':', '', translate($field['vname'], $newModuleFilter)); $tmpField['rhs_module'] = $filter; $output[] = $tmpField; } } $text = array(); foreach ($output as $key => $row) { $text[$key] = strtolower($row['name']); } if ($orderBy == "ASC") { array_multisort($text, SORT_ASC, $output); } else { array_multisort($text, SORT_DESC, $output); } $start = $offset; $end = $offset + $limit; $count = 0; $outputTmp = array(); foreach ($output as $field) { if ($count >= $start && $count < $end) { $outputTmp[] = $field; } $count++; } return array('totalRecords' => count($output), 'records' => $outputTmp); }