Пример #1
0
/**
 * Generate the documentation. The "main loop", so to speak.
 * 
 * @param string $file (the filename)
 * @return void
 */
function generate_documentation($file)
{
    $code = file_get_contents($file);
    $sections = parse($file, $code);
    $sections = highlight($file, $sections);
    generate_html($file, $sections);
}
Пример #2
0
function generate_pdf($start, $end, $userid, $courseid, $method = 'I', $base = '', $timesheetid = -1, $unsignedonly = false)
{
    global $CFG, $DB;
    $htmlpages = generate_html($start, $end, $userid, $courseid, $timesheetid, $unsignedonly);
    // Collect Data
    $conf = get_timetracker_config($courseid);
    $month = userdate($start, "%m");
    $year = userdate($start, "%Y");
    $workerrecord = $DB->get_record('block_timetracker_workerinfo', array('id' => $userid));
    if (!$workerrecord) {
        print_error('usernotexist', 'block_timetracker', $CFG->wwwroot . '/blocks/timetracker/index.php?id=' . $courseid);
    }
    // ********** BEGIN PDF ********** //
    // Create new PDF
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    $fn = $year . '_' . ($month < 10 ? '0' . $month : $month) . 'Timesheet_' . substr($workerrecord->firstname, 0, 1) . $workerrecord->lastname . '_' . $workerrecord->mdluserid;
    // Set Document Data
    $pdf->setCreator(PDF_CREATOR);
    $pdf->SetFont('helvetica', '', 8);
    $pdf->SetCellPadding(0);
    $pdf->SetTitle($fn);
    $pdf->SetAuthor('TimeTracker');
    $pdf->SetSubject(' ');
    $pdf->SetKeywords(' ');
    // Remove Default Header/Footer
    $pdf->setPrintHeader(false);
    $pdf->setPrintFooter(false);
    foreach ($htmlpages as $page) {
        $pdf->AddPage();
        $pdf->writeHTML($page);
    }
    //create the filename
    $fn .= '.pdf';
    //Close and Output PDF document
    //change the $method from 'I' to $method -- allow more than just a single file
    //to be created
    $pdf->Output($base . '/' . $fn, $method);
    return $fn;
}
Пример #3
0
/**
 * Generates entries, frontpages and archives for a given entry ID.
 *
 * @uses generate_html generates entry (HTML)
 * @uses generate_archive generates archive page
 * @uses generate_frontpage generates front page
 */
function generate_pages($id, $singlepage = TRUE, $frontpage = TRUE, $archive = TRUE, $ping = FALSE, $rss = TRUE)
{
    global $db, $Weblogs, $Current_weblog, $Allow_RSS;
    //LoadTempLanguage();
    $Allow_RSS = $rss;
    // load an entry
    $entry = $db->read_entry($id, TRUE);
    $in_weblogs = find_weblogs_with_cat($entry['category']);
    foreach ($in_weblogs as $in_weblog) {
        $entry = $db->read_entry($id);
        $org_date = $entry['date'];
        $Current_weblog = $in_weblog;
        $template = $Weblogs[$in_weblog]['entry_template'];
        // we generate the single (static) entry only if it's published
        if ($Weblogs[$in_weblog]['live_entries'] != 1 && $entry['status'] == 'publish') {
            generate_html($template, $in_weblog);
        }
        // generate the archives (for this date) only if the entry is
        // published.
        if ($archive && $Weblogs[$Current_weblog]['archive_unit'] != 'none' && $entry['status'] == 'publish') {
            generate_archive($in_weblog, $org_date);
        }
        // generate the frontpage
        if ($frontpage) {
            $filename = generate_frontpage($in_weblog);
        }
        LoadUserLanguage();
    }
    // if we need to ping. do here:
    if ($ping) {
        open_ping_window($in_weblogs);
    }
}
Пример #4
0
$perp = 20;
$salle = "Salles" . $_POST['Departement'];
$sql = "SELECT * FROM `{$salle}` WHERE LOCATE('" . $_POST['cpost'] . "', `CODE POSTAL`)";
$result = mysql_query($sql);
$arr = [];
for ($i = 0; $i < mysql_num_rows($result); $i++) {
    $arr[] = mysql_fetch_assoc($result);
}
$nbpage = ceil(count($arr) / $perp);
$j = 0;
if (!empty($arr)) {
    for ($i = 1; $i < $nbpage + 1; $i++) {
        if ($i == 1) {
            echo "<div class='selection' style='display: block;' id='page-" . $i . "'>";
        } else {
            echo "<div class='selection' style='display: none;' id='page-" . $i . "'>";
        }
        for ($k = $j; $k < $perp + $j && isset($arr[$k]); $k++) {
            $url = generate_html($arr[$k]);
            echo "<center><a href='{$url}' class='resultat'>" . $arr[$k]['NOM'] . "</a></center><br/>";
            echo "<center><a class='ville'>" . $arr[$k]['VILLE'] . "</a></center><hr/>";
        }
        if (!isset($arr[$j + 4])) {
            break;
        }
        $j += 4;
        echo "</div>";
    }
} else {
    echo "<h2 id='noresult'>No result</h2>";
}
Пример #5
0
containing the data value. (This will not work if you are viewing the
example in the reference manual.)
</p>
<img src="{$url}" alt="Plot image" usemap="#map1">
</body>
</html>

