Пример #1
0
 /** Gets TMeaning object by page_id
  * @return TMeaning or NULL in case of error
  */
 public static function getByPageAndLang($page_id, $lang_code = '')
 {
     $meaning_arr = array();
     $lang_pos_arr = TLangPOS::getIDByPageAndLang($page_id, $lang_code);
     foreach ($lang_pos_arr as $lang_pos_id) {
         $meaning_arr = array_merge($meaning_arr, (array) self::getMeaning("lang_pos_id", $lang_pos_id));
     }
     return $meaning_arr;
 }
Пример #2
0
 /** Gets array of TPage objects with SQL "WHERE" $condition .
  * @return array[TPage] or empty array in case of error
  */
 public function getPage(string $condition) : array
 {
     $link_db = Piwidict::getDatabaseConnection();
     $limit = Piwidict::getLimitRequest();
     $query = "SELECT * FROM page WHERE {$condition} order by page_title";
     if ($limit > 0) {
         $query .= " LIMIT 0, {$limit}";
     }
     $result = $link_db->query_err($query, __FILE__, __LINE__, __METHOD__);
     if ($link_db->query_count($result) == 0) {
         return array();
     }
     $page_arr = array();
     while ($row = $result->fetch_object()) {
         $page = new TPage($row->id, $row->page_title, $row->word_count, $row->wiki_link_count, $row->is_in_wiktionary, $row->is_redirect, $row->redirect_target, array());
         $page->lang_pos = TLangPOS::getByPage($row->id, $page);
         $page_arr[] = $page;
     }
     //  if (sizeof($page_arr
     return $page_arr;
 }
Пример #3
0
 /** Gets array of TLangPOS objects by lang_id.
  * @return array[TLangPOS] or empty array if data is absent. */
 public static function getByLang(int $lang_id, TLang $lang_obj = NULL) : array
 {
     return TLangPOS::getLangPOS("lang_id", $lang_id, $lang_obj);
 }