Skip to content

Commit

Permalink
Merge pull request #674 from mindline-analytics/feat-sort-samples
Browse files Browse the repository at this point in the history
Adds nat sortation to sample files menu and fixes "markAsFinal"
  • Loading branch information
Progi1984 committed Sep 7, 2021
2 parents 0116c89 + 7b04d83 commit 3a9d316
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion samples/Sample_13_MarkAsFinal.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$objPHPPresentation = new PhpPresentation();

// Mark the document as final
$objPHPPresentation->markAsFinal(true);
$objPHPPresentation->getPresentationProperties()->markAsFinal(true);

// Create slide
echo date('H:i:s') . ' Create slide' . EOL;
Expand Down
13 changes: 9 additions & 4 deletions samples/Sample_Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,17 @@
$name = str_replace('_', ' ', preg_replace('/(Sample_|\.php)/', '', $file));
$group = substr($name, 0, 1);
if (!isset($files[$group])) {
$files[$group] = '';
$files[$group] = [];
}
$files[$group] .= "<li><a href='{$file}'>{$name}</a></li>";
$files[$group][$name] = "<li><a href='{$file}'>{$name}</a></li>";
}
}
closedir($handle);

foreach ($files as $group => $a) {
natsort($files[$group]);
}
ksort($files);
}

/**
Expand Down Expand Up @@ -497,10 +502,10 @@ protected function getConstantName($class, $search, $startWith = '')
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<?php foreach ($files as $key => $fileStr) { ?>
<?php foreach ($files as $key => $groupfiles) { ?>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-code fa-lg"></i>&nbsp;Samples <?php echo $key; ?>x<strong class="caret"></strong></a>
<ul class="dropdown-menu"><?php echo $fileStr; ?></ul>
<ul class="dropdown-menu"><?php echo implode('', $groupfiles); ?></ul>
</li>
<?php } ?>
</ul>
Expand Down

0 comments on commit 3a9d316

Please sign in to comment.