Public Member Functions | Static Public Member Functions | Data Fields | Private Member Functions | Static Private Member Functions

bkasc_napdf Class Reference

This creates and manages an instance of the napdf class, and creates the PDF file. More...

Inheritance diagram for bkasc_napdf:
Inheritance graph
[legend]

Public Member Functions

 __construct ($in_http_vars)
 AssemblePDF ()
 OutputPDF ()
 BK_DrawFrontCover ($in_layout)
 BK_DrawChangeForm ($in_layout)
 BK_DrawString ($in_string, $in_x_max, $in_x='', $in_y='', $in_align='', $in_fontsize='', $in_font_family='', $in_font_style='')
 BK_DrawOneListPage (&$in_layout)
 BK_Write_One_Meeting ($in_layout, $in_index, $in_y, $in_page_offset=0, $in_bgcolor=255, $in_textcolor=0)
 BK_WriteDayHeader ($in_layout, $in_day, $in_y, $in_left, $in_right, $in_day_contd="")
 _Set_Page_Layout ($in_font_family="Helvetica")
 _CalculateListMeta ($in_font_family="Helvetica")
 _GetMeetings_And_Formats ()

Static Public Member Functions

static sort_meeting_data_callback_ny (&$in_a, &$in_b)
 This is a static callback function to be used for sorting the multi-dimensional meeting_data array. It uses the sort_order_keys array to determine the sort.

Data Fields

 $weekday_names = array ( "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" )
 $pos = array ( 'start' => 1, 'end' => '', 'count' => 0, 'y' => 0, 'weekday' => 1 )
 $right_offset = 0
 $formats = 0

Private Member Functions

 DrawFormatPage ()
 RearrangeFormats ($inFormats)

Static Private Member Functions

static sort_cmp_formats ($a, $b)
static sort_formats ($in_format_data)
static sort_cmp ($a, $b)
static FindFormatPos ($in_key, $in_format_array)
static translate_time ($in_time_string)
static translate_duration ($in_time_string)

Detailed Description

This creates and manages an instance of the napdf class, and creates the PDF file.

Definition at line 23 of file bkasc_napdf.class.php.


Constructor & Destructor Documentation

__construct ( in_http_vars  ) 

< The width, in inches, of each page

< The height, in inches, of each page.

< The measurement units (inches)

< The font we'll use

< The font size we'll use

< The orientation (portrait)

These are the sort keys, for sorting the meetings before display

< First, weekday

< Finally, the time the meeting starts

< Our week starts on Sunday (1)

These are the parameters that we send over to the root server, in order to get our meetings.

< Do a search

< We'll be looking for a borough...

< named 'brooklyn'.

< Just as long as its contained in the borough.

Parameters:
in_http_vars The HTTP parameters we'd like to send to the server.

Definition at line 36 of file bkasc_napdf.class.php.

References napdf::$sort_callback.

    {
        $this->page_x = 7;      ///< The width, in inches, of each page
        $this->page_y = 8.5;        ///< The height, in inches, of each page.
        $this->units = 'in';        ///< The measurement units (inches)
        $this->font = 'Helvetica';      ///< The font we'll use
        $this->font_size = 7.25;    ///< The font size we'll use
        $this->orientation = 'P';   ///< The orientation (portrait)
        /// These are the sort keys, for sorting the meetings before display
        $this->sort_keys = array (  'weekday_tinyint' => true,          ///< First, weekday
                                    'start_time' => true,               ///< Finally, the time the meeting starts
                                    'week_starts' => 1                  ///< Our week starts on Sunday (1)
                                    );
        /// These are the parameters that we send over to the root server, in order to get our meetings.
        $this->out_http_vars = array ('do_search' => 'yes',                     ///< Do a search
                                    'meeting_key' => 'location_city_subsection',    ///< We'll be looking for a borough...
                                    'meeting_key_value' => 'brooklyn',      ///< named 'brooklyn'.
                                    'meeting_key_contains' => '1'           ///< Just as long as its contained in the borough.
                                    );
        
        $this->lang_search = array ( 'en', 'es' );

        napdf::$sort_callback = 'bkasc_napdf::sort_meeting_data_callback_ny';
        
        parent::__construct ( $in_http_vars, $this->lang_search );
    }


Member Function Documentation

_CalculateListMeta ( in_font_family = "Helvetica"  ) 

Definition at line 1200 of file bkasc_napdf.class.php.

References printableList::$font_size, and _GetMeetings_And_Formats().

Referenced by _Set_Page_Layout().

        {
        define ( "_BK_PLACEHOLDER_", "####" );
        
        $meetings = $this->_GetMeetings_And_Formats ( );
        
        $ret = array (  "Meta" => array (       "font_size" => 10,
                                                        "font_family" => $in_font_family,
                                                        "H Gap" => 0.125,
                                                        "V Gap" => 0.02,
                                                        "meetings" => $meetings),
                            
                            "Info" =>   array ( "Name" => array ( "key" => "name", "format" => "B", "width" => 0, "const_value" => _BK_PLACEHOLDER_, "row" => 0, "col" => 0 ),
                            
                                                        // Meeting Location Stuff
                                                        "Town" => array ( "key" => "town", "format" => "", "width" => 0, "const_value" => _BK_PLACEHOLDER_, "row" => 0, "col" => 0 ),
                                                        "Borough" => array ( "key" => "county", "format" => "", "width" => 0, "const_value" => _BK_PLACEHOLDER_, "row" => 0, "col" => 0 ),
                                                        "Neighborhood" => array ( "key" => "neighborhood", "format" => "", "width" => 0, "const_value" => _BK_PLACEHOLDER_, "row" => 0, "col" => 0 ),
                                                        "Location" => array ( "key" => "location_and_street_address", "format" => "", "width" => 0, "const_value" => _BK_PLACEHOLDER_, "row" => 0, "col" => 0 ),
                                                        "Location Info" => array ( "key" => "location_info", "format" => "", "width" => 0, "const_value" => _BK_PLACEHOLDER_, "row" => 0, "col" => 0 ),
                                                        
                                                        // Time and Duration Stuff
                                                        "Weekday" => array ( "key" => "weekday", "format" => "", "width" => 0, "const_value" => _BK_PLACEHOLDER_, "row" => 0, "col" => 0 ),
                                                        "Time" => array ( "key" => "start_time", "format" => "", "width" => 0, "const_value" => _BK_PLACEHOLDER_, "row" => 0, "col" => 0 ),
                                                        "Duration" => array ( "key" => "duration", "format" => "", "width" => 0, "const_value" => _BK_PLACEHOLDER_, "row" => 0, "col" => 0 ),
                                                        
                                                        // Meta Stuff
                                                        "Description" => array ( "key" => "description", "width" => 0, "const_value" => _BK_PLACEHOLDER_, "row" => 0, "col" => 0 ),
                                                        "Comments" => array ( "key" => "othertext", "width" => 0, "const_value" => _BK_PLACEHOLDER_, "row" => 0, "col" => 0 ),
                                                        "Format" => array ( "key" => "format", "format" => "", "width" => 0, "const_value" => _BK_PLACEHOLDER_, "row" => 0, "col" => 0 ) ) );
        
        reset ( $ret['Meta']['meetings'] );
        $font_family = $ret['Meta']['font_family'];
        $font_size = $ret['Meta']['font_size'];
        
        $meetings = $ret['Meta']['meetings']['meetings'];
    
        foreach ( $meetings as $meeting )
            {
            reset ( $ret['Info'] );
            
            while ( list ( $key, $value ) = each ( $ret['Info'] ) )
                {
                if ( ($ret['Info'][$key]['const_value'] == _BK_PLACEHOLDER_) && $meeting[$ret['Info'][$key]['key']] )
                    {
                    $ret['Info'][$key]['const_value'] = $meeting[$ret['Info'][$key]['key']];
                    }
                elseif ( $ret['Info'][$key]['const_value']
                        && ($ret['Info'][$key]['const_value'] != _BK_PLACEHOLDER_)
                        && ($ret['Info'][$key]['const_value'] != $meeting[$ret['Info'][$key]['key']]) )
                    {
                    $ret['Info'][$key]['const_value'] = "";
                    }
                
                $meeting_key = $ret['Info'][$key]['key'];
                $string = $meeting[$meeting_key];
                
                $this->napdf_instance->SetFont ( $font_family, $ret['Info'][$key]['format'], $font_size );
                $width = $this->napdf_instance->GetStringWidth ( $meeting[$meeting_key] );
                $ret['Info'][$key]['width'] = max ( $width, $ret['Info'][$key]['width'] );
                }
            }
        
        reset ( $ret['Info'] );
        
        while ( list ( $key, $value ) = each ( $ret['Info'] ) )
            {
            if ( $ret['Info'][$key]['const_value'] == _BK_PLACEHOLDER_ )
                {
                $ret['Info'][$key]['const_value'] = Null;
                }
            }
        
        return $ret;
        }

