SpecialTranslationStats Class Reference
[Special pages of Translate extensionStatistics]

Includable special page for generating graphs on translations. More...

List of all members.

Public Member Functions

 __construct ()
 getGraphTypes ()
 getGraphClass ($type)
 execute ($par)
 draw (FormOptions $opts)
 Adds raw image data of the graph to the output.

Static Public Member Functions

static roundToSignificant ($number, $significant=1)
 Enhanced version of round that supports rounding up to a given scale relative to the number itself.
static getIncrement ($scale)
 Returns an increment in seconds for a given scale.

Protected Member Functions

 form (FormOptions $opts)
 Constructs the form which can be used to generate custom graphs.
 eInput ($name, FormOptions $opts, $width=4)
 Constructs a table row with label and input in two columns.
 eLabel ($name)
 Constructs a label for option.
 eRadio ($name, FormOptions $opts, array $alts)
 Constructs a table row with label and radio input in two columns.
 eLanguage ($name, FormOptions $opts)
 Constructs a table row with label and language selector in two columns.
 languageSelector ()
 Constructs a JavaScript enhanced language selector.
 eGroup ($name, FormOptions $opts)
 Constructs a table row with label and group selector in two columns.
 image (FormOptions $opts)
 Returns an <img> tag for graph.
 getData (FormOptions $opts)
 Fetches and preprocesses graph data that can be fed to graph drawer.

Static Protected Member Functions

static roundTimestampToCutoff ($scale, $cutoff, $direction= 'earlier')
 Gets the closest earlieast timestamp that corresponds to start of a period in given scale, like, midnight, monday or first day of the month.
static roundingAddition ($ts, $amount, $dir)

Static Protected Attributes

static $graphs

Detailed Description

Includable special page for generating graphs on translations.

Definition at line 22 of file SpecialTranslationStats.php.


Constructor & Destructor Documentation

SpecialTranslationStats::__construct (  ) 

Definition at line 23 of file SpecialTranslationStats.php.


Member Function Documentation

SpecialTranslationStats::draw ( FormOptions $  opts  ) 

Adds raw image data of the graph to the output.

Parameters:
FormOptions $opts

Definition at line 563 of file SpecialTranslationStats.php.

Referenced by execute().

Here is the call graph for this function:

SpecialTranslationStats::eGroup ( name,
FormOptions $  opts 
) [protected]

Constructs a table row with label and group selector in two columns.

Parameters:
string $name Option name.
FormOptions $opts
Returns:
string Html.

Definition at line 329 of file SpecialTranslationStats.php.

Referenced by form().

Here is the call graph for this function:

SpecialTranslationStats::eInput ( name,
FormOptions $  opts,
width = 4 
) [protected]

Constructs a table row with label and input in two columns.

Parameters:
string $name Option name.
FormOptions $opts
int $width
Returns:
string Html.

Definition at line 224 of file SpecialTranslationStats.php.

Referenced by form().

Here is the call graph for this function:

SpecialTranslationStats::eLabel ( name  )  [protected]

Constructs a label for option.

Parameters:
string $name Option name.
Returns:
string Html.

Definition at line 238 of file SpecialTranslationStats.php.

Referenced by eGroup(), eInput(), eLanguage(), and eRadio().

SpecialTranslationStats::eLanguage ( name,
FormOptions $  opts 
) [protected]

Constructs a table row with label and language selector in two columns.

Parameters:
string $name Option name.
FormOptions $opts
Returns:
string Html.

Definition at line 283 of file SpecialTranslationStats.php.

Referenced by form().

Here is the call graph for this function:

SpecialTranslationStats::eRadio ( name,
FormOptions $  opts,
array $  alts 
) [protected]

Constructs a table row with label and radio input in two columns.

Parameters:
string $name Option name.
FormOptions $opts
string[] $alts List of alternatives.
Returns:
string Html.

Definition at line 256 of file SpecialTranslationStats.php.

Referenced by form().

Here is the call graph for this function:

SpecialTranslationStats::execute ( par  ) 

Definition at line 53 of file SpecialTranslationStats.php.

