public function actionUpdate($id)
 {
     $model = Rubrics::model()->findByPk($id);
     if (isset($_POST['Rubrics'])) {
         $model->attributes = $_POST['Rubrics'];
         $model->chpu = TranslitFilter::translitUrl($model->name);
         if ($model->save()) {
             $text = Text::model()->find('rubric_id=:rubricId', array(':rubricId' => $model->id));
             $text->text = $_POST['Text']['text'];
             $text->save();
             $returnUrl = '/admin/pages/';
             $this->redirect($returnUrl . '?' . Yii::app()->request->queryString);
         }
     }
     $this->render('form', array('model' => $model, 'title' => 'Виртуальные страницы'));
 }
 public function actionReferat($referat_url)
 {
     /** @var Referat $ref */
     $ref = Referat::model()->findByAttributes(["urlpart" => $referat_url]);
     if (!$ref) {
         die("Nicht gefunden");
     }
     $this->top_menu = "themen";
     $von = date("Y-m-d H:i:s", time() - 3600 * 24 * 30);
     $bis = date("Y-m-d H:i:s", time());
     $antraege_referat = Antrag::model()->neueste_stadtratsantragsdokumente_referat($ref->id, $von, $bis)->findAll();
     $text = Text::model()->findByAttributes(["typ" => 2, "titel" => $ref->name]);
     $my_url = Yii::app()->createUrl("/themen/referat/" . $referat_url);
     if ($this->binContentAdmin() && AntiXSS::isTokenSet("save")) {
         if (strlen($_REQUEST["text"]) == 0) {
             die("Kein Text angegeben");
         }
         $text->text = $_REQUEST["text"];
         $text->save();
         $this->msg_ok = "Gespeichert.";
     }
     $this->render("referat", ["referat" => $ref, "antraege_referat" => $antraege_referat, "text" => $text, "my_url" => $my_url]);
 }
Exemple #3
0
<?php 
if ($lesson->mediaType == "link") {
    ?>
<embed class="dxd-video-iframe" src="<?php 
    echo $lesson->mediaLink->url;
    ?>
" height="480" allowfullscreen="true">

<?php 
} elseif ($lesson->mediaType == "video") {
    $this->renderPartial('/lesson/_file_video', array('lesson' => $lesson));
} elseif ($lesson->mediaType == "text") {
    ?>
<div class="dxd-post-content" style="margin-bottom:30px;">
<?php 
    $text = Text::model()->findByPk($lesson->mediaId);
    echo $text->content;
    ?>
</div>
<?php 
}
?>

<div class="mt10">
    <!-- JiaThis 分享 -->
    <div class="pull-left">
        <?php 
$this->widget('ext.jiathis.JiaThis');
?>
    </div>
    <?php 
Exemple #4
0
<?php

