Class story

Description

A class which encapsulates a story or article item. Provides methods to get/save to database, edit the story in a popup window, and view it.

Also provides methods to index/unindex to Lucene.

Located in /story-defs.php (line 56)

RenderableObject
   |
   --story
Variable Summary
Method Summary
 story story ([mixed $id = false], [mixed $category = false], [mixed $language = false])
 void delete_story ()
 string editform ()
 void get_story ([mixed $id = false])
 void get_translation (integer $language)
 string html ()
 void index ()
 void initialise ()
 string make_precis ([integer $maxwords = 50], [integer $minwords = 5])
 void plaintext_content (integer $wrapchars)
 void POSTprocess ()
 string render_story_icon ()
 void save_story ()
 void unindex ()
 boolean user_can_edit ()
 string view ()
 integer word_count ()
Variables
mixed $bytesize = 0 (line 94)
mixed $deleted = false (line 88)
mixed $expiry_date = "" (line 74)
mixed $expiry_date_ts = 0 (line 75)
mixed $formname = "" (line 93)
mixed $has_expiry = true (line 63)
mixed $has_media = true (line 60)
mixed $has_multilang = true (line 64)
mixed $has_multimedia = false (line 61)
mixed $has_precis = true (line 62)
mixed $info_msg = "" (line 89)
mixed $language = 0 (line 65)
mixed $lastmodified = "" (line 76)
mixed $lastmodified_ts = 0 (line 77)
mixed $microsite_name (line 96)
mixed $newstory = false (line 90)
mixed $root_translation_id = -1 (line 84)
mixed $root_translation_lang (line 85)
mixed $storymode = "" (line 92)
mixed $story_author = "" (line 69)
mixed $story_author_name = "" (line 70)
mixed $story_category = false (line 58)
mixed $story_category_desc = "" (line 59)
mixed $story_content = "" (line 68)
mixed $story_date = "" (line 72)
mixed $story_date_ts = 0 (line 73)
mixed $story_headline = "" (line 66)
mixed $story_icon (line 79)
mixed $story_icon_url (line 80)
mixed $story_id = NEW_STORY (line 57)
mixed $story_locs = array() (line 82)
mixed $story_media = array() (line 78)
mixed $story_precis = "" (line 67)
mixed $story_translations = array() (line 83)
mixed $story_type = "" (line 71)
mixed $valid = false (line 91)
mixed $visible = false (line 81)
mixed $wordcount = 0 (line 95)
Methods
Constructor story (line 103)

Constructor

story story ([mixed $id = false], [mixed $category = false], [mixed $language = false])
  • mixed $id: Story ID, or false if not known
  • mixed $category: String category identifier, or false if unknown
  • mixed $language: Integer language code, or false if default
delete_story (line 600)

Remove the story from the system. We actually just flag it as deleted on the database, and keep the record.

void delete_story ()
editform (line 975)

Render the story details as an edit form.

  • return: The editform complete.
string editform ()
get_story (line 224)

Get a story in total. We always access stories by their ID.

void get_story ([mixed $id = false])
  • mixed $id: Story ID, or false if not known
get_translation (line 852)

Returns the story_id of a translation of the current story in the

given language. If it already exists, then it just returns the story ID. If it doesn't exist, then it simply makes a copy of this story, assigns it the language it _will_ be translated into, and records a relationship to the other associated translations in the database table 'story_tranlsation'. This latter table allows us to put a list of languages (or little country flags) on any stories which have alternatives in another language.

void get_translation (integer $language)
  • integer $language: Language to get translated story in
html (line 1729)

Render the story. We render the story as a table within a form containing all the form elements required to manipulate the story content, email it to someone, save it, and delete it etc...

  • return: The HTML for edit or view.
string html ()

Redefinition of:
RenderableObject::html()
Return output suitable for normal HTML-capable device. This method must be over-ridden by a method of the same name in the descendant class which renders output to web browsers.
index (line 512)

Index this story to Lucene, if enabled for this website.

void index ()
initialise (line 192)

Initialise local vars..

void initialise ()
make_precis (line 941)

Generate a precis from the story content.

  • return: The precis
string make_precis ([integer $maxwords = 50], [integer $minwords = 5])
  • integer $maxwords: Maximum number of words for the precis
  • integer $minwords: Minimum number of words for the precis
plaintext_content (line 1705)

Return the content of this story formatted for plaintext display

void plaintext_content (integer $wrapchars)
  • integer $wrapchars: Number of characters to wrap the lines at
POSTprocess (line 622)

Process the POST from form. This method deals with POSTed content from the edit form.

void POSTprocess ()
render_story_icon (line 957)

Return the rendering of the story icon (if one exists) either as a standard HTML anchor tag if an icon URL exists, or as an image.

  • return: HTML for anchor or image of the story icon
string render_story_icon ()
save_story (line 550)

Routine to save the story to the database.

void save_story ()
unindex (line 539)

Un-Index this story from Lucene, if enabled for this website.

void unindex ()
user_can_edit (line 291)

Determine wwhether user can edit this story.

  • return: True if user can edit the story, else false.
boolean user_can_edit ()
view (line 1474)

Render the story as a maintainer reader would view it. Note that this

is not a fully dressed-up story viewer. It is designed as a view that a story administrator would see, showing all the technical bits and pieces such as story byte-size etc. You should create your own viewer for rendering stories 'prettily' on your website.

  • return: The HTML for the view story content.
string view ()
word_count (line 927)

Do a re-count of the story words. Set our local variable and also return the value as a by-product..

  • return: Count of words in the story
integer word_count ()

Inherited Methods

Inherited From RenderableObject

 RenderableObject::RenderableObject()
 RenderableObject::html()
 RenderableObject::render()
 RenderableObject::wml()
 RenderableObject::wmlup()
 RenderableObject::xml()

Documentation generated by phpDocumentor 1.3.0RC3