CMS  Version 3.9
scroll_manager.inc
Go to the documentation of this file.
1 <?php
14 {
15  function ScrollManager()
16  {
17 
18  }
19 
20  static function setDefaults()
21  {
22  Settings::setDefaultValue("scroll", "scroll_part_template", "<a name='{title:codify}'></a>\n<div id='{title:codify}' class='part {css_class}' style='{styles}'>\n<div class='content'>{content}</div>\n</div>", Text);
23  }
24 
25 
26  static function registerSerializationHandler()
27  {
28  SerializationManager::registerHandler("scroll", "Scrolls and Parts", new CompoundSerializationHandler("ScrollMap", 'Scroll', 'ScrollPart'));
29  }
30 
31  static function scrollTabs($key)
32  {
33  $tabs = array( "Definition" => "scroll_form",
34  "Parts" => "scroll_parts"
35  );
36 
37  $qs = ($key) ? "scroll_id=$key" : "";
38  return new TabBar("tabs", $tabs, $qs);
39  }
40 
41 
42  static function displayScroll($identifier, &$continue)
43  {
44  try
45  {
46  trace("Searching for scroll with identifier '$identifier'", 2);
48  $page = ComponentPage::findByIdentifier("scroll", "WHERE enabled=1");
49  Fakoli::put("content_object", $scroll);
50 
51  $pageView = new ComponentPageView($page, "{$page->template}.tpl");
52 
53  $page_role = $page->role;
54 
55  if (!checkRole($page->role))
56  {
58  redirect("/login");
59  }
60 
61  echo $pageView->drawView();
62 
63  $continue = false;
64  }
65  catch(DataNotFoundException $e)
66  {
67 
68  }
69  return $identifier;
70  }
71 
72  static function enumerateScrolls($items)
73  {
74  $scrolls = Query::create(Scroll, "ORDER BY identifier")->execute();
75 
76  $items["Scrolls"] = $scrolls;
77  return $items;
78  }
79 
81  {
82  $classes[] = Scroll;
83  return $classes;
84  }
85 
86  static function registerVersionedContent()
87  {
89  }
90 
91  static function upgradeComponent($version)
92  {
93  $mgr = new ScrollUpgradeManager();
94  $mgr->upgrade($version);
95  }
96 }
97 ?>
$tabs
$page
Definition: help.inc:39
static findByIdentifier($identifier, $constraint="")
ComponentPageView generates the page content for a component page, substituting page fields,...
Provides serialization for a number of DataItem classes, grouped under a common tag in the serialized...
static put($key, $obj)
Stores a value or object at the given key.
Definition: core.inc:99
static storeRedirectPage()
Store the page from which a user has been redirected when prompted to login or create an account.
Definition: login.inc:493
Definition: scroll.inc:8
static findByIdentifier($identifier)
Definition: scroll.inc:41
Provides a central management class for event handlers and common functionality for the scroll compon...
static registerVersionedContent()
static registerTaxonomyClasses($classes)
static scrollTabs($key)
static displayScroll($identifier, &$continue)
static enumerateScrolls($items)
static registerSerializationHandler()
static setDefaults()
static upgradeComponent($version)
registerHandler($component, $title, $handler)
Registers a serialization handler for a component.
static setDefaultValue($component, $name, $value, $field_type="String", $annotation="", $category="", $options="", $weight=0)
Sets the default value of the given component setting.
Definition: settings.inc:174
$identifier
Definition: rss.inc:37
$scroll
Definition: scroll_form.inc:44