2) $sem = 0; } $theme = 0; if (isset($_GET['theme'])) { $theme = intval($_GET['theme']); if ($theme<0) $theme = 0; } ?> Persian Compound Verbs

Persian Simple Verbs - Persian Compound Verbs

Sort verbs by: 0) print " - "; $link = $sort_titles[$i]; if ($sort[$i]!=$sort_param) { $link = "$link"; } print $link; if ($i==2) { print " [  info ]"; } elseif ($i==3) { print " [  info ]"; } } print "

Limit verbs to: "; for ($i=0; $i<=2; $i++) { if ($i>0) print " - "; $link = $sort_titles_sem[$i]; if ($i!=$sem) { $link = "$link"; } print $link; } print "

"; $r = mysql_query("SELECT * FROM pvc_topics WHERE t_id=$theme"); if ($topic = mysql_fetch_assoc($r)) { print "Theme: $topic[t_name]"; } else { print "Limit to a theme"; } print " v

\n"; $ctable = ''; $sortby = "v1.pers_inf"; switch ($sort_param) { case 'simple': $sortby = "c_pers_inf, v1.pers_inf"; break; case 'lambton': $sortby = "v1.comp_type, v1.pers_inf"; break; case 'dabir': $sortby = "v1.comp_dtype, v1.pers_inf"; break; } $sql = " SELECT v1.*, v2.id sp_id, v2.style sp_style, v2.pers_inf sp_pers_inf, v2.pers_presstem sp_pers_presstem, v2.trans_inf sp_trans_inf, v2.trans_presstem sp_trans_presstem, c.pers_inf c_pers_inf FROM $table v1 LEFT JOIN $table v2 ON v2.style_id=v1.id LEFT JOIN $table c ON v1.comp_id=c.id ".($theme>0 ? "LEFT JOIN ( SELECT * FROM pvc_verb_topics vt WHERE vt.topic_id=$theme ) t ON t.verb_id=v1.id" : '')." WHERE v1.comp_id<>-1 AND v1.style IN (0,3) AND v1.style_id=-1".($sem>0?" AND v1.comp_sem=$sem":"").($sort_param=='dabir'?" AND v1.comp_dtype>0":"").($theme>0?" AND NOT t.topic_id IS NULL":"")." ORDER BY $sortby"; $r = mysql_query($sql) or die(mysql_error()); $c_type = -2; $comp = ""; $prev_header = ''; $headers = array(); while ($row = mysql_fetch_assoc($r)) { switch ($sort_param) { case "simple": if ($prev_header!=$row['c_pers_inf']) { $prev_header = $row['c_pers_inf']; $headers[] = "$prev_header"; $ctable .= " "; } break; case "lambton": if ($c_type!=$row['comp_type']) { $prev_header = $lambton[$row['comp_type']]; $headers[] = "$prev_header"; $ctable .= " "; $c_type = $row['comp_type']; } break; case "dabir": if ($c_type!=$row['comp_dtype']) { $prev_header = $dabir[$row['comp_dtype']]; $headers[] = "$prev_header"; $ctable .= " "; $c_type = $row['comp_dtype']; } break; default: if (substr($row['pers_inf'], 0, 2)!=$prev_header) { $prev_header = substr($row['pers_inf'], 0, 2); $headers[] = "$prev_header"; $ctable .= " "; $c_type = $row['comp_type']; } // $cur_comp = explode(" ", $row['pers_inf']); // array_pop($cur_comp); // $cur_comp = implode(" ", $cur_comp); // if ($cur_comp!=$comp) { // print " // // // "; // $comp = $cur_comp; // } // break; } $wr_id = -1; $id = -1; // Find the default spoken verb if (!is_null($row['sp_id'])) { $id = $row['sp_id']; // default written style if ($row['sp_style']==3) { $wr_id = $row['sp_id']; } $cnt = 0; do { $cnt++; $rt = mysql_query("SELECT * FROM $table WHERE style_id=$id"); if ($sprow = mysql_fetch_assoc($rt)) { $id = $sprow['id']; if ($sprow['style']==2) { // default spoken break; } // Don't go to infinitive loop if ($id==$row['sp_id'] || $id==$row['id'] || $cnt>10) { $id = -1; } } else { $id = -1; } } while ($id!=-1); // find first spoken verb if there is a default written verb if ($id==-1 && ($wr_id!=-1 || $row['style']==3)) { $id = $row['sp_id']; $cnt = 0; do { $cnt++; $rt = mysql_query("SELECT * FROM $table WHERE style_id=$id"); if ($sprow = mysql_fetch_assoc($rt)) { $id = $sprow['id']; if ($sprow['style']==1) { // spoken break; } // Don't go to infinitive loop if ($id==$row['sp_id'] || $id==$row['id'] || $cnt>10) { $id = -1; } } else { $id = -1; } } while ($id!=-1); } } $ctable .= " "; } if ($sort_param=='lambton' || $sort_param=='dabir') { $headers_text = implode('
', $headers); if ($sort_param=='lambton') { $headers_text = "You have selected sorting by the Lambton system:
$headers_text"; } else { $headers_text = "You have selected sorting by the Dabir-Moghaddam system:
$headers_text"; } } else $headers_text = implode(' - ', $headers); if (!empty($headers_text)) { print "
Transcription English Translation Perso-Arabic Script
spoken written نوشتاری گفتاری
^
$prev_header
^
".$prev_header."
^
".$prev_header."
^
".$prev_header."
$cur_comp
"; if (!is_null($row['sp_id'])) { if ($id!=-1) $ctable .= "$sprow[trans_inf]"; else $ctable .= "$row[sp_trans_inf]"; } else { $ctable .= " "; } if ($wr_id!=-1) { $ctable .= " $row[sp_trans_inf] "; } else { $ctable .= " $row[trans_inf] "; } $translation = $row['translation']; $tags = $row['tags']; if (empty($translation)) $ctable .= "not found"; else { $trans_ar = explode(",", $translation); $tags_ar = explode(",", $tags); $prev_meaning_tags = ''; for ($i=0; $i0) { $trans_ar[$i-1] .= ';'; } for ($k=0; $k$row[sp_pers_inf] "; } else { $ctable .= " $row[pers_inf] "; } if (!is_null($row['sp_id'])) { if ($id!=-1) $ctable .= "$sprow[pers_inf]"; else $ctable .= "$row[sp_pers_inf]"; } else { $ctable .= " "; } $ctable .= "

$headers_text

"; } print $ctable; ?>