Here is the call graph for this function:

SpecialTranslationStats::form ( FormOptions $  opts  )  [protected]

Constructs the form which can be used to generate custom graphs.

Parameters:
FormOptions $opts

Definition at line 140 of file SpecialTranslationStats.php.

Referenced by execute().

Here is the call graph for this function:

SpecialTranslationStats::getData ( FormOptions $  opts  )  [protected]

Fetches and preprocesses graph data that can be fed to graph drawer.

Parameters:
FormOptions $opts
Returns:
array ( string => array ) Data indexed by their date labels.

Definition at line 398 of file SpecialTranslationStats.php.

Referenced by draw().

Here is the call graph for this function:

SpecialTranslationStats::getGraphClass ( type  ) 
Since:
2012-03-05
Parameters:
string $type
Returns:
string

Definition at line 49 of file SpecialTranslationStats.php.

Referenced by getData().

SpecialTranslationStats::getGraphTypes (  ) 
Since:
2012-03-05
Returns:
array List of graph types

Definition at line 40 of file SpecialTranslationStats.php.

Referenced by execute(), and form().

static SpecialTranslationStats::getIncrement ( scale  )  [static]

Returns an increment in seconds for a given scale.

The increment must be small enough that we will hit every item in the scale when using different multiples of the increment. It should be large enough to avoid hitting the same item multiple times.

Parameters:
string $scale Either months, weeks, days or hours.
Returns:
int Number of seconds in the increment.

Definition at line 671 of file SpecialTranslationStats.php.

Referenced by getData().

SpecialTranslationStats::image ( FormOptions $  opts  )  [protected]

Returns an <img> tag for graph.

Parameters:
FormOptions $opts
Returns:
string Html.

Definition at line 379 of file SpecialTranslationStats.php.

Referenced by execute(), and form().

SpecialTranslationStats::languageSelector (  )  [protected]

Constructs a JavaScript enhanced language selector.

Returns:
JsSelectToInput

Definition at line 300 of file SpecialTranslationStats.php.

Referenced by eLanguage().

static SpecialTranslationStats::roundingAddition ( ts,
amount,
dir 
) [static, protected]
Parameters:
int $ts
int $amount
int $dir
Returns:
int

Definition at line 551 of file SpecialTranslationStats.php.

Referenced by roundTimestampToCutoff().

static SpecialTranslationStats::roundTimestampToCutoff ( scale,
cutoff,
direction = 'earlier' 
) [static, protected]

Gets the closest earlieast timestamp that corresponds to start of a period in given scale, like, midnight, monday or first day of the month.

Parameters:
string $scale One of hours, days, weeks, months
int $cutoff Timestamp in unix format.
string $direction One of earlier, later
Returns:
int

Definition at line 516 of file SpecialTranslationStats.php.

Referenced by getData().

Here is the call graph for this function:

static SpecialTranslationStats::roundToSignificant ( number,
significant = 1 
) [static]

Enhanced version of round that supports rounding up to a given scale relative to the number itself.

Examples:

  • roundToSignificant( 1234, 0 ) = 10000
  • roundToSignificant( 1234, 1 ) = 2000
  • roundToSignificant( 1234, 2 ) = 1300
  • roundToSignificant( 1234, 3 ) = 1240
Parameters:
int $number Number to round.
int $significant How many signficant numbers to keep.
Returns:
int Rounded number.

Definition at line 655 of file SpecialTranslationStats.php.

Referenced by draw().


Member Data Documentation

SpecialTranslationStats::$graphs [static, protected]
Initial value:
 array(
        'edits' => 'TranslatePerLanguageStats',
        'users' => 'TranslatePerLanguageStats',
        'registrations' => 'TranslateRegistrationStats',
        'reviews' => 'ReviewPerLanguageStats',
        'reviewers' => 'ReviewPerLanguageStats',
    )
Since:
2012-03-05

Definition at line 28 of file SpecialTranslationStats.php.


The documentation for this class was generated from the following file:
Generated on Tue Oct 29 00:00:54 2013 for MediaWiki Translate Extension by  doxygen 1.6.3