_GetMeetings_And_Formats (  ) 

Definition at line 1278 of file bkasc_napdf.class.php.

References $formats, translate_duration(), and translate_time().

Referenced by _CalculateListMeta().

        {
        global $days, $formats, $special_formats, $special_formats_spanish;
        
        $meetings_in =& $this->napdf_instance->meeting_data;

        $meetings = array();
        $weekdayindex = 0;
        $meeting_day = array ();
        
        foreach ( $meetings_in as $row )
            {
            $this_meeting['weekday'] = $this->weekday_names[$row['weekday_tinyint'] - 1];
            $this_meeting['name'] = $row['meeting_name'];
            $this_meeting['town'] = $row['location_municipality'];
            $this_meeting['county'] = $row['location_city_subsection'];
            $this_meeting['neighborhood'] = $row['location_neighborhood'];
            $this_meeting['start_time'] = self::translate_time ( $row['start_time'] );
            $this_meeting['location'] = $row['location_text'];
            $this_meeting['location_info'] = $row['location_info'];
            $this_meeting['street_address'] = $row['location_street'];
            $this_meeting['description'] = $row['comments'];
            $this_meeting['othertext'] =  $row['description_string'];
            $this_meeting['format'] = $row['formats'];
            $check_f = split ( ",", $this_meeting['format'] );
            $spec = false;
            foreach ( $check_f as $f )
                {
                if ( ($f == "C") || ($f == "O") )
                    {
                    $spec = true;
                    break;
                    }
                }
            
            if ( !$spec )
                {
                if ( $this_meeting['format'] )
                    {
                    $this_meeting['format'] = ",".$this_meeting['format'];
                    }
                
                $this_meeting['format'] = "C".$this_meeting['format'];
                }
            
            $this_meeting['location_and_street_address'] = $this_meeting['location'].", ".$this_meeting['street_address'];
            $this_meeting['duration'] = self::translate_duration ( $meeting['duration_time'] );
            
            array_push ( $meetings, $this_meeting );
            }
        
        // This will mark when the list was printed.
        $date = _PDF_PRINTED_ON;
        
        $ret['date'] = $date;
        $ret['meetings'] = $meetings;
        
        return $ret;
        }

_Set_Page_Layout ( in_font_family = "Helvetica"  ) 

Definition at line 1111 of file bkasc_napdf.class.php.

References printableList::$font_size, $pos, and _CalculateListMeta().

Referenced by AssemblePDF().

        {
        $calculated_data = $this->_CalculateListMeta ( $in_font_family );
        
        $page_metrics['font_family'] = $in_font_family;
        $page_metrics['width'] = 7;
        $page_metrics['height'] = 8.5;
        $page_metrics['margin']['top'] = 0.25;
        $page_metrics['margin']['left'] = 0.25;
        $page_metrics['margin']['bottom'] = 0.25;
        $page_metrics['margin']['right'] = 0.25;
        $page_metrics['footer'] = 0.5;
        $page_metrics['font_size'] = 0;
        
        $rows[0] = array ( "Name", "Location", "Time", "Format" );
        
        $row_layout = array();
        
        $total_width = 0;
        
        for ( $row_index = 0; $row_index < count ( $rows ); $row_index++ )
            {
            $e_count = 0;
            for ( $row_array_index = 0; $row_array_index < count ( $rows[$row_index] ); $row_array_index++ )
                {
                $element = $rows[$row_index][$row_array_index];
                $elements = split ( "\+", $element );
                
                for ( $element_index = 0; $element_index < count ( $elements ); $element_index++ )
                    {
                    $element_string = $elements[$element_index];
                    
                    if ( array_key_exists ( $element_string, $calculated_data['Info'] ) )
                        {
                        $width = $calculated_data['Info'][$element]['width'];
                        $row_layout[$row_index][$e_count]['key'] = $calculated_data['Info'][$element_string]['key'];
                        }
                    
                    $row_layout[$row_index][$e_count]['string'] = $element_string;
                    $row_layout[$row_index][$e_count]['format'] = $calculated_data['Info'][$element_string]['format'];
                    $row_layout[$row_index][$e_count++]['width'] = $width;
                    }
                
                if ( $row_array_index != (count ( $rows[$row_index] ) - 1) )
                    {
                    $row_layout[$row_index][$e_count++]['width'] = $calculated_data['Meta']['H Gap'];
                    }
                }
            
            $row_width = 0;
            for ( $counter = 0; $counter < count ( $row_layout[$row_index] ); $counter++ )
                {
                $row_width += $row_layout[$row_index][$counter]['width'];
                }
            
            $total_width = max ( $total_width, $row_width );
            }
            
        $page_width = $page_metrics['width'] - ($page_metrics['margin']['left'] + $page_metrics['margin']['right']);
        
        $coefficient = $page_width / $total_width;
    
        $font_size = $calculated_data['Meta']['font_size'];
        $font_size *= $coefficient;
    
        for ( $row_index = 0; $row_index < count ( $row_layout ); $row_index++ )
            {
            $pos = $page_metrics['margin']['left'];
            for ( $row_array_index = 0; $row_array_index < count ( $row_layout[$row_index] ); $row_array_index++ )
                {
                $row_layout[$row_index][$row_array_index]['width'] *= $coefficient;
                $row_layout[$row_index][$row_array_index]['left'] = $pos;
                $pos += $row_layout[$row_index][$row_array_index]['width'];
                }
            }
            
        $page_metrics['font_size'] = $font_size;
        $row_layout['page_metrics'] = $page_metrics;
        $row_layout['data'] = $calculated_data;
        $row_layout['placeholder']['weekday'] = 0;
        $row_layout['placeholder']['town'] = 0;
        $row_layout['placeholder']['county'] = 0;
        $row_layout['placeholder']['meeting_index'] = 0;
    
        return $row_layout;
        }

