Skip to content
Snippets Groups Projects
Commit a1e7a58f authored by Peter Rotich's avatar Peter Rotich
Browse files

Remove unused functions - replaced by variable replacer

parent 00dc2c32
Branches
Tags
No related merge requests found
...@@ -281,23 +281,6 @@ class Dept { ...@@ -281,23 +281,6 @@ class Dept {
return $num; return $num;
} }
//Replace staff's variables
function replaceVariables($text, $prefix='dept') {
$manager = $this->getManager();
$prefix = rtrim($prefix, '.');
$search = array("/%$prefix.name/", "/%$prefix.manager/", "/%$prefix.signature/");
$replace = array($this->getName(),
($manager?$manager->getName():''),
$this->getSignature());
while ($text != ($T = preg_replace($search, $replace, $text))) {
$text = $T;
}
return $text;
}
/*----Static functions-------*/ /*----Static functions-------*/
function getIdByName($name) { function getIdByName($name) {
$id=0; $id=0;
......
...@@ -506,28 +506,7 @@ class Staff { ...@@ -506,28 +506,7 @@ class Staff {
return $num; return $num;
} }
//Replace staff's variables
function replaceVariables($text, $prefix='staff') {
$prefix = rtrim($prefix, '.');
$search = array("/%$prefix.username/", "/%$prefix.firstname/", "/%$prefix.lastname/",
"/%$prefix.name/", "/%$prefix.email/", "/%$prefix.signature/");
$replace = array($this->getUserName(),
$this->getFirstName(),
$this->getLastName(),
$this->getName(),
$this->getEmail(),
$this->getSignature());
while ($text != ($T = preg_replace($search,$replace,$text))) {
$text = $T;
}
return $text;
}
/**** Static functions ********/ /**** Static functions ********/
function getStaffMembers($availableonly=false) { function getStaffMembers($availableonly=false) {
$sql='SELECT s.staff_id,CONCAT_WS(", ",s.lastname, s.firstname) as name ' $sql='SELECT s.staff_id,CONCAT_WS(", ",s.lastname, s.firstname) as name '
......
...@@ -173,21 +173,6 @@ class Team { ...@@ -173,21 +173,6 @@ class Team {
return true; return true;
} }
//Replace staff's variables
function replaceVariables($text, $prefix='team') {
$lead = $this->getLead();
$prefix = rtrim($prefix, '.');
$search = array("/%$prefix.name/", "/%$prefix.lead/");
$replace = array($this->getName(), ($lead?$lead->getName():''));
while ($text != ($T = preg_replace($search, $replace, $text))) {
$text = $T;
}
return $text;
}
/* ----------- Static function ------------------*/ /* ----------- Static function ------------------*/
function lookup($id) { function lookup($id) {
return ($id && is_numeric($id) && ($team= new Team($id)) && $team->getId()==$id)?$team:null; return ($id && is_numeric($id) && ($team= new Team($id)) && $team->getId()==$id)?$team:null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment