<?php

namespace PHPMaker2021\rdigital21;

// Page object
$ProyekView = &$Page;
?>
<?php if (!$Page->isExport()) { ?>
<script>
var currentForm, currentPageID;
var fproyekview;
loadjs.ready("head", function () {
    var $ = jQuery;
    // Form object
    currentPageID = ew.PAGE_ID = "view";
    fproyekview = currentForm = new ew.Form("fproyekview", "view");
    loadjs.done("fproyekview");
});
</script>
<script>
loadjs.ready("head", function () {
    // Write your table-specific client script here, no need to add script tags.
});
</script>
<?php } ?>
<script>
if (!ew.vars.tables.proyek) ew.vars.tables.proyek = <?= JsonEncode(GetClientVar("tables", "proyek")) ?>;
</script>
<?php if (!$Page->isExport()) { ?>
<div class="btn-toolbar ew-toolbar">
<?php $Page->ExportOptions->render("body") ?>
<?php $Page->OtherOptions->render("body") ?>
<div class="clearfix"></div>
</div>
<?php } ?>
<?php $Page->showPageHeader(); ?>
<?php
$Page->showMessage();
?>
<form name="fproyekview" id="fproyekview" class="form-inline ew-form ew-view-form" action="<?= CurrentPageUrl(false) ?>" method="post">
<?php if (Config("CHECK_TOKEN")) { ?>
<input type="hidden" name="<?= $TokenNameKey ?>" value="<?= $TokenName ?>"><!-- CSRF token name -->
<input type="hidden" name="<?= $TokenValueKey ?>" value="<?= $TokenValue ?>"><!-- CSRF token value -->
<?php } ?>
<input type="hidden" name="t" value="proyek">
<input type="hidden" name="modal" value="<?= (int)$Page->IsModal ?>">
<table class="table table-borderless table-hover table-sm ew-view-table">
<?php if ($Page->project_id->Visible) { // project_id ?>
    <tr id="r_project_id">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_proyek_project_id"><?= $Page->project_id->caption() ?></span></td>
        <td data-name="project_id" <?= $Page->project_id->cellAttributes() ?>>
<span id="el_proyek_project_id">
<span<?= $Page->project_id->viewAttributes() ?>><?php
$project_id=$proyek->project_id->getViewValue();
$tahun_pelajaran=$proyek->tahun_pelajaran->getViewValue();
$project=$proyek->project->getViewValue();
$kelas=$proyek->kelas->getViewValue();
$gdimensi=ExecuteScalar("SELECT dimensi FROM proyek where project_id='$project_id'"); 
$txt=$project_id."|".$tahun_pelajaran."|".$project."|".$gdimensi."|".$kelas;
$cek = ExecuteScalar("SELECT COUNT(*) FROM nilai_p5 WHERE project_id='$project_id'");
if ($cek==0) {
    echo '<a href="act.php?p5='.base64_encode($txt).'" class="btn btn-success btn-sm">Generate Nilai P5</a>';
} else { ?>
   <button class="btn btn-secondary btn-sm" onclick="alert('Data Nilai Sudah Ada')">Buat Nilai P5</button>
<?php } ?>
</span>
</span>
</td>
    </tr>
<?php } ?>
<?php if ($Page->tahun_pelajaran->Visible) { // tahun_pelajaran ?>
    <tr id="r_tahun_pelajaran">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_proyek_tahun_pelajaran"><?= $Page->tahun_pelajaran->caption() ?></span></td>
        <td data-name="tahun_pelajaran" <?= $Page->tahun_pelajaran->cellAttributes() ?>>
<span id="el_proyek_tahun_pelajaran">
<span<?= $Page->tahun_pelajaran->viewAttributes() ?>>
<?= $Page->tahun_pelajaran->getViewValue() ?></span>
</span>
</td>
    </tr>
<?php } ?>
<?php if ($Page->kelas->Visible) { // kelas ?>
    <tr id="r_kelas">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_proyek_kelas"><?= $Page->kelas->caption() ?></span></td>
        <td data-name="kelas" <?= $Page->kelas->cellAttributes() ?>>
<span id="el_proyek_kelas">
<span<?= $Page->kelas->viewAttributes() ?>>
<?= $Page->kelas->getViewValue() ?></span>
</span>
</td>
    </tr>
<?php } ?>
<?php if ($Page->project->Visible) { // project ?>
    <tr id="r_project">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_proyek_project"><?= $Page->project->caption() ?></span></td>
        <td data-name="project" <?= $Page->project->cellAttributes() ?>>
<span id="el_proyek_project">
<span<?= $Page->project->viewAttributes() ?>>
<?= $Page->project->getViewValue() ?></span>
</span>
</td>
    </tr>
<?php } ?>
<?php if ($Page->nama_proyek->Visible) { // nama_proyek ?>
    <tr id="r_nama_proyek">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_proyek_nama_proyek"><?= $Page->nama_proyek->caption() ?></span></td>
        <td data-name="nama_proyek" <?= $Page->nama_proyek->cellAttributes() ?>>
<span id="el_proyek_nama_proyek">
<span<?= $Page->nama_proyek->viewAttributes() ?>>
<?= $Page->nama_proyek->getViewValue() ?></span>
</span>
</td>
    </tr>
<?php } ?>
<?php if ($Page->tema->Visible) { // tema ?>
    <tr id="r_tema">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_proyek_tema"><?= $Page->tema->caption() ?></span></td>
        <td data-name="tema" <?= $Page->tema->cellAttributes() ?>>
<span id="el_proyek_tema">
<span<?= $Page->tema->viewAttributes() ?>>
<?= $Page->tema->getViewValue() ?></span>
</span>
</td>
    </tr>
<?php } ?>
<?php if ($Page->dimensi->Visible) { // dimensi ?>
    <tr id="r_dimensi">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_proyek_dimensi"><?= $Page->dimensi->caption() ?></span></td>
        <td data-name="dimensi" <?= $Page->dimensi->cellAttributes() ?>>
<span id="el_proyek_dimensi">
<span<?= $Page->dimensi->viewAttributes() ?>><?php
 $project_id=$proyek->project_id->getViewValue();
 $gdimensi=ExecuteScalar("SELECT dimensi FROM proyek where project_id='$project_id'");
 echo count($dimensi=explode(",",$gdimensi))." Dimensi"; 
?>
</span>
</span>
</td>
    </tr>
<?php } ?>
<?php if ($Page->deskripsi_proyek->Visible) { // deskripsi_proyek ?>
    <tr id="r_deskripsi_proyek">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_proyek_deskripsi_proyek"><?= $Page->deskripsi_proyek->caption() ?></span></td>
        <td data-name="deskripsi_proyek" <?= $Page->deskripsi_proyek->cellAttributes() ?>>
<span id="el_proyek_deskripsi_proyek">
<span<?= $Page->deskripsi_proyek->viewAttributes() ?>>
<?= $Page->deskripsi_proyek->getViewValue() ?></span>
</span>
</td>
    </tr>
<?php } ?>
</table>
<?php
    if (in_array("nilai_p5", explode(",", $Page->getCurrentDetailTable())) && $nilai_p5->DetailView) {
?>
<?php if ($Page->getCurrentDetailTable() != "") { ?>
<h4 class="ew-detail-caption"><?= $Language->tablePhrase("nilai_p5", "TblCaption") ?>&nbsp;<?= str_replace("%c", Container("nilai_p5")->Count, $Language->phrase("DetailCount")) ?></h4>
<?php } ?>
<?php include_once "NilaiP5Grid.php" ?>
<?php } ?>
</form>
<?php
$Page->showPageFooter();
echo GetDebugMessage();
?>
<?php if (!$Page->isExport()) { ?>
<script>
loadjs.ready("load", function () {
    // Write your table-specific startup script here, no need to add script tags.
});
</script>
<?php } ?>