AssemblePDF (  ) 

Implements IPrintableList.

Definition at line 69 of file bkasc_napdf.class.php.

References _Set_Page_Layout(), BK_DrawChangeForm(), BK_DrawFrontCover(), BK_DrawOneListPage(), and DrawFormatPage().

    {
        $ret = false;
        
        if ( $this->napdf_instance instanceof napdf )
            {
            $layout = $this->_Set_Page_Layout ( );
            
            $this->BK_DrawFrontCover ( $layout );
            
            $this->DrawFormatPage ( );
            
            while ( $this->BK_DrawOneListPage ( $layout ) );
            
            $this->BK_DrawChangeForm ( $layout );

            $ret = true;
            }
        
        return $ret;
    }

BK_DrawChangeForm ( in_layout  ) 

Definition at line 613 of file bkasc_napdf.class.php.

References printableList::$font_size, $formats, BK_DrawString(), and sort_formats().

Referenced by AssemblePDF().

        {
        $top = $in_layout['page_metrics']['margin']['top'];
        $left = $in_layout['page_metrics']['margin']['left'];
        $bottom = $this->napdf_instance->h - $in_layout['page_metrics']['margin']['bottom'];
        $right = $this->napdf_instance->w - $in_layout['page_metrics']['margin']['right'];
        $v_gap = $in_layout['data']['Meta']["V Gap"];
        $font_size = $in_layout[page_metrics]['font_size'];
        $height_row = $font_size/72 + $v_gap;
        $inTitleGraphic = "../ny_printed_lists/images/ELI_Cover_Logo.png";
    
        $this->napdf_instance->AddPage();
    
        // The NA Symbol. 1-Inch diameter.
        $this->napdf_instance->Image ( $inTitleGraphic, $left, $top, 1, 1 );
            
        $x = $left;
        $x_max = $left + 1;
        $y = $top + 1.125;
    
        // The URL, just under the NA symbol.   
        $this->BK_DrawString ( _PDF_BROOKLYN_VISIT, $x_max, $x, $y, "c", 7, "Helvetica" );
        $this->BK_DrawString ( _PDF_BROOKLYN_URL, $x_max, $x, 0, "c", 8.5, "Helvetica", "B" );
    
        $y_start = $this->napdf_instance->GetY() + ($v_gap * 2);
        
        $x = $left + 1.25;
        $x_max = $right;
        $y = $top;
    
        // The header
        $this->BK_DrawString ( _PDF_BROOKLYN_ASC_HEADER, $x_max, $x, $y, "c", 20, "Times", "B" );
        $this->BK_DrawString ( _PDF_BROOKLYN_ASC_NAME, $x_max, $x, 0, "c", 14, "Times" );
        $this->BK_DrawString ( _PDF_BROOKLYN_UPDATE, $x_max, $x, 0, "c", 16, "Times", "B" );
        
        // The GSR note
        $this->BK_DrawString ( _PDF_BROOKLYN_NOTE_GSR, $x_max, $x, $this->napdf_instance->GetY() + ($v_gap * 2), "", 9, "Helvetica", "i" );
        
        // The Submitter Info
    
        $x = $left;
        $x_max = $left + 2;
        $y = $y_start - 0.25;
        $this->napdf_instance->SetLineWidth ( 0.01 );
        
        $this->BK_DrawString ( _PDF_BROOKLYN_NAME, $x_max, $x, $y, "r", 10, "Times", "B" );
        
        $y = $this->napdf_instance->GetY();
        
        $this->napdf_instance->Line ( $x_max + 0.1, $y, $right, $y );
        
        $this->BK_DrawString ( _PDF_BROOKLYN_PHONE, $x_max, $x, $y + 0.15, "r", 10, "Times", "B" );
        
        $y = $this->napdf_instance->GetY();
        
        $this->napdf_instance->Line ( $x_max + 0.1, $y, $right, $y );
    
        $this->BK_DrawString ( _PDF_BROOKLYN_EMAIL, $x_max, $x, $y + 0.15, "r", 10, "Times", "B" );
        
        $y = $this->napdf_instance->GetY();
        
        $this->napdf_instance->Line ( $x_max + 0.1, $y, $right, $y );
    
        $this->BK_DrawString ( _PDF_BROOKLYN_GSP, $x_max, $x, $y + 0.15, "r", 10, "Times", "B" );
        
        $y = $this->napdf_instance->GetY();
        
        $this->napdf_instance->Line ( $x_max + 0.1, $y, $right, $y );
    
        $y += 0.05;
        $this->napdf_instance->SetLineWidth ( 0.025 );
        $this->napdf_instance->Line ( $left, $y, $right, $y );
        $y += 0.05;
        $x_max = $left + 1.125;
    
        $this->BK_DrawString ( _PDF_BROOKLYN_CHANGE_TYPE, $x_max, $x, $y, "r", 9, "Helvetica", "B" );
        
        $r_w = $r_h = 0.125;
        $this->napdf_instance->SetLineWidth ( 0.01 );
        $x_max = $right;
    
        
        $x = $left + 1.25;
        $this->napdf_instance->Rect ( $x, $y+ 0.01, $r_w, $r_h );
        $x += ($r_w + 0.01);
    
        $d_s = $this->BK_DrawString ( _PDF_BROOKLYN_CHANGE_TYPE_CLOSED, $x_max, $x, $y, "", 9, "Helvetica", "" );
        
        $x += $d_s['width'] + 0.25;
        $this->napdf_instance->Rect ( $x, $y+ 0.01, $r_w, $r_h );
        $x += ($r_w + 0.01);
    
        $d_s = $this->BK_DrawString ( _PDF_BROOKLYN_CHANGE_TYPE_NEW, $x_max, $x, $y, "", 9, "Helvetica", "" );
            
        $x += $d_s['width'] + 0.25;
        $this->napdf_instance->Rect ( $x, $y+ 0.01, $r_w, $r_h );
        $x += ($r_w + 0.01);
    
        $d_s = $this->BK_DrawString ( _PDF_BROOKLYN_CHANGE_TYPE_CHANGED, $x_max, $x, $y, "", 9, "Helvetica", "" );
        
        $y = ($d_s['y'] + 0.065);
        $this->napdf_instance->SetLineWidth ( 0.025 );
        $this->napdf_instance->Line ( $left, $y, $right, $y );
        
        $y += 0.065;
    
        $d_s = $this->BK_DrawString ( _PDF_BROOKLYN_HEADER_FORMAT, $right, $left, $y, "C", 12, "Helvetica", "B" );
        
        $y = $d_s['y'];
        
        $d_s = $this->BK_DrawString ( _PDF_BROOKLYN_NOTE_FORMAT, $right, $left, $y, "C", 9, "Helvetica", "I" );
        
        // Format Checkboxes
        
        $y = ($d_s['y'] + 0.065);
        $col = -1;
        $x = $left;
        $cell_size = 0.5;
        $this->napdf_instance->SetLineWidth ( 0.01 );
        $this->napdf_instance->SetFont ( "Helvetica", "B", 10 );
        
        $formats = self::sort_formats ( $this->napdf_instance->format_data );
        foreach ( $formats as $format )
            {
            if ( $format['key_string'] )
                {
                if ( $col++ > 11 )
                    {
                    $col = 0;
                    $x = $left;
                    $y += 0.25;
                    }
                $this->napdf_instance->Rect ( $x, $y+ 0.01, $r_w, $r_h );
                $this->napdf_instance->SetXY ( $x + $r_w, $y );
                $this->napdf_instance->Cell ( 0, 10/72, utf8_decode (  $format['key_string'] ) );
                $x += $cell_size;
                }
            }
        
        $y += 0.25;
        $this->napdf_instance->SetLineWidth ( 0.025 );
        $this->napdf_instance->Line ( $left, $y, $right, $y );
        
        $y += 0.065;
    
        $d_s = $this->BK_DrawString ( _PDF_BROOKLYN_HEADER_LOCATION, $right, $left, $y, "C", 12, "Helvetica", "B" );
    
        $y = ($d_s['y'] + 0.15);
    
        $x = $left;
        $x_max = $left + 1.1;
        $this->napdf_instance->SetLineWidth ( 0.01 );
        
        $d_s = $this->BK_DrawString ( _PDF_BROOKLYN_LOCATION_MEETING_NAME, $x_max, $x, $y, "r", 10, "Times", "B" );
        
        $y = $d_s['y'];
        
        $this->napdf_instance->Line ( $x_max + 0.1, $y, $right, $y );
        
        $y += 0.15;
        
        $d_s = $this->BK_DrawString ( _PDF_BROOKLYN_LOCATION_NAME, $x_max, $x, $y, "r", 10, "Times", "B" );
        
        $y = $d_s['y'];
        
        $this->napdf_instance->Line ( $x_max + 0.1, $y, $right, $y );
        
        $y += 0.15;
        
        $d_s = $this->BK_DrawString ( _PDF_BROOKLYN_LOCATION_ADDR, $x_max, $x, $y, "r", 10, "Times", "B" );
        
        $y = $d_s['y'];
        
        $this->napdf_instance->Line ( $x_max + 0.1, $y, $right, $y );
        
        $y += 0.15;
        
        $d_s = $this->BK_DrawString ( _PDF_BROOKLYN_LOCATION_TOWN, $x_max, $x, $y, "r", 10, "Times", "B" );
        
        $yt = $d_s['y'];
        
        $this->napdf_instance->Line ( $x_max + 0.1, $yt, $x_max + 3.6, $yt );
        
        $d_s = $this->BK_DrawString ( _PDF_BROOKLYN_LOCATION_ZIP, $x_max + 4, $x_max + 3.6, $y, "r", 10, "Times", "B" );
        
        $this->napdf_instance->Line ( $x_max + 4.1, $yt, $right, $yt );
        
        $y = $d_s['y'] + 0.15;
        
        $d_s = $this->BK_DrawString ( _PDF_BROOKLYN_LOCATION_DIR, $x_max, $x, $y, "r", 10, "Times", "B" );
        
        $y = $d_s['y'];
        
        $this->napdf_instance->Line ( $x_max + 0.1, $y, $right, $y );
        
        $y += 0.3;
        
        $this->napdf_instance->Line ( $x_max + 0.1, $y, $right, $y );
        
        $y += 0.05;
        
        $this->napdf_instance->SetLineWidth ( 0.025 );
        $this->napdf_instance->Line ( $left, $y, $right, $y );
    
        $y += 0.065;
    
        $d_s = $this->BK_DrawString ( _PDF_BROOKLYN_HEADER_TIME, $right, $left, $y, "C", 12, "Helvetica", "B" );
    
        $y = ($d_s['y'] + 0.15);
        
        $d_s = $this->BK_DrawString ( _PDF_BROOKLYN_MEETING_DAY, $left + 0.9, $left, $y, "R", 10, "Times", "B" );
    
        $this->napdf_instance->SetFont ( "Helvetica", "", 9 );
    
        global $days;
        
        $x = $left + 1;
        $this->napdf_instance->SetLineWidth ( 0.01 );
        
        foreach ( $this->weekday_names as $day )
            {
            $this->napdf_instance->Rect ( $x, $y+ 0.01, $r_w, $r_h );
            $this->napdf_instance->SetXY ( $x + $r_w, $y );
            $cell_size = $this->napdf_instance->GetStringWidth ( utf8_decode ( $day ) ) + 0.2 + $r_w;
            $this->napdf_instance->Cell ( 0, 10/72, utf8_decode ( $day ) );
            $x += $cell_size;
            }
        
        $y += ($r_h + 0.15);
        
        $d_s = $this->BK_DrawString ( _PDF_BROOKLYN_MEETING_TIME, $left + 0.9, $left, $y, "R", 10, "Times", "B" );
        
        $yt = $d_s['y'];
        
        $this->napdf_instance->Line ( $left + 1, $yt, $left + 4, $yt );
        
        $d_s = $this->BK_DrawString ( _PDF_BROOKLYN_MEETING_DURATION, $left + 4.8, $left + 4.1, $y, "R", 10, "Times", "B" );
        
        $y = $d_s['y'];
        
        $this->napdf_instance->Line ( $left + 4.9, $yt, $right, $yt );
        
        $y = $this->napdf_instance->GetY() + 0.05;
        $this->napdf_instance->SetLineWidth ( 0.025 );
        $this->napdf_instance->Line ( $left, $y, $right, $y );
    
        $y += 0.065;
    
        $d_s = $this->BK_DrawString ( _PDF_BROOKLYN_HEADER_NOTES, $right, $left, $y, "C", 12, "Helvetica", "B" );
    
        $this->napdf_instance->SetLineWidth ( 0.01 );
    
        $y = ($d_s['y'] + 0.3);
        
        while ( $y < $bottom )
            {
            $this->napdf_instance->Line ( $left, $y, $right, $y );
        
            $y += 0.3;
            }
        }

