コード例 #1
0
                 $tmpcounter = 1;
                 $tempreg = $p;
                 $print = 1;
                 goto printlabel;
             } else {
                 $tempreg .= ', ' . $p;
                 $tmpcounter = $tmpcounter + 1;
             }
             $eq_b4 = 0;
             //now it is set for comma
         }
         $equal = nxtchk($in, $n);
     } elseif ($equal == 1) {
         $eq_b4 = $eq_b4 + 1;
         //now it is set for hypen
         $equal = nxtchk($in, $n);
     }
 }
 if ($i + 1 == $total) {
     if ($eq_b4 == -1 || $islast == 1) {
         $tempreg = $p . '.';
     } elseif ($eq_b4 == 0) {
         $tempreg .= ', ' . $p . '.';
     } elseif ($eq_b4 == 1) {
         $tempreg .= ' - ' . $p . '.';
     } elseif ($eq_b4 > 1) {
         $tempreg .= ' - ' . $p . '.';
     }
     $printreg = $tempreg;
     $print = 1;
 } elseif ($tmpcounter == 3) {
コード例 #2
0
function disp_dpt($reg, $a, $total)
{
    global $w, $strmax, $tempreg, $printd_no, $firstloop;
    $in = null;
    $n = null;
    $pcountr = 0;
    $firstloop = 1;
    //a is the starting number from which number to display.
    for ($i = $a; $i < $total; $i++) {
        if (isset($reg[$i])) {
            $p = $reg[$i];
            //present (current) used reg no.
            intval($reg[$i]);
            $in = $reg[$i] + 1;
            // imaginary next reg no. adds one to $p
            if (isset($reg[$i + 1])) {
                intval($reg[$i + 1]);
                $n = $reg[$i + 1];
                // this is the real next reg no. present in the array
            }
            if ($i == $a) {
                //ec1ho $reg[$i];
                ////////////////////***********must try below function at start***********////////////////////
                $reg[$i] = str_replace(' ', '', $reg[$i]);
                // removes any extra spaces in between reg nos.
                $reg[$i] = preg_replace('/\\s+/', '', $reg[$i]);
                // removes any whitespaces in between reg nos.
                ////// spaces and whitespaces are different in php.... so both the above funcs are mandatory
                $tempreg = $reg[$i];
                //$pdf->myCell($width[2], $height[1], $reg[$i], 'LR');
                nxtchk($in, $n, 0, $p);
                if ($a + 1 == $total) {
                    $tempreg .= '.';
                    printcell1($tempreg);
                }
            } elseif ($i == $total - 1) {
                if ($w == 0 or $w == 1) {
                    //echo ", ".$reg[$i];
                    if (strlen($tempreg . ', ' . $reg[$i]) < $strmax) {
                        $reg[$i] = str_replace(' ', '', $reg[$i]);
                        $reg[$i] = preg_replace('/\\s+/', '', $reg[$i]);
                        $tempreg .= ', ' . $reg[$i];
                        $pcountr = 1;
                        $printd_no = $reg[$i] + 1;
                    } else {
                        $tempreg .= ',';
                        if ($firstloop == 1) {
                            printcell1($tempreg);
                            $firstloop = 0;
                        } else {
                            printcell($tempreg);
                        }
                        $reg[$i] = str_replace(' ', '', $reg[$i]);
                        $reg[$i] = preg_replace('/\\s+/', '', $reg[$i]);
                        $tempreg = $reg[$i];
                        $pcountr = $pcountr + 1;
                    }
                    //$pdf->myCell($width[2], $height[1], ', '.$reg[$i], 0);
                } elseif ($w > 1) {
                    //echo " - ".$reg[$i];
                    if (strlen($tempreg . ' - ' . $reg[$i]) < $strmax) {
                        $reg[$i] = str_replace(' ', '', $reg[$i]);
                        $reg[$i] = preg_replace('/\\s+/', '', $reg[$i]);
                        $tempreg .= ' - ' . $reg[$i];
                        $pcountr = 1;
                    } else {
                        $tempreg .= ',';
                        if ($firstloop == 1) {
                            printcell1($tempreg);
                            $firstloop = 0;
                        } else {
                            printcell($tempreg);
                        }
                        $reg[$i] = str_replace(' ', '', $reg[$i]);
                        $reg[$i] = preg_replace('/\\s+/', '', $reg[$i]);
                        $tempreg = $printd_no . ' - ' . $reg[$i];
                        $pcountr = $pcountr + 1;
                    }
                    //$pdf->myCell($width[2], $height[1], ' - '.$reg[$i], 0);
                }
            } elseif ($w == 0) {
                //echo ", ".$reg[$i];
                if (strlen($tempreg . ', ' . $reg[$i]) < $strmax) {
                    $reg[$i] = str_replace(' ', '', $reg[$i]);
                    $reg[$i] = preg_replace('/\\s+/', '', $reg[$i]);
                    $tempreg .= ', ' . $reg[$i];
                    $pcountr = 1;
                    $printd_no = $reg[$i] + 1;
                } else {
                    $tempreg .= ',';
                    if ($firstloop == 1) {
                        printcell1($tempreg);
                        $firstloop = 0;
                    } else {
                        printcell($tempreg);
                    }
                    $reg[$i] = str_replace(' ', '', $reg[$i]);
                    $reg[$i] = preg_replace('/\\s+/', '', $reg[$i]);
                    $tempreg = $reg[$i];
                    $pcountr = $pcountr + 1;
                }
                //$pdf->myCell($width[2], $height[1], ', '.$reg[$i], 0);
                nxtchk($in, $n, 0, $p);
            } elseif ($w == 1) {
                nxtchk($in, $n, 1, $p);
            } elseif ($w > 1) {
                nxtchk($in, $n, 2, $p);
            }
        }
    }
    if ($pcountr > 0) {
        $tempreg .= '.';
        if ($firstloop == 1) {
            printcell1($tempreg);
            $firstloop = 0;
        } else {
            printcell($tempreg);
        }
        $pcountr = 0;
    }
}