Update plugin.php

This commit is contained in:
alexonweb 2016-11-09 00:56:41 +03:00 committed by GitHub
parent dbaf520653
commit 1b56a75cdf
1 changed files with 26 additions and 15 deletions

View File

@ -6,6 +6,7 @@ class pluginPages extends Plugin {
{
$this->dbFields = array(
'homeLink'=>1,
'childrens'=>1,
'label'=>'Pages'
);
}
@ -24,6 +25,12 @@ class pluginPages extends Plugin {
$html .= '<input name="homeLink" id="jshomeLink" type="checkbox" value="1" '.($this->getDbField('homeLink')?'checked':'').'>';
$html .= '<label class="forCheckbox" for="jshomeLink">'.$Language->get('Show home link').'</label>';
$html .= '</div>';
$html .= '<div>';
$html .= '<input type="hidden" name="childrens" value="0">';
$html .= '<input name="childrens" id="jschildrens" type="checkbox" value="1" '.($this->getDbField('childrens')?'checked':'').'>';
$html .= '<label class="forCheckbox" for="jschildrens">'.$Language->get('Show childrens').'</label>';
$html .= '</div>';
return $html;
}
@ -62,25 +69,29 @@ class pluginPages extends Plugin {
$html .= '<li class="parent">';
$html .= '<a class="parent'.( ($parent->key()==$Url->slug())?' active':'').'" href="'.$parent->permalink().'">'.$parent->title().'</a>';
// Check if the parent has children
if(isset($pagesParents[$parent->key()]))
{
$children = $pagesParents[$parent->key()];
// Show children elements?
if($this->getDbField('childrens')) {
// Print children
$html .= '<ul class="children">';
foreach($children as $child)
// Check if the parent has children
if(isset($pagesParents[$parent->key()]))
{
// Check if the child is published
if( $child->published() )
$children = $pagesParents[$parent->key()];
// Print children
$html .= '<ul class="children">';
foreach($children as $child)
{
$html .= '<li class="child">';
$html .= '<a class="'.( ($child->key()==$Url->slug())?' active':'').'" href="'.$child->permalink().'">'.$child->title().'</a>';
$html .= '</li>';
// Check if the child is published
if( $child->published() )
{
$html .= '<li class="child">';
$html .= '<a class="'.( ($child->key()==$Url->slug())?' active':'').'" href="'.$child->permalink().'">'.$child->title().'</a>';
$html .= '</li>';
}
}
$html .= '</ul>';
}
$html .= '</ul>';
}
}
$html .= '</li>';
}
@ -92,4 +103,4 @@ class pluginPages extends Plugin {
return $html;
}
}
}