BK_DrawFrontCover ( in_layout  ) 

Definition at line 508 of file bkasc_napdf.class.php.

Referenced by AssemblePDF().

        {
        $top = $in_layout['page_metrics']['margin']['top'];
        $left = $in_layout['page_metrics']['margin']['left'];
        $bottom = $this->napdf_instance->h - $in_layout['page_metrics']['margin']['bottom'];
        $right = $this->napdf_instance->w - $in_layout['page_metrics']['margin']['right'];
        $inTitleGraphic = "../ny_printed_lists/images/ELI_Cover_Logo.png";
    
        $this->napdf_instance->AddPage();
    
        $this->napdf_instance->Image ( $inTitleGraphic, ($right + $left) / 2 - 1, $top + 0.25, 2, 2 );
        
        $y = 2.75;
        
        $str = _BK_MAIN_DESIGNATOR_;
        
        $this->napdf_instance->SetFont ( "Helvetica", "B", 16 );
        $stw = $this->napdf_instance->GetStringWidth ( utf8_decode ( $str ) );
        
        $this->napdf_instance->SetXY ( (($right + $left) / 2) - ($stw / 2), $y ); 
    
        $this->napdf_instance->Cell ( 0, 14/72, utf8_decode ( $str ) );
        
        $y += 0.25;
        
        $str = _BK_MAIN_STATEMENT_;
        
        $this->napdf_instance->SetFont ( "Helvetica", "B", 14 );
        $stw = $this->napdf_instance->GetStringWidth ( utf8_decode ( $str ) );
        
        $this->napdf_instance->SetXY ( (($right + $left) / 2) - ($stw / 2), $y ); 
    
        $this->napdf_instance->Cell ( 0, 14/72, utf8_decode ( $str ) );
        
        $y += 0.25;
        
        $str = _BK_URL_;
        
        $this->napdf_instance->SetFont ( "Helvetica", "B", 12 );
        $stw = $this->napdf_instance->GetStringWidth ( utf8_decode ( $str ) );
        
        $this->napdf_instance->SetXY ( (($right + $left) / 2) - ($stw / 2), $y ); 
    
        $this->napdf_instance->Cell ( 0, 12/72, utf8_decode ( $str ) );
        
        $y += 0.35;
        
        $this->napdf_instance->SetLineWidth ( 0.025 );
        $this->napdf_instance->Rect ( $left + 1, $y - 0.05, $right - ($left + 2), 3.25 );
        
        $str = _BK_BLURB_;
        
        $this->napdf_instance->SetFont ( "Helvetica", "", 9 );
        
        $this->napdf_instance->SetXY ( $left + 1, $y ); 
    
        $this->napdf_instance->MultiCell ( ($right - 1) - ($left + 1), 9/72, utf8_decode ( $str ), 0, "L" );
        
        $y = $this->napdf_instance->GetY() + 18/72;
        $this->napdf_instance->SetLineWidth ( 0.01 );
        
        $this->napdf_instance->Line ( $left + 1.25, $y - 9/72, $right - 1.25, $y - 9/72 );
        
        $str = _PDF_BROOKLYN_JFT_TEXT;
        
        $this->napdf_instance->SetFont ( "Helvetica", "", 9 );
        
        $this->napdf_instance->SetXY ( $left + 1, $y ); 
    
        $this->napdf_instance->MultiCell ( ($right - 1) - ($left + 1), 9/72, utf8_decode ( $str ), 0, "L" );
        
        $y = $this->napdf_instance->GetY() + 0.25;
            
        $str = _BK_HELPLINE_;
        
        $this->napdf_instance->SetFont ( "Helvetica", "B", 10 );
        $stw = $this->napdf_instance->GetStringWidth ( utf8_decode ( $str ) );
        
        $this->napdf_instance->SetXY ( (($right + $left) / 2) - ($stw / 2), $y ); 
    
        $this->napdf_instance->Cell ( 0, 10/72, utf8_decode ( $str ) );
        
        $y = $bottom - 0.25;
        
        $str = _BK_GNY_;
        
        $this->napdf_instance->SetFont ( "Helvetica", "I", 9 );
        $stw = $this->napdf_instance->GetStringWidth ( utf8_decode ( $str ) );
        
        $this->napdf_instance->SetXY ( $left + 0.1, $y ); 
    
        $this->napdf_instance->Cell ( 0, 9/72, utf8_decode ( $str ) );
        
        $str = _BK_REVISED_ . date ( "F, Y" );
        
        $this->napdf_instance->SetFont ( "Helvetica", "B", 10 );
        $stw = $this->napdf_instance->GetStringWidth ( utf8_decode ( $str ) );
        
        $this->napdf_instance->SetXY ( $right - ($stw + 0.1), $y ); 
    
        $this->napdf_instance->Cell ( 0, 10/72, utf8_decode ( $str ) );
        }

