当前位置: 首页>>代码示例>>PHP>>正文


PHP Min函数代码示例

本文整理汇总了PHP中Min函数的典型用法代码示例。如果您正苦于以下问题:PHP Min函数的具体用法?PHP Min怎么用?PHP Min使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Min函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parseTimeAsRatio

 protected function parseTimeAsRatio($time)
 {
     if (substr($time, -1) === '%') {
         return substr($time, 0, strlen($time) - 1) / 100;
     }
     return Max(Min((double) $time, 1), 0);
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:7,代码来源:Video2Image.php

示例2: Min

 function Min()
 {
     $nmax = 0;
     list($xmin, $ysetmin) = $this->plots[0]->Min();
     $n = count($this->plots);
     for ($i = 0; $i < $n; ++$i) {
         $nc = count($this->plots[$i]->coords[0]);
         $nmax = max($nmax, $nc);
         list($x, $y) = $this->plots[$i]->Min();
         $xmin = Min($xmin, $x);
         $ysetmin = Min($y, $ysetmin);
     }
     for ($i = 0; $i < $nmax; $i++) {
         $y = $this->plots[0]->coords[0][$i];
         for ($j = 1; $j < $this->nbrplots; $j++) {
             $y += $this->plots[$j]->coords[0][$i];
         }
         $ymin[$i] = $y;
     }
     $ymin = Min($ysetmin, Min($ymin));
     return array($xmin, $ymin);
 }
开发者ID:natanoj,项目名称:nuBuilderPro,代码行数:22,代码来源:jpgraph_line.php

示例3: Stroke

 function Stroke($aStrokeFileName = "")
 {
     // Do any pre-stroke adjustment that is needed by the different plot types
     // (i.e bar plots want's to add an offset to the x-labels etc)
     for ($i = 0; $i < count($this->plots); ++$i) {
         $this->plots[$i]->PreStrokeAdjust($this);
         $this->plots[$i]->Legend($this);
     }
     if ($this->y2scale != null) {
         for ($i = 0; $i < count($this->y2plots); ++$i) {
             $this->y2plots[$i]->PreStrokeAdjust($this);
             $this->y2plots[$i]->Legend($this);
         }
     }
     // Bail out if any of the Y-axis not been specified and
     // has no plots. (This means it is impossible to do autoscaling and
     // no other scale was given so we can't possible draw anything). If you use manual
     // scaling you also have to supply the tick steps as well.
     if (!$this->yscale->IsSpecified() && count($this->plots) == 0 || $this->y2scale != null && !$this->y2scale->IsSpecified() && count($this->y2plots) == 0) {
         die("<strong>JpGraph: Can't draw unspecified Y-scale.</strong><br>\n\t\t\t\tYou have either:\n\t\t\t\t<br>* Specified an Y axis for autoscaling but have not supplied any plots\n\t\t\t\t<br>* Specified a scale manually but have forgot to specify the tick steps");
     }
     // Bail out if no plots and no specified X-scale
     if (!$this->xscale->IsSpecified() && count($this->plots) == 0 && count($this->y2plots) == 0) {
         die("<strong>JpGraph: Can't draw unspecified X-scale.</strong><br>No plots.<br>");
     }
     //Check if we should autoscale y-axis
     if (!$this->yscale->IsSpecified() && count($this->plots) > 0) {
         list($min, $max) = $this->GetPlotsYMinMax($this->plots);
         $this->yscale->AutoScale($this->img, $min, $max, $this->img->plotheight / $this->ytick_factor);
     }
     if ($this->y2scale != null) {
         if (!$this->y2scale->IsSpecified() && count($this->y2plots) > 0) {
             list($min, $max) = $this->GetPlotsYMinMax($this->y2plots);
             $this->y2scale->AutoScale($this->img, $min, $max, $this->img->plotheight / $this->ytick_factor);
         }
     }
     //Check if we should autoscale x-axis
     if (!$this->xscale->IsSpecified()) {
         if (substr($this->axtype, 0, 4) == "text") {
             $max = 0;
             foreach ($this->plots as $p) {
                 $max = max($max, $p->numpoints - 1);
             }
             $min = 0;
             $this->xscale->Update($this->img, $min, $max);
             $this->xscale->ticks->Set($this->xaxis->tick_step, 1);
             $this->xscale->ticks->SupressMinorTickMarks();
         } else {
             list($min, $ymin) = $this->plots[0]->Min();
             list($max, $ymax) = $this->plots[0]->Max();
             foreach ($this->plots as $p) {
                 list($xmin, $ymin) = $p->Min();
                 list($xmax, $ymax) = $p->Max();
                 $min = Min($xmin, $min);
                 $max = Max($xmax, $max);
             }
             $this->xscale->AutoScale($this->img, $min, $max, $this->img->plotwidth / $this->xtick_factor);
         }
         //Adjust position of y-axis and y2-axis to minimum/maximum of x-scale
         $this->yaxis->SetPos($this->xscale->GetMinVal());
         if ($this->y2axis != null) {
             $this->y2axis->SetPos($this->xscale->GetMaxVal());
             $this->y2axis->SetTitleSide(SIDE_RIGHT);
         }
     }
     // If we have a negative values and x-axis position is at 0
     // we need to supress the first and possible the last tick since
     // they will be drawn on top of the y-axis (and possible y2 axis)
     // The test below might seem strange the reasone being that if
     // the user hasn't specified a value for position this will not
     // be set until we do the stroke for the axis so as of now it
     // is undefined.
     if (!$this->xaxis->pos && $this->yscale->GetMinVal() < 0) {
         $this->yscale->ticks->SupressZeroLabel(false);
         $this->xscale->ticks->SupressFirst();
         if ($this->y2axis != null) {
             $this->xscale->ticks->SupressLast();
         }
     }
     // Copy in background image
     if ($this->background_image != "") {
         $bkgimg = $this->LoadBkgImage($this->background_image_format);
         $this->img->_AdjBrightContrast($bkgimg, $this->background_image_bright, $this->background_image_contr);
         $this->img->_AdjSat($bkgimg, $this->background_image_sat);
         $bw = ImageSX($bkgimg);
         $bh = ImageSY($bkgimg);
         $aa = $this->img->SetAngle(0);
         switch ($this->background_image_type) {
             case BGIMG_FILLPLOT:
                 // Resize to just fill the plotarea
                 $this->StrokeFrame();
                 imagecopyresized($this->img->img, $bkgimg, $this->img->left_margin, $this->img->top_margin, 0, 0, $this->img->plotwidth, $this->img->plotheight, $bw, $bh);
                 break;
             case BGIMG_FILLFRAME:
                 // Fill the whole area from upper left corner, resize to just fit
                 imagecopyresized($this->img->img, $bkgimg, 0, 0, 0, 0, $this->img->width, $this->img->height, $bw, $bh);
                 $this->StrokeFrame();
                 break;
             case BGIMG_COPY:
                 // Just copy the image from left corner, no resizing
//.........这里部分代码省略.........
开发者ID:ahviplc,项目名称:judgegirl,代码行数:101,代码来源:jpgraph.php

示例4: GetXMinMax

 function GetXMinMax()
 {
     list($min, $ymin) = $this->plots[0]->Min();
     list($max, $ymax) = $this->plots[0]->Max();
     $i = 0;
     // Some plots, e.g. PlotLine should not affect the scale
     // and will return (null,null). We should ignore those
     // values.
     while (($min === null || $max === null) && $i < count($this->plots) - 1) {
         ++$i;
         list($min, $ymin) = $this->plots[$i]->Min();
         list($max, $ymax) = $this->plots[$i]->Max();
     }
     foreach ($this->plots as $p) {
         list($xmin, $ymin) = $p->Min();
         list($xmax, $ymax) = $p->Max();
         if ($xmin !== null && $xmax !== null) {
             $min = Min($xmin, $min);
             $max = Max($xmax, $max);
         }
     }
     if ($this->y2axis != null) {
         foreach ($this->y2plots as $p) {
             list($xmin, $ymin) = $p->Min();
             list($xmax, $ymax) = $p->Max();
             $min = Min($xmin, $min);
             $max = Max($xmax, $max);
         }
     }
     $n = count($this->ynaxis);
     for ($i = 0; $i < $n; ++$i) {
         if ($this->ynaxis[$i] != null) {
             foreach ($this->ynplots[$i] as $p) {
                 list($xmin, $ymin) = $p->Min();
                 list($xmax, $ymax) = $p->Max();
                 $min = Min($xmin, $min);
                 $max = Max($xmax, $max);
             }
         }
     }
     return array($min, $max);
 }
开发者ID:nbgmaster,项目名称:happify,代码行数:42,代码来源:jpgraph.php

示例5: Min

 function Min()
 {
     return Min($this->data);
 }
开发者ID:jeroenrnl,项目名称:php-syslog-ng,代码行数:4,代码来源:jpgraph_radar.php

示例6: Min

 function Min()
 {
     $nmax = 0;
     list($xmin, $ysetmin) = $this->plots[0]->Min();
     for ($i = 0; $i < count($this->plots); ++$i) {
         $n = count($this->plots[$i]->coords[0]);
         $nmax = max($nmax, $n);
         list($x, $y) = $this->plots[$i]->Min();
         $xmin = Min($xmin, $x);
         $ysetmin = Min($y, $ysetmin);
     }
     for ($i = 0; $i < $nmax; $i++) {
         // Get y-value for bar $i by adding the
         // individual bars from all the plots added.
         // It would be wrong to just add the
         // individual plots max y-value since that
         // would in most cases give to large y-value.
         $y = $this->plots[0]->coords[0][$i];
         for ($j = 1; $j < $this->nbrplots; $j++) {
             $y += $this->plots[$j]->coords[0][$i];
         }
         $ymin[$i] = $y;
     }
     $ymin = Min($ysetmin, Min($ymin));
     // Bar always start at baseline
     if ($ymin >= $this->ybase) {
         $ymin = $this->ybase;
     }
     return array($xmin, $ymin);
 }
开发者ID:teammember8,项目名称:roundcube,代码行数:30,代码来源:jpgraph_bar.php

示例7: ScaleImage

 function ScaleImage($sourceImageWidth, $sourceImageHeight, $arSize, $resizeType, &$bNeedCreatePicture, &$arSourceSize, &$arDestinationSize)
 {
     if (!is_array($arSize)) {
         $arSize = array();
     }
     if (!array_key_exists("width", $arSize) || intval($arSize["width"]) <= 0) {
         $arSize["width"] = 0;
     }
     if (!array_key_exists("height", $arSize) || intval($arSize["height"]) <= 0) {
         $arSize["height"] = 0;
     }
     $arSize["width"] = intval($arSize["width"]);
     $arSize["height"] = intval($arSize["height"]);
     $bNeedCreatePicture = false;
     $arSourceSize = array("x" => 0, "y" => 0, "width" => 0, "height" => 0);
     $arDestinationSize = array("x" => 0, "y" => 0, "width" => 0, "height" => 0);
     if ($sourceImageWidth > 0 && $sourceImageHeight > 0) {
         if ($arSize["width"] > 0 && $arSize["height"] > 0) {
             switch ($resizeType) {
                 case BX_RESIZE_IMAGE_EXACT:
                     $bNeedCreatePicture = true;
                     $ratio = $sourceImageWidth / $sourceImageHeight < $arSize["width"] / $arSize["height"] ? $arSize["width"] / $sourceImageWidth : $arSize["height"] / $sourceImageHeight;
                     $x = max(0, round($sourceImageWidth / 2 - $arSize["width"] / 2 / $ratio));
                     $y = max(0, round($sourceImageHeight / 2 - $arSize["height"] / 2 / $ratio));
                     $arDestinationSize["width"] = $arSize["width"];
                     $arDestinationSize["height"] = $arSize["height"];
                     $arSourceSize["x"] = $x;
                     $arSourceSize["y"] = $y;
                     $arSourceSize["width"] = round($arSize["width"] / $ratio, 0);
                     $arSourceSize["height"] = round($arSize["height"] / $ratio, 0);
                     break;
                 default:
                     if ($resizeType == BX_RESIZE_IMAGE_PROPORTIONAL_ALT) {
                         $width = Max($sourceImageWidth, $sourceImageHeight);
                         $height = Min($sourceImageWidth, $sourceImageHeight);
                     } else {
                         $width = $sourceImageWidth;
                         $height = $sourceImageHeight;
                     }
                     $ResizeCoeff["width"] = $arSize["width"] / $width;
                     $ResizeCoeff["height"] = $arSize["height"] / $height;
                     $iResizeCoeff = Min($ResizeCoeff["width"], $ResizeCoeff["height"]);
                     $iResizeCoeff = 0 < $iResizeCoeff && $iResizeCoeff < 1 ? $iResizeCoeff : 1;
                     $bNeedCreatePicture = $iResizeCoeff != 1 ? true : false;
                     $arDestinationSize["width"] = max(1, intval($iResizeCoeff * $sourceImageWidth));
                     $arDestinationSize["height"] = max(1, intval($iResizeCoeff * $sourceImageHeight));
                     $arSourceSize["x"] = 0;
                     $arSourceSize["y"] = 0;
                     $arSourceSize["width"] = $sourceImageWidth;
                     $arSourceSize["height"] = $sourceImageHeight;
                     break;
             }
         } else {
             $arSourceSize = array("x" => 0, "y" => 0, "width" => $sourceImageWidth, "height" => $sourceImageHeight);
             $arDestinationSize = array("x" => 0, "y" => 0, "width" => $sourceImageWidth, "height" => $sourceImageHeight);
         }
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:58,代码来源:file.php

示例8: _enlargeSafeResize

 protected function _enlargeSafeResize($width, $height)
 {
     $imageWidth = $this->image->getImageWidth();
     $imageHeight = $this->image->getImageHeight();
     if ($imageWidth >= $imageHeight) {
         if ($imageWidth <= $width && $imageHeight <= $height) {
             return $this->_thumbnailImage($imageWidth, $imageHeight);
         }
         $wRatio = $width / $imageWidth;
         $hRatio = $height / $imageHeight;
     } else {
         if ($imageHeight <= $width && $imageWidth <= $height) {
             return $this->_thumbnailImage($imageWidth, $imageHeight);
         }
         // no resizing required
         $wRatio = $height / $imageWidth;
         $hRatio = $width / $imageHeight;
     }
     $resizeRatio = Min($wRatio, $hRatio);
     $newHeight = $imageHeight * $resizeRatio;
     $newWidth = $imageWidth * $resizeRatio;
     return $this->_thumbnailImage($newWidth, $newHeight);
 }
开发者ID:nilBora,项目名称:konstruktor,代码行数:23,代码来源:ImageMagic.php

示例9: Min

 public function Min()
 {
     $nmax = 0;
     list($xmin, $ysetmin) = $this->plots[0]->Min();
     $n = count($this->plots);
     for ($i = 0; $i < $n; ++$i) {
         $nc = count($this->plots[$i]->coords[0]);
         $nmax = max($nmax, $nc);
         list($x, $y) = $this->plots[$i]->Min();
         $xmin = Min($xmin, $x);
         $ysetmin = Min($y, $ysetmin);
     }
     for ($i = 0; $i < $nmax; $i++) {
         // Get y-value for line $i by adding the
         // individual bars from all the plots added.
         // It would be wrong to just add the
         // individual plots min y-value since that
         // would in most cases give to small y-value.
         $y = $this->plots[0]->coords[0][$i];
         for ($j = 1; $j < $this->nbrplots; $j++) {
             $y += $this->plots[$j]->coords[0][$i];
         }
         $ymin[$i] = $y;
     }
     $ymin = Min($ysetmin, Min($ymin));
     return array($xmin, $ymin);
 }
开发者ID:amenadiel,项目名称:jpgraph,代码行数:27,代码来源:AccLinePlot.php

示例10: DB_Count

$Count = DB_Count($TableID, array('Where' => $Where, 'GroupBy' => $Query['GroupBy']));
if (Is_Error($Count)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Source['Count'] = $Count;
//print_r($Count);
//die();
#-------------------------------------------------------------------------------
$Request = array('Where' => $Where, 'SortOn' => $Query['SortOn'], 'IsDesc' => $Query['IsDesc'], 'GroupBy' => $Query['GroupBy']);
#-------------------------------------------------------------------------------
$InPage = $Template['Query']['InPage'];
#-------------------------------------------------------------------------------
$Index =& $Query['Index'];
#-------------------------------------------------------------------------------
$Index = Min(Max(0, $Index), (int) (($Count > $InPage ? $Count : 0) / $InPage));
#-------------------------------------------------------------------------------
$Request['Limits'] = array('Start' => $Index * $InPage, 'Length' => $InPage);
#-------------------------------------------------------------------------------
$ColumnsIDs = $Source['ColumnsIDs'];
#-------------------------------------------------------------------------------
$Columns = $Template['Columns'];
#-------------------------------------------------------------------------------
foreach ($Template['Sequence'] as $ColumnID) {
    #-----------------------------------------------------------------------------
    $Column = $Columns[$ColumnID];
    #-----------------------------------------------------------------------------
    if (isset($Column['Alias'])) {
        $ColumnsIDs[] = SPrintF('%s as `%s`', $Column['Alias'], $ColumnID);
    }
}
开发者ID:carriercomm,项目名称:jbs,代码行数:31,代码来源:SQL.comp.php

示例11: DrawAttendanceCalendar

 function DrawAttendanceCalendar($nameX, $yTop, $aNames, $tTitle, $extraLines, $tFirstSunday, $tLastSunday, $tNoSchool1, $tNoSchool2, $tNoSchool3, $tNoSchool4, $tNoSchool5, $tNoSchool6, $tNoSchool7, $tNoSchool8, $rptHeader)
 {
     $startMonthX = 60;
     $dayWid = 7;
     $MaxLinesPerPage = 36;
     $yIncrement = 6;
     $yTitle = 20;
     $yTeachers = $yTitle + 6;
     $nameX = 10;
     unset($NameList);
     $numMembers = 0;
     $aNameCount = 0;
     //
     //  determine how many pages will be includes in this report
     //
     //
     // First cull the input names array to remove duplicates, then extend the array to include the requested
     // number of blank lines
     //
     $prevThisName = "";
     $aNameCount = 0;
     for ($row = 0; $row < count($aNames); $row++) {
         extract($aNames[$row]);
         $thisName = $per_LastName . ", " . $per_FirstName;
         // Special handling for person listed twice- only show once in the Attendance Calendar
         // This happens when a child is listed in two different families (parents divorced and
         // both active in the church)
         if ($thisName != $prevThisName) {
             $NameList[$aNameCount++] = $thisName;
             //			echo "adding {$thisName} to NameList at {$aNameCount}\n\r";
         }
         $prevThisName = $thisName;
     }
     //
     // add extra blank lines to the array
     //
     for ($i = 0; $i < $extraLines; $i++) {
         $NameList[] = "   ";
     }
     $numMembers = count($NameList);
     $nPages = ceil($numMembers / $MaxLinesPerPage);
     //	echo "nPages = {$nPages} \n\r";
     //
     // Main loop which draws each page
     //
     for ($p = 0; $p < $nPages; $p++) {
         //
         // 	Paint the title section- class name and year on the top, then teachers/liaison
         //
         if ($p > 0) {
             $this->AddPage();
         }
         $this->SetFont("Times", 'B', 16);
         $this->WriteAt($nameX, $yTitle, $rptHeader);
         $this->SetLineWidth(0.5);
         $this->Line($nameX, $yTeachers - 0.75, 195, $yTeachers - 0.75);
         $yMonths = $yTop;
         $yDays = $yTop + $yIncrement;
         $y = $yDays + $yIncrement;
         //
         //	put title on the page
         //
         $this->SetFont("Times", 'B', 12);
         $this->WriteAt($nameX, $yDays + 1, $tTitle);
         $this->SetFont("Times", '', 12);
         //
         // calculate the starting and ending rows for the page
         //
         $pRowStart = $p * $MaxLinesPerPage;
         $pRowEnd = Min(($p + 1) * $MaxLinesPerPage, $numMembers);
         //		echo "pRowStart = {$pRowStart} and pRowEnd= {$pRowEnd}\n\r";
         //
         // Write the names down the page and draw lines between
         //
         $this->SetLineWidth(0.25);
         for ($row = $pRowStart; $row < $pRowEnd; $row++) {
             $this->WriteAt($nameX, $y + 1, $NameList[$row]);
             $y += $yIncrement;
         }
         //
         // write a totals text at the bottom
         //
         $this->SetFont("Times", 'B', 12);
         $this->WriteAt($nameX, $y + 1, gettext("Totals"));
         $this->SetFont("Times", '', 12);
         $bottomY = $y + $yIncrement;
         //
         // Paint the calendar grid
         //
         $dayCounter = 0;
         $monthCounter = 0;
         $dayX = $startMonthX;
         $monthX = $startMonthX;
         $noSchoolCnt = 0;
         $heavyVerticalXCnt = 0;
         $lightVerticalXCnt = 0;
         $tWhichSunday = $tFirstSunday;
         $dWhichSunday = strtotime($tWhichSunday);
         $dWhichMonthDate = $dWhichSunday;
         $whichMonth = date("n", $dWhichMonthDate);
//.........这里部分代码省略.........
开发者ID:jwigal,项目名称:emcommdb,代码行数:101,代码来源:ClassAttendance.php

示例12: ajax_request


//.........这里部分代码省略.........
                }
                if (preg_match_all('/^(\\w+)\\s+(.*)/m', $new, $m)) {
                    $stops = $m[1];
                }
                //if forward direction and changing last item update orig, dest and title
                $rename = '';
                if (reset($routes) == $fld && clb_count($stops) <= $stopindex + 2) {
                    $orig = reset($m[2]);
                    $dest = end($m[2]);
                    $rename .= ', title=' . clb_escape($orig . ' - ' . $dest);
                    $rename .= ', orig=' . clb_escape($orig);
                    $rename .= ', dest=' . clb_escape($dest);
                }
                if ($new_route) {
                    $query = 'SELECT area, count(*) AS c FROM ' . $route_tab . ' WHERE ptype=' . clb_escape($ptype) . ' GROUP BY area';
                    $sel = $db->get_results($query, ARRAY_A);
                    $area = is_array($sel) ? clb_val('', reset($sel), 'area') : '';
                    $query = '';
                    $query .= ', ' . $route_key . '=' . clb_escape($pnum);
                    $query .= ', area=' . clb_escape($area);
                    $query .= ', ptype=' . clb_escape($ptype);
                    $query .= ', ' . $fld . '=' . clb_escape($new);
                    $query .= ', created=' . clb_escape(clb_now_utc());
                    $query = 'INSERT INTO ' . $route_tab . ' SET ' . trim($query, ', ') . $rename;
                } else {
                    $query = 'UPDATE ' . $route_tab . ' SET ' . $fld . '=' . clb_escape($new) . $rename . ' WHERE ' . $route_key . '=' . clb_escape($pnum);
                }
                $db->query($query);
            }
            if ($stops) {
                $index = array_search(clb_val(FALSE, $_REQUEST, 'stop'), $stops);
                //index of the stop we opened route from
                if (is_numeric($stopindex)) {
                    $index = Min($stopindex + ($newstop ? 1 : 0), clb_count($stops) - 1);
                }
                //use new index if provided and add one if new stop
                if (preg_match('/^(\\w+)_\\w+$/', reset($stops), $m)) {
                    $table = array_search($m[1], $prefixes);
                    $spec = clb_val(FALSE, $editor_tables, $table);
                    $points = array();
                    $names = array();
                    $pnums = array();
                    $query = 'SELECT lat, lng, pnum, ptype, title FROM ' . $table . ' WHERE pnum IN ' . clb_join($stops, TRUE);
                    $sel = $db->get_results($query, ARRAY_A);
                    //in theory could be multiple stop instances and need to give points in order so loop on $stops and look up record via xref
                    $xref = clb_column($sel, 'pnum');
                    if (clb_count($sel)) {
                        foreach ($stops as $stop_pnum) {
                            $rec = clb_val(FALSE, $sel, array_search($stop_pnum, $xref));
                            $points[] = array($rec['lat'], $rec['lng'], 0);
                            $names[] = str_replace('|', ',', $rec['title']);
                            $pnums[] = $rec['pnum'];
                            $rec['type'] = 'marker';
                            $xml .= clb_tag('response', '', '', $rec) . "\n";
                            $rec_count++;
                        }
                    }
                    foreach ($points as $i => $pt) {
                        if (!is_array($pt)) {
                            unset($points[$i]);
                        }
                    }
                    //remove non points if there are any
                    $line = pline_make($points, array('color' => '#FF0000'));
                    $line['names'] = join('|', $names);
                    $line['pnums'] = join('|', $pnums);
开发者ID:davidkeen,项目名称:railservice,代码行数:67,代码来源:edit_ajax.php

示例13: getBankProduction

function getBankProduction(&$objUser)
{
    $production = array();
    $iAllianceId = $objUser->get_stat(ALLIANCE);
    $iLand = $objUser->get_build(LAND);
    $arrMines = getMineProduction($objUser);
    $strRace = $objUser->get_stat(RACE);
    $citizens = $objUser->get_pop(CITIZENS);
    $iBanks = $objUser->get_build(BANKS);
    // Bank Income Formula
    $landratio = $iLand / 2000;
    $citzacre = max($citizens / $iLand * Min(pow($landratio, 2), 1), 1);
    $gold = $arrMines['per_each'] * 2 * exp(-50 / $citzacre);
    // Lowest Possible value
    if ($strRace == "Dragon" && $gold < 60) {
        $gold = 60;
    } elseif ($gold < 250) {
        $gold = 250;
    }
    $raw = $iBanks * $gold;
    // Research Bonus - New code                        January 09, 2008, Martel
    $arrResearch = getResearchBonuses($objUser->get_alliance());
    $research_bonus = round($raw * $arrResearch['income']);
    $total = $raw + $research_bonus;
    $production['per_each'] = $gold;
    $production['raw'] = $raw;
    $production['research_bonus'] = $research_bonus;
    $production['total'] = $total;
    return $production;
}
开发者ID:BrorHolm,项目名称:Orkfia-2008,代码行数:30,代码来源:production.php

示例14: Tag

 $Right = $Index + 3;
 #-----------------------------------------------------------------------------
 if ($Left < 1) {
     $Right -= $Left;
 }
 #-----------------------------------------------------------------------------
 if ($Right > ($Pages = Ceil($Count / $InPage))) {
     $Left -= $Right - $Pages;
 }
 #-----------------------------------------------------------------------------
 if ($Left > 0) {
     $Div->AddChild(new Tag('IMG', array('class' => 'Button', 'alt' => 'Прокрутить назад', 'width' => 12, 'height' => 10, 'onclick' => SPrintF('TableSuperSetIndex(%s);', $Index - 6), 'src' => 'SRC:{Images/ArrowLeft.gif}')));
 }
 #-----------------------------------------------------------------------------
 $Left = Max(0, $Left);
 $Right = Min($Pages, $Right);
 #-----------------------------------------------------------------------------
 for ($i = $Left; $i < $Right; $i++) {
     #---------------------------------------------------------------------------
     $Button = new Tag('BUTTON', array('class' => 'TableSuperIndexes', 'onclick' => SPrintF('TableSuperSetIndex(%s);', $i)), $i + 1);
     #---------------------------------------------------------------------------
     if ($i == $Index) {
         $Button->AddAttribs(array('disabled' => 'true'));
     }
     #---------------------------------------------------------------------------
     $Div->AddChild($Button);
 }
 #-----------------------------------------------------------------------------
 if ($Right < $Pages) {
     $Div->AddChild(new Tag('IMG', array('class' => 'Button', 'alt' => 'Прокрутить вперед', 'width' => 12, 'height' => 10, 'onclick' => SPrintF('TableSuperSetIndex(%s);', $Index + 6), 'src' => 'SRC:{Images/ArrowRight.gif}')));
 }
开发者ID:carriercomm,项目名称:jbs,代码行数:31,代码来源:Indexes.comp.php

示例15: Max

						<?}?>
					</TR><TR>
						<?FOR($i = 1; $i <= $days; $i++){?>
						<TD class="fs8px bg_light center"><?Print $i;?></TD>
						<?}?>
					</TR>
				</TABLE>
			</TD><TD>
	<!-- ------- Search stats ------- -->
				<TABLE class="b1 fs9px">
					</TR><TR>
						<TD class="h3 center b1" colspan=<?Print $days?>><?Print $text_search_stats;?></TD>
					</TR><TR>
						<TD class="bg_light" colspan=<?Print $days;?>>
							<?Print "<FONT class=\"b\"> ".$text_max."</FONT> : ".@Max($max_search);?>/s&nbsp;
							<?Print "<FONT class=\"b\"> ".$text_min."</FONT> : ".@Min($min_search);?>/s&nbsp;
							<?Print "<FONT class=\"b\"> ".$text_averange."</FONT> : ".$total['search'];?>/s
						</TD>
					</TR><TR>
						<?FOR($i = 1; $i <= $days; $i++){
						$info  = $text_averange." : ".$search[$i]."/s\n";
						$info .= $text_min." : ".$min_search[$i]."/s\n";
						$info .= $text_max." : ".$max_search[$i]."/s";?>
						<TD class="fs0px b1 center bottom" height=100 title="<?Print $info;?>">
							<?IF($search[$i]){?><IMG src="img/bar.gif" width=8 height=<?Print @Round($search[$i] / Max($search) * 100);?>><?}
							ELSE{?><IMG src="img/space.gif" width=8><?}?>
						</TD>
						<?}?>
					</TR><TR>
						<?FOR($i = 1; $i <= $days; $i++){?>
						<TD class="fs8px bg_light center"><?Print $i;?></TD>
开发者ID:BackupTheBerlios,项目名称:verlihub,代码行数:31,代码来源:stats.php


注:本文中的Min函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。