51 var
$fields = array(
"section_id" => Number,
53 "section_title" => String,
54 "default_template" => String,
55 "default_role" => String,
56 "default_permissions" => String,
57 "default_page" => String,
58 "default_body_class" => String,
61 "section_type" => String
87 return $this->getRelated(
Site);
103 return Query::create(
Section,
"WHERE section=:identifier AND site_id=:site")
110 throw new FakoliException(
"Unknown or ambiguous section '$identifier'");
128 return $this->default_template;
135 return $this->default_role;
142 return $this->default_permissions;
149 $sections = Query::create(
Section,
"WHERE section=:section AND site_id=:site")
150 ->bind(
":section", $section_name,
":site",
$site->site_id)
158 $modules = Cache::get(
"section_module_map_{$this->section_id}");
161 $join =
new InnerJoin();
165 $result = $join->groupedQuery(
"WHERE section_id={$this->section_id} $constraint",
"SectionModuleXref.position");
169 $globals = groupedQuery(
Module,
"WHERE global=1",
"global_position");
170 foreach($globals as $position => $modulesAtPosition)
172 if (array_key_exists($position,
$modules))
174 $modules[$position] = removeDuplicates(array_merge($modulesAtPosition,
$modules[$position]));
178 $modules[$position] = $modulesAtPosition;
182 Cache::put(
"section_module_map_{$this->section_id}",
$modules);
190 Cache::invalidate(
"section_module_map_{$this->section_id}");
201 $url =
"http" . (($this->use_SSL) ?
"s" :
"") .
"://{$config['http_host']}/";
215 $directory = $this->
Site()->getThemeDirectory();
216 $file = $directory . DIRECTORY_SEPARATOR . $this->default_template;
217 trace(
"Template File: $file", 3);
218 $template = file_get_contents(
$file);
229 return $url . $this->default_page;
240 $positionMatches = array();
242 preg_match_all(
"/\{position:(.*?)\}/", $template, $positionMatches, PREG_PATTERN_ORDER);
257 var
$fields = array(
"section_content_id" => Number,
258 "section_id" => String,
259 "identifier" => String,
261 "permissions" => String,
262 "template" => String,
263 "body_class" => String,
264 "override_page_title" => String,
265 "use_SSL" => Boolean);
274 return $this->getRelated(
Section);
285 if (!$this->section_content_id)
291 $modules = Cache::get(
"section_content_module_map_{$this->section_content_id}");
294 $join =
new InnerJoin();
298 $result = $join->groupedQuery(
"WHERE section_content_id={$this->section_content_id} $constraint",
"SectionContentModuleXref.position");
304 $globals = groupedQuery(
Module,
"WHERE global=1",
"global_position");
305 foreach($globals as $position => $modulesAtPosition)
307 if (array_key_exists($position,
$modules))
309 $modules[$position] = removeDuplicates(array_merge($modulesAtPosition,
$modules[$position]));
313 $modules[$position] = $modulesAtPosition;
318 Cache::put(
"section_module_map_{$this->section_id}",
$modules);
344 $template = file_get_contents(
"{$config['homedir']}/templates/{$this->template}");
348 $template = $this->
Section()->getDefaultTemplate();
362 $positionMatches = array();
364 preg_match_all(
"/\{position:(.*?)\}/", $template, $positionMatches, PREG_PATTERN_ORDER);
376 return $this->body_class ? $this->body_class : $this->
Section()->default_body_class;
389 if ($this->section_id)
391 throw new FakoliException(
"Attempt to map section content that is already mapped to a section");
402 $this->section_id =
$section->section_id;
415 "section_id" => Number,
416 "module_id" => Number,
417 "position" => String,
418 "sort_order" => Number);
427 return $this->getRelated(
Section);
432 return $this->getRelated(
Module);
440 var
$table =
"section_content_module_xref";
445 "section_content_id" => Number,
446 "module_id" => Number,
447 "position" => String,
448 "sort_order" => Number);
462 return $this->getRelated(
Module);
static fireEvent($event, $parameter=null, $mustBeConsumed=false)
Fire an event to all subscribers as detailed in their manifests.
FakoliException is the base exception class for all Fakoli errors.
Defines the Module class.
SectionContentModuleXrefs($constraint="ORDER BY position, sort_order")
getBodyClass()
Returns any custom body CSS classes defined for this section content.
getModulesByPosition($constraint="ORDER BY position, sort_order")
getTemplate()
Loads the default template associated with this section.
static getMappedContent($identifier)
addToSection($section_folder)
Add this SectionContent to the specified Section.
getPositions()
Retrieves an array of the position names defined in the template for this page.
static getManager($section)
Retrieves the SectionContentManager object for the specified section.
Section DataItem, defining the data model for sections within a site.
static findSection($section_name)
getDefaultPage()
Returns the path to the default page for this section.
getModulesByPosition($constraint="ORDER BY position, sort_order")
static createFromIdentifier($identifier)
getSectionURL()
Returns the Section URL.
Modules($constraint="ORDER BY position, sort_order")
SectionModuleXrefs($constraint="ORDER BY position, sort_order")
getDefaultTemplate()
Loads the default template associated with this section.
getPermissions($identifier)
getTemplateFile($identifier)
getPositions()
Retrieves an array of the position names defined in the template for this page.
static isInSection($section_folder, $identifier)
static ensureContentManager()
static getSite()
Returns the Site object that describes the currently active site (i.e.
if(array_key_exists("HTTP_IF_MODIFIED_SINCE", $_SERVER)) $content