BK_DrawOneListPage ( &$  in_layout  ) 

Definition at line 929 of file bkasc_napdf.class.php.

References printableList::$font_size, BK_Write_One_Meeting(), and BK_WriteDayHeader().

Referenced by AssemblePDF().

        {
        $ret = false;
    
        $top = $in_layout['page_metrics']['margin']['top'];
        $left = $in_layout['page_metrics']['margin']['left'];
        $bottom = $this->napdf_instance->h - $in_layout['page_metrics']['margin']['bottom'];
        $right = $this->napdf_instance->w - $in_layout['page_metrics']['margin']['right'];
        $v_gap = $in_layout['data']['Meta']["V Gap"];
        $font_size = $in_layout[page_metrics]['font_size'];
        $height_row = $font_size/72 + $v_gap;
        
        $current_meeting = $in_layout['data']['Meta']['meetings']['meetings'][$in_layout['placeholder']['meeting_index']];
        
        if ( !$in_layout['placeholder']['meeting_index'] )
            {
            $day = "";
            }
        else
            {
            $day = $in_layout['placeholder']['weekday'];
            }
    
        $this->napdf_instance->AddPage();
    
        $y = $this->BK_WriteDayHeader ( $in_layout, $current_meeting['weekday'], $top, $left, $right,  $day );  
        $day = $current_meeting['weekday'];
        $in_layout['placeholder']['weekday'] = $day;
    
        $alt_color = 255;
        
        do {
            $alt_color = ($alt_color == 255) ? 225 : 255;
            if ( !$current_meeting )
                {
                $current_meeting = $in_layout['data']['Meta']['meetings']['meetings'][$in_layout['placeholder']['meeting_index']];
                }
            $look_ahead = $height_row;
    
            if ( $current_meeting['weekday'] != $day )
                {
                $look_ahead += 0.27;
                
                if ( $y < ($bottom - $look_ahead) )
                    {
                    $day = $current_meeting['weekday'];
                    $in_layout['placeholder']['weekday'] = $day;
                    $y = $this->BK_WriteDayHeader ( $in_layout, $day, $y, $left, $right );
                    $alt_color = 255;
                    }
                else
                    {
                    break;
                    }
                }
            else
                {
                $y = $this->BK_Write_One_Meeting ( $in_layout, $in_layout['placeholder']['meeting_index']++, $y, 0, $alt_color );
                }
    
            $current_meeting = "";
            } while ( ($y < ($bottom - $look_ahead))
                && ($in_layout['placeholder']['meeting_index'] < count ( $in_layout['data']['Meta']['meetings']['meetings'] )) );
    
        if ( $in_layout['placeholder']['meeting_index'] < count ( $in_layout['data']['Meta']['meetings']['meetings'] ) )
            {
            $ret = true;
            }
            
        return $ret;
        }

