本文整理汇总了PHP中Text::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::model方法的具体用法?PHP Text::model怎么用?PHP Text::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text
的用法示例。
在下文中一共展示了Text::model方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionUpdate
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' => 'Виртуальные страницы'));
}
示例2: actionReferat
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]);
}
示例3: elseif
<?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
示例4: array
<?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><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></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')))));
示例5: loadModel
/**
* 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;
}
示例6: actionGlossarBearbeiten
/**
* @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]);
}
示例7: actionUpdate
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);
}
示例8: insertTooltips
/**
* @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ü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;
}