chinese-journal/yii/protected/views/site/_dictionaryResultView.php

152 lines
3.0 KiB
PHP

<?php
/* @var $this SiteController */
$this->pageTitle=Yii::t('app', Yii::app()->name);
?>
<hr>
<p>
<?php
$wordType = $data["word"];
$nounData = null;
$adjectiveData = null;
if ($wordType === "noun")
{
$nounData = $data["noun"];
echo str_replace('{nominative}', $nounData["nominativeSingularForm"], Yii::t('dict', 'Most likely, original word is <b>{nominative}</b><BR>'));
echo Yii::t('dict', "This is noun") . "<BR>";
}
if ($wordType === "adjective")
{
$adjectiveData = $data["adjective"];
echo str_replace('{nominative}', $adjectiveData["nominativeSingularForm"], Yii::t('dict', 'Most likely, original word is <b>{nominative}</b><BR>'));
echo Yii::t('dict', "This is adjective") . "<BR>";
}
?>
</p>
<p>
<?php
if ($wordType === "noun")
{
$animateSuffix = "";
if ($nounData["animated"] === "true")
{
$animateSuffix = "ANIMATE";
}
else
{
$animateSuffix = "INANIMATE";
}
$genderSuffix = "";
if ($nounData["count"] === "NC_SINGULAR")
{
if ($nounData["gender"] === "0")
{
$genderSuffix = "_MALE";
}
else if ($nounData["gender"] === "1")
{
$genderSuffix = "_FEMALE";
}
else
{
$genderSuffix = "_NEUTER";
}
}
if ($nounData["grammaticalCase"] === "NGC_P4_ACCUSATIVE")
{
$combinedStr = $nounData["grammaticalCase"] . "_" . $nounData["count"] . "_" . $animateSuffix . $genderSuffix;
echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "<BR>";
}
else if ($nounData["grammaticalCase"] === "NGC_P1_NOMINATIVE")
{
$combinedStr = $nounData["grammaticalCase"] . "_" . $nounData["count"] . $genderSuffix;
echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "<BR>";
}
else
{
$combinedStr = $nounData["grammaticalCase"] . "_" . $nounData["count"] . $genderSuffix;
echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "<BR>";
}
echo Yii::t('dict', $animateSuffix) . "<BR>";
}
if ($wordType === "adjective")
{
$animateSuffix = "";
if ($adjectiveData["animated"] === "true")
{
$animateSuffix = "ANIMATE";
}
else
{
$animateSuffix = "INANIMATE";
}
$genderSuffix = "";
if ($adjectiveData["count"] === "NC_SINGULAR")
{
if ($adjectiveData["gender"] === "0")
{
$genderSuffix = "_MALE";
}
else if ($adjectiveData["gender"] === "1")
{
$genderSuffix = "_FEMALE";
}
else
{
$genderSuffix = "_NEUTER";
}
}
if ($adjectiveData["grammaticalCase"] === "NGC_P4_ACCUSATIVE")
{
$combinedStr = $adjectiveData["grammaticalCase"] . "_" . $adjectiveData["count"] . "_" . $animateSuffix . $genderSuffix;
echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "<BR>";
}
else if ($adjectiveData["grammaticalCase"] === "NGC_P1_NOMINATIVE")
{
$combinedStr = $adjectiveData["grammaticalCase"] . "_" . $adjectiveData["count"] . $genderSuffix;
echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "<BR>";
}
else
{
$combinedStr = $adjectiveData["grammaticalCase"] . "_" . $adjectiveData["count"] . $genderSuffix;
echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "<BR>";
}
echo Yii::t('dict', $animateSuffix) . "<BR>";
echo Yii::t('dict', $genderSuffix) . "<BR>";
}
?>
</p>