BK_DrawString ( in_string,
in_x_max,
in_x = '',
in_y = '',
in_align = '',
in_fontsize = '',
in_font_family = '',
in_font_style = '' 
)

Definition at line 877 of file bkasc_napdf.class.php.

Referenced by BK_DrawChangeForm().

        {
        if ( !$in_x )
            {
            $in_x = $this->napdf_instance->GetX();
            }
    
        if ( !$in_y )
            {
            $in_y = $this->napdf_instance->GetY();
            }
        
        if ( !$in_fontsize )
            {
            $in_fontsize = $this->napdf_instance->FontSizePt;
            }
    
        if ( !$in_font_family )
            {
            $in_font_family = $this->napdf_instance->FontFamily;
            }
    
        $height_row = $in_fontsize/72;
        
        $this->napdf_instance->SetFont ( $in_font_family, $in_font_style, $in_fontsize );
        $stringWidth = $this->napdf_instance->GetStringWidth ( utf8_decode ( $in_string ) );
        $ret['width'] = $stringWidth;
        
        $align = "L";
        
        if ( ($in_x_max > $in_x) && preg_match ( "/^c.*/i", $in_align ) )
            {
            $cellleft = (($in_x_max + $in_x) / 2) - ($stringWidth / 2);
            }
        elseif ( ($in_x_max > $in_x) && preg_match ( "/^r.*/i", $in_align ) )
            {
            $cellleft = $in_x_max - $stringWidth;
            }
        else
            {
            $cellleft = $in_x;
            }
        
        $this->napdf_instance->SetXY ( $cellleft, $in_y );
        $this->napdf_instance->MultiCell ( $in_x_max - $in_x, $height_row, utf8_decode ( $in_string ), "", $align );
        $ret['y'] = $this->napdf_instance->GetY();
        
        return $ret;
        }

BK_Write_One_Meeting ( in_layout,
in_index,
in_y,
in_page_offset = 0,
in_bgcolor = 255,
in_textcolor = 0 
)

Definition at line 1004 of file bkasc_napdf.class.php.

References printableList::$font_size.

Referenced by BK_DrawOneListPage().

        {
        $current_meeting = $in_layout['data']['Meta']['meetings']['meetings'][$in_index];
        $v_gap = $in_layout['data']['Meta']["V Gap"];
        
        $left = $in_page_offset + $in_layout[page_metrics]['margin']['left'];
        $right = $in_page_offset + $in_layout[page_metrics]['width'] - $in_layout[page_metrics]['margin']['right'];
        $font_family = $in_layout[page_metrics]['font_family'];
        $font_size = $in_layout[page_metrics]['font_size'];
        $height_row = $font_size/72 + $v_gap;
        $rows = count ( $in_layout ) - 3;
        $height = $height_row * $rows;
        
        $this->napdf_instance->SetFillColor ( $in_bgcolor );
        $this->napdf_instance->SetTextColor ( $in_textcolor );
        $this->napdf_instance->Rect ( $left, $in_y, ($right - $left), $height, "F" );
    
        $this->napdf_instance->SetY ( $in_y );
    
        for ( $count = 0; $count < $rows; $count++ )
            {
            $row_array = $in_layout[$count];
    
            $last_elem = "key";
            
            $row_layout = array();
            
            $element_count = count ( $row_array );
    
            $str = "";
            $left_pos = 0;
            
            for ( $ecount = 0; $ecount < $element_count; $ecount++ )
                {
                $element = $row_array[$ecount];
                $et['string'] = $current_meeting[$element['key']];
                $et['left'] = $element['left'];
                $et['format'] = $element['format'];
                array_push ( $row_layout, $et );
                }
            
            foreach ( $row_layout as $et )
                {
                $this->napdf_instance->SetFont ( $font_family, $et['format'], $font_size );
                $this->napdf_instance->SetX ( $et['left'] );
                $this->napdf_instance->Cell ( 0, $height_row, utf8_decode ( $et['string'] ) );
                }
            
            $this->napdf_instance->SetY ( $in_y + $height_row );
            }
        
        
        return $this->napdf_instance->GetY();
        }

BK_WriteDayHeader ( in_layout,
in_day,
in_y,
in_left,
in_right,
in_day_contd = "" 
)

Definition at line 1061 of file bkasc_napdf.class.php.

Referenced by BK_DrawOneListPage().

        {
        if ( $in_day_contd == $in_day )
            {
            $in_day .= _PDF_CONTD;
            }
        
        $height_total = 0.25;
        
        $this->napdf_instance->SetFillColor ( 0 );
        $this->napdf_instance->SetTextColor ( 255 );
        $this->napdf_instance->Rect ( $in_left, $in_y, ($in_right - $in_left), $height_total, "F" );
        
        $height_header = 0.15;
    
        $this->napdf_instance->SetFont ( 'Times', 'B', 9 );
        $stringWidth = $this->napdf_instance->GetStringWidth ( utf8_decode ( $in_day ) );
        $cellleft = (($in_right + $in_left) / 2) - ($stringWidth / 2);
        $this->napdf_instance->SetXY ( $cellleft, $in_y );
        $this->napdf_instance->Cell ( 0, $height_header, utf8_decode ( $in_day ) );
        
        $this->napdf_instance->SetFont ( 'Helvetica', 'B', 7 );
        
        $height_row = 0.1;
        
        $row_layout = array();
        
        $in_y += $height_header;
        
        foreach ( $in_layout[0] as $element )
            {
            $et['left'] = $element['left'];
            $et['string'] = $element['string'];
            array_push ( $row_layout, $et );
            }
        
        foreach ( $row_layout as $et )
            {
            $this->napdf_instance->SetXY ( $et['left'], $in_y );
            $this->napdf_instance->Cell ( 0, $height_row, utf8_decode ( $et['string'] ) );
            }
    
        $this->napdf_instance->SetFillColor ( 255 );
        $this->napdf_instance->SetTextColor ( 0 );
        $this->napdf_instance->SetY ( $in_y + $height_row + 0.02 );
        return $this->napdf_instance->GetY();
        }

DrawFormatPage (  )  [private]

Definition at line 155 of file bkasc_napdf.class.php.

References $formats, $header, and sort_formats().

