Other changes

This commit is contained in:
Dimo Belov 2018-07-10 23:51:48 +03:00
parent b290209a41
commit b276e543a7
3 changed files with 23 additions and 13 deletions

View File

@ -76,12 +76,6 @@
<textarea id="jseditor" style="display:none;"><?php echo $page->contentRaw(false) ?></textarea> <textarea id="jseditor" style="display:none;"><?php echo $page->contentRaw(false) ?></textarea>
</div> </div>
<div class="form-group mt-2">
<button id="jsbuttonSave" type="button" class="btn btn-primary"><?php echo $L->g('Publish') ?></button>
<button id="jsbuttonDraft" type="button" class="btn btn-secondary"><?php echo $L->g('Save as draft') ?></button>
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary"><?php echo $L->g('Cancel') ?></a>
</div>
</div> </div>
<!-- TABS IMAGES --> <!-- TABS IMAGES -->
@ -140,7 +134,7 @@
echo Bootstrap::formSelect(array( echo Bootstrap::formSelect(array(
'name'=>'type', 'name'=>'type',
'label'=>'Type', 'label'=>'Type',
'selected'=>$page->status(), 'selected'=>$page->type(),
'options'=>array( 'options'=>array(
''=>'- Default -', ''=>'- Default -',
'sticky'=>'Sticky', 'sticky'=>'Sticky',
@ -179,8 +173,19 @@
'placeholder'=>'', 'placeholder'=>'',
'value'=>$page->template() 'value'=>$page->template()
)); ));
?> ?>
</div> </div>
<div class="form-group mt-2">
<button id="jsbuttonSave" type="button" class="btn btn-primary">
<?php echo $L->g('Publish') ?>
</button>
<button id="jsbuttonDraft" type="button" class="btn btn-secondary">
<?php echo $L->g('Save as draft') ?>
</button>
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary">
<?php echo $L->g('Cancel') ?>
</a>
</div>
<!-- Modal for Categories --> <!-- Modal for Categories -->
<div id="jscategoryModal" class="modal fade" tabindex="-1" role="dialog"> <div id="jscategoryModal" class="modal fade" tabindex="-1" role="dialog">

View File

@ -93,7 +93,7 @@ class dbPages extends dbJSON
// Set type of the page // Set type of the page
if ($args['status']=='static') { if ($args['status']=='static') {
$args['type'] = 'page'; $args['type'] = 'static';
} }
// Set type to the variables // Set type to the variables
@ -346,7 +346,7 @@ class dbPages extends dbJSON
{ {
$tmp = $this->db; $tmp = $this->db;
foreach ($tmp as $key=>$fields) { foreach ($tmp as $key=>$fields) {
if ($fields['status']!='published') { if ($fields['status']!='published' || $fields['type'] != "") {
unset($tmp[$key]); unset($tmp[$key]);
} }
} }
@ -362,7 +362,7 @@ class dbPages extends dbJSON
{ {
$tmp = $this->db; $tmp = $this->db;
foreach ($tmp as $key=>$fields) { foreach ($tmp as $key=>$fields) {
if ($fields['status']!='static') { if ($fields['type']!='static') {
unset($tmp[$key]); unset($tmp[$key]);
} }
} }
@ -408,7 +408,7 @@ class dbPages extends dbJSON
{ {
$tmp = $this->db; $tmp = $this->db;
foreach ($tmp as $key=>$fields) { foreach ($tmp as $key=>$fields) {
if($fields['status']!='sticky') { if($fields['type']!='sticky') {
unset($tmp[$key]); unset($tmp[$key]);
} }
} }

View File

@ -399,7 +399,7 @@ class Page {
// (boolean) Returns TRUE if the page is static, FALSE otherwise // (boolean) Returns TRUE if the page is static, FALSE otherwise
public function isStatic() public function isStatic()
{ {
return ($this->getValue('status')=='static'); return ($this->getValue('type')=='static');
} }
// (string) Returns status of the page // (string) Returns status of the page
@ -408,6 +408,11 @@ class Page {
return $this->getValue('status'); return $this->getValue('status');
} }
public function type()
{
return $this->getValue('type');
}
// Returns the title field // Returns the title field
public function title() public function title()
{ {