END;
}
$plot = new PHPlot(640, 480);
if ($do_html) {
    # When producing HTML, don't output the plot image:
    $plot->SetPrintImage(False);
    # Just to make it clear, this script usage returns HTML:
    header("Content-type: text/html");
    # The image map callback is only needed when doing the HTML page.
    # Pass the data array so the callback can fetch values from it.
    $plot->SetCallback('data_points', 'store_map', $data);
}
$plot->SetTitle("PHPlot Example: Image Map and Non-embedded Plot");
$plot->SetImageBorderType('plain');
$plot->SetDataValues($data);
$plot->SetDataType('text-data');
$plot->SetPlotType('bars');
$plot->SetXTickPos('none');
$plot->SetPlotAreaWorld(NULL, 0, NULL, 30);
$plot->SetLegend($legend);
$plot->DrawGraph();
if ($do_html) {
    generate_html();
}
    function definition()
    {
        global $CFG, $DB, $COURSE, $USER, $OUTPUT;
        $mform =& $this->_form;
        $mform->addElement('header', 'general', get_string('timesheet', 'block_timetracker'));
        $mform->addElement('hidden', 'userid', $this->userid);
        $mform->addElement('hidden', 'id', $this->courseid);
        $mform->addElement('hidden', 'start', $this->start);
        $mform->addElement('hidden', 'end', $this->end);
        $mform->addElement('html', get_string('workerstatement', 'block_timetracker'));
        $mform->addElement('checkbox', 'workersig', get_string('clicktosign', 'block_timetracker'));
        $buttonarray = array();
        $buttonarray[] =& $mform->createElement('submit', 'signbutton', get_string('signbutton', 'block_timetracker'), array('onclick' => 'return confirm("Are you sure you wish to submit the work units during
                this range?  Doing so may split units in a way that cannot be undone.")'));
        $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
        $mform->disabledIf('buttonar', 'workersig');
        $mform->addElement('html', '<br />');
        $mform->addElement('html', '
            <style type="text/css">
            
            table{
                width: 80%;
                height: 80%;
            }
            .calendar{
                border-left: 1px solid black;
                border-bottom: 1px solid black;
                border-top: 1px solid black;
            }
            table,div,td,th,tr{
                font-weight: normal;
                font-size: 15px;
                font-family: helvetica;
            }
            
            table{
            padding: 0;
            spacing: 0;
            border: 1px solid black;
            border-collapse: separate;
            margin-left: auto;
            margin-right: auto;
            }
            
            span.thirteen{
                font-weight: bold;
                font-size: 18px;
                font-family: helvetica;
            }
            
            span.ten{
                font-weight: bold;
                font-size: 15px;
                font-family: helvetica;
            }
            
            span.eightpointfive{
                font-weight: bold;
                font-size: 13px;
                font-family; helvetica;
            }

            span.eight{
                display: inline-block;
                font-weight: bold;
                font-size: 13px;
                font-family: helvetica;
                width: 75px;
            }
            
            span.seven{
                display: inline-block;
                font-size: 12px;
                font-family: helvetica;
                height: 95px;
            }
            
            </style>');
        $pages = generate_html($this->start, $this->end, $this->userid, $this->courseid, -1, true);
        foreach ($pages as $page) {
            $page = str_replace('<font size="13">', '<span class="thirteen">', $page);
            $page = str_replace('<font size="10">', '<span class="ten">', $page);
            $page = str_replace('<font size="8.5">', '<span class="eightpointfive">', $page);
            $page = str_replace('<font size="8">', '<span class="eight">', $page);
            $page = str_replace('<font size="7">', '<span class="seven">', $page);
            $page = str_replace('</font>', '</span>', $page);
            $page = str_replace('<hr style="height: 1px" />', '', $page);
            $mform->addElement('html', $page);
            $mform->addElement('html', "\n\n\n");
        }
    }