/** * Returns the value of $module's field called $fieldName. * Calls accessLocalField($fieldName) on a separate DataTool object * for the remote module. * @param $module - Name of remote module to access. * @param $fieldName - Name of field in remote module to retrieve. */ function accessRemoteField($module, $fieldName) { /* Form is 'Module' => field */ /* I need to call $this->getData. */ /* I need to load the Data/Module.php file, * to make a proper call to getData. */ /* I need the var_defs for the Module, so * I can access its type or dbType. (only if it's an enum...)*/ /* I also need the remote count of the 'parent' or 'related' * module. This count would be the one that I get when * I generate relationships or fill 'related' fields. */ /* But getData looks at $this->module... ick */ /* Well, I'm loading the vardefs for this class, so I might * as well load a new dataTool for it. */ /* 1. Load Data/Module definitions * 2. Load class[Module] * 3. Identify related count - ? * 4. call getData on the one field we want. */ /* Should one accidentally refer to itsself, just call local */ if ($module == $this->module) { return $this->accessLocalField($fieldName); } /* Check if a cached dataTool object exists. */ if (!empty($GLOBALS['foreignDataTools']) && !empty($GLOBALS['foreignDataTools'][$module])) { $rbfd = $GLOBALS['foreignDataTools'][$module]; } else { include 'include/modules.php'; $class = $beanList[$module]; require_once $beanFiles[$class]; $bean = new $class(); if (file_exists('Tidbit/Data/' . $bean->module_dir . '.php')) { require_once 'Tidbit/Data/' . $bean->module_dir . '.php'; } $rbfd = new DataTool(); $rbfd->fields = $bean->field_defs; $rbfd->table_name = $bean->table_name; $rbfd->module = $module; /* Cache the dataTool object. */ $GLOBALS['foreignDataTools'][$module] = $rbfd; } $rbfd->clean(); $rbfd->count = $this->getRelatedUpId($module); return $rbfd->accessLocalField($fieldName); }
$ibfd->fields = $bean->field_defs; $ibfd->table_name = $bean->table_name; $ibfd->module = $module; unset($GLOBALS['queryHead']); unset($GLOBALS['queries']); /* We need to insert $total records * into the DB. We are using the module and table-name given by * $module and $bean->table_name. */ for ($i = 0; $i < $total; $i++) { if (isset($_SESSION['iterator']) && $i <= $total_iterator) { continue; } $ibfd->count = $i; /* Don't turbo Users or Teams */ if (!isset($_SESSION['turbo']) || !($i % $recordsPerPage) || $module != 'Users' || $module != 'Teams') { $ibfd->clean(); $ibfd->count = $i; $ibfd->generateData(); } /* if ($i == 0) { foreach($ibfd->installData as $key => $val) { echo $key . " => " . $val . "\n"; } } */ $ibfd->generateId(); //$ibfd->generateTeamSetId(); $ibfd->createInserts(); $ibfd->generateRelationships(); $_SESSION['processedRecords']++;