Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: /home/inri/public_html/daCode-HEAD/daCode/src/phplib/tips.php3
daCode -

Tips

Tips

Class to handle tips.

 

private class Tips

Class to handle tips.

http://www.dacode.org
daCode http://www.dacode.org/
$Id: tips.php3,v 1.59 2002/05/13 21:34:03 jbcombes Exp $

Depends: Config Db Html User

 

Public Method Summary

void

Tips()

Constructor
mixed

checkResource(int $tip_id)

Checks wether the item selected is "commentable"
string

viewResource(int $tips_id)

Preview the item selected.
string

getTopicUrl(integer $tip_id, integer $absolute, [ integer $score, mixed $order, integer $theme ])

Returns the URL where the tip && comments can be found
bool

loadResources(array $res_ids)

Preloads some infos about the resources. For optimizatiuon only.
string

get_random()

Select a random tip
string

tips_list(integer $nb_tips, string $tip_section, integer $tip_index)

Creates o list of tips on 2 columns
string

tips_to_moderate()

Creates HTML code for the list of tips to moderate
string

show_tips_to_moderate(integer $id)

Creates the moderation form for a tip
void

do_moderate(array $row)

Take moderator's choices into account
string

tips_sections()

Creates the list of of tips sections
void

formNewTip()

Creates the form to submit a new tip
void

addNewTip(array $row)

Add a new tip in DB

Private Method Summary

string

viewShort(integer $res_id)

Abreviated view of the resource (eg the title)

Private Field Summary

object Db

$db

Database abstraction layer
object Html

$html

HTML rendering package
object Session

$session

Session handling instance
object Cache

$cache

Cache abstraction layer
object Utils

$utils

Utils package
array

$sqlCache

Cache for optimizing multiple requests
bool

$isCached

Boolean to indicate wether smg is in sqlCache
integer

$resType

Public Method Details

Tips

public void Tips( )

  Constructor

Returns void


checkResource

public mixed checkResource( int $tip_id )

  Checks wether the item selected is "commentable"

Parameter
int $tip_id
the ID of the item
Returns mixed

a string (an error message) if the item is not to be commented, NULL otherwise.


viewResource

public string viewResource( int $tips_id )

  Preview the item selected.

Parameter
int $tips_id
ID of the tip to display
Returns string

the HTML for the item


getTopicUrl

public string getTopicUrl( integer $tip_id, integer $absolute, [ integer $score, mixed $order, integer $theme ] )

  Returns the URL where the tip && comments can be found

Parameter
integer $tip_id
the ID of tip viewed
integer $absolute
URL is absolute or not.
integer $score = >>-2<<
the threshold for displaying comments
mixed $order = >>""<<
TODO
integer $theme = >>0<<
TODO
Returns string

the URL where to view it. Not HTML-escaped!


loadResources

public bool loadResources( array $res_ids )

  Preloads some infos about the resources. For optimizatiuon only.
FIXME: maybe other stuff neede here...
Implementation details: shall cache as much info as needed.
Everything needed to produced a 'short view' shall be cached,
plus ids, timpstamps & that kind of stuff.

Parameter
array $res_ids
the list of IDs of the resouces to preload
Returns bool

true if SQL succeeded, false otherwise.


get_random

public string get_random( )

  Select a random tip

Returns string

the sidebox with the selected tip.


tips_list

public string tips_list( integer $nb_tips, string $tip_section, integer $tip_index )

  Creates o list of tips on 2 columns

Parameter
integer $nb_tips
of tips to display
string $tip_section
of to=ips section (an integer)
integer $tip_index
of start of tip list
Returns string

the list of tips


tips_to_moderate

public string tips_to_moderate( )

  Creates HTML code for the list of tips to moderate

Returns string

HTML code


show_tips_to_moderate

public string show_tips_to_moderate( integer $id )

  Creates the moderation form for a tip

Parameter
integer $id
of the tip
Returns string

the HTML code


do_moderate

public void do_moderate( array $row )

  Take moderator's choices into account
May call echo on failure, may return a string on failure

Parameter
array $row
????
Returns void


tips_sections

public string tips_sections( )

  Creates the list of of tips sections

Returns string


formNewTip

public void formNewTip( )

  Creates the form to submit a new tip
@retrun string

Returns void


addNewTip

public void addNewTip( array $row )

  Add a new tip in DB
calls exit and echo on failure
calls header ot redirect to main page and exits on success

Parameter
array $row
from form submission
Returns void


Private Method Details

viewShort

private string viewShort( integer $res_id )

  Abreviated view of the resource (eg the title)

Parameter
integer $res_id
the id of the item
Returns string

the short view, HTML-escaped.


Private Field Details

$db

private object Db $db

>><<

Database abstraction layer


$html

private object Html $html

>><<

HTML rendering package


$session

private object Session $session

>><<

Session handling instance


$cache

private object Cache $cache

>><<

Cache abstraction layer


$utils

private object Utils $utils

>><<

Utils package


$sqlCache

private array $sqlCache

>><<

Cache for optimizing multiple requests


$isCached

private bool $isCached

>><<

Boolean to indicate wether smg is in sqlCache


$resType

private integer $resType

>>2<<




Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta