Exemplo n.º 1
0
<?php

function evaluation($str)
{
    $string = str_split(trim($str));
    $count = count($string);
    $i = 0;
    if ($count % 2 == 0) {
        foreach ($string as $key => $value) {
            $strcount = substr_count($str, $value) % 2;
            //echo $strcount;
            if ($strcount !== 0) {
                return "NO";
            }
        }
        echo "YES";
    } else {
        foreach ($string as $key => $value) {
            if (substr_count($str, $value) % 2 == 1) {
                $array[] = $value;
                //echo $i;
            }
        }
        $i = count(array_unique($array));
        echo $i == 1 ? "YES" : "NO";
    }
}
$handle = fopen("php://stdin", "r");
$str = fgets($handle);
echo evaluation($str);
fclose($handle);
Exemplo n.º 2
0
function subContent($code, $id, $kod, $pp_kod)
{
    if ($kod == 1) {
        ?>
      <div class="col-md-12">
        <?php 
        getProduct($id, $pp_kod);
        ?>
      </div>
      <div class="col-md-12">&nbsp;</div>
      <div class="col-md-12">
        <button class="btn btn-primary" onclick="content('<?php 
        echo $code;
        ?>
')"><i class="fa fa-arrow-left"></i> Back</button>
        <button class="btn btn-primary" onclick="subContent(2,'<?php 
        echo $pp_kod;
        ?>
')">Next <i class="fa fa-arrow-right"></i></a>
      </div>
    <?php 
    } elseif ($kod == 2) {
        $query = "SELECT pp_ref_no,pp_nama_brand,pp_nama_generic,pp_nama FROM p_product WHERE pp_kod='{$pp_kod}'";
        $result = selQuery($query);
        $row = mysqli_fetch_assoc($result);
        ?>
    <div class="col-md-12">
      <div class="row">
        <div class="alert alert-sm alert-border-left alert-primary"><b>Product Information</b></div>
        <div class="col-md-6">
        <?php 
        if ($id == 2) {
            ?>
        <b>Call No : </b>
        <p><?php 
            echo isEmpty($pp_kod);
            ?>
</p>
        <?php 
        } else {
            ?>
        <b>Reference No : </b>
        <p><?php 
            echo isEmpty($row['pp_ref_no']);
            ?>
</p>
        <?php 
        }
        ?>
        <input type="hidden" id="pp_kod" value="<?php 
        echo $pp_kod;
        ?>
" />
        </div>
        <div class="col-md-6">
        <b>Brand Name : </b>
        <p><?php 
        echo isEmpty($row["pp_nama_brand"]);
        ?>
</p>
        </div>
        <div class="col-md-6">
        <b>Generic Name : </b>
        <p><?php 
        echo isEmpty($row["pp_nama_generic"]);
        ?>
</p>
        </div>
        <div class="col-md-6">
        <b>Full product name : </b>
        <p><?php 
        echo isEmpty($row["pp_nama"]);
        ?>
</p>
        </div>
      </div>
      <div class="row">
        <div class="section-divider"></div>
      </div>
    </div>
      <?php 
        if ($id == 2 || $id == 5 || $id == 6) {
            ?>
      <div class="col-md-12">
      <?php 
            getValidList($id, $pp_kod);
            ?>
      </div>
      <?php 
        } else {
            ?>
      <div class="col-md-12">
        <?php 
            distributedList($id, $pp_kod);
            ?>
      </div>
      <?php 
        }
        ?>
      <div class="col-md-12">
        <?php 
        documentList($id, $pp_kod);
        ?>
      </div>
      <div class="col-md-12">
        <?php 
        analysisProtocol($id, $pp_kod);
        ?>
      </div>
      <div class="col-md-12">
        <?php 
        sectionS($id, $pp_kod);
        ?>
      </div>
      <div class="col-md-12">
        <?php 
        coaProduct($id, $pp_kod);
        ?>
      </div>
      <?php 
        if ($id == 2 || $id == 5 || $id == 6) {
            ?>
      <div class="col-md-12">
        <?php 
            distributedList($id, $pp_kod);
            ?>
      </div>
      <?php 
        }
        ?>
      <div class="col-md-12">
        <?php 
        officerWork($id, $pp_kod);
        ?>
      </div>
      <div class="col-md-12">&nbsp;</div>
      <div class="col-md-12">
        <button class="btn btn-primary" onclick="subContent(1,'<?php 
        echo $pp_kod;
        ?>
')"><i class="fa fa-arrow-left"></i> Back</button>
        <?php 
        if ($id != 2) {
            ?>
        <button class="btn btn-primary" onclick="chronology(0,'<?php 
            echo $pp_kod;
            ?>
')"><i class="fa fa-sort-alpha-asc"></i> Chronology</button>
        <?php 
        }
        if ($id == 2) {
            ?>
        <label id="screenBtn" <?php 
            if (screening($pp_kod) == "false") {
                echo "style='display:none;'";
            } else {
                echo "";
            }
            ?>
>
          <button class="btn btn-primary" onclick="approveScreen('<?php 
            echo $pp_kod;
            ?>
','<?php 
            echo $code;
            ?>
')"><i class="fa fa-check"></i> Approve</button>
          <button class="btn btn-primary" onclick="rejectScreen('<?php 
            echo $pp_kod;
            ?>
','<?php 
            echo $code;
            ?>
')"><i class="fa fa-times"></i> Reject</button>
        </label>
        <?php 
        } elseif ($id == 5 || $id == 6) {
            ?>
        <button class="btn btn-primary" onclick="sendLab('<?php 
            echo $pp_kod;
            ?>
','<?php 
            echo $code;
            ?>
')"><i class="fa fa-send"></i> Send to Lab</button>
        <?php 
        } elseif ($id == 8 or evaluate($pp_kod) == 2) {
            ?>
        <button class="btn btn-primary" id="assignPhar" onclick="assignPharma('<?php 
            echo $code;
            ?>
','<?php 
            echo $pp_kod;
            ?>
')"><i class="fa fa-undo"></i> Send Back to Pharmacist</button>
        <button class="btn btn-primary" onclick="approveEvaluate('<?php 
            echo $pp_kod;
            ?>
','<?php 
            echo $_SESSION['ru_kod'];
            ?>
','<?php 
            echo $code;
            ?>
')"><i class="fa fa-check"></i> Approve</button>
        <?php 
        } elseif (evaluate($pp_kod) == 1) {
            ?>
        <button class="btn btn-primary" id="assignPhar" onclick="assignPharma('<?php 
            echo $code;
            ?>
','<?php 
            echo $pp_kod;
            ?>
')"><i class="fa fa-check-square-o"></i> Send to Pharmacist</button>
        <?php 
        } elseif (evaluate($pp_kod) == 0) {
            ?>
        <label id="evaluateButton"><?php 
            echo evaluation($pp_kod);
            ?>
</label>
        <?php 
        }
        ?>
      </div>
    <?php 
    }
}