public function actionAutocomplete()
 {
     $result = array();
     if (isset($_GET['term'])) {
         // http://www.yiiframework.com/doc/guide/database.dao
         $kiswahili = wortschatz::model()->trimSQL('kiswahili');
         $qtxt1 = "SELECT kiswahili FROM wortschatz WHERE ( " . $kiswahili . " LIKE :term ) GROUP BY 1 ORDER BY 1";
         $command1 = Yii::app()->db->createCommand($qtxt1);
         $command1->bindValue(":term", $_GET['term'] . '%', PDO::PARAM_STR);
         $result1 = $command1->queryColumn();
         //queryColumn() gibt nur die erste Spalte des Ergebnisses zurueck
         $qtxt2 = "SELECT noun_plural_swahili FROM wortschatz WHERE ( noun_plural_swahili LIKE :term ) GROUP BY 1 ORDER BY 1";
         $command2 = Yii::app()->db->createCommand($qtxt2);
         $command2->bindValue(":term", $_GET['term'] . '%', PDO::PARAM_STR);
         $result2 = $command2->queryColumn();
         //queryColumn() gibt nur die erste Spalte des Ergebnisses zurueck
         $qtxt3 = "SELECT deutsch FROM wortschatz WHERE ( deutsch LIKE :term ) GROUP BY 1 ORDER BY 1";
         $command3 = Yii::app()->db->createCommand($qtxt3);
         $command3->bindValue(":term", $_GET['term'] . '%', PDO::PARAM_STR);
         $result3 = $command3->queryColumn();
         //queryColumn() gibt nur die erste Spalte des Ergebnisses zurueck
         $resultA = CMap::mergeArray($result1, $result2);
         $result = CMap::mergeArray($resultA, $result3);
         sort($result);
     }
     echo CJSON::encode($result);
     Yii::app()->end();
 }
 public function run()
 {
     $search = new SearchForm();
     $controller = $this->getController();
     $controller->layout = 'form';
     if (isset($_GET['SearchForm'])) {
         $search->attributes = $_GET['SearchForm'];
         if ($search->validate()) {
             if ($search->searchq == '') {
                 $query = '%';
             } else {
                 $query = $search->searchq;
             }
             $kategorie = $search->kategorie;
             $wortart = $search->wortart;
             $klasse = '';
             // Suchoptionen filtern:
             $filteredResults = wortschatz::model()->filterSearchOptions($kategorie, $wortart, $klasse);
             // alle genauen Treffer:
             $exactSearchResults = wortschatz::model()->exactSearch($filteredResults, $query);
             $pages_exact = $exactSearchResults['pages'];
             $countAll_exact = $exactSearchResults['countAll'];
             $count_exact = $exactSearchResults['count'];
             $sort_exact = $exactSearchResults['sort'];
             $models_exact = $exactSearchResults['models'];
             $linkedExactResults = wortschatz::model()->addLinks($models_exact);
             $models_exact_linked = $linkedExactResults['models'];
             // alle LIKE-Treffer:
             $standardSearchResults = wortschatz::model()->standardSearch($filteredResults, $query);
             $pages_standard = $standardSearchResults['pages'];
             $countAll_standard = $standardSearchResults['countAll'];
             $count_standard = $standardSearchResults['count'];
             $sort_standard = $standardSearchResults['sort'];
             $models_standard = $standardSearchResults['models'];
             // LIKE-Treffer ohne genaue Treffer:
             $cleanedResults = wortschatz::model()->removeExactResults($models_standard, $models_exact);
             $linkedResults = wortschatz::model()->addLinks($cleanedResults['models']);
             $models_linked = $linkedResults['models'];
             if ($count_exact != 0 or $count_standard != 0) {
                 $controller->render('search', array('search' => $search, 'query' => $query, 'models' => $models_linked, 'pages' => $pages_standard, 'countAll' => $countAll_standard, 'count' => $count_standard, 'sort' => $sort_standard, 'models_exact' => $models_exact_linked, 'pages_exact' => $pages_exact, 'countAll_exact' => $countAll_exact, 'count_exact' => $count_exact, 'sort_exact' => $sort_exact));
             } else {
                 $controller->render('search', array('search' => $search, 'errortext' => 'Keine Daten gefunden'));
             }
         } else {
             $controller->render('search', array('search' => $search));
         }
     } else {
         $controller->render('search', array('search' => $search));
     }
 }
Esempio n. 3
0
echo $form->labelEx($model, 'anmerkung');
?>
		<?php 
echo $form->textField($model, 'anmerkung');
?>
		<?php 
echo $form->error($model, 'anmerkung');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'author');
?>
                <?php 
echo $form->dropDownList($model, 'author', CHtml::listData(wortschatz::model()->findAll(), 'author', 'author'), array('prompt' => 'alle Autoren'));
?>
		<?php 
echo $form->error($model, 'author');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'link');
?>
		<?php 
echo $form->textField($model, 'link');
?>
		<?php 
echo $form->error($model, 'link');
Esempio n. 4
0
        <table class="resultTable">
          <thead>
          <tr>
                <th class='resultsSwahili'>Orthographisch �hnliche W�rter - Kiswahili</th>
                <th class='resultsDeutsch'>Orthographisch �hnliche W�rter - Deutsch</th>
          </tr>
          </thead>
          <tbody>
               <tr>
                   <td>

        <?php 
    foreach ($similarWords['models_kiswahili'] as $n => $model) {
        ?>
                  <?php 
        echo wortschatz::model()->makeSearchLink(CHtml::encode($model->kiswahili)) . " ";
        ?>
        <?php 
    }
    ?>
                   </td>
                   <td></td>
               </tr>

          </tbody>
        </table>
<?php 
}
//endif
?>
-->
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the primary key value. Defaults to null, meaning using the 'id' GET variable
  */
 public function loadwortschatz($id = null)
 {
     if ($this->_model === null) {
         if ($id !== null || isset($_GET['id'])) {
             $this->_model = wortschatz::model()->findbyPk($id !== null ? $id : $_GET['id']);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }
 public function run()
 {
     $search = new SearchForm();
     $controller = $this->getController();
     $controller->layout = 'form';
     $controller->pageDescriptionMetaTag = false;
     //use the default Meta-Tag
     if (isset($_GET['SearchForm'])) {
         $search->attributes = $_GET['SearchForm'];
         if ($search->validate()) {
             if ($search->searchq == '') {
                 $query = '%';
             } else {
                 $query = $search->searchq;
             }
             // Ergebnis 1: alle Treffer die genau dem Suchbegriff entsprechen:
             $exactSearchResults = wortschatz::model()->exactSearch($query);
             $pages_exact = $exactSearchResults['pages'];
             $countAll_exact = $exactSearchResults['countAll'];
             $count_exact = $exactSearchResults['count'];
             $sort_exact = $exactSearchResults['sort'];
             $models_exact = $exactSearchResults['models'];
             // Ergebnis 2: alle Treffer die den Suchbegriff als Wort enthalten (enthalten auch die genauen Treffer):
             $wordSearchResults = wortschatz::model()->wordSearch($query);
             $pages_word = $wordSearchResults['pages'];
             $countAll_word = $wordSearchResults['countAll'];
             $count_word = $wordSearchResults['count'];
             $sort_word = $wordSearchResults['sort'];
             $models_word = $wordSearchResults['models'];
             // Ergebnis 3: Wort-Treffer ohne genaue Treffer (Ergebnis 2 minus Ergebnis 1):
             $cleanedResults = wortschatz::model()->removeExactResults($models_word, $models_exact);
             $models_cleaned = $cleanedResults['models'];
             // Ergebnis 4: alle LIKE-Treffer (Wortteilsuche):
             $standardSearchResults = wortschatz::model()->standardSearch($query);
             $pages_standard = $standardSearchResults['pages'];
             $countAll_standard = $standardSearchResults['countAll'];
             $count_standard = $standardSearchResults['count'];
             $sort_standard = $standardSearchResults['sort'];
             $models_standard = $standardSearchResults['models'];
             // Ergebnis 5: LIKE-Treffer ohne Worttreffer und exakte Treffer (Ergebnis 4 minus Ergebnis 2):
             if ($models_word == NULL) {
                 $models_word = $models_exact;
             }
             $cleanedLikeResults = wortschatz::model()->removeExactResults($models_standard, $models_word);
             $models_likeCleaned = $cleanedLikeResults['models'];
             if ($count_exact != 0 or $count_word != 0) {
                 $controller->render('search', array('search' => $search, 'query' => $query, 'models' => $models_cleaned, 'pages' => $pages_standard, 'countAll' => $countAll_standard, 'count' => $count_standard, 'sort' => $sort_standard, 'models_exact' => $models_exact, 'pages_exact' => $pages_exact, 'countAll_exact' => $countAll_exact, 'count_exact' => $count_exact, 'sort_exact' => $sort_exact, 'models_like' => $models_likeCleaned));
             } else {
                 if ($count_exact == 0 and $count_word == 0 and $count_standard != 0) {
                     $controller->render('search', array('errortext' => 'Der exakte Suchbegriff wurde nicht gefunden. Unscharfe Ergebnisse:<br /><br />', 'search' => $search, 'query' => $query, 'models' => $models_standard, 'pages' => $pages_standard, 'countAll' => $countAll_standard, 'count' => $count_standard, 'sort' => $sort_standard, 'models_exact' => $models_exact, 'pages_exact' => $pages_exact, 'countAll_exact' => $countAll_exact, 'count_exact' => $count_exact, 'sort_exact' => $sort_exact, 'models_like' => $models_likeCleaned));
                 } else {
                     $controller->render('search', array('search' => $search, 'errortext' => 'Keine Daten gefunden'));
                 }
             }
         } else {
             $controller->render('search', array('search' => $search));
         }
     } else {
         $controller->render('search', array('search' => $search));
     }
 }
Esempio n. 7
0
        </div><!-- head_menu -->

    </div><!-- header -->
    
    <div id="content">
        <?php 
echo $content;
?>
    </div>

    <div id="footer">
        <div><a href="#" onclick="javascript:installSearchEngine();">Das Wörterbuch als Suche im Browser hinzufügen</a> | Wörterbuch kiswahili//deutsch (v<?php 
echo Yii::app()->params['version'];
?>
) | Copyright &copy; 2010 by Elias Vierneisel</div>
        <br /><div class="statistics"><?php 
$statistics = wortschatz::model()->statistics();
echo 'Gesamtzahl Einträge:' . $statistics['countAll'];
echo '<br />Einzelne Kiswahili-Stichwörter: ' . $statistics['countKiswahili'];
echo '<br />Einzelne deutsche Stichwörter: ' . $statistics['countDeutsch'];
echo '<br />Anzahl Beispiele/Ausdrücke: ' . $statistics['countBeispiele'];
print sprintf("<br /><br />Ausgeführt in %.4f Sek.\n", Yii::app()->timer->getTimer());
?>
        </div>
    </div><!-- footer -->
    </div><!-- div fixed end -->
    <div>&nbsp;</div>
</body>

</html>
Esempio n. 8
0
<?php

$this->pageTitle = Yii::app()->name . ' - Begriffe verwalten';
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('wortschatz-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Begriffe verwalten</h1>

<div style="width:100%"> <!-- if the column width should be exact put px here -->
    <?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'wortschatz-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'template' => '{summary} {pager} {items}', 'cssFile' => Yii::app()->baseUrl . '/css/customGridView.css', 'summaryText' => 'Ergebnis {start}-{end} von insgesamt {count}.', 'selectableRows' => '2', 'selectionChanged' => 'select', 'pager' => array('header' => false, 'cssFile' => Yii::app()->baseUrl . '/css/customPager.css', 'firstPageLabel' => 'Anfang', 'prevPageLabel' => '< zurück', 'nextPageLabel' => 'weiter >', 'lastPageLabel' => 'Ende'), 'columns' => array(array('class' => 'CCheckBoxColumn'), array('header' => 'Aktion', 'class' => 'CButtonColumn', 'template' => '{view} {update} {delete}', 'htmlOptions' => array('style' => 'width:60px; white-space:nowrap;')), array('name' => 'id', 'htmlOptions' => array('style' => 'width:10px')), array('name' => 'kiswahili', 'htmlOptions' => array('style' => 'width:160px')), array('name' => 'sw_grammatik_id', 'header' => '', 'filter' => CHtml::activeDropDownList($model, 'sw_grammatik_id', CHtml::listData(sw_grammatik::model()->findAll(), 'id', 'kurz'), array('prompt' => '')), 'htmlOptions' => array('style' => 'width:10px')), array('name' => 'sw_fachgebiet_id', 'header' => '', 'filter' => CHtml::activeDropDownList($model, 'sw_fachgebiet_id', CHtml::listData(sw_fachgebiet::model()->findAll(), 'id', 'kurz'), array('prompt' => '')), 'htmlOptions' => array('style' => 'width:10px')), array('name' => 'sw_gebrauch_id', 'header' => '', 'filter' => CHtml::activeDropDownList($model, 'sw_gebrauch_id', CHtml::listData(sw_gebrauch::model()->findAll(), 'id', 'kurz'), array('prompt' => '')), 'htmlOptions' => array('style' => 'width:10px')), array('name' => 'sw_region_id', 'header' => '', 'filter' => CHtml::activeDropDownList($model, 'sw_region_id', CHtml::listData(sw_region::model()->findAll(), 'id', 'kurz'), array('prompt' => '')), 'htmlOptions' => array('style' => 'width:10px')), array('name' => 'deutsch', 'htmlOptions' => array('style' => 'width:160px')), array('name' => 'deutsch_addition', 'header' => false, 'htmlOptions' => array('style' => 'width:10px')), array('name' => 'wortart_id', 'value' => '$data->wortart_rel->bezeichnung', 'filter' => CHtml::activeDropDownList($model, 'wortart_id', CHtml::listData(wortarten::model()->findAll(), 'id', 'bezeichnung'), array('prompt' => '')), 'htmlOptions' => array('style' => 'width:120px')), array('name' => 'herkunft_id', 'value' => '$data->herkunft_rel->bezeichnung', 'filter' => CHtml::activeDropDownList($model, 'herkunft_id', CHtml::listData(herkunft::model()->findAll(), 'id', 'kurz'), array('prompt' => '')), 'htmlOptions' => array('style' => 'width:70px')), array('name' => 'noun_class', 'filter' => CHtml::activeDropDownList($model, 'noun_class', CHtml::listData(klassen::model()->findAll(array('order' => 'id')), 'klasse_standard', 'klasse_standard'), array('prompt' => '')), 'htmlOptions' => array('style' => 'width:10px')), array('name' => 'noun_animate', 'header' => 'A', 'type' => 'raw', 'value' => 'CHtml::activeCheckBox($data,"noun_animate",array("disabled"=>"disabled"))', 'htmlOptions' => array('style' => 'width:10px')), array('name' => 'noun_singular_swahili', 'header' => 'Singular', 'htmlOptions' => array('style' => 'width:160px')), array('name' => 'noun_class_singular', 'header' => 'Kl.', 'htmlOptions' => array('style' => 'width:15px')), array('name' => 'noun_plural_swahili', 'header' => 'Plural (Sw)', 'htmlOptions' => array('style' => 'width:160px')), array('name' => 'noun_class_plural', 'header' => 'Kl.', 'htmlOptions' => array('style' => 'width:15px'), 'filter' => CHtml::activeDropDownList($model, 'noun_class_plural', CHtml::listData(wortschatz::model()->findAll(), 'noun_class_plural', 'noun_class_plural'), array('prompt' => ''))), array('name' => 'noun_plural_deutsch', 'header' => 'Plural (D)', 'htmlOptions' => array('style' => 'width:160px')), array('name' => 'verb_monosyllabic', 'header' => 'M', 'type' => 'raw', 'value' => 'CHtml::activeCheckBox($data,"verb_monosyllabic",array("disabled"=>"disabled"))', 'htmlOptions' => array('style' => 'width:10px')), array('name' => 'verb_stem', 'htmlOptions' => array('style' => 'width:100px')), array('name' => 'verb_infinitive', 'htmlOptions' => array('style' => 'width:100px')), array('name' => 'kategorie_id', 'value' => '$data->kategorie_rel->bezeichnung', 'filter' => CHtml::activeDropDownList($model, 'kategorie_id', CHtml::listData(kategorien::model()->findAll(), 'id', 'bezeichnung'), array('prompt' => '')), 'htmlOptions' => array('style' => 'width:120px')), array('name' => 'grundwortschatz', 'header' => 'G', 'type' => 'raw', 'value' => 'CHtml::activeCheckBox($data,"grundwortschatz",array("disabled"=>"disabled"))', 'htmlOptions' => array('style' => 'width:10px')), array('name' => 'anmerkung', 'htmlOptions' => array('style' => 'width:220px')), array('name' => 'link', 'htmlOptions' => array('style' => 'width:80px')), array('name' => 'quelle', 'htmlOptions' => array('style' => 'width:100px')), array('name' => 'author', 'htmlOptions' => array('style' => 'width:30px')))));
?>
    
    <?php 
// small script to process the selected row. Add "alert(test[0]);" to the the function will display the (first) id
Yii::app()->clientScript->registerScript("selectedRows", "function select() { var test = new Array();  test=\$.fn.yiiGridView.getSelection('wortschatz-grid'); };", 4);
?>
</div>