public function getAllLogs() { $conn = self::$db->getConnection(); $query = FilterUtil::applyFilter(self::$SELECT_ALL); $stmt = $conn->prepare($query); $stmt->execute(); $error = $stmt->errorInfo(); $rows = $stmt->fetchAll(); $mainArray = array(); foreach ($rows as $row) { $array = array(); $array["timestamp"] = $row["timestamp"]; $array["message"] = $row["message"]; $array["level"] = $row["level"]; $array["file"] = $row["file"]; $array["line"] = $row["line"]; array_push($mainArray, $array); } return $mainArray; }
public function FindArrByFolder($folderSeq) { $conn = self::$db->getConnection(); $query = FilterUtil::applyFilter(self::$FIND_BY_FOLDER); $stmt = $conn->prepare($query); $stmt->bindValue(':folderseq', $folderSeq); $stmt->execute(); $error = $stmt->errorInfo(); $objArr = array(); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { array_push($objArr, $row); } $mainArr["Rows"] = $objArr; $mainArr["TotalRows"] = $this->getTotalCountByFolder($folderSeq); return $mainArr; }
public function executeAttributeQuery($attributes, $colValuePair, $isApplyFilter = false) { foreach ($colValuePair as $key => $value) { if ($value != '') { $query_array[] = $key . ' = ' . "'" . $value . "'"; } } $columns = implode(", ", $attributes); $query = "SELECT " . $columns . " FROM " . $this->tableName . " WHERE " . implode(" AND ", $query_array); if ($isApplyFilter) { $query = FilterUtil::applyFilter($query, false); } $db = MainDB::getInstance(); $conn = $db->getConnection(); $sth = $conn->prepare($query); $sth->execute(); //$this->throwException($sth->errorInfo()); $objList = $sth->fetchAll(); return $objList; }
public function FindAllUsersArr($locSeq) { $conn = self::$db_New->getConnection(); if ($locSeq != null && $locSeq > 0) { self::$SELECT_ALL_USERS_LOCATION_USERS .= " and lu.locationseq in (" . $locSeq . ")"; } $query = FilterUtil::applyFilter(self::$SELECT_ALL_USERS_LOCATION_USERS); $stmt = $conn->prepare($query); $stmt->execute(); $userArray = array(); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $locationNames = $this->getLocationNamesByUser($row["seq"]); if (count(explode(",", $locSeq)) > 1) { $row["username"] .= " (" . implode(", ", $locationNames) . ")"; } array_push($userArray, $row); } $mainArr["Rows"] = $userArray; $mainArr["TotalRows"] = $this->getTotalCount(self::$SELECT_ALL_USERS_LOCATION_USERS); return $mainArr; }
public function FindJsonByLocationSeqs($locationSeqs) { $conn = self::$db->getConnection(); $FIND_BY_LOCATION_SEQS = "select * from folder where locationseq in({$locationSeqs})"; $query = FilterUtil::applyFilter($FIND_BY_LOCATION_SEQS); $stmt = $conn->prepare($query); $stmt->execute(); $arr = array(); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { array_push($arr, $this->getJsonArray($row)); } $mainArr["Rows"] = $arr; $mainArr["TotalRows"] = $this->getTotalCount($FIND_BY_LOCATION_SEQS); return json_encode($mainArr); }