projectname)); $bl = trim(strtolower($b->projectname)); if ($al == $bl) { return 0; } return ($al > $bl) ? +1 : -1; } } usort($this->list, "cmp_obj"); } function getList() { return $this->list; } function setList($_list) { $this->list = $_list; } function add($_project) { $this->list[count($this->list)] = $_project; } function getCount() { return count($this->list); } function getItemAt($_pos) { if($_pos < $this->getCount()) { return $this->list[$_pos]; } } function selectProjectInfoList($_projectID = NULL, $_mainKey = NULL, $_subKey = NULL, $_value = NULL, $_projectInfoID = NULL , $_order_by = NULL) { $App = new App(); $sql = "SELECT DISTINCT ProjectID FROM ProjectInfo, ProjectInfoValues"; if ($_projectID) { $wheresql .= " ProjectID like '$_projectID%'"; } if ($_mainKey) { $wheresql = $this->addAndIfNotNull($wheresql); $wheresql .= " MainKey = '$_mainKey'"; } if ($_subKey) { $wheresql = $this->addAndIfNotNull($wheresql); $wheresql .= " SubKey = '$_subKey'"; } if ($_value) { $wheresql = $this->addAndIfNotNull($wheresql); $wheresql .= " Value = '$_value'"; } if ($_projectInfoID) { $wheresql = $this->addAndIfNotNull($wheresql); $wheresql .= " ProjectInfo.ProjectInfoID = '$_projectInfoID'"; } if($wheresql != "") { $wheresql = " WHERE " . $wheresql. " AND ProjectInfo.ProjectInfoID = ProjectInfoValues.ProjectInfoID"; } if($_order_by == "") { $_order_by = "MainKey"; } $_order_by = " ORDER BY " . $_order_by; $sql = $sql . $wheresql . $_order_by; $result = $App->eclipse_sql($sql) or die ("ProjectInfoList.selectProjectInfoList: ". mysql_error()); while ($sqlIterator = mysql_fetch_array($result)) { $projectID = $sqlIterator['ProjectID']; $ProjectInfoData = new ProjectInfoData($projectID); $this->add($ProjectInfoData); } } function addAndIfNotNull($_String) { # Accept: String - String to be AND'ed # return: string - AND'ed String if($_String != "") { $_String = $_String . " AND "; } return $_String; } } ?>