Render the print book table of contents.

@param array $chapters Array of book chapters
@param object $book The book object
@param object $cm The curse module object
@return string html for the TOC
776369
public function render_print_book_toc($chapters, $book, $cm) {

        $first = true;

        $context = context_module::instance($cm->id);

        $toc = ''; // Representation of toc (HTML).

        switch ($book->numbering) {
            case BOOK_NUM_NONE:
                $toc .= html_writer::start_tag('div', array('class' => 'book_toc_none'));
                break;
            case BOOK_NUM_NUMBERS:
                $toc .= html_writer::start_tag('div', array('class' => 'book_toc_numbered'));
                break;
            case BOOK_NUM_BULLETS:
                $toc .= html_writer::start_tag('div', array('class' => 'book_toc_bullets'));
                break;
            case BOOK_NUM_INDENTED:
                $toc .= html_writer::start_tag('div', array('class' => 'book_toc_indented'));
                break;
        }

        $toc .= html_writer::tag('a', '', array('name' => 'toc')); // Representation of toc (HTML).

        $toc .= html_writer::tag('h2', get_string('toc', 'mod_book'), ['class' => 'text-center p-b-2']);
        $toc .= html_writer::start_tag('ul');
        foreach ($chapters as $ch) {
            if (!$ch->hidden) {
                $title = book_get_chapter_title($ch->id, $chapters, $book, $context);
                if (!$ch->subchapter) {

                    if ($first) {
                        $toc .= html_writer::start_tag('li');
                    } else {
                        $toc .= html_writer::end_tag('ul');
                        $toc .= html_writer::end_tag('li');
                        $toc .= html_writer::start_tag('li');
                    }

                } else {

                    if ($first) {
                        $toc .= html_writer::start_tag('li');
                        $toc .= html_writer::start_tag('ul');
                        $toc .= html_writer::start_tag('li');
                    } else {
                        $toc .= html_writer::start_tag('li');
                    }

                }

                if (!$ch->subchapter) {
                    $toc .= html_writer::link(new moodle_url('#ch' . $ch->id), $title,
                            array('title' => s($title), 'class' => 'font-weight-bold text-decoration-none'));
                    $toc .= html_writer::start_tag('ul');
                } else {
                    $toc .= html_writer::link(new moodle_url('#ch' . $ch->id), $title,
                            array('title' => s($title), 'class' => 'text-decoration-none'));
                    $toc .= html_writer::end_tag('li');
                }
                $first = false;
            }
        }

        $toc .= html_writer::end_tag('ul');
        $toc .= html_writer::end_tag('li');
        $toc .= html_writer::end_tag('ul');
        $toc .= html_writer::end_tag('div');

        $toc = str_replace('<ul></ul>', '', $toc); // Cleanup of invalid structures.

        return $toc;
    }
1000023
public function render(array $chapter, array $params = array()) {
        $partial = 'partials/chapters/' . ($chapter['type'] ?: 'default') . '.phtml';
        $params['content'] = $chapter['content'];
        return $this->view->partial($partial, 'default', $params);
    }
21375
public function display($quiz, $cm, $course) {
        global $OUTPUT, $DB;

        raise_memory_limit(MEMORY_HUGE);

        $this->context = context_module::instance($cm->id);

        if (!quiz_has_questions($quiz->id)) {
            $this->print_header_and_tabs($cm, $course, $quiz, 'statistics');
            echo quiz_no_questions_message($quiz, $cm, $this->context);
            return true;
        }

        // Work out the display options.
        $download = optional_param('download', '', PARAM_ALPHA);
        $everything = optional_param('everything', 0, PARAM_BOOL);
        $recalculate = optional_param('recalculate', 0, PARAM_BOOL);
        // A qid paramter indicates we should display the detailed analysis of a sub question.
        $qid = optional_param('qid', 0, PARAM_INT);
        $slot = optional_param('slot', 0, PARAM_INT);
        $variantno = optional_param('variant', null, PARAM_INT);
        $whichattempts = optional_param('whichattempts', $quiz->grademethod, PARAM_INT);
        $whichtries = optional_param('whichtries', question_attempt::LAST_TRY, PARAM_ALPHA);

        $pageoptions = array();
        $pageoptions['id'] = $cm->id;
        $pageoptions['mode'] = 'statistics';

        $reporturl = new moodle_url('/mod/quiz/report.php', $pageoptions);

        $mform = new quiz_statistics_settings_form($reporturl, compact('quiz'));

        $mform->set_data(array('whichattempts' => $whichattempts, 'whichtries' => $whichtries));

        if ($whichattempts != $quiz->grademethod) {
            $reporturl->param('whichattempts', $whichattempts);
        }

        if ($whichtries != question_attempt::LAST_TRY) {
            $reporturl->param('whichtries', $whichtries);
        }

        // Find out current groups mode.
        $currentgroup = $this->get_current_group($cm, $course, $this->context);
        $nostudentsingroup = false; // True if a group is selected and there is no one in it.
        if (empty($currentgroup)) {
            $currentgroup = 0;
            $groupstudentsjoins = new \core\dml\sql_join();

        } else if ($currentgroup == self::NO_GROUPS_ALLOWED) {
            $groupstudentsjoins = new \core\dml\sql_join();
            $nostudentsingroup = true;

        } else {
            // All users who can attempt quizzes and who are in the currently selected group.
            $groupstudentsjoins = get_enrolled_with_capabilities_join($this->context, '',
                    array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'), $currentgroup);
            if (!empty($groupstudentsjoins->joins)) {
                $sql = "SELECT DISTINCT u.id
                    FROM {user} u
                    {$groupstudentsjoins->joins}
                    WHERE {$groupstudentsjoins->wheres}";
                if (!$DB->record_exists_sql($sql, $groupstudentsjoins->params)) {
                    $nostudentsingroup = true;
                }
            }
        }

        $qubaids = quiz_statistics_qubaids_condition($quiz->id, $groupstudentsjoins, $whichattempts);

        // If recalculate was requested, handle that.
        if ($recalculate && confirm_sesskey()) {
            $this->clear_cached_data($qubaids);
            redirect($reporturl);
        }

        // Set up the main table.
        $this->table = new quiz_statistics_table();
        if ($everything) {
            $report = get_string('completestatsfilename', 'quiz_statistics');
        } else {
            $report = get_string('questionstatsfilename', 'quiz_statistics');
        }
        $courseshortname = format_string($course->shortname, true,
                array('context' => context_course::instance($course->id)));
        $filename = quiz_report_download_filename($report, $courseshortname, $quiz->name);
        $this->table->is_downloading($download, $filename,
                get_string('quizstructureanalysis', 'quiz_statistics'));
        $questions = $this->load_and_initialise_questions_for_calculations($quiz);

        // Print the page header stuff (if not downloading.
        if (!$this->table->is_downloading()) {
            $this->print_header_and_tabs($cm, $course, $quiz, 'statistics');
        }

        if (!$nostudentsingroup) {
            // Get the data to be displayed.
            $progress = $this->get_progress_trace_instance();
            list($quizstats, $questionstats) =
                $this->get_all_stats_and_analysis($quiz, $whichattempts, $whichtries, $groupstudentsjoins, $questions, $progress);
        } else {
            // Or create empty stats containers.
            $quizstats = new \quiz_statistics\calculated($whichattempts);
            $questionstats = new \core_question\statistics\questions\all_calculated_for_qubaid_condition();
        }

        // Set up the table.
        $this->table->statistics_setup($quiz, $cm->id, $reporturl, $quizstats->s());

        // Print the rest of the page header stuff (if not downloading.
        if (!$this->table->is_downloading()) {

            if (groups_get_activity_groupmode($cm)) {
                groups_print_activity_menu($cm, $reporturl->out());
                if ($currentgroup && $nostudentsingroup) {
                    $OUTPUT->notification(get_string('nostudentsingroup', 'quiz_statistics'));
                }
            }

            if (!$this->table->is_downloading() && $quizstats->s() == 0) {
                echo $OUTPUT->notification(get_string('nogradedattempts', 'quiz_statistics'));
            }

            foreach ($questionstats->any_error_messages() as $errormessage) {
                echo $OUTPUT->notification($errormessage);
            }

            // Print display options form.
            $mform->display();
        }

        if ($everything) { // Implies is downloading.
            // Overall report, then the analysis of each question.
            $quizinfo = $quizstats->get_formatted_quiz_info_data($course, $cm, $quiz);
            $this->download_quiz_info_table($quizinfo);

            if ($quizstats->s()) {
                $this->output_quiz_structure_analysis_table($questionstats);

                if ($this->table->is_downloading() == 'html' && $quizstats->s() != 0) {
                    $this->output_statistics_graph($quiz->id, $qubaids);
                }

                $this->output_all_question_response_analysis($qubaids, $questions, $questionstats, $reporturl, $whichtries);
            }

            $this->table->export_class_instance()->finish_document();

        } else if ($qid) {
            // Report on an individual sub-question indexed questionid.
            if (!$questionstats->has_subq($qid, $variantno)) {
                print_error('questiondoesnotexist', 'question');
            }

            $this->output_individual_question_data($quiz, $questionstats->for_subq($qid, $variantno));
            $this->output_individual_question_response_analysis($questionstats->for_subq($qid, $variantno)->question,
                                                                $variantno,
                                                                $questionstats->for_subq($qid, $variantno)->s,
                                                                $reporturl,
                                                                $qubaids,
                                                                $whichtries);
            // Back to overview link.
            echo $OUTPUT->box('<a href="' . $reporturl->out() . '">' .
                              get_string('backtoquizreport', 'quiz_statistics') . '</a>',
                              'boxaligncenter generalbox boxwidthnormal mdl-align');
        } else if ($slot) {
            // Report on an individual question indexed by position.
            if (!isset($questions[$slot])) {
                print_error('questiondoesnotexist', 'question');
            }

            if ($variantno === null &&
                                ($questionstats->for_slot($slot)->get_sub_question_ids()
                                || $questionstats->for_slot($slot)->get_variants())) {
                if (!$this->table->is_downloading()) {
                    $number = $questionstats->for_slot($slot)->question->number;
                    echo $OUTPUT->heading(get_string('slotstructureanalysis', 'quiz_statistics', $number), 3);
                }
                $this->table->define_baseurl(new moodle_url($reporturl, array('slot' => $slot)));
                $this->table->format_and_add_array_of_rows($questionstats->structure_analysis_for_one_slot($slot));
            } else {
                $this->output_individual_question_data($quiz, $questionstats->for_slot($slot, $variantno));
                $this->output_individual_question_response_analysis($questions[$slot],
                                                                    $variantno,
                                                                    $questionstats->for_slot($slot, $variantno)->s,
                                                                    $reporturl,
                                                                    $qubaids,
                                                                    $whichtries);
            }
            if (!$this->table->is_downloading()) {
                // Back to overview link.
                echo $OUTPUT->box('<a href="' . $reporturl->out() . '">' .
                        get_string('backtoquizreport', 'quiz_statistics') . '</a>',
                        'backtomainstats boxaligncenter generalbox boxwidthnormal mdl-align');
            } else {
                $this->table->finish_output();
            }

        } else if ($this->table->is_downloading()) {
            // Downloading overview report.
            $quizinfo = $quizstats->get_formatted_quiz_info_data($course, $cm, $quiz);
            $this->download_quiz_info_table($quizinfo);
            if ($quizstats->s()) {
                $this->output_quiz_structure_analysis_table($questionstats);
            }
            $this->table->export_class_instance()->finish_document();

        } else {
            // On-screen display of overview report.
            echo $OUTPUT->heading(get_string('quizinformation', 'quiz_statistics'), 3);
            echo $this->output_caching_info($quizstats->timemodified, $quiz->id, $groupstudentsjoins, $whichattempts, $reporturl);
            echo $this->everything_download_options($reporturl);
            $quizinfo = $quizstats->get_formatted_quiz_info_data($course, $cm, $quiz);
            echo $this->output_quiz_info_table($quizinfo);
            if ($quizstats->s()) {
                echo $OUTPUT->heading(get_string('quizstructureanalysis', 'quiz_statistics'), 3);
                $this->output_quiz_structure_analysis_table($questionstats);
                $this->output_statistics_graph($quiz, $qubaids);
            }
        }

        return true;
    }
434596
public function cmdGetPage()
    {
        $result = $this->getListPage();
        $this->outputFormat($result);
        $this->outputFormatTablePage($result);
        $this->output();
    }
313817
protected function generateExcel(ExcelBook $book, Options $options = null)
    {
        $sheet = $book->addSheet('Sheet');
        $headerFormat = $this->getHeaderFormat($book);

        // Step 1, print header
        $specs = $this->getMetadataSpecs($book);
        $column_max_widths = array_fill_keys(array_keys((array) $specs), 0);
        $col_idx = 0;
        foreach ($specs as $name => $spec) {
            $sheet->write($row = 0, $col_idx, $spec['header'], $headerFormat);
            $column_max_widths[$name] = max(strlen($spec['header']) * $this->column_width_multiplier, $column_max_widths[$name]);
            ++$col_idx;
        }

        $sheet->setRowHeight(0, 30);

        // Fix the header
        $sheet->splitSheet(1, 0);

        // Fill document content

        $data = $this->store->getData($options);

        foreach ($data as $idx => $row) {
            $col_idx = 0;
            $row_idx = $idx + 1;
            $rowHeight = $sheet->rowHeight($row_idx);

            foreach ($specs as $name => $spec) {
                // Row may have no key in the case of customer renderers,
                // to prevent notice let's make it to null
                $value = isset($row[$name]) ? $row[$name] : null;

                if ($spec['format'] !== null) {
                    $format = $spec['format'];
                    if (is_callable($format)) {
                        // Dynamic column format
                        $sheet->write($row_idx, $col_idx, (string) $value, $format($book, $row[$spec['custom_column']], $spec['decimals']), ExcelFormat::AS_NUMERIC_STRING);
                    } else {
                        switch ($spec['type']) {
                            case 'number':
                                $sheet->write($row_idx, $col_idx, (string) $value, $spec['format'], ExcelFormat::AS_NUMERIC_STRING);
                                break;
                            case 'date':
                            case 'datetime':
                                if ($value != '') {
                                    $time = strtotime($value);
                                } else {
                                    $time = null;
                                }
                                $sheet->write($row_idx, $col_idx, $time, $spec['format'], ExcelFormat::AS_DATE);
                                break;
                            default:
                                if (preg_match('/(\n)/', $value)) {
                                    // More height when one cell contains multiple lines
                                    $sheet->setRowHeight($row_idx, ceil($rowHeight * 1.9));
                                }

                                $sheet->write($row_idx, $col_idx, $value, $format);
                        }
                    }
                } else {
                    $sheet->write($row_idx, $col_idx, $value);
                }
                $column_max_widths[$name] = max(strlen((string) $value) * $this->column_width_multiplier, $column_max_widths[$name]);
                ++$col_idx;
            }
        }

        foreach (array_values($column_max_widths) as $idx => $width) {
            $sheet->setColWidth($idx, ceil($idx), min($width, $this->column_max_width));
        }

        $sheet->setPrintGridlines(true);
        //$sheet->setPrintRepeatRows(1, 2);
        //$sheet->setPrintHeaders(true);
        //$sheet->setVerPageBreak($col_idx, true);

        return $book;
    }
870327
function renderChapterLabelField( $args ) {
		unset( $args['label_for'], $args['class'] );
		$this->renderField(
			[
				'id' => 'chapter_label',
				'name' => 'pressbooks_theme_options_' . $this->getSlug(),
				'option' => 'chapter_label',
				'value' => getset( $this->options, 'chapter_label' ),
				'description' => $args[0],
				'type' => 'text',
				'class' => 'regular-text',
			]
		);
	}
382679
public function render_print_book_page(print_book_page $page) {
        $data = $page->export_for_template($this);
        return parent::render_from_template('booktool_print/print_book', $data);
    }
1286244
public function getNavHTML($content_label){
		if( !$this->root ){
			return '';
		}
		$landmarks = '';
		$toc = '';
		foreach( $this->children as $child ){
			$toc .= $this->makeList($child, false);
			$landmarks .= $this->makeList($child, true, $content_label);
		}
		$html = <<<HTML
<nav epub:type="toc" id="toc">
	<ol>
		{$toc}
	</ol>
</nav>

<nav id="landmarks" epub:type="landmarks" hidden="hidden" class="hidden">
	<ol epub:type="list">
		{$landmarks}
	</ol>
</nav>
HTML;
		return trim($html);
	}
916780
public static void renderIndex(final PrintWriter out, final Collection<? extends HelpPage> pages) {
    checkNotNull(out);
    checkNotNull(pages);

    checkArgument(!pages.isEmpty(), "No help pages to render index");

    // construct a printf format with sizing for showing columns
    int max = pages.stream().mapToInt(page -> page.getName().length()).max().orElse(0);
    String nameFormat = "%-" + max + 's';

    for (HelpPage page : pages) {
      String formattedName = String.format(nameFormat, page.getName());
      out.format("  @{bold %s}", formattedName);

      String description = page.getDescription();
      if (description != null) {
        out.printf("   %s%n", description);
      }
      else {
        out.println();
      }
    }
  }
54457
protected function renderContent() {      
        ?>                
        <div id="maj-sosa-stats-page">
			<h2><?php echo $this->data->get('title'); ?></h2>
			
			<?php 
			/** @var \Fisharebest\Webtrees\Individual $root_indi */
			$root_indi = $this->data->get('root_indi');
			if($root_indi !== null && $root_indi->canShowName()) { ?>
			<h4 class="center"><?= I18N::translate('%s: %s', I18N::translate('Root individual'), $root_indi->getFullName()); ?><h4>
			<?php } ?>
			
			<?php  if($this->data->get('is_setup')) {  
			    $general_stats = $this->data->get('general_stats'); ?>
			<h3><?php echo I18N::translate('General statistics'); ?></h3>
			<div class="maj-table">
				<div class="maj-row">
					<div class="label"><?php echo I18N::translate('Number of ancestors'); ?></div>
					<div class="value"><?php echo I18N::number($general_stats['sosa_count']); ?></div>
				</div>
				<div class="maj-row">
					<div class="label"><?php echo I18N::translate('Number of different ancestors'); ?></div>
					<div class="value"><?php echo I18N::number($general_stats['distinct_count']); ?></div>
				</div>
				<div class="maj-row">
					<div class="label"><?php echo I18N::translate('%% of ancestors in the base'); ?></div>
					<div class="value"><?php echo I18N::percentage($general_stats['sosa_rate'], 1); ?></div>
				</div>
				<div class="maj-row">
					<div class="label"><?php echo I18N::translate('Pedigree collapse'); ?></div>
					<div class="value"><?php echo I18N::percentage($general_stats['pedi_collapse'], 2); ?></div>
				</div>
				<div class="maj-row">
					<div class="label"><?php echo I18N::translate('Mean generation time'); ?></div>
					<div class="value"><?php echo I18N::plural('%s year', '%s years', $general_stats['mean_gen_time'],  I18N::number($general_stats['mean_gen_time'], 1)); ?></div>
				</div>
			</div>
			
			<h3><?php echo I18N::translate('Statistics by generations'); ?></h3>
			<table class="maj-table">
				<thead>
					<tr class="maj-row">
						<th class="label" colspan="2" >&nbsp;</th>
						<th class="label help_tooltip" title="<?php echo I18N::translate('Theoretical number of ancestors in generation G.'); ?>">
							<?php  echo I18N::translate('Theoretical'); ?>
						</th>
						<th class="label help_tooltip" title="<?php echo I18N::translate('Number of ancestors found in generation G. A same individual can be counted several times.'); ?>">
							<?php  echo I18N::translate('Known'); ?>
						</th>				
						<th class="label help_tooltip" title="<?php echo I18N::translate('Ratio of found ancestors in generation G compared to the theoretical number.'); ?>">
							<?php  echo I18N::translate('%'); ?>
						</th>
						<th class="label help_tooltip" title="<?php echo I18N::translate('Number of ancestors not found in generation G, but whose children are known in generation G-1.'); ?>">
							<?php  echo I18N::translate('Losses G-1'); ?>
						</th>
						<th class="label help_tooltip" title="<?php echo I18N::translate('Ratio of not found ancestors in generation G amongst the theoretical ancestors in this generation whose children are known in generation G-1. This is an indicator of the completion of a generation relative to the completion of the previous generation.'); ?>">
							<?php  echo I18N::translate('%'); ?>
						</th>
						<th class="label help_tooltip" title="<?php echo I18N::translate('Cumulative number of ancestors found up to generation G. A same individual can be counted  several times.'); ?>">
							<?php  echo I18N::translate('Total known'); ?>
						</th>
						<th class="label help_tooltip" title="<?php echo I18N::translate('Ratio of cumulative found ancestors in generation G compared to the cumulative theoretical number.'); ?>">
						<?php  echo I18N::translate('%'); ?></th>
						<th class="label help_tooltip" title="<?php echo I18N::translate('Number of distinct ancestors found in generation G. A same individual is counted only once.'); ?>">
						<?php  echo I18N::translate('Different'); ?></th>
						<th class="label help_tooltip" title="<?php echo I18N::translate('Ratio of distinct individuals compared to the number of ancestors found in generation G.'); ?>">
						<?php  echo I18N::translate('%'); ?></th>
						<th class="label help_tooltip" title="<?php echo I18N::translate('Number of cumulative distinct ancestors found up to generation G. A same individual is counted only once in the total number, even if present in different generations.'); ?>">
						<?php  echo I18N::translate('Total Different'); ?></th>
						<th class="label help_tooltip" title="<?php echo I18N::translate('Pedigree collapse at generation G. Pedigree collapse is a measure of the real number of ancestors of a person compared to its theorical number. The higher this number is, the more marriages between related persons have happened. Extreme examples of high pedigree collapse are royal families for which this number can be as high as nearly 90%% (Alfonso XII of Spain).'); ?>">
						<?php  echo I18N::translate('Pedigree collapse'); ?></th>
					</tr>
				</thead>
				<tbody>
					<?php foreach($this->data->get('generation_stats') as $gen => $row) { ?>
					<tr class="maj-row">
						<td class="label"><?php echo I18N::translate('<strong>G%d</strong>', $gen); ?></td>
						<td class="label"><?php echo I18N::translate('%1$s <> %2$s', $row['gen_min_birth'], $row['gen_max_birth']); ?></td>
						<td class="value"><?php echo I18N::number($row['theoretical']); ?></td>
						<td class="value"><?php echo $row['known'] > 0 ? '<a href="'.$this->data->get('sosaanc_url').$gen.'">'.I18N::number($row['known']).'</a>' : I18N::number($row['known']); ?></td>
						<td class="value"><?php echo I18N::percentage($row['perc_known'], 2); ?></td>
						<td class="value"><?php echo $row['missing'] > 0 ? '<a href="'.$this->data->get('missinganc_url').$gen.'">'.I18N::number($row['missing']).'</a>' : I18N::number($row['missing']); ?></td>
						<td class="value"><?php echo I18N::percentage($row['perc_missing'], 2); ?></td>
						<td class="value"><?php echo I18N::number($row['total_known']); ?></td>
						<td class="value"><?php echo I18N::percentage($row['perc_total_known'], 2); ?></td>
						<td class="value"><?php echo I18N::number($row['different']); ?></td>
						<td class="value left percent_container">
							<div class="percent_frame">
								<div class="percent_cell" style="width:<?php echo 100*$row['perc_different'] ?>%;">
									&nbsp;<?php echo I18N::percentage($row['perc_different']); ?>&nbsp;
								</div>
							</div>
						</td>
						<td class="value"><?php echo I18N::number($row['total_different']); ?></td>
						<td class="value"><?php echo I18N::percentage($row['pedi_collapse'], 2); ?></td>
					</tr>
					<?php  } ?>
				</tbody>
				<tfoot>
					<tr class="maj-row">
						<td class="label" colspan="13">
							<?php echo I18N::translate('Generation-equivalent: %s generations', I18N::number($this->data->get('equivalent_gen'),2)); ?>
						</td>
					</tr>
				</tfoot>
			</table>
			<div class="center"><em><?php echo I18N::translate('Hover the column headers to display some help on their meaning.'); ?></em></div>
			
			<?php  
			$top10_multi_ancestors = $this->data->get('top10multiancestors');
			if(count($top10_multi_ancestors) > 0) { ?>
			<h3><?= I18N::translate('Most duplicated root Sosa ancestors'); ?></h3>
			<div class="maj-table">
			<?php foreach($top10_multi_ancestors as $count => $indis) { ?>
			    <div class="maj-row">
			    	<div class="label"><?= I18N::translate('%s times', I18N::number($count)); ?></div>
			    	<div class="value"><?php 
			    	echo implode(
			    	    I18N::$list_separator, 
			    	    array_map(function(Individual $indi) {
			    	        return '<a href="'. $indi->getHtmlUrl(). '">'. $indi->getFullName() . '&nbsp;' . $indi->getSexImage() . '</a>';
			    	    }, $indis)
			    	);
			    	?></div>
				</div>
			<?php } ?>
			</div>
			<?php } ?>
			
			<h3><?php echo I18N::translate('Known Sosa ancestors\' family dispersion'); ?></h3>
			<div class="center">
				<?php echo $this->data->get('chart_img_g2') ?: '' ; ?>
				<?php echo $this->data->get('chart_img_g3') ?: '' ; ?>				
				<!--  <canvas id="chart_ancestors_g2" width="300" height="300"></canvas>  -->
			</div>
			
			<?php   } else { ?>
			<div class="center warning"><?php echo I18N::translate('No Sosa root individual has been defined.'); ?></div>
			<?php }     
    }
1123366
public function transform(Book $book)
    {
        $payload = [
            'id' => (int) $book->id,
            'title' => $book->title,
            'description' => $book->description,
            'out_of_print' => (bool) $book->out_of_print == 1,
            'published_yr' => property_exists($book, 'published_at') ? $book->published_at->format('Y') : 'unknown',
            'link' => [
                'rel' => 'self',
                'href' => route(
                    'v1.books.show', [
                    'id' => $book->id,
                    'include' => 'author',
                ]
                ),
            ],
            'author' => $book->author->name,
        ];

        return $this->buildPayload($payload);
    }
1275697
public function renderPage()
    {
        $contents = $this->pageContents;

        /**
         * @event cms.page.render
         * Provides an oportunity to manipulate the page's rendered contents
         *
         * Example usage:
         *
         *     Event::listen('cms.page.render', function ((\Cms\Classes\Controller) $controller, (string) $pageContents) {
         *         return 'My custom contents';
         *     });
         *
         * Or
         *
         *     $CmsController->bindEvent('page.render', function ((string) $pageContents) {
         *         return 'My custom contents';
         *     });
         *
         */
        if ($event = $this->fireSystemEvent('cms.page.render', [$contents])) {
            return $event;
        }

        return $contents;
    }
291543
function renderHeader(&$header)
    {
        $this->_ary['sections'][$this->_sectionCount] = array(
            'header' => $header->toHtml(),
            'name'   => $header->getName()
        );
        $this->_currentSection = $this->_sectionCount++;
    }
1152406
protected function renderContent() {
        
        if (Module::getModuleByName('ckeditor')) {
            CkeditorModule::enableEditor($this->ctrl);
        }
        
        /** @var AbstractModule $module  */
        $module = $this->data->get('module');        
        ?>        
        <ol class="breadcrumb small">
        	<li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li>
			<li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?></a></li>
			<li class="active"><?php echo $this->data->get('title'); ?></li>
		</ol>
		
		<h1><?php echo $this->data->get('title'); ?></h1>

		<form method="post" class="form-horizontal">
			<?php echo Filter::getCsrf(); ?>
			<input type="hidden" name="action" value="update">
			
			<h3><?php echo I18N::translate('Titles'); ?></h3>
			
			<!--  MAJ_TITLE_PREFIX -->        	
        	<div class="form-group">			
        		<label for="MAJ_TITLE_PREFIX" class="col-sm-3 control-label">
        			<?php echo I18N::translate('Title prefixes'); ?>
        		</label>
    			<div class="col-sm-9">
    				<input type="text" class="form-control" dir="auto" id="MAJ_TITLE_PREFIX" name="MAJ_TITLE_PREFIX" value="<?php echo Filter::escapeHtml($module->getSetting('MAJ_TITLE_PREFIX')); ?>" maxlength="255" placeholder="de |d'|du |of |von |vom |am |zur |van |del |della |t'|da |ten |ter |das |dos |af ">
        			<p class="small text-muted">
        				<?php echo I18N::translate('Set possible aristocratic particles to separate titles from the land they refer to (e.g. Earl <strong>of</strong> Essex). Variants must be separated by the character |.'); ?><br />
        				<?php echo I18N::translate('An example for this setting is : <strong>de |d\'|du |of |von |vom |am |zur |van |del |della |t\'|da |ten |ter |das |dos |af </strong> (covering some of French, English, German, Dutch, Italian, Spanish, Portuguese, Swedish common particles).'); ?>
        			</p>
        		</div>        		
        	</div>
        	
        	<h3><?php echo I18N::translate('Header'); ?></h3>
        	
        	<!-- MAJ_ADD_HTML_HEADER -->
    		<div class="form-group">
    			<label class="control-label col-sm-3" for="MAJ_ADD_HTML_HEADER">
    				<?php echo I18N::translate('Include additional HTML in header'); ?>
    			</label>
    			<div class="col-sm-9">
    				<?php echo FunctionsEdit::editFieldYesNo('MAJ_ADD_HTML_HEADER', $module->getSetting('MAJ_ADD_HTML_HEADER', 0), 'class="radio-inline"'); ?>
				    <p class="small text-muted">
    					<?php echo I18N::translate('Enable this option to include raw additional HTML in the header of the page.'); ?>
    				</p>
    			</div>
    		</div>
        	
        	<!-- MAJ_SHOW_HTML_HEADER -->
        	<div class="form-group">
        		<label class="control-label col-sm-3" for="MAJ_SHOW_HTML_HEADER">
        			<?php echo I18N::translate('Hide additional header'); ?>
        		</label>
        		<div class="col-sm-9">
        			<?php echo FunctionsEdit::editFieldAccessLevel('MAJ_SHOW_HTML_HEADER', $module->getSetting('MAJ_SHOW_HTML_HEADER', Auth::PRIV_HIDE), 'class="form-control"'); ?>
        			<p class="small text-muted">
        				<?php echo I18N::translate('Select the access level until which the additional header should be displayed. The <em>Hide from everyone</em> should be used to show the header to everybody.'); ?>
        			</p>
        		</div>
        	</div>
        	
        	<!--  MAJ_HTML_HEADER -->        	
        	<div class="form-group">			
        		<label for="MAJ_HTML_HEADER" class="col-sm-3 control-label">
        			<?php echo I18N::translate('Additional HTML in header'); ?>
        		</label>
    			<div class="col-sm-9">
    				<textarea class="form-control html-edit" rows="10" dir="auto" id="MAJ_HTML_HEADER" name="MAJ_HTML_HEADER" ><?php echo Filter::escapeHtml($module->getSetting('MAJ_HTML_HEADER')); ?></textarea>
        			<p class="small text-muted">
        				<?php echo I18N::translate('If the option has been enabled, the saved HTML will be inserted in the header.'); ?><br>
        				<?php echo I18N::translate('In edit mode, the HTML characters might have been transformed to their HTML equivalents (for instance &amp;gt; for &gt;), it is however possible to insert HTML characters, they will be automatically converted to their equivalent values.'); ?>
        			</p>
        		</div>        		
        	</div>
        	
        	<h3><?php echo I18N::translate('Footer'); ?></h3>
        	
        	<!-- MAJ_DISPLAY_CNIL -->
    		<div class="form-group">
    			<label class="control-label col-sm-3" for="MAJ_DISPLAY_CNIL">
    				<?php echo I18N::translate('Display French <em>CNIL</em> disclaimer'); ?>
    			</label>
    			<div class="col-sm-9">
    				<?php echo FunctionsEdit::editFieldYesNo('MAJ_DISPLAY_CNIL', $module->getSetting('MAJ_DISPLAY_CNIL', 0), 'class="radio-inline"'); ?>
				    <p class="small text-muted">
    					<?php echo I18N::translate('Enable this option to display an information disclaimer in the footer required by the French <em>CNIL</em> for detaining personal information on users.'); ?>
    				</p>
    			</div>
    		</div>
    		
    		<!--  MAJ_CNIL_REFERENCE -->        	
        	<div class="form-group">			
        		<label for="MAJ_CNIL_REFERENCE" class="col-sm-3 control-label">
        			<?php echo I18N::translate('<em>CNIL</em> reference'); ?>
        		</label>
    			<div class="col-sm-9">
    				<input type="text" class="form-control" dir="auto" id="MAJ_CNIL_REFERENCE" name="MAJ_CNIL_REFERENCE" value="<?php echo Filter::escapeHtml($module->getSetting('MAJ_CNIL_REFERENCE')); ?>" maxlength="255">
        			<p class="small text-muted">
        				<?php echo I18N::translate('If the website has been notified to the French <em>CNIL</em>, an authorisation number may have been delivered. Providing this reference will display a message in the footer visible to all users.'); ?>
        			</p>
        		</div>        		
        	</div>
        	
        	<!-- MAJ_ADD_HTML_FOOTER -->
    		<div class="form-group">
    			<label class="control-label col-sm-3" for="MAJ_ADD_HTML_FOOTER">
    				<?php echo I18N::translate('Include additional HTML in footer'); ?>
    			</label>
    			<div class="col-sm-9">
    				<?php echo FunctionsEdit::editFieldYesNo('MAJ_ADD_HTML_FOOTER', $module->getSetting('MAJ_ADD_HTML_FOOTER', 0), 'class="radio-inline"'); ?>
				    <p class="small text-muted">
    					<?php echo I18N::translate('Enable this option to include raw additional HTML in the footer of the page.'); ?>
    				</p>
    			</div>
    		</div>
        	
        	<!-- MAJ_SHOW_HTML_FOOTER -->
        	<div class="form-group">
        		<label class="control-label col-sm-3" for="MAJ_SHOW_HTML_FOOTER">
        			<?php echo I18N::translate('Hide additional footer'); ?>
        		</label>
        		<div class="col-sm-9">
        			<?php echo FunctionsEdit::editFieldAccessLevel('MAJ_SHOW_HTML_FOOTER', $module->getSetting('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE), 'class="form-control"'); ?>
        			<p class="small text-muted">
        				<?php echo I18N::translate('Select the access level until which the additional footer should be displayed. The <em>Hide from everyone</em> should be used to show the footer to everybody.'); ?>
        			</p>
        		</div>
        	</div>
        	
        	<!--  MAJ_HTML_FOOTER -->        	
        	<div class="form-group">			
        		<label for="MAJ_HTML_FOOTER" class="col-sm-3 control-label">
        			<?php echo I18N::translate('Additional HTML in footer'); ?>
        		</label>
    			<div class="col-sm-9">
    				<textarea class="form-control html-edit" rows="10" dir="auto" id="MAJ_HTML_FOOTER" name="MAJ_HTML_FOOTER" ><?php echo Filter::escapeHtml($module->getSetting('MAJ_HTML_FOOTER')); ?></textarea>
        			<p class="small text-muted">
        				<?php echo I18N::translate('If the option has been enabled, the saved HTML will be inserted in the footer, before the logo.'); ?><br>
        				<?php echo I18N::translate('In edit mode, the HTML characters might have been transformed to their HTML equivalents (for instance &amp;gt; for &gt;), it is however possible to insert HTML characters, they will be automatically converted to their equivalent values.'); ?>
        			</p>
        		</div>        		
        	</div>
        	
        	<div class="form-group">
        		<div class="col-sm-offset-3 col-sm-9">
        			<button type="submit" class="btn btn-primary">
        				<i class="fa fa-check"></i>
        				<?php echo I18N::translate('save'); ?>
        			</button>
        		</div>
        	</div>
        	
        </form>
		
		<?php        
    }
903230
public function cmdGetLibrary()
    {
        $list = $this->getListLibrary();
        $this->outputFormat($list);
        $this->outputFormatTableLibrary($list);
        $this->output();
    }
119616
public static function create_from_chapter(\stdClass $book, \context_module $context, \stdClass $chapter) {
        $data = array(
            'context' => $context,
            'objectid' => $chapter->id,
        );
        /** @var chapter_printed $event */
        $event = self::create($data);
        $event->add_record_snapshot('book', $book);
        $event->add_record_snapshot('book_chapters', $chapter);
        return $event;
    }
1316474
public function cmfParse(\Twig_Environment $twig, Node $node, array $options = array())
    {
        $html = "";

        if ($node instanceof ContentNode) {

            /**
             * @var ContentNode $node
             */
            $template = $this->cmfContentParser->findTemplate($node);

            $refClass = $this->cmfContentParser->getNativeClassnamimg($node);

            $generated_classes = array("ContentNode", $refClass['name']);

            /**
             * parse css classes
             */
            $display_classes = array();
            $class_string = trim($node->getClasses());

            if ($class_string)
                $display_classes = explode(" ", $class_string);

            /*
             * workaround to avoid broken grid-layouts couz of missing xs sizing
             */
            if ( strpos($class_string,'col-xs') === false && !in_array(get_class($node), $this->notGridableContentNodeClasses))
                $generated_classes[] = "col-xs-12";


            $display_classes = array_merge($display_classes, $generated_classes);
            $display_classes = array_unique($display_classes);

            $html = $twig->render($template,
                array_merge_recursive(
                    array(
                        'node' => $node,
                        'node_class' => $refClass['name'],
                        'node_namespace' => $refClass['namespace'],
                        'display_classes' => implode(" ", $display_classes),
                        'generated_classes' => implode(" ", $generated_classes)
                    )
                    , $options
                )
            );
        }

        /**
         * if user is not authenticated, strip all cmf data
         */

        if (!$this->checkUser())
            $html = $this->stripCmfData($html);

        return $html;

    }