SetInitialValues(); } /** * Set attributes of global content block to blank (but predictable) values. * @access private */ function SetInitialValues() { $this->id = -1; $this->name = ''; $this->content = ''; $this->owner = -1; $this->modified_date = -1; $this->use_wywiwyg = 1; $this->description = ''; } /** * Returns the database ID for this Global Content Block * @final * @return int opaque database ID for the Global Content Block */ function Id() { return $this->id; } /** * Returns the name for this Global Content Block * * @final * @return string name of the global content block */ function Name() { return $this->name; } /** * Returns the description for this global content block * * @final * @return string Description of the global content block */ function Description() { return $this->description; } /** * Saves the Global Content Block to the database * * @return boolean true indicates success, false indicates failure */ function Save() { $result = false; $gcbops = cmsms()->GetGlobalContentOperations(); if ($this->id > -1) { $result = $gcbops->UpdateHtmlBlob($this); } else { $newid = $gcbops->InsertHtmlBlob($this); if ($newid > -1) { $this->id = $newid; $result = true; } } return $result; } /** * Deletes the Global Content Block from the database * * @return boolean true indicates success, false indicates failure */ function Delete() { $result = false; $gcbops = cmsms()->GetGlobalContentOperations(); if ($this->id > -1) { $result = $gcbops->DeleteHtmlBlobByID($this->id); if ($result) { $this->SetInitialValues(); } } return $result; } /** * Test to see if a specified User (specified as admin-side user's database ID) * is the owner of this Global Content Block * * @param string $user_id User ID to test * @return boolean indicates whether specified user owns this Global Content Block */ function IsOwner($user_id) { $result = false; $gcbops = cmsms()->GetGlobalContentOperations(); if ($this->id > -1) { $result = $gcbops->CheckOwnership($this->id, $user_id); } return $result; } /** * Test to see if a specified User (specified as admin-side user's database ID) * is the author of this Global Content Block * * @param string $user_id User ID to test * @return boolean indicates whether specified user is the author of this Global Content Block */ function IsAuthor($user_id) { $result = false; $gcbops = cmsms()->GetGlobalContentOperations(); if ($this->id > -1) { $result = $gcbops->CheckAuthorship($this->id, $user_id); } return $result; } /** * Clears all of the Additional Editors from this Global Content Block in the database * * @return boolean true indicates success, false indicates failure */ function ClearAuthors() { $result = false; $gcbops = cmsms()->GetGlobalContentOperations(); if ($this->id > -1) { $gcbops->ClearAdditionalEditors($this->id); $result = true; } return $result; } /** * Adds a specified User (specified as admin-side user's database ID) as an editor for * this Global Content Block * * @param string $user_id User ID to add * @return boolean true indicates success, false indicates failure */ function AddAuthor($user_id) { $result = false; $gcbops = cmsms()->GetGlobalContentOperations(); if ($this->id > -1) { $gcbops->InsertAdditionalEditors($this->id, $user_id); $result = true; } return $result; } } /** * The class used for "Global Content Blocks" in CMS Made Simple. * * @ignore * @package CMS * @version $Revision$ * @license GPL */ class HtmlBlob extends GlobalContent { } # vim:ts=4 sw=4 noet ?>