Changeset 331


Ignore:
Timestamp:
04/22/07 20:32:32 (17 years ago)
Author:
bastiaans
Message:

job_monarch/libtoga.php:

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/addons/job_monarch/libtoga.php

    r330 r331  
    8181global $skan_str;
    8282global $x_first, $y_first;
     83global $SORT_XLABEL, $SORT_YLABEL;
    8384
    8485$my_dir = getcwd();
     
    10601061                global $SORTBY_HOSTNAME, $SORT_ORDER, $skan_str;
    10611062                global $x_first, $y_first;
     1063
     1064                global $SORT_XLABEL, $SORT_YLABEL;
    10621065       
    10631066                $mydatag = $this->dataget;
     
    12101213                        $sorted_nodes   = usort( $nodes, "cmp" );
    12111214
     1215                        $cur_node       = 0;
     1216
    12121217                        $x_offset       = 0;
    1213                         $cur_node       = 0;
     1218                        $y_offset       = 0;
     1219                        $font           = 2;
     1220                        $fontwidth      = ImageFontWidth( $font );
     1221                        $fontheight     = ImageFontHeight( $font );
     1222                        $fontspaceing   = 2;
     1223
     1224                        if( $this->isBig() )
     1225                        {
     1226
     1227                                $y_offset       = ($fontheight * (1 + strlen( $x_max) ) ) + ((2 + strlen( $x_max)) * $fontspaceing);
     1228                                $x_offset       = ($fontwidth * (1 + strlen( $y_max) ) ) + ((2 + strlen( $y_max)) * $fontspaceing);
     1229
     1230                        }
     1231                        //$x_offset     = ($fontwidth * 3) + (5 * $fontspaceing);
    12141232
    12151233                        //printf( "xmin %s xmax %s\n", $x_min, $x_max );
     
    12311249                        imageFill( $image, 0, 0, $colorwhite );
    12321250
    1233                         //if( $this->isSmall() ) {
    1234 
    1235                         //      $colorblue      = imageColorAllocate( $image, 0, 0, 255 );
    1236 
    1237                         //      imageString( $image, $font, 2, 2, "Monarch Joblist - cluster: ".$this->clustername, $colorblue );
    1238                         //}
     1251                        if( $this->isBig() )
     1252                        {
     1253                                $colorblue      = imageColorAllocate( $image, 0, 0, 255 );
     1254
     1255                                imageString( $image, $font, $x_offset, $fontspaceing, $SORT_XLABEL, $colorblue );
     1256
     1257                                // Stupid php without imageStringDown function
     1258                                //
     1259                                imageStringDown( $image, $font, $fontspaceing, $y_offset, $SORT_YLABEL, $colorblue );
     1260                        }
    12391261
    12401262                        for( $n = $x_min; $n <= $x_max; $n++ )
     
    12491271                                        {
    12501272                                                $y      = $y_offset + ( ($m-$y_min) * $node_width );
     1273                                        }
     1274
     1275                                        if( $n == $x_min )
     1276                                        {
     1277                                                $mfontspacing   = 1;
     1278                                                $ylabel_x       = $x - ( $fontwidth * strlen( $y_max ) ) - $mfontspacing;
     1279                                                $ylabel_y       = $y;
     1280
     1281                                                imageString( $image, $font, $ylabel_x, $ylabel_y, strval( $m ), $colorblue );
     1282                                        }
     1283                                        if( $m == $y_min )
     1284                                        {
     1285                                                $mfontspacing   = 2;
     1286                                                $xlabel_y       = $y - ( $fontheight * strlen( $x_max ) );
     1287                                                $xlabel_x       = $x + $mfontspacing;
     1288
     1289                                                imageStringDown( $image, $font, $xlabel_x, $xlabel_y, strval( $n ), $colorblue );
    12511290                                        }
    12521291
     
    15391578}
    15401579
     1580function imageStringDown( &$image, $font, $x, $y, &$s, &$col )
     1581{
     1582        $fw     = imagefontwidth( $font);
     1583        $fh     = imagefontheight( $font);
     1584       
     1585        $fontspacing = 0;
     1586
     1587        $fx     = $x;
     1588        $fy     = $y;
     1589
     1590        for( $n=0; $n<strlen( $s ); $n++ )
     1591        {
     1592                $myc    = $s{$n};
     1593
     1594                imagestring( $image, $font, $fx, $fy, $myc, $col );
     1595
     1596                $fy     += ($fontspacing + $fh );
     1597        }
     1598}
     1599
    15411600function array_rem( $val, &$arr )
    15421601{
Note: See TracChangeset for help on using the changeset viewer.