/** * Template function to link to the provider associated with this person. * @param DOMNode $node * @param I2CE_Template $template * @param string $link */ public function linkToProvider($node, $template, $link) { if (!$node instanceof DOMNOde || !$template instanceof I2CE_Template || !$node->parentNode instanceof DOMNode || $template->getUser()->getRole() != "training_provider") { $template->removeNode($node); return; } $access = self::getAccessProvider($template->getUser()); if (count($access) > 0) { $a = $template->createElement('a', array('href' => $link . $access[0])); $node->parentNode->replaceChild($a, $node); while ($node->firstChild instanceof DOMNode) { $a->appendChild($node->firstChild); } return; } $template->removeNode($node); }
/** * Template function to see if the user is mapped to a personnel record and if so replace the node with the given link * @param DOMNode $node * @param I2CE_Template $template * @param string $link */ public function linkToPersonRecord($node, $template, $link) { if (!$node instanceof DOMNode || !$template instanceof I2CE_Template || !$node->parentNode instanceof DOMNode || ($id = iHRIS_UserMap::getPersonId()) == '|') { $template->removeNode($node); return; } $a = $template->createElement('a', array('href' => $link . $id)); $node->parentNode->replaceChild($a, $node); while ($node->firstChild instanceof DOMNode) { $a->appendChild($node->firstChild); } }