diff --git a/yii/protected/messages/en/dict.php b/yii/protected/messages/en/dict.php index 742dff2..38512d4 100644 --- a/yii/protected/messages/en/dict.php +++ b/yii/protected/messages/en/dict.php @@ -49,6 +49,13 @@ return array( 'ANIMATE' => 'Now this word is animate', 'INANIMATE' => 'Now this word is inanimate', + + '_MALE' => 'In this case, grammatical gender is Male', + '_FEMALE' => 'In this case, grammatical gender is Female', + '_NEUTER' => 'In this case, grammatical gender is Neuter', + + 'This is noun' => 'This is noun', + 'This is adjective' => 'This is adjective', '{n} records found.' => '{n} records found.', diff --git a/yii/protected/messages/ru/dict.php b/yii/protected/messages/ru/dict.php index 3db79ce..697c9ff 100644 --- a/yii/protected/messages/ru/dict.php +++ b/yii/protected/messages/ru/dict.php @@ -50,6 +50,12 @@ return array( 'ANIMATE' => 'В данном случае это слово одушевленное.', 'INANIMATE' => 'В данном случае это слово неодушевленное.', + '_MALE' => 'В данном случае это слово имеет мужской род.', + '_FEMALE' => 'В данном случае это слово имеет женский род.', + '_NEUTER' => 'В данном случае это слово имеет средний род.', + + 'This is noun' => 'Это существительное.', + 'This is adjective' => 'Это прилагательное.', '{n} records found.' => 'Найдено: {n} записей.', diff --git a/yii/protected/models/DictionaryForm.php b/yii/protected/models/DictionaryForm.php index 28fe644..92ff919 100644 --- a/yii/protected/models/DictionaryForm.php +++ b/yii/protected/models/DictionaryForm.php @@ -52,12 +52,12 @@ class DictionaryForm extends CFormModel public function resultExists() { - return ($this->serverIsWorking) && ($this->response) && ($this->response['nouns'] !== ""); + return ($this->serverIsWorking) && ($this->response) && ($this->response['words'] !== ""); } public function getDataProvider() { - $dataProvider=new CArrayDataProvider($this->response['nouns'], array( + $dataProvider=new CArrayDataProvider($this->response['words'], array( 'id'=>'dictionaryResultDataProvider', 'pagination'=>array( 'pageSize'=>10, diff --git a/yii/protected/runtime/application.log b/yii/protected/runtime/application.log index b86d56b..6f16434 100644 --- a/yii/protected/runtime/application.log +++ b/yii/protected/runtime/application.log @@ -1396,3 +1396,47 @@ REQUEST_URI=/cj/index.php?r=site/dictionary in C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\dictionaryResult.php (13) in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (69) in C:\Workplace\Apache2.4\htdocs\cj\index.php (25) +2014/12/09 14:36:15 [error] [php] Undefined index: nouns (C:\Workplace\Apache2.4\htdocs\cj\protected\models\DictionaryForm.php:55) +Stack trace: +#0 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): SiteController->renderInternal() +#1 C:\Workplace\yii1.1.15\framework\web\CController.php(869): SiteController->renderFile() +#2 C:\Workplace\yii1.1.15\framework\web\CController.php(782): SiteController->renderPartial() +#3 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(69): SiteController->render() +#4 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionDictionary() +#5 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams() +#6 C:\Workplace\yii1.1.15\framework\web\CController.php(286): SiteController->runAction() +#7 C:\Workplace\yii1.1.15\framework\web\CController.php(265): SiteController->runActionWithFilters() +#8 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): SiteController->run() +#9 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController() +#10 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest() +#11 C:\Workplace\Apache2.4\htdocs\cj\index.php(25): CWebApplication->run() +REQUEST_URI=/cj/index.php?r=site/dictionary +in C:\Workplace\Apache2.4\htdocs\cj\protected\models\DictionaryForm.php (55) +in C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\dictionaryResult.php (11) +in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (69) +2014/12/09 14:36:52 [error] [php] Undefined index: nominativeSingularForm (C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\_dictionaryResultView.php:15) +Stack trace: +#0 C:\Workplace\yii1.1.15\framework\zii\widgets\CListView.php(291): SiteController->renderFile() +#1 C:\Workplace\yii1.1.15\framework\zii\widgets\CBaseListView.php(167): CListView->renderItems() +#2 unknown(0): CListView->renderSection() +#3 C:\Workplace\yii1.1.15\framework\zii\widgets\CBaseListView.php(150): preg_replace_callback() +#4 C:\Workplace\yii1.1.15\framework\zii\widgets\CBaseListView.php(135): CListView->renderContent() +#5 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(173): CListView->run() +#6 C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\dictionaryResult.php(30): SiteController->widget() +#7 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require() +#8 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): SiteController->renderInternal() +#9 C:\Workplace\yii1.1.15\framework\web\CController.php(869): SiteController->renderFile() +#10 C:\Workplace\yii1.1.15\framework\web\CController.php(782): SiteController->renderPartial() +#11 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(69): SiteController->render() +#12 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionDictionary() +#13 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams() +#14 C:\Workplace\yii1.1.15\framework\web\CController.php(286): SiteController->runAction() +#15 C:\Workplace\yii1.1.15\framework\web\CController.php(265): SiteController->runActionWithFilters() +#16 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): SiteController->run() +#17 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController() +#18 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest() +#19 C:\Workplace\Apache2.4\htdocs\cj\index.php(25): CWebApplication->run() +REQUEST_URI=/cj/index.php?r=site/dictionary +in C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\_dictionaryResultView.php (15) +in C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\dictionaryResult.php (30) +in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (69) diff --git a/yii/protected/views/site/_dictionaryResultView.php b/yii/protected/views/site/_dictionaryResultView.php index f05da6e..1de7bd5 100644 --- a/yii/protected/views/site/_dictionaryResultView.php +++ b/yii/protected/views/site/_dictionaryResultView.php @@ -10,15 +10,35 @@ $this->pageTitle=Yii::t('app', Yii::app()->name);

-{nounNominative}'))?> +{nominative}
')); +echo Yii::t('dict', "This is noun") . "
"; +} + +if ($wordType === "adjective") +{ +$adjectiveData = $data["adjective"]; +echo str_replace('{nominative}', $adjectiveData["nominativeSingularForm"], Yii::t('dict', 'Most likely, original word is {nominative}
')); +echo Yii::t('dict', "This is adjective") . "
"; +} +?>

"; } -else if ($data["grammaticalCase"] === "NGC_P1_NOMINATIVE") +else if ($nounData["grammaticalCase"] === "NGC_P1_NOMINATIVE") { - $combinedStr = $data["grammaticalCase"] . "_" . $data["count"] . $genderSuffix; + $combinedStr = $nounData["grammaticalCase"] . "_" . $nounData["count"] . $genderSuffix; echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "
"; } else { - $combinedStr = $data["grammaticalCase"] . "_" . $data["count"] . $genderSuffix; + $combinedStr = $nounData["grammaticalCase"] . "_" . $nounData["count"] . $genderSuffix; echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "
"; } echo Yii::t('dict', $animateSuffix) . "
"; +} + +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)) . "
"; + +} +else if ($adjectiveData["grammaticalCase"] === "NGC_P1_NOMINATIVE") +{ + $combinedStr = $adjectiveData["grammaticalCase"] . "_" . $adjectiveData["count"] . $genderSuffix; + echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "
"; + +} +else +{ + $combinedStr = $adjectiveData["grammaticalCase"] . "_" . $adjectiveData["count"] . $genderSuffix; + echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "
"; +} + + +echo Yii::t('dict', $animateSuffix) . "
"; + +echo Yii::t('dict', $genderSuffix) . "
"; + +} ?>

+