Public Method Details |
News |
public void News( )
|
|
Class constructor
|
Returns |
void |
|
get_news |
public array get_news( [ integer $nb, string $section, string $topic, integer $state, integer $view, integer $news_id, boolean $body, string $start_date, integer $date, string $start_nb ] )
|
|
Get a number of news. Return an array of array.
|
Parameter |
|
integer |
$nb |
= >>10<< |
|
number of news |
|
|
string |
$section |
= >>""<< |
|
news from a specific section |
|
|
string |
$topic |
= >>""<< |
|
news from a specific topic |
|
|
integer |
$state |
= >>1<< |
|
state of news |
|
|
integer |
$view |
= >>1<< |
|
1 for main page, 2 for others |
|
|
integer |
$news_id |
= >>0<< |
|
to find a specific news |
|
|
boolean |
$body |
= >>true<< |
|
to include news body or not |
|
|
string |
$start_date |
= >>""<< |
|
timestamp14 |
|
|
integer |
$date |
= >>0<< |
|
the date of the news can't be superior to $date |
|
|
string |
$start_nb |
= >>"0"<< |
|
timestamp14 |
|
Returns |
array all the news in an array of array. |
|
get_urls |
public mixed get_urls( integer $id )
|
|
Get all the urls of the given news_id.
|
Parameter |
|
|
Returns |
mixed array with all the urls, or -1 if db error |
|
get_attach |
public mixed get_attach( integer $id, [ boolean $w ] )
|
|
Get all the attachements of the given news_id.
|
Parameter |
|
|
|
boolean |
$w |
= >>false<< |
|
or without body |
|
Returns |
mixed array with all the urls, or -1 if db error |
|
view_attach |
public void view_attach( integer $id )
|
|
Get attachement for save as command under netscape
Call to header() to send attachment.
Warning : Exit with -1 if db error
|
Parameter |
|
|
Returns |
void |
|
count_section |
public array count_section( array $section )
|
|
Return the number of news in the last week for the given section
This function could work with string or array
Warning : return -1 if DB error
FIXME: used only in Sidebox
|
Parameter |
|
array |
$section |
|
|
of the name section |
|
Returns |
array contains number of news,in the section |
|
show_title |
public string show_title( [ mixed $news_id ] )
|
|
Get title
Gets the title (HTML-escaped) of the news whose id is $news_id.
Warning : Exit with -1 if db error
|
Parameter |
|
mixed |
$news_id |
= >>""<< |
|
the ID of the news or empty string -- dirty |
|
Returns |
string the title HTML escaped. |
|
viewResource |
public string viewResource( string $news_id )
|
|
View only one news... for reminder.
Part of the implementation of the resource interface.
|
Parameter |
|
string |
$news_id |
|
|
the id of the news to view |
|
Returns |
string the HTML for this news. |
|
show_news |
public string show_news( [ integer $nb, string $section, string $topic, integer $state, integer $view, integer $news_id, integer $date ] )
|
|
/* Html code to display the news in their beautiful boxes
|
Parameter |
|
integer |
$nb |
= >>10<< |
|
number of news |
|
|
string |
$section |
= >>""<< |
|
news from a specific section |
|
|
string |
$topic |
= >>""<< |
|
news from a specific topic |
|
|
integer |
$state |
= >>1<< |
|
state of news |
|
|
integer |
$view |
= >>1<< |
|
1 for main page, 2 for others |
|
|
integer |
$news_id |
= >>0<< |
|
to find a specific news |
|
|
integer |
$date |
= >>0<< |
|
the date of the news can't be superior to $date |
|
Returns |
string the HTML to display |
|
show_archive |
public string show_archive( [ integer $nb, string $section, string $topic, integer $state, integer $view, integer $others, string $title ] )
|
|
This is to show archives of the news in an archive box
|
Parameter |
|
integer |
$nb |
= >>10<< |
|
number of news |
|
|
string |
$section |
= >>""<< |
|
news from a specific section |
|
|
string |
$topic |
= >>""<< |
|
news from a specific topic |
|
|
integer |
$state |
= >>1<< |
|
state of news |
|
|
integer |
$view |
= >>1<< |
|
1 for main page, 2 for others |
|
|
integer |
$others |
= >>0<< |
|
Is it the "other" box? |
|
|
string |
$title |
= >>""<< |
|
title of a news |
|
Returns |
string the HTML to display |
|
show_prev_next_news |
public string show_prev_next_news( integer $news_id, [ string $section, string $topic, integer $view, integer $top ] )
|
|
Give navigation box with <-- previous_news next_news-->
if top=0 "title" is written
if top=1 "top of the page" is written
Warning : return -1 id db error
|
Parameter |
|
|
|
string |
$section |
= >>""<< |
|
news from a specific section |
|
|
string |
$topic |
= >>""<< |
|
news from a specific topic |
|
|
integer |
$view |
= >>1<< |
|
1 for main page, 2 for others |
|
|
integer |
$top |
= >>0<< |
|
"top of the page" if 1 |
|
Returns |
string html to display |
|
view_modero |
public string view_modero( integer $news_id )
|
|
Give an html list of a specific news moderators
Warning: return -1 if db error
|
Parameter |
|
integer |
$news_id |
|
|
of the news |
|
Returns |
string html to display with modero1<br />modero2.... |
|
checkResource |
public mixed checkResource( integer $news_id )
|
|
Controls wether the news may be commented.
Part of the implementation of the resource interface.
|
Parameter |
|
integer |
$news_id |
|
|
the ID of the news to control |
|
Returns |
mixed NULL if it may be commented; an error string otherwise. |
|
submit |
public string submit( [ integer $size_url ] )
|
|
A form to fill to submit a news
Warning: return -1 if db error
|
Parameter |
|
integer |
$size_url |
= >>50<< |
|
of the box to write url |
|
Returns |
string html to be displayed, or error message |
|
send_email_view |
public mixed send_email_view( [ integer $news_id ] )
|
|
We print the form to send an email to a friend about a news
|
Parameter |
|
integer |
$news_id |
= >>0<< |
|
of the news |
|
Returns |
mixed NULL or html form |
|
send_email |
public mixed send_email( [ integer $news_id, string $email_address, string $body ] )
|
|
We send email if to a friend if everything is ok
|
Parameter |
|
integer |
$news_id |
= >>0<< |
|
of the news |
|
|
string |
$email_address |
= >>""<< |
|
adress |
|
|
string |
$body |
= >>""<< |
|
body |
|
Returns |
mixed NULL or html to diplay |
|
show_print |
public mixed show_print( [ integer $news_id ] )
|
|
Returns a simplebox with icon (printer and email) inside if $news_id != 0
Returns nothing if $news_id=0
|
Parameter |
|
integer |
$news_id |
= >>0<< |
|
of the news |
|
Returns |
mixed NULL or html to diplay |
|
getTopicUrl |
public string getTopicUrl( integer $news_id, [ integer $absolute, integer $score, mixed $order, integer $theme ] )
|
|
Returns the URL where the news && comments can be found
|
Parameter |
|
integer |
$news_id |
|
|
the ID of news viewed |
|
|
integer |
$absolute |
= >>1<< |
|
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. |
|
loadResources |
public void loadResources( integer $news_ids )
|
|
Preloads a few things...
FIXME : very basic version
|
Parameter |
|
integer |
$news_ids |
|
|
of the news |
|
Returns |
void |
|
viewShort |
public string viewShort( integer $news_id )
|
|
Displays the title, using the SQL cache
|
Parameter |
|
integer |
$news_id |
|
|
of the news |
|
Returns |
string news title |
|