$this->breadcrumbs = array('Texts' => array('index'), 'Manage');
$this->menu = array(array('label' => 'List Text', 'url' => array('index')));
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('text-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Manage Texts</h1>

<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php 
echo CHtml::link('Advanced Search', '#', array('class' => 'search-button'));
?>
<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$dataProvider = $model->search();
$dataProvider->pagination->pageSize = 50;
$this->widget('zii.widgets.grid.CGridView', array('id' => 'text-grid', 'dataProvider' => $dataProvider, 'filter' => $model, 'columns' => array(array('name' => 'id', 'headerHtmlOptions' => array('width' => '30px')), array('name' => 'category', 'value' => '$data->category', 'headerHtmlOptions' => array('width' => '50px'), 'filter' => CHtml::listData(Text::model()->findAll(array('distinct' => true, 'order' => 't.category DESC')), 'category', 'category'), 'sortable' => true), 'message', array('name' => 'language', 'filter' => CHtml::listData(Message::model()->findAll(array('distinct' => true, 'order' => 't.language DESC')), 'language', 'language')), 'translation', array('header' => 'Actions', 'type' => 'html', 'value' => 'CHtml::link( "Update", Yii::app()->createUrl("sac/text/create?id=".$data->id."&category=".$data->category."&language=".$data->language))', 'headerHtmlOptions' => array('width' => '50px')))));
Exemple #5
0
 /**
  * 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 ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Text::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 /**
  * @param int $id
  * @throws Exception
  */
 public function actionGlossarBearbeiten($id)
 {
     if (!$this->binContentAdmin()) {
         throw new Exception("Kein Zugriff");
     }
     $this->top_menu = "so_funktioniert";
     /** @var Text $eintrag */
     $eintrag = Text::model()->findByAttributes(["id" => $id, "typ" => Text::$TYP_GLOSSAR]);
     if (!$eintrag) {
         throw new Exception("Nicht gefunden");
     }
     if (AntiXSS::isTokenSet("speichern")) {
         $eintrag->titel = $_REQUEST["titel"];
         $eintrag->text = $_REQUEST["text"];
         $eintrag->edit_datum = new CDbExpression("NOW()");
         $eintrag->edit_benutzerIn_id = $this->aktuelleBenutzerIn()->id;
         $eintrag->save();
         $this->redirect($this->createUrl("infos/glossar"));
     }
     if (AntiXSS::isTokenSet("del")) {
         $eintrag->delete();
         $this->redirect($this->createUrl("infos/glossar"));
     }
     $this->render('glossar_bearbeiten', ["eintrag" => $eintrag]);
 }
 public function actionUpdate($url, $id)
 {
     foreach ($this->parseUrl($url) as $k => $v) {
         ${$k} = $v;
     }
     $model = $object->findByPk($id);
     //$this->performAjaxValidation($model);
     if ($_GET['del_image']) {
         $image = $_GET['del_image'];
         if ($model->{$image}) {
             $oldImage = $model->{$image};
             $model->{$image} = null;
             if ($model->save()) {
                 $uploadPath = $_SERVER['DOCUMENT_ROOT'] . '/userdata/';
                 $objectPath = $ctype . '/' . $ctype . '_' . $model->id . '/';
                 foreach ($this->image_size[$ctype][$image] as $k => $v) {
                     $thumbPath = $k . '/';
                     $file = $uploadPath . $objectPath . $thumbPath . $oldImage;
                     unlink($file);
                 }
                 $this->redirect('/' . Yii::app()->request->pathInfo);
             }
         }
     }
     if (isset($_POST['Text'])) {
         $text = Text::model()->find('rubric_id=:rubric_id', array(':rubric_id' => $rubric->id));
         $text->attributes = $_POST['Text'];
         if ($text->save()) {
             $this->redirect($rubric->getLink());
         }
     } else {
         if ($_POST['Rubrics']) {
             $rubric->attributes = $_POST['Rubrics'];
             if ($rubric->save()) {
                 $this->redirect($rubric->getLink());
             }
         } else {
             if ($_POST[$obj_class]) {
                 if ($_FILES['file']) {
                     foreach ($_FILES['file']['name'] as $k => $v) {
                         if ($v) {
                             $file[$k] = CUploadedFile::getInstanceByName('file[' . $k . ']');
                             if (in_array(strtolower($file[$k]->getExtensionName()), array('jpg', 'gif', 'png', 'jpeg'))) {
                                 $model->{$k} = $k . '.' . $file[$k]->getExtensionName();
                             } else {
                                 $model->{$k} = CUploadedFile::getInstanceByName('file[' . $k . ']');
                             }
                         }
                     }
                 }
                 $model->attributes = $_POST[$obj_class];
                 if ($model->save()) {
                     if ($file) {
                         $folder = dirname(Yii::app()->request->scriptFile);
                         $folder .= '/userdata/' . $ctype . '/' . $ctype . '_' . $model->id . '/';
                         foreach ($file as $k => $v) {
                             if (in_array(strtolower($file[$k]->getExtensionName()), array('jpg', 'gif', 'png', 'jpeg'))) {
                                 UploadImages::upload($file[$k]->getTempName(), $model->{$k}, $folder, $ctype, $k);
                             } else {
                                 $model->{$k}->saveAs($folder . $model->{$k}->getName());
                             }
                         }
                     }
                     $this->redirect($rubric->getLink() . '?' . Yii::app()->request->queryString);
                 }
             }
         }
     }
     $data = array('model' => $model, 'title' => $rubric->name, 'rubric' => $rubric);
     $this->render('/_form/update', $data);
 }
 /**
  * @param string $text_html
  * @return string
  */
 public static function insertTooltips($text_html)
 {
     /** @var Text[] $eintraege */
     $eintraege = Text::model()->findAllByAttributes(["typ" => Text::$TYP_GLOSSAR]);
     $regexp_parts = [];
     /** @var Text[] $tooltip_replaces */
     $tooltip_replaces = [];
     foreach ($eintraege as $ein) {
         $aliases = [strtolower($ein->titel)];
         if ($ein->titel == "Fraktion") {
             $aliases[] = "fraktionen";
         }
         if ($ein->titel == "Ausschuss") {
             $aliases[] = "aussch&uuml;ssen";
         }
         foreach ($aliases as $alias) {
             $regexp_parts[] = preg_quote($alias);
             $tooltip_replaces[$alias] = $ein;
         }
     }
     $text_html = preg_replace_callback("/(?<pre>[^\\w])(?<word>" . implode("|", $regexp_parts) . ")(?<post>[^\\w])/siu", function ($matches) use($tooltip_replaces) {
         $eintrag = $tooltip_replaces[strtolower($matches["word"])];
         $text = strip_tags(html_entity_decode($eintrag->text, ENT_COMPAT, "UTF-8"));
         if (strlen($text) > 200) {
             $text = substr($text, 0, 198) . "... [weiter]";
         }
         $link = CHtml::encode(Yii::app()->createUrl("infos/glossar") . "#" . $eintrag->titel);
         $replace_html = '<a href="' . $link . '" class="tooltip_link" data-toggle="tooltip" data-placement="top" title="" data-original-title="' . CHtml::encode($text) . '">' . $matches["word"] . '</a>';
         return $matches["pre"] . $replace_html . $matches["post"];
     }, $text_html);
     /*
     foreach ($eintraege as $eintrag) if ($eintrag->titel == "Stadtrat") {
     
     }
     */
     return $text_html;
 }