CMS  Version 3.9
SectionManager Class Reference

SectionManager provides simple programmatic interface for managing registration of pages to sections. More...

Static Public Member Functions

static ensureContentManager ()
 
static addToSection ($section_folder, $identifier, $role="", $template="", $use_SSL=false, $permissions="")
 
static removeFromSection ($section_folder, $identifier)
 
static isInSection ($section_folder, $identifier)
 
static permissionDeleted ($permission)
 
static upgradeComponent ($version)
 
static registerSectionContentManager ()
 
static registerSerializationHandler ()
 

Detailed Description

SectionManager provides simple programmatic interface for managing registration of pages to sections.

Author
andy

Definition at line 145 of file section_manager.inc.

Member Function Documentation

◆ addToSection()

static SectionManager::addToSection (   $section_folder,
  $identifier,
  $role = "",
  $template = "",
  $use_SSL = false,
  $permissions = "" 
)
static

Definition at line 155 of file section_manager.inc.

156  {
157  trace("Adding '$identifier' to section '$section_folder'", 3);
158 
160 
161  if (SectionManager::isInSection($section_folder, $identifier)) return;
162  $section = Section::createFromIdentifier($section_folder);
163 
164  $content = new SectionContent();
165  $content->section_id = $section->section_id;
166  $content->identifier = $identifier;
167  $content->role = $role;
168  $content->permissions = $permissions;
169  $content->template = $template;
170  $conent->use_SSL = $use_SSL;
171  $content->save();
172  }
$section
Definition: event_form.inc:44
static createFromIdentifier($identifier)
Definition: section.inc:95
static isInSection($section_folder, $identifier)
static ensureContentManager()
$role
Definition: role_form.inc:41
$identifier
Definition: rss.inc:37
if(array_key_exists("HTTP_IF_MODIFIED_SINCE", $_SERVER)) $content
Definition: styles.css.inc:24

◆ ensureContentManager()

static SectionManager::ensureContentManager ( )
static

Definition at line 147 of file section_manager.inc.

148  {
150  {
152  }
153  }
static isSectionTypeRegistered($section_type)
Check whether a SectionContentManager has been registered for the specified type.
static registerManager($type, $manager)
Registers a SectionContentManager for handling a specified section type.

◆ isInSection()

static SectionManager::isInSection (   $section_folder,
  $identifier 
)
static

Definition at line 186 of file section_manager.inc.

187  {
189  $section = Section::createFromIdentifier($section_folder);
190 
191  $content = new SectionContent();
192  return $content->exists("WHERE section_id={$section->section_id} AND identifier='$identifier'");
193  }

◆ permissionDeleted()

static SectionManager::permissionDeleted (   $permission)
static

Definition at line 195 of file section_manager.inc.

196  {
197  $affected = Query::create(SectionContent, "WHERE permissions REGEXP '[[:<:]]{$permission}[[:>:]]'")
198  ->execute();
199 
200  foreach($affected as $a)
201  {
202  $p = array();
203  $perms = explode(",", $a->permissions);
204  foreach($perms as $q)
205  {
206  if ($q != $a) $p[] = $q;
207  }
208 
209  $a->permissions = implode(",", $p);
210  $a->filter = new InclusionFilter("permissions");
211  $a->save();
212 
213  }
214  }

◆ registerSectionContentManager()

static SectionManager::registerSectionContentManager ( )
static

Definition at line 222 of file section_manager.inc.

223  {
225  }

◆ registerSerializationHandler()

static SectionManager::registerSerializationHandler ( )
static

Definition at line 227 of file section_manager.inc.

228  {
229  SerializationManager::registerHandler("section", "Sections and Section Content", new SectionSerializationHandler());
230  return true;
231  }
Handles serialization of the section map for import/export.
registerHandler($component, $title, $handler)
Registers a serialization handler for a component.

◆ removeFromSection()

static SectionManager::removeFromSection (   $section_folder,
  $identifier 
)
static

Definition at line 174 of file section_manager.inc.

175  {
176  trace("Removing '$identifier' from section '$section_folder'", 3);
177 
179 
180  $section = Section::createFromIdentifier($section_folder);
181 
182  $content = new SectionContent();
183  $content->delete("WHERE section_id={$section->section_id} AND identifier='$identifier'");
184  }

◆ upgradeComponent()

static SectionManager::upgradeComponent (   $version)
static

Definition at line 216 of file section_manager.inc.

217  {
218  $mgr = new SectionUpgradeManager();
219  $mgr->upgrade($version);
220  }

The documentation for this class was generated from the following file: