Skip to content
Permalink
Browse files

lesson5 деталь. стр. статьи

  • Loading branch information...
vaajnur committed Mar 5, 2017
1 parent 8b4a16b commit eacac0f501d0a6484c3af6e5f12db60badc53b9f
@@ -8,6 +8,17 @@
use Lib\DateBase;
class Articles extends Model{
/**
* @param $id
* @return mixed
*/
public function getById($id){
$sql = 'SELECT * FROM article WHERE id = %s';
$result = DateBase::query($sql, $id);
$row = $result->fetch_assoc();
return $row;
}
/**
*
*/
@@ -0,0 +1,107 @@
<?php
/**
* Created by PhpStorm.
* User: valiev
* Date: 08.02.2016
* Time: 14:43
*/
?>
<!-- Left col -->
<section class="col-lg-12 connectedSortable">
<!-- quick email widget -->
<div class="box box-info">
<div class="box-body">
<h3 class="box-title">Редактировать статью</h3>
<!-- //////////////////////////////// form ////////////////////////////// -->
<form action="/admin/articles/edit/<?= $article['id'] ?>" method="post" name="add_article"
enctype="multipart/form-data">
<div class="form-group">
<input type="text" class="form-control" name="title" placeholder="" value="<?= $article['title'] ?>"/>
</div>
<img src="images/<?= $article['preview_pic'] ?>" alt="" class="preview">

<div class="callout callout-info"><span class="glyphicon glyphicon-paperclip"></span>
</div>

<!-- datepicker -->
<div class="form-group">
<label>Дата:</label>

<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" class="form-control pull-right" id="datepicker" name="date"
value="<?= $article['date'] ?>"/>
</div>
<!-- /.input group -->
</div>
<!-- anons -->
<p class="lead">Анонс:</p>
<textarea name="anons" id="anons" cols="30" rows="10"><?= $article['anons'] ?></textarea>
<!-- HTML editor -->
<div class='box'>
<div class='box-header'>
<h3 class='box-title'>Текст статьи</h3>
<!-- tools box -->
<div class="pull-right box-tools">
<button class="btn btn-default btn-sm" data-widget='collapse' data-toggle="tooltip"
title="Collapse"><i class="fa fa-minus"></i></button>
<button class="btn btn-default btn-sm" data-widget='remove' data-toggle="tooltip"
title="Remove"><i class="fa fa-times"></i></button>
</div>
<!-- /. tools -->
</div>
<!-- /.box-header -->
<div class='box-body pad'>
<div>
<textarea name="description" class="textarea" id="editor1"
placeholder="Place some text here"
style="width: 100%; height: 200px; font-size: 14px; line-height: 18px; border: 1px solid #dddddd; padding: 10px;">
<?= $article['description'] ?>
</textarea>
</div>
</div>
</div>
<!-- Select multiple category-->
<div class="form-group">
<label>Выберите категорию:</label>
<select name="category[]" multiple="multiple" class="form-control">
<? foreach ($article['categories'] as $categories): ?>
<option value="<?= $categories['id'] ?>"><?= $categories['name'] ?></option>
<? endforeach ?>
</select>
</div>
<div class="form-group">
<? if (isset($article['mess'])): ?>
<div class="alert alert-danger alert-dismissible">
<?= $article['mess']; ?>
</div>
<? endif ?>
<label for="exampleInputFile">Загрузка файлов</label>
<!-- error mess for pictures -->
<? if (!empty($article['mess'][0])) {
foreach ($article['mess'] as $mess) {
echo '
<div class="alert alert-danger alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<span><i class="icon fa fa-ban"></i></span>
' . $mess . '
</div>
';
}
}?>
<input name="picture[]" type="file" multiple="multiple" id="exampleInputFile">

<p class="help-block">Выберите файлы для загрузки</p>
</div>
<div class="box-footer clearfix">
<button type="submit" class="pull-right btn btn-default" name="send">Редактировать <i
class="fa fa-arrow-circle-right"></i></button>
</div>
</form>
<!-- //////////////////////////////// end form ////////////////////////////// -->
</div>
</div>

</section><!-- /.Left col -->
@@ -11,11 +11,8 @@
<th>Превью</th>
<th>Дата</th>
<th class="anons_td">Анонс</th>
<!-- <th>Категория</th>
<th></th>
<th style=""></th> -->
<th></th>
</tr>
<!-- //////////////////////////////// Articles ////////////////////////////// -->
<? if (!empty($articles)): ?>
<? foreach ($articles as $key => $article): ?>
<tr>
@@ -31,25 +28,15 @@
</td>
<td><?= $article['date'] ?></td>
<td class="anons_td"><?= $article['anons'] ?>...</td>
<!-- <td class="category_td">
<?//= $article['name'] ?>
</td>
<td>
<a href="/admin/articles/edit/<?= $article['id'] ?>">
<span class="glyphicon glyphicon-edit"></span>
</a>
</td>
<td>
<a href="/admin/articles/delete/<?= $article['id'] ?>" class="delete_item"
data-confirm-title="Удалить запись?"
data-confirm-message="Вы действительно хотите удалить эту запись?">
<span class="glyphicon glyphicon-trash"></span>
</a>
</td> -->

<td>
<a href="/admin/articles/article/<?= $article['id'] ?>">
<span class="glyphicon glyphicon-edit"></span>
</a>
</td>
</tr>
<? endforeach ?>
<? endif ?>
<!-- //////////////////////////////// end ////////////////////////////// -->
</table>
<div class="clearfix"></div>
</div>
@@ -152,8 +152,8 @@
-->
<script src="js/jquery-1.8.2.min.js"></script>
<!-- jQuery UI 1.10.3 -->
<!--<script src="js/jquery-ui-1.10.3.min.js" type="text/javascript"></script>-->
<!-- <script src="js/jquery-ui.min.js" type="text/javascript"></script> -->
<!-- <script src="js/jquery-ui-1.10.3.min.js" type="text/javascript"></script> -->
<script src="js/jquery-ui.min.js" type="text/javascript"></script>
<!-- Bootstrap -->
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<!-- Morris.js charts -->
@@ -179,9 +179,9 @@
<script src="js/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
-->
<!-- datepicker -->
<!--
<script src="js/plugins/datepicker/bootstrap-datepicker.js" type="text/javascript"></script>
-->

<!-- <script src="js/plugins/datepicker/bootstrap-datepicker.js" type="text/javascript"></script> -->

<!-- Bootstrap WYSIHTML5 -->
<!--<script src="js/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js" type="text/javascript"></script>-->

@@ -192,7 +192,7 @@
-->
<!-- AdminLTE App -->
<!-- <script src="js/AdminLTE/confirm-bootstrap.js"></script> -->
<!-- <script src="js/AdminLTE/app.js" type="text/javascript"></script> -->
<script src="js/app.js" type="text/javascript"></script>

<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
<!--

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,5 @@
;(function($){
$( "#datepicker" ).datepicker({
dateFormat: "yy-mm-dd"
});
})(jQuery)

Large diffs are not rendered by default.

Oops, something went wrong.

0 comments on commit eacac0f

Please sign in to comment.
You can’t perform that action at this time.