/** Gets TTranslationEntry object by property $property_name with value $property_value.
  * @return TTranslationEntry or NULL in case of error
  */
 public static function getTranslationEntry($property_name, $property_value, $translation_obj = NULL)
 {
     $link_db = Piwidict::getDatabaseConnection();
     $query = "SELECT * FROM translation_entry 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;
     }
     $translationEntry_arr = array();
     while ($row = $result->fetch_object()) {
         if ($translation_obj == NULL) {
             $translation_obj = TTranslation::getByID($row->translation_id);
         }
         $translationEntry_arr[] = new TTranslationEntry($row->id, $translation_obj, TLang::getByID($row->lang_id), TWikiText::getByID($row->wiki_text_id));
     }
     return $translationEntry_arr;
 }
Beispiel #2
0
 /** Gets TRelation object by property $property_name with value $property_value.
  * @return TRelation or NULL in case of error
  */
 public static function getRelation($property_name, $property_value, $meaning_obj = NULL)
 {
     $link_db = Piwidict::getDatabaseConnection();
     $query = "SELECT * FROM relation 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;
     }
     $relation_arr = array();
     while ($row = $result->fetch_object()) {
         /*
         	    if ($meaning_obj == NULL)
         	  	$meaning_obj = TMeaning::getByID($row->meaning_id);
         */
         $relation_arr[] = new TRelation($row->id, $meaning_obj, TWikiText::getByID($row->wiki_text_id), TRelationType::getByID($row->relation_type_id), $row->meaning_summary);
     }
     return $relation_arr;
 }
Beispiel #3
0
 /** Gets TMeaning object by property $property_name with value $property_value.
  * @return TMeaning or NULL in case of error
  */
 public static function getMeaning($property_name, $property_value, $lang_pos_obj = NULL)
 {
     $link_db = Piwidict::getDatabaseConnection();
     $query = "SELECT * FROM meaning 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;
     }
     $meaning_arr = array();
     while ($row = $result->fetch_object()) {
         /*
                 if ($lang_pos_obj == NULL)
                 $lang_pos_obj = TLangPOS::getByID($row->lang_pos_id);
         */
         $meaning = new TMeaning($row->id, $lang_pos_obj, $row->lang_pos_id, $row->meaning_n, TWikiText::getByID($row->wiki_text_id), $row->wiki_text_id);
         $meaning->relation = TRelation::getByMeaning($row->id, $meaning);
         $meaning->translation = TTranslation::getByMeaning($row->id, $meaning);
         $meaning->label_meaning = TLabelMeaning::getByMeaning($row->id, $meaning);
         $meaning_arr[] = $meaning;
     }
     return $meaning_arr;
 }