mirror of
https://github.com/danpros/htmly.git
synced 2026-04-18 19:46:21 +05:30
Simple scheduled post
Publish a post with future date or time, it will go into scheduled posts.
This commit is contained in:
parent
9b162c2e5b
commit
212bdf4152
6 changed files with 424 additions and 100 deletions
|
|
@ -106,7 +106,18 @@ $( function() {
|
|||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<label for="pDate"><?php echo i18n('Date');?></label>
|
||||
<input type="date" id="pDate" name="date" class="form-control text" value="<?php echo date('Y-m-d'); ?>">
|
||||
</div>
|
||||
<div class="col">
|
||||
<label for="pTime"><?php echo i18n('Time');?></label>
|
||||
<input step="1" type="time" id="pTime" name="time" class="form-control text" value="<?php echo date('H:i:s'); ?>">
|
||||
</div>
|
||||
<small style="margin-top:10px;"><em>Publish a post with future date or time, it will go into scheduled posts.</em></small>
|
||||
</div>
|
||||
<br>
|
||||
<label for="pURL">Url (<?php echo i18n('optional');?>)</label>
|
||||
<input type="text" class="form-control text" id="pURL" name="url" value="<?php if (isset($postUrl)) { echo $postUrl;} ?>" placeholder="<?php echo i18n('If_the_url_leave_empty_we_will_use_the_post_title');?>"/>
|
||||
<br>
|
||||
|
|
|
|||
|
|
@ -39,7 +39,11 @@ $replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
|
|||
|
||||
// Category string
|
||||
$cat = explode('/', $replaced);
|
||||
$category = $cat[count($cat) - 3];
|
||||
if ($cat[count($cat) - 2] === 'scheduled') {
|
||||
$category = $cat[count($cat) - 4];
|
||||
} else {
|
||||
$category = $cat[count($cat) - 3];
|
||||
}
|
||||
|
||||
$dt = str_replace($replaced, '', $oldurl[0]);
|
||||
$t = str_replace('-', '', $dt);
|
||||
|
|
@ -161,6 +165,7 @@ $( function() {
|
|||
<label for="pTime"><?php echo i18n('Time');?></label>
|
||||
<input step="1" type="time" id="pTime" name="time" class="form-control text" value="<?php echo $time->format('H:i:s'); ?>">
|
||||
</div>
|
||||
<small style="margin-top:10px;"><em>Publish a post with future date or time, it will go into scheduled posts.</em></small>
|
||||
</div>
|
||||
<br>
|
||||
<label for="pURL">Url (<?php echo i18n('optional');?>)</label>
|
||||
|
|
|
|||
57
system/admin/views/scheduled.html.php
Normal file
57
system/admin/views/scheduled.html.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php if (!defined('HTMLY')) die('HTMLy'); ?>
|
||||
<h2 class="post-index"><?php echo $heading ?></h2>
|
||||
<br>
|
||||
<a class="btn btn-primary right" href="<?php echo site_url();?>admin/content"><?php echo i18n('Add_new_post');?></a>
|
||||
<br><br>
|
||||
<?php if (!empty($posts)) { ?>
|
||||
<table class="table post-list">
|
||||
<tr class="head">
|
||||
<th><?php echo i18n('Title');?></th>
|
||||
<th><?php echo i18n('Publish');?></th>
|
||||
<th><?php echo i18n('Category');?></th>
|
||||
<th><?php echo i18n('Tags');?></th>
|
||||
<th><?php echo i18n('Operations');?></th>
|
||||
</tr>
|
||||
<?php $i = 0;
|
||||
$len = count($posts); ?>
|
||||
<?php foreach ($posts as $p): ?>
|
||||
<?php
|
||||
if ($i == 0) {
|
||||
$class = 'item first';
|
||||
} elseif ($i == $len - 1) {
|
||||
$class = 'item last';
|
||||
} else {
|
||||
$class = 'item';
|
||||
}
|
||||
$i++;
|
||||
?>
|
||||
<tr class="<?php echo $class ?>">
|
||||
<td><?php echo $p->title ?></td>
|
||||
<td><?php echo format_date($p->date, 'd F Y, H:i:s') ?></td>
|
||||
<td><a href="<?php echo str_replace('category', 'admin/categories', $p->categoryUrl); ?>"><?php echo strip_tags($p->category);?></a></td>
|
||||
<td><?php echo $p->tag ?></td>
|
||||
<td><a class="btn btn-primary btn-xs" href="<?php echo $p->url ?>/edit?destination=admin/scheduled"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/scheduled"><?php echo i18n('Delete');?></a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<?php if (!empty($pagination['prev']) || !empty($pagination['next'])): ?>
|
||||
<br>
|
||||
<div class="pager">
|
||||
<ul class="pagination">
|
||||
<?php if (!empty($pagination['prev'])) { ?>
|
||||
<li class="newer page-item"><a class="page-link" href="?page=<?php echo $page - 1 ?>" rel="prev">← <?php echo i18n('Newer');?></a></li>
|
||||
<?php } else { ?>
|
||||
<li class="page-item disabled" ><span class="page-link">← <?php echo i18n('Newer');?></span></li>
|
||||
<?php } ?>
|
||||
<li class="page-number page-item disabled"><span class="page-link"><?php echo $pagination['pagenum'];?></span></li>
|
||||
<?php if (!empty($pagination['next'])) { ?>
|
||||
<li class="older page-item" ><a class="page-link" href="?page=<?php echo $page + 1 ?>" rel="next"><?php echo i18n('Older');?> →</a></li>
|
||||
<?php } else { ?>
|
||||
<li class="page-item disabled" ><span class="page-link"><?php echo i18n('Older');?> →</span></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php } else {
|
||||
echo 'No scheduled posts found!';
|
||||
} ?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue