Fixed theme Blogger
[vanilla-miry.git] / library / Vanilla / Vanilla.Class.Category.php
blobbe98075197145f5f50fae022a4ab786f889dfa91
1 <?php
2 /**
3 * Category class
5 * Copyright 2003 Mark O'Sullivan
6 * This file is part of Lussumo's Software Library.
7 * Lussumo's Software Library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
8 * Lussumo's Software Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
9 * You should have received a copy of the GNU General Public License along with Vanilla; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
10 * The latest source code is available at www.lussumo.com
11 * Contact Mark O'Sullivan at mark [at] lussumo [dot] com
13 * @author Mark O'Sullivan
14 * @copyright 2003 Mark O'Sullivan
15 * @license http://lussumo.com/community/gpl.txt GPL 2
16 * @package Vanilla
17 * @version 1.1.10
21 /**
22 * Object representation of a category.
23 * @package Vanilla
25 class Category {
26 var $CategoryID;
27 var $Name;
28 var $Description;
29 var $Blocked; // Is this category blocked by the viewing user
30 var $RoleBlocked; // Is this category blocked to the role of the viewing user
31 var $AllowedRoles; // Contains the roles that are allowed to take part in this category
32 var $DiscussionCount; // aggregate - display only
34 function Category() {
35 $this->Clear();
38 // Clears all properties
39 function Clear() {
40 $this->CategoryID = 0;
41 $this->Name = '';
42 $this->Description = '';
43 $this->DiscussionCount = 0;
44 $this->Blocked = 0;
45 $this->RoleBlocked = 0;
46 $this->AllowedRoles = array();
49 function FormatPropertiesForDatabaseInput() {
50 $this->Name = FormatStringForDatabaseInput($this->Name, 1);
51 $this->Description = FormatStringForDatabaseInput($this->Description, 1);
54 function FormatPropertiesForDisplay() {
55 $this->Name = FormatStringForDisplay($this->Name, 1);
56 $this->Description = FormatStringForDisplay($this->Description, 1);
59 function GetPropertiesFromDataSet($DataSet) {
60 $this->CategoryID = ForceInt(@$DataSet['CategoryID'], 0);
61 $this->Name = ForceString(@$DataSet['Name'], '');
62 $this->Description = ForceString(@$DataSet['Description'], '');
63 $this->DiscussionCount = ForceInt(@$DataSet['DiscussionCount'], 0);
64 $this->Blocked = ForceBool(@$DataSet['Blocked'], 0);
65 $this->RoleBlocked = ForceBool(@$DataSet['RoleBlocked'], 0);
68 function GetPropertiesFromForm(&$Context) {
69 $this->CategoryID = ForceIncomingInt('CategoryID', 0);
70 $this->Name = ForceIncomingString('Name', '');
71 $this->Description = ForceIncomingString('Description', '');
72 $this->AllowedRoles = ForceIncomingArray('CategoryRoleBlock', array());