Class client

client

public class client

Client part support for Article System.
A set of database querying methods for getting client part data from the Article System database.


Constructor Summary
client(var $a, var $g, var $i, var $ai)
          Contructor of client class.
 
Method Summary
 unknown connect()
          Connect to the database.
 unknown display_article(var $article)
          An example of article rendering function.
 unknown format_signature(var $text)
          Return formatted signature from an unformatted one.
 unknown get_adata(var $what)
          Return specified part of last loaded (with get_article) article.
 unknown get_archived_article(var $id)
          Fill in local var and return detailed article data of given article.
 unknown get_archived_issue(var $id)
          Returns data on issue given by id, which is currently archived.
 unknown get_article_special(var $id, var $restrict, var $what)
          Fill in local var and return detailed article data of given article.
 unknown get_article(var $id)
          Fill in local var and return detailed article data of given article.
 unknown get_current_article(var $id)
          Fill in local var and return detailed article data of given article.
 unknown get_current_issue()
          Returns data on currently active issue.
 unknown get_formatted(var $what)
          Return specified part of last loaded (with get_article) article with custom formatting.
 unknown get_group_articles(var $id)
          Returns basic data of articles of given group.
 unknown get_group_by(var $col, var $val)
          Return group data of group specified by given column name and it's value.
 unknown get_group(var $id)
          Return data of group specified by id.
 unknown get_groups(var $how)
          Return list of exported article groups.
 unknown get_issue_archive()
          Returns data on archived issues.
 unknown get_issue_articles(var $id)
          Returns basic data of articles in given issue.
 unknown get_issue_menu(var $id, var $menu_group)
          Returns menu of given issue as linkset class.
 unknown get_next_archived_issue(var $id)
          Returns next archived issue id from given $id.
 unknown get_previous_archived_issue(var $id)
          Returns previous archived issue id from given $id.
 unknown is_archived(var $id)
          Test if given issue id is of archived issue.
 unknown is_current(var $id)
          Test if given article id is from current issue.
 unknown test_fake_issue(var $user, var $fake_active_issue, var $fake)
          Get an issue to display with respect to fake issue input.
 

Constructor Detail

client

public client(var $a,
              var $g,
              var $i,
              var $ai)
Contructor of client class.
Parameters:
$a - is passed by reference
$g - is passed by reference
$i - is passed by reference
$ai - Default Value: ''
Method Detail

connect

public unknown connect()
Connect to the database.
Returns:
boolean

get_current_issue

public unknown get_current_issue()
Returns data on currently active issue. Namely 'id, name, subtitle'.
Returns:
associative array

get_archived_issue

public unknown get_archived_issue(var $id)
Returns data on issue given by id, which is currently archived. Namely 'id, name, subtitle'.
Returns:
associative array

get_next_archived_issue

public unknown get_next_archived_issue(var $id)
Returns next archived issue id from given $id.

get_previous_archived_issue

public unknown get_previous_archived_issue(var $id)
Returns previous archived issue id from given $id.

get_issue_archive

public unknown get_issue_archive()
Returns data on archived issues. Namely 'id, name, subtitle' for each of them.
Returns:
associative array

get_issue_articles

public unknown get_issue_articles(var $id)
Returns basic data of articles in given issue. Namely 'id, title, menu_title, menu_group, iorder'. The list is ordered by 'iorder'.
Parameters:
$id - Id of an issue
Returns:
array of associative arrays

get_issue_menu

public unknown get_issue_menu(var $id,
                              var $menu_group)
Returns menu of given issue as linkset class. The data contained are in form (menu_group, menu_title, menu_group, menu_title, ..) or just plain array of menu_titles (menu_title, menu_title, ...).
The list is ordered by 'iorder'.

Use linkset methods get_plain for menu_group items and get_link for menu_title items.
Parameters:
$id - Id of an issue
$menu_group - Boolean to specify, whether get 'menu_group' data too)
$menu_group - Default Value: true
Returns:
array of associative arrays
See Also:
linkset

is_archived

public unknown is_archived(var $id)
Test if given issue id is of archived issue. Use to prevent displaying of non-public issues.
Parameters:
$id - Id of an issue
Returns:
string

get_article

public unknown get_article(var $id)
Fill in local var and return detailed article data of given article.
Parameters:
$id - Id of an article
Returns:
associative array

get_adata

public unknown get_adata(var $what)
Return specified part of last loaded (with get_article) article.
Parameters:
$what - Column name from Articles.
Returns:
string

is_current

public unknown is_current(var $id)
Test if given article id is from current issue. Use to prevent displaying of non-public articles.
Parameters:
$id - Id of an article
Returns:
string

get_article_special

public unknown get_article_special(var $id,
                                   var $restrict,
                                   var $what)
Fill in local var and return detailed article data of given article. Restriction to articles is specified as parameter.
Parameters:
$id - Id of an article
$restrict - Restrictions to apply.
$what - Columns to return: select from { Articles A, Users U, Issues I }. Comma separated.
$what - Default Value: 'A.id
Returns:
associative array

get_current_article

public unknown get_current_article(var $id)
Fill in local var and return detailed article data of given article. Restricted to articles of current issue.
Parameters:
$id - Id of an article
Returns:
associative array

get_archived_article

public unknown get_archived_article(var $id)
Fill in local var and return detailed article data of given article. Restricted to articles of archived issues.
Parameters:
$id - Id of an article
Returns:
associative array

get_formatted

public unknown get_formatted(var $what)
Return specified part of last loaded (with get_article) article with custom formatting.
Parameters:
$what - Column name from Articles.
Returns:
string

format_signature

public unknown format_signature(var $text)
Return formatted signature from an unformatted one.
Parameters:
$text - The text of unformatted signature.
Returns:
string

get_groups

public unknown get_groups(var $how)
Return list of exported article groups. For each of them returns 'id, name, menu_text, description'.
Default ordering by 'menu_text' ascending.
Parameters:
$how - Optional WHERE/ORDER clause that overrides the default ordering.
$how - Default Value: "WHERE exported='1' ORDER BY menu_text ASC"
Returns:
array of asoc.arrays

get_group_by

public unknown get_group_by(var $col,
                            var $val)
Return group data of group specified by given column name and it's value. The data contains 'id, name, menu_text, description'.
Parameters:
$col - Name of the column which $val is data from.
$val - Value to specify the wanted group.
Returns:
asoc.array

get_group

public unknown get_group(var $id)
Return data of group specified by id. The data contains 'id, name, menu_text, description'.
Parameters:
$id - Id of a group.
Returns:
asoc.array

get_group_articles

public unknown get_group_articles(var $id)
Returns basic data of articles of given group. Namely 'A.id, A.title, A.menu_title, A.issue, U.name', as this is the default for get_group. The list is ordered by A.issue ascending.
Parameters:
$id - Id of an issue
Returns:
array of associative arrays

test_fake_issue

public unknown test_fake_issue(var $user,
                               var $fake_active_issue,
                               var $fake)
Get an issue to display with respect to fake issue input.
Parameters:
$user - is passed by reference
Returns:
asoc.array $issue ('id', 'name', ..)

display_article

public unknown display_article(var $article)
An example of article rendering function.
Parameters:
$article - Id of an article to display.