Created
April 19, 2018 10:54
-
-
Save Amanskiy/661afae3a5e8cbc1b6e4987220fc1663 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Vokuro\Controllers; | |
use Vokuro\Forms\ProjectsForm; | |
use Vokuro\Models\Projects; | |
use Phalcon\MVC\Model\Criteria; | |
use Phalcon\Paginator\Adapter\Model as Paginator; | |
use Phalcon\Tag; | |
/** | |
* Display the default index page. | |
*/ | |
class IndexController extends ControllerBase | |
{ | |
/** | |
* Default action. Set the public layout (layouts/public.volt) | |
*/ | |
public function indexAction() | |
{ | |
$this->view->setVar('logged_in', is_array($this->auth->getIdentity())); | |
$this->view->setVar('user', is_array($this->auth->getUser())); | |
$this->view->setTemplateBefore('public'); | |
} | |
public function newsAction() | |
{ | |
$this->view->setVar('logged_in', is_array($this->auth->getIdentity())); | |
$this->view->setVar('user', is_array($this->auth->getUser())); | |
$this->view->setTemplateBefore('public'); | |
$numberPage = 1; | |
if ($this->request->isPost()) | |
{ | |
$query = Criteria::fromInput($this->di, 'Vokuro\Models\Projects', $this->request->getPost()); | |
$this->persistent->searchParams = $query->getParams(); | |
} | |
else | |
{ | |
$numberPage = $this->request->getQuery("page", "int"); | |
} | |
$parameters = []; | |
if ($this->persistent->searchParams) | |
{ | |
$parameters = $this->persistent->searchParams; | |
} | |
$projects = Projects::find($parameters); | |
if (count($projects) == 0) | |
{ | |
$this->flash->notice("Не найдено ни одного проекта"); | |
return $this->dispatcher->forward([ | |
"action" => "index" | |
]); | |
} | |
$paginator = new Paginator([ | |
"data" => $projects, | |
"limit" => 10, | |
"page" => $numberPage | |
]); | |
$duration = $this->ddiff(); | |
} | |
public function ddiff() | |
{ | |
$date1=date_create("2013-03-15"); | |
$date2=date_create("2013-12-12"); | |
$diff=date_diff($date1,$date2); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ content() }} | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> | |
{{ stylesheet_link('css/showprojects.css') }} | |
</head> | |
<header class="jumbotron subhead" id="overview"> | |
<div class="hero-unit"> | |
<p class="lead">Мониторинг инвестиционных проектов.</p> | |
<div class="btn-group"> | |
{{ link_to('index/news', 'Новые', 'class': 'btn btn-primary btn-large') }} | |
{{ link_to('index/hyip', 'Хайпы', 'class': 'btn btn-primary btn-large') }} | |
{{ link_to('index/games', 'Игры', 'class': 'btn btn-primary btn-large') }} | |
{{ link_to('index/other', 'Другие', 'class': 'btn btn-primary btn-large') }} | |
{{ link_to('index/scam', 'Не платит', 'class': 'btn btn-primary btn-large') }} | |
{{ link_to('pro/cashdesk', 'Касса взаимопомощи', 'class': 'btn btn-primary btn-large') }} | |
</div> | |
</div> | |
</header> | |
{% for projects in page.items %} | |
{% if loop.first %} | |
<tbody> | |
{% endif %} | |
{% if projects.section is '0' %} | |
<div class="column2"> | |
<div class="column3"> | |
<img src="http://test.revolution-games.ru/img/temp.png" class="img-rounded" alt="Temp" width="96" height="96"> | |
<p>{{ projects.name }}<br><a href="{{ projects.url }}" target="_blank" class="reg">Регистрация</a></p> | |
<p>Открытие: {{ projects.DateOpen }}</p> | |
<p>Работает {{ duration }} дней</p> | |
<p>Мониторим</p> | |
<p>Наш вклад</p> | |
<p>Выплачено</p> | |
<p>Мин. вклад: {{ projects.MinPay }}</p> | |
<p>Рефсистема: {% if projects.RefSystem is '0' %} | |
{{ "Есть" }} | |
{% elseif projects.RefSystem is '1' %} | |
{{ "Нет" }} | |
{% endif %}</p> | |
<p>Баллы: {% if projects.score is '0' %} | |
{{ "Есть" }} | |
{% elseif projects.score is '1' %} | |
{{ "Нет" }} | |
{% endif %}</p> | |
<p>Выплаты: {% if projects.PayType is '0' %} | |
{{ "Авто" }} | |
{% elseif projects.PayType is '1' %} | |
{{ "Ручная" }} | |
{% endif %}</p> | |
<p>Голосовать </p> | |
</div> | |
</div> | |
<div class="container"> | |
<!-- Trigger --> | |
<button type="button" class="btn btn-default btn-xs" id="p{{ projects.id }}">Подробнее</button> | |
<!-- Modal --> | |
<div class="modal fade" id="pm{{ projects.id }}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> | |
<div class="modal-dialog"> | |
<!-- Modal content --> | |
<div class="modal-content"> | |
<div class="modal-header"> | |
<button type="button" class="close" data-dismiss="modal">×</button> | |
<h4 class="modal-title">{{ projects.name }}</h4> | |
</div> | |
<div class="modal-body"> | |
<p>Детали</p> | |
</div> | |
<div class="model-footer"> | |
<button type="button" class="close" data-dismiss="modal">Закрыть</button> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<script> | |
$(document).ready(function () | |
{ | |
$("#p{{ projects.id }}").click(function () | |
{ | |
$("#pm{{ projects.id }}").modal(); | |
}); | |
}); | |
</script> | |
{% endif %} | |
</tbody> | |
{% else %} | |
Проекты не найдены | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment