public function modAction($mod_action) { switch ($mod_action) { case 'admin_batch_update': $controller = new WT_Controller_Page(); $controller->setPageTitle(WT_I18N::translate('Batch update'))->restrictAccess(Auth::isAdmin())->pageHeader(); // TODO: these files should be methods in this class require WT_ROOT . WT_MODULES_DIR . $this->getName() . '/' . $mod_action . '.php'; $mod = new batch_update(); echo $mod->main(); break; default: header('HTTP/1.0 404 Not Found'); } }
static function _surnames_to_add($xref, $gedrec) { $wife_surnames = self::_surnames($xref, $gedrec); $husb_surnames = array(); $missing_surnames = array(); preg_match_all('/^1 FAMS @(.+)@/m', $gedrec, $fmatch); foreach ($fmatch[1] as $famid) { $famrec = batch_update::getLatestRecord($famid, 'FAM'); if (preg_match('/^1 MARR/m', $famrec) && preg_match('/^1 HUSB @(.+)@/m', $famrec, $hmatch)) { $husbrec = batch_update::getLatestRecord($hmatch[1], 'INDI'); $husb_surnames = array_unique(array_merge($husb_surnames, self::_surnames($hmatch[1], $husbrec))); } } foreach ($husb_surnames as $husb_surname) { if (!in_array($husb_surname, $wife_surnames)) { $missing_surnames[] = $husb_surname; } } return $missing_surnames; }
function getActionButtons($xref) { if (Auth::user()->getSetting('auto_accept')) { return array(batch_update::createSubmitButton(WT_I18N::translate('Update'), $xref, 'update'), batch_update::createSubmitButton(WT_I18N::translate('Update all'), $xref, 'update_all')); } else { return array(batch_update::createSubmitButton(WT_I18N::translate('Update'), $xref, 'update')); } }