Esempio n. 1
0
 /** Gets TTranslation object by property $property_name with value $property_value.
  * @return TTranslation or NULL in case of error
  */
 public static function getTranslation($property_name, $property_value, $meaning_obj = NULL)
 {
     $link_db = Piwidict::getDatabaseConnection();
     $query = "SELECT * FROM translation WHERE `{$property_name}`='{$property_value}' order by id";
     $result = $link_db->query_e($query, "Query failed in " . __METHOD__ . " in file <b>" . __FILE__ . "</b>, string <b>" . __LINE__ . "</b>");
     if ($link_db->query_count($result) == 0) {
         return NULL;
     }
     $translation_arr = array();
     while ($row = $result->fetch_object()) {
         /*
                 if ($meaning_obj == NULL)
                 $meaning_obj = TMeaning::getByID($row->meaning_id);
                
                 if ($meaning_obj != NULL)
                 $lang_pos_obj = $meaning_obj->getLangPOS();
                 else $lang_pos_obj = NULL;
         */
         $translation = new TTranslation($row->id, NULL, $row->meaning_summary, $meaning_obj);
         $translation->entry = TTranslationEntry::getByTranslation($row->id, $translation);
         $translation_arr[] = $translation;
     }
     return $translation_arr;
 }
Esempio n. 2
0
 /** Gets TTranslationEntry object by Translation
  * @return TTranslationEntry or NULL in case of error
  */
 public static function getByTranslation($translation_id, $translation_obj = NULL)
 {
     return TTranslationEntry::getTranslationEntry("translation_id", $translation_id, $translation_obj);
 }