Skip to content

Commit

Permalink
Bug #14, fixes - split/chunk a Moodle course home-page.. [iet:6252860]
Browse files Browse the repository at this point in the history
  • Loading branch information
nfreear committed Jul 21, 2016
1 parent 5b50a71 commit a143983
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Generator/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function staticHtml($page)
</div>
EOT;
if (false === strpos($page->url, 'sideblock') || (isset($page->filename) && false === strpos($page->filename, '-resources-')) ) {
if (false === strpos($page->url, 'sideblock') || (isset($page->filename) && false === strpos($page->filename, '_resources-'))) {
$template .= <<<EOT
<script id="mbp-pg-data" type="application/json">
%json
Expand Down
8 changes: 5 additions & 3 deletions lib/Generator/StaticPages.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ protected function putSectionPage($section, $section_html)
'modulename' => 'section',
'filename' => $section_pages[ 'sid:' . $section->id ],
'name' => $section->title,
'content' => implode('\n', $section_html),
'content' => implode("\n", $section_html),
];
$sec_page->url = $this->url($sec_page->filename);
$filename = $this->output_dir . '/' . $sec_page->filename . '.htm';
Expand Down Expand Up @@ -302,7 +302,7 @@ protected function putUrlActivity($url)

protected function url($filename)
{
return $this->base . preg_replace('/^\-/', '', $filename);
return $this->base . preg_replace('/^[-_\.]/', '', $filename);
}

protected function putIndex()
Expand Down Expand Up @@ -343,7 +343,9 @@ protected function putYaml()
$yml_post = ": { }\n\n#End.\n";
$yml_join = ": { }\n ";

$bytes = file_put_contents($filename, $yml_pre . implode($yml_join, $this->references) . $yml_post);
$references = array_merge($this->opt('section_pages', []), $this->references);

$bytes = file_put_contents($filename, $yml_pre . implode($yml_join, $references) . $yml_post);
return $bytes;
}
}

0 comments on commit a143983

Please sign in to comment.