Referenced by AssemblePDF().

    {
    $formats = self::sort_formats ( $this->napdf_instance->format_data );

    $this->napdf_instance->SetFont ( $this->font, '', $this->font_size );
    $heading_height = 9;
    $height = ($heading_height/72) + 0.01;
    $top = 0.125;
    $left = 0.125;
    $bottom = $this->napdf_instance->h - 0.125;
    $right = $this->napdf_instance->w - 0.125;
    $fontFamily = $this->napdf_instance->FontFamily;
    $fontSize = $this->napdf_instance->FontSizePt;
    $fontSizeSmaller = $fontSize - 0.3;
    $fSize = $fontSizeSmaller / 72;
    $this->right_offset = 0.4;
    $space_needed = (($fontSizeSmaller / 72) * 5) + 0.02;
    $y_offset = $bottom - $fSize;
    
    $newpage = 2;
    
    $countmax = count ( $formats );
        
    $alt_color = 255;
    
    for ( $count = 0; $count < $countmax; $count++ )
        {
        $alt_color = ($alt_color == 255) ? 225 : 255;
        $format_code = $formats[$count]['key_string'];
        $format_desc = $formats[$count]['description_string'];
        
        if ( $format_code )
            {
            if ( $newpage )
                {
                $alt_color = 225;
                $this->napdf_instance->AddPage();
                $this->napdf_instance->SetFont ( $fontFamily, 'B', 7 );
                $this->napdf_instance->Line ( $left, $y_offset - 0.1, $right, $y_offset - 0.1 );
                $this->napdf_instance->SetXY ( $left, $y_offset );
                global $resized;
                
                $this->napdf_instance->SetXY ( $right, $y_offset );
                $this->napdf_instance->Cell ( 0, 0, _PDF_PAGE." ".$this->napdf_instance->PageNo(), 0, 0, "R" );
                $this->napdf_instance->SetFont ( $fontFamily, '', $fontSize );
                $this->napdf_instance->SetFillColor ( 0 );
                $this->napdf_instance->SetTextColor ( 255 );
                $header = ""._PDF_LEGEND_HEADER."";
                if ( $newpage != 2 )
                    {
                    $header .= _PDF_CONTD;
                    }
                
                $this->napdf_instance->SetFont ( $fontFamily, 'B', $heading_height );
                $stringWidth = $this->napdf_instance->GetStringWidth ( utf8_decode ( $header ) );
                $cellleft = (($right + $left) / 2) - ($stringWidth / 2);
                $this->napdf_instance->Rect ( $left, $top, ($right - $left), $height, "F" );
                $this->napdf_instance->SetXY ( $cellleft, $top + 0.01 );
                $this->napdf_instance->Cell ( 0, $heading_height/72, utf8_decode ( $header ) );
                $this->napdf_instance->SetFillColor ( 255 );
                $this->napdf_instance->SetTextColor ( 0 );
                $newpage = "";
                $this->napdf_instance->SetY ( $top + $height );
                }
            
            $y = $this->napdf_instance->GetY();
            
            $height = ($fSize * 2) + 0.02;
            $this->napdf_instance->SetFillColor ( $alt_color );
            $this->napdf_instance->Rect ( $left, $y, ($right - $left), $height, "F" );

            $this->napdf_instance->SetY($this->napdf_instance->GetY()+ 0.01);
            $y = $this->napdf_instance->GetY();
            $this->napdf_instance->SetFont ( $fontFamily, 'B', $fontSizeSmaller );
            $this->napdf_instance->SetLeftMargin ( $left );
            $this->napdf_instance->SetXY ( $left, $y );
            $this->napdf_instance->MultiCell ( $this->right_offset - $left, $fSize, utf8_decode ( $format_code ), 0, "L" );
    
            $this->napdf_instance->SetFont ( $fontFamily, '', $fontSizeSmaller );
            $this->napdf_instance->SetLeftMargin ( $this->right_offset );
            $this->napdf_instance->SetXY ( $this->right_offset, $y );
            $this->napdf_instance->MultiCell ( $right - $this->right_offset, $fSize, utf8_decode ( $format_desc ), 0, "L" );
            
            if ( ($this->napdf_instance->GetY() + 0.01 + $space_needed) >= $y_offset )
                {
                $newpage = 1;
                }
            else
                {
                $this->napdf_instance->SetY($this->napdf_instance->GetY()+ 0.01);
                }
            }
        }
    
    if ( ($this->napdf_instance->GetY() + 0.3 + $fSize/72) > $y_offset )
        {
        $this->napdf_instance->AddPage();
        $y = $y_offset;
        }
    else
        {
        $y = $this->napdf_instance->GetY() + 0.3;
        }
    }

static FindFormatPos ( in_key,
in_format_array 
) [static, private]

Definition at line 316 of file bkasc_napdf.class.php.

    {
        $c = -1;
        
        foreach ( $in_format_array as $format )
            {
            $c++;
            
            if ( $in_key == $format['key_string'] )
                {
                break;
                }
            }
        
        return $c;
    }

OutputPDF (  ) 

Implements IPrintableList.

Definition at line 93 of file bkasc_napdf.class.php.

    {
        $d = date ( "Y_m_d" );
        $this->napdf_instance->Output( "BKASC_PrintableList_$d.pdf", "D" );
    }

RearrangeFormats ( inFormats  )  [private]

Definition at line 262 of file bkasc_napdf.class.php.

    {
    $inFormats = split ( ",", $inFormats );
    
    if ( !in_array ( "C", $inFormats ) && !in_array ( "O", $inFormats ) )
        {
        array_push ( $inFormats, "C" );
        }
    
    if ( !$ignore_bk && !in_array ( "BK", $inFormats ) && ((in_array ( "BT", $inFormats ) || in_array ( "IW", $inFormats ) || in_array ( "JT", $inFormats ) || in_array ( "SG", $inFormats ))) )
        {
        array_push ( $inFormats, "BK" );
        }
    
    uasort ( $inFormats, 'bkasc_napdf::sort_cmp' );
    
    $tFormats = $inFormats;
    
    $inFormats = array();
    
    foreach ( $tFormats as $format )
        {
        $format = trim ( $format );
        if ( $format )
            {
            array_push ( $inFormats, $format );
            }
        }
    
    return join ( ",", $inFormats );
    }

static sort_cmp ( a,
b 
) [static, private]

Definition at line 296 of file bkasc_napdf.class.php.

    {
    $order_array = array(   0=>"C", 1=>"O",
                            2=>"ES", 3=>"B", 4=>"M", 5=>"W", 6=>"GL", 7=>"YP", 8=>"BK", 9=>"IP", 10=>"Pi", 11=>"RF", 12=>"Rr",
                            13=>"So", 14=>"St", 15=>"To", 16=>"Tr", 17=>"OE", 18=>"D", 19=>"SD", 20=>"TW", 21=>"IL",
                            22=>"BL", 23=>"IW", 24=>"BT", 25=>"SG", 26=>"JT",
                            27=>"Ti", 28=>"Sm", 29=>"NS", 30=>"CL", 31=>"CS", 32=>"NC", 33=>"SC", 34=>"CH", 35=>"SL", 36=>"WC" );
    
    if ( in_array ( $a, $order_array ) || in_array ( $b, $order_array ) )
        {
        return (array_search ( $a, $order_array ) < array_search ( $b, $order_array )) ? -1 : 1;
        }
    else
        {
        return 0;
        }
    }

static sort_cmp_formats ( a,
b 
) [static, private]

