00001 <?
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 include_once('TranslationString.php');
00022
00030 class StringIterator implements Iterator
00031 {
00032 private $ProjectID;
00033 private $ProjectStrings;
00035 private $Current;
00036 private $IsValid;
00043 public function __construct($projectID)
00044 {
00045 $DB =& GetDbConn();
00046 $Tables =& GetTables();
00047
00048 $this->ProjectID = $projectID;
00049
00050
00051 $rs = $DB->Execute("SELECT ID, Original, LocaleID, Translation, SentenceID, LastSeen, RowOrder FROM ".$Tables["Strings"]." WHERE ProjectID=? ORDER BY RowOrder", array($this->ProjectID));
00052
00053 while($row = $rs->FetchRow())
00054 {
00055
00056 $this->ProjectStrings[] = new TranslationString(
00057 $row["ID"],
00058 $this->ProjectID,
00059 $row["Original"],
00060 $row["LocaleID"],
00061 $row["Translation"],
00062 $row["SentenceID"],
00063 $row["LastSeen"],
00064 $row["RowOrder"]);
00065 }
00066 $this->rewind();
00067 }
00068
00069
00070
00074 public function rewind()
00075 {
00076 $this->Current = 0;
00077 }
00078
00082 public function hasMore()
00083 {
00084 return (count($this->ProjectStrings) > $this->Current);
00085 }
00086
00090 public function key()
00091 {
00092 return $this->Current;
00093 }
00094
00098 public function current()
00099 {
00100 return $this->ProjectStrings[$this->Current];
00101 }
00102
00106 public function next()
00107 {
00108 $this->Current++;
00109 }
00110
00114 public function valid()
00115 {
00116 return (count($this->ProjectStrings) > $this->Current);
00117 }
00118 }