| 88 | | $where_q = "WHERE correct=0"; // show all except blocked |
|---|
| 89 | | $order_q = "ORDER BY $this->_tbl_key"; |
|---|
| 90 | | |
|---|
| 91 | | $query = "SELECT * FROM $this->_tbl $where_q $order_q"; |
|---|
| 92 | | $this->_db->setQuery($query); |
|---|
| 93 | | $rows = $this->_db->loadRowList(); |
|---|
| 94 | | $res = array(); |
|---|
| 95 | | foreach($rows as $row) { |
|---|
| 96 | | array_push($res, |
|---|
| 97 | | array("name" => mb_convert_case($row["name"], MB_CASE_TITLE, 'UTF-8'), |
|---|
| 98 | | "correct" => $row["correct"])); |
|---|
| 99 | | } |
|---|
| 100 | | if (!$this->_db->query()) { |
|---|
| 101 | | echo $this->_db->stderr(); |
|---|
| 102 | | return array(); |
|---|
| 103 | | } |
|---|
| 104 | | return $res; |
|---|
| | 88 | $where_q = "WHERE correct=0"; // show all except blocked |
|---|
| | 89 | $order_q = "ORDER BY $this->_tbl_key"; |
|---|
| | 90 | |
|---|
| | 91 | $query = "SELECT * FROM $this->_tbl $where_q $order_q"; |
|---|
| | 92 | $this->_db->setQuery($query); |
|---|
| | 93 | $rows = $this->_db->loadRowList(); |
|---|
| | 94 | $res = array(); |
|---|
| | 95 | foreach($rows as $row) { |
|---|
| | 96 | array_push($res, |
|---|
| | 97 | array("name" => mb_convert_case($row["name"], MB_CASE_TITLE, 'UTF-8'), |
|---|
| | 98 | "correct" => $row["correct"])); |
|---|
| | 99 | } |
|---|
| | 100 | if (!$this->_db->query()) { |
|---|
| | 101 | echo $this->_db->stderr(); |
|---|
| | 102 | return array(); |
|---|
| | 103 | } |
|---|
| | 104 | return $res; |
|---|
| | 105 | } |
|---|
| | 106 | |
|---|
| | 107 | function listAll() { |
|---|
| | 108 | $order_q = "ORDER BY $this->_tbl_key"; |
|---|
| | 109 | |
|---|
| | 110 | $query = "SELECT * FROM $this->_tbl $order_q"; |
|---|
| | 111 | $this->_db->setQuery($query); |
|---|
| | 112 | $rows = $this->_db->loadRowList(); |
|---|
| | 113 | $res = array(); |
|---|
| | 114 | foreach($rows as $row) { |
|---|
| | 115 | array_push($res, |
|---|
| | 116 | array("name" => mb_convert_case($row["name"], MB_CASE_TITLE, 'UTF-8'), |
|---|
| | 117 | "correct" => $row["correct"])); |
|---|
| | 118 | } |
|---|
| | 119 | if (!$this->_db->query()) { |
|---|
| | 120 | echo $this->_db->stderr(); |
|---|
| | 121 | return array(); |
|---|
| | 122 | } |
|---|
| | 123 | return $res; |
|---|