Пример #1
0
 $arrayNum = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
 if (!empty($_POST["seo"])) {
     foreach (PostController::getAll() as $post) {
         if ($post->Seo == $_POST["seo"]) {
             $contador += 1;
         }
         foreach ($arrayNum as $num) {
             if ($post->Seo == $_POST["seo"] . "-" . $num) {
                 $contador += 1;
             }
         }
     }
     $_POST["seo"] .= "-" . $contador;
 } else {
     $url = DefaultHelper::gerarLinkSeo($_POST['titulo']);
     foreach (PostController::getAll() as $post) {
         if ($post->Seo == $url) {
             $contador += 1;
         }
         foreach ($arrayNum as $num) {
             if ($post->Seo == $_POST["seo"] . "-" . $num) {
                 $contador += 1;
             }
         }
     }
     $_POST["seo"] .= "-" . $contador;
 }
 if (empty($_POST['id'])) {
     $res = PostController::insert($_POST);
     //Tags
     $tags = array();
Пример #2
0
				<div class="col-lg-12">
					
					<a href="blog-posts-form" class="btn btn-primary pull-right"><i class="icon-plus icon-white"></i> Novo post</a>
					
					<table class="table table-hover">
						<thead>
							<tr>
								<th style="width: 160px">Data criação</th>
								<th>Título</th>
								<th style="width: 15%">Usuário</th>
								<th style="width: 20%"></th>
							</tr>
						</thead>
						<tbody>
							<?php 
foreach (PostController::getAll("", "DataCriacao DESC") as $post) {
    echo "\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t<td>" . DefaultHelper::converterData($post->DataCriacao) . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $post->Titulo . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $post->Usuario_Nome . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t<td class='align-right'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div class='btn-group'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<button class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<!--i class='fa fa-fw fa-bars'></i--><span class='caret'></span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ul class='dropdown-menu dropdown-menu-right'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href='blog-posts-form?id=" . $post->Id . "'>Editar</a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href='#' class='abrir-modal-avaliacoes' alt='" . $post->Id . "' data-toggle='modal' data-target='#modal-avaliacoes'>Avaliações</a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<li role='separator' class='divider'></li>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href='#' class='del' value='" . $post->Id . "' style='color: red;'>Excluir</button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t</tr>";
}
?>
						</tbody>
					</table>
				</div>
			</div>
			
		</div>
		
	</div>
	
	<!-- Avaliações do post -->
	<div class="modal fade" id="modal-avaliacoes" tabindex="-1" role="dialog" aria-labelledby="modal-avaliacoes-label">
		<div class="modal-dialog">