20 include_once(
'config.inc.php');
21 include_once(
'lib/Common.php');
25 $DB->Execute(
"SET NAMES utf8");
28 define(
'LOCATE_CURR', 0);
29 define(
'LOCATE_NEXT', 1);
30 define(
'LOCATE_NEXTMISSING', 2);
31 define(
'LOCATE_PREV', 3);
32 define(
'LOCATE_PREVMISSING', 4);
87 throw new Exception(
"Invalid default locale in the configuration: $localeName");
95 $this->txtFindText =
"";
96 $this->ddlSearchType = 0;
97 $this->ddlFindPercent = 60;
98 $this->ddlLocaleID = $localeID;
99 $this->xOldLocaleID = $localeID;
100 $this->xStringID = 0;
101 $this->xProjectID = 0;
104 if(count($this->RootProjects) == 0)
106 throw new Exception(
"Cannot initialze backend for $this->ddlLocaleID locale. No roots.");
122 if(!$this->xActiveRootID)
124 $this->xActiveRootID = array_keys($this->RootProjects)[0];
149 switch($this->ddlSearchType)
154 $this->Translations = $this->String->FindText($this->txtFindText, $this->ddlLocaleID,
true);
159 $this->Translations = $this->String->FindText($this->txtFindText, $this->ddlLocaleID,
false);
164 $this->Translations = $this->String->FindSimilar($this->txtFindText, $this->ddlLocaleID, $this->ddlFindPercent);
203 unset($this->LocatedString);
208 if($this->xStringID != 0)
218 foreach($stringIter as $str)
225 if($missingOnly && $this->LocatedString->GetTranslation() !=
"")
228 unset($this->LocatedString);
233 $this->xStringID = $str->GetStringID();
239 if($str->GetStringID() == $currentString->GetStringID())
255 while(empty($this->LocatedString) && !$rootHit)
257 $takeProject =
false;
260 $parentProjects =
new RecursiveIteratorIterator(
262 RecursiveIteratorIterator::SELF_FIRST);
265 foreach($parentProjects as $proj)
277 if($stringIter->valid())
279 $this->xStringID = $stringIter->
current()->GetStringID();
289 foreach($stringIter as $str)
291 if($str->GetTranslation() ==
"")
293 $this->xStringID = $str->GetStringID();
316 $rootHit = ($currentProject->GetParentID() == 0);
319 if($currentProject->GetParentID() != 0 && empty($this->LocatedString))
342 unset ($this->LocatedProjects);
343 unset ($this->SiblingProjects);
344 unset ($this->ChildProjects);
352 $this->LocatedProjects[] = $proj;
353 $pid = $proj->GetParentID();
357 $this->ChildProjects =
new ProjectIterator($this->xProjectID, $this->ddlLocaleID,
true);
373 $string->SetTranslation($this->txtEditString);
385 $string->DestroyData();
397 $parent = $project->GetParentID();
398 $project->DestroyData();
417 if(count($this->LocatedProjects) > 0)
419 return $this->LocatedProjects[0];
LocateStringNext($missingOnly)
static GetRoots($localeID)
LocateString($locate=LOCATE_CURR)
DeleteProject($projectID)