Definition at line 102 of file bkasc_napdf.class.php.

    {
    $order_array = array(   0=>"C", 1=>"O",
                            2=>"ES", 3=>"B", 4=>"M", 5=>"W", 6=>"GL", 7=>"YP", 8=>"BK", 9=>"IP", 10=>"Pi", 11=>"RF", 12=>"Rr",
                            13=>"So", 14=>"St", 15=>"To", 16=>"Tr", 17=>"OE", 18=>"D", 19=>"SD", 20=>"TW", 21=>"IL",
                            22=>"BL", 23=>"IW", 24=>"BT", 25=>"SG", 26=>"JT",
                            27=>"Ti", 28=>"Sm", 29=>"NS", 30=>"CL", 31=>"CS", 32=>"NC", 33=>"SC", 34=>"CH", 35=>"SL", 36=>"WC" );
    
    if ( in_array ( $a['key_string'], $order_array ) || in_array ( $b['key_string'], $order_array ) )
        {
        return (array_search ( $a['key_string'], $order_array ) < array_search ( $b['key_string'], $order_array )) ? -1 : 1;
        }
    else
        {
        return 0;
        }
    }

static sort_formats ( in_format_data  )  [static, private]
Parameters:
in_format_data An array of format information

Definition at line 126 of file bkasc_napdf.class.php.

Referenced by BK_DrawChangeForm(), and DrawFormatPage().

    {
        $ret = array();
        
        foreach ( $in_format_data as $format )
            {
            if ( $format['lang'] == 'en' )  // We skip the Spanish, and only work on the English.
                {
                $s_desc = ((isset ( $in_format_data[$format['id'].'_es'] )) ? '('.$in_format_data[$format['id'].'_es']['name_string'].') '.$in_format_data[$format['id'].'_es']['description_string'] : null);
                $r_temp = array (   'key_string' => $format['key_string'],
                                    'description_string' => '('.$format['name_string'].') '.$format['description_string']
                                    );
                if ( $s_desc )
                    {
                    $r_temp['description_string'] .= "\n$s_desc";
                    }
                
                array_push ( $ret, $r_temp );
                }
            }
        
        usort ( $ret, 'bkasc_napdf::sort_cmp_formats' );
        
        return $ret;
    }

static sort_meeting_data_callback_ny ( &$  in_a,
&$  in_b 
) [static]

This is a static callback function to be used for sorting the multi-dimensional meeting_data array. It uses the sort_order_keys array to determine the sort.

Returns:
an integer. -1 if a < b, 0 if a == b, or 1 if a > b.
Parameters:
in_a The first meeting array to compare
in_b The second meeting array to compare

Definition at line 391 of file bkasc_napdf.class.php.

References printableList::$sort_keys, napdf::$sort_order_keys, and napdf::$week_starts.

    {
        $ret = 0;
        
        if ( is_array ( $in_a ) && is_array ( $in_b ) && is_array ( napdf::$sort_order_keys ) )
            {
            // We reverse the array, in order to sort from least important to most important.
            $sort_keys = array_reverse ( napdf::$sort_order_keys, true );

            foreach ( $sort_keys as $key => $value )
                {
                if ( isset ( $in_a[$key] ) && isset ( $in_b[$key] ) )
                    {
                    $val_a = trim ( $in_a[$key] );
                    $val_b = trim ( $in_b[$key] );

                    if ( ('weekday_tinyint' == $key) && (napdf::$week_starts > 1) && (napdf::$week_starts < 8) )
                        {
                        $val_a -= napdf::$week_starts;

                        if ( $val_a < 0 )
                            {
                            $val_a += 8;
                            }
                        else
                            {
                            $val_a += 1;
                            }
                        
                        $val_b -= napdf::$week_starts;
                        
                        if ( $val_b < 0 )
                            {
                            $val_b += 8;
                            }
                        else
                            {
                            $val_b += 1;
                            }
                        }

                    // We know a few keys already, and we can determine how the sorting goes from there.
                    switch ( $key )
                        {
                        case 'start_time':
                        case 'duration_time':
                            $val_a = strtotime ( $val_a );
                            $val_b = strtotime ( $val_b );
                        case 'weekday_tinyint':
                        case 'id_bigint':
                        case 'shared_group_id_bigint':
                        case 'service_body_bigint':
                            $val_a = intval ( $val_a );
                            $val_b = intval ( $val_b );
                        case 'longitude':
                        case 'latitude':
                            if ( $val_a > $val_b )
                                {
                                $ret = 1;
                                }
                            elseif ( $val_b > $val_a )
                                {
                                $ret = -1;
                                }
                        break;
                        
                        default:
                            // We ignore blank values
                            if ( strlen ( $val_a ) && strlen ( $val_b ) )
                                {
                                $tmp = strcmp ( strtolower ( $val_a ), strtolower ( $val_b ) );
                                
                                if ( $tmp != 0 )
                                    {
                                    $ret = $tmp;
                                    }
                                }
                        break;
                        }
                    }
                
                if ( !$value )
                    {
                    $ret = -$ret;
                    }
                }
            
            $county_a = trim ( $in_a['location_city_subsection'] );
            if ( !$county_a )
                {
                $county_a = trim ( $in_a['location_sub_province'] );
                }
            
            $county_b = trim ( $in_b['location_city_subsection'] );
            if ( !$county_b )
                {
                $county_b = trim ( $in_b['location_sub_province'] );
                }
            
            if ( isset ( $county_a ) && isset ( $county_b ) )
                {
                $tmp = strcmp ( strtolower ( $county_a ), strtolower ( $county_b ) );
                
                if ( $tmp != 0 )
                    {
                    $ret = $tmp;
                    }
                }
            }
        
        return $ret;
    }

static translate_duration ( in_time_string  )  [static, private]

Definition at line 354 of file bkasc_napdf.class.php.

Referenced by _GetMeetings_And_Formats().

    {
        $t = split ( ":", $in_time_string );
        $hours = intval ( $t[0] );
        $minutes = intval ( $t[1] );
        
        $ret = '';
        
        if ( $hours )
            {
            $ret .= "$hours hour";
            
            if ( $hours > 1 )
                {
                $ret .= "s";
                }
                
            if ( $minutes )
                {
                $ret .= " and ";
                }
            }
        
        if ( $minutes )
            {
            $ret .= "$minutes minutes";
            }
        
        return $ret;
    }

static translate_time ( in_time_string  )  [static, private]

Definition at line 335 of file bkasc_napdf.class.php.

Referenced by _GetMeetings_And_Formats().

    {
        $split = split ( ":", $in_time_string );
        if ( $in_time_string == "12:00:00" )
            {
            return "Noon";
            }
        elseif ( ($split[0] == "23") && (intval ( $split[1] ) > 45) )
            {
            return "Midnight";
            }
        else
            {
            return date ( "g:i A", strtotime ( $in_time_string ) );
            }
    }


Field Documentation

$formats = 0
$pos = array ( 'start' => 1, 'end' => '', 'count' => 0, 'y' => 0, 'weekday' => 1 )

Definition at line 26 of file bkasc_napdf.class.php.

Referenced by _Set_Page_Layout().

$right_offset = 0

Definition at line 27 of file bkasc_napdf.class.php.

$weekday_names = array ( "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" )

Definition at line 25 of file bkasc_napdf.class.php.


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Enumerations