CMS  Version 3.9
SectionContentAdminView Class Reference
+ Inheritance diagram for SectionContentAdminView:
+ Collaboration diagram for SectionContentAdminView:

Public Member Functions

 __construct ($section)
 
 handlePOST ()
 
 drawView ()
 
 categorizeItemTypes ($itemsByType)
 

Additional Inherited Members

- Protected Attributes inherited from AbstractSectionContentAdminView
 $section
 

Detailed Description

Definition at line 123 of file section_content_manager.inc.

Constructor & Destructor Documentation

◆ __construct()

SectionContentAdminView::__construct (   $section)

Reimplemented from AbstractSectionContentAdminView.

Definition at line 125 of file section_content_manager.inc.

126  {
127  parent::__construct($section);
128  }

Member Function Documentation

◆ categorizeItemTypes()

SectionContentAdminView::categorizeItemTypes (   $itemsByType)

Definition at line 265 of file section_content_manager.inc.

266  {
267  $types = array();
268 
269  foreach($itemsByType as $type => $items)
270  {
271  foreach($items as $item)
272  {
273  $types[$item->identifier] = $type;
274  }
275  }
276 
277  return $types;
278  }
$itemsByType
$types

◆ drawView()

SectionContentAdminView::drawView ( )

Reimplemented from AbstractSectionContentAdminView.

Definition at line 155 of file section_content_manager.inc.

156  {
157  global $script;
158  global $dialogs;
159 
160  $content = $this->section->Content("ORDER BY identifier");
161 
162  $contentByIdentifier = reindexList($content, "identifier");
163 
164  $itemsByType = array();
166 
168 
169  $contentTree = new TreeControl("section_content_tree", "Section Content");
170  $contentTree->scroll = true;
171  $contentTree->width = 360;
172  $contentTree->height = 430;
173  $contentTree->selectOnRightClick = true;
174 
175  $availableTree = new TreeControl("available_content_tree", "Available Content");
176  $availableTree->scroll = true;
177  $availableTree->width = 360;
178  $availableTree->height = 430;
179 
180  $categories = array();
181 
182  foreach($itemsByType as $type => $items)
183  {
184  $category = new TreeNode("content_type_".codify($type), $type, null, false, "tree_node_closed", "tree_node_open");
185 
186  $categories[$type] = new TreeNode("category_".codify($type), $type, null, false, "tree_node_closed", "tree_node_open");
187 
188  foreach($items as $item)
189  {
190  if (array_key_exists($item->identifier, $contentByIdentifier)) continue;
191 
192  $child = new TreeNode("available[{$item->identifier}]", $item->identifier, $item->identifier, false, "plain_tree_closed", "plain_tree_open");
193  $child->leafStyle = "file_node_leaf";
194 
195  $category->add($child);
196  }
197 
198  $availableTree->add($category);
199  }
200 
201  foreach($content as $item)
202  {
203  if (!array_key_exists($item->identifier, $types)) continue;
204 
205  $type = $types[$item->identifier];
206  $properties = $contentByIdentifier[$item->identifier];
207 
208  $child = new TreeNode("content['{$item->identifier}']", $item->identifier, $item->section_content_id, false, "plain_tree_closed", "plain_tree_open");
209  $child->leafStyle = ($properties->template || $properties->role || $properties->permissions || $properties->use_SSL) ? "flagged_node_leaf" : "file_node_leaf";
210  $categories[$type]->add($child);
211  }
212 
213  foreach($categories as $category)
214  {
215  $contentTree->add($category);
216  }
217 
218  $script .= <<<ENDSCRIPT
219  <script src="/fakoli/js/section_content_manager.js" type="text/javascript"></script>
220  <script type="text/javascript">
221 
222  var sectionContentManager;
223 
224  window.addEvent("domready", function()
225  {
226  sectionContentManager = new SectionContentManager('section_content_tree_table');
227  });
228 
229  </script>
230 ENDSCRIPT;
231 
232  $contextMenu = new ContextMenu("section_content_menu", "#section_content_tree_table");
233  $contextMenu->command("set_template", "Set Template...", "sectionContentManager.setTemplate()", false)
234  ->command("set_roles", "Set Roles...", "sectionContentManager.setRole()", false)
235  ->command("set_permissions", "Set Permissions...", "sectionContentManager.setPermissions()", false)
236  ->command("set_ssl", "Configure SSL...", "sectionContentManager.setSSL()", false)
237  ->command("set_page_title", "Override Page Title...", "sectionContentManager.setPageTitle()", false)
238  ->command("set_body_class", "Set Body Class...", "sectionContentManager.setBodyClass()", false)
239  ->command("set_all", "All Properties...", "sectionContentManager.allProperties()", "", false)
240  ->separator()
241  ->command("use_defaults", "Use Section Defaults", "sectionContentManager.clearProperties()", "", false)
242  ->separator()
243  ->command("position_modules", "Position Modules", "sectionContentManager.positionModules()", "", false);
244 
245  $script .= $contextMenu->writeScript();
246  $dialogs .= $contextMenu->writeMenu();
247 
248  ?>
249 <form method="POST" action="?section_id=<?echo $this->section->section_id?>">
250 <div style="float: left; width: 365px; margin-left: 10px">
251 <? $contentTree->writeHTML()?>
252 </div>
253 <div id="section_content_buttons">
254 <button class="button" id="section_move_left" title="Add"></button>
255 <button class="button" id="section_move_right" title="Remove"></button>
256 </div>
257 <div style="float: left; width: 365px">
258 <? $availableTree->writeHTML()?>
259 </div>
260 <div style="clear: left"><br/></div>
261 </form>
262 <?
263  }
$helpTree style
Definition: tree.inc:46
$form action
Definition: edit.inc:67
$bookmark title
static fireEvent($event, $parameter=null, $mustBeConsumed=false)
Fire an event to all subscribers as detailed in their manifests.
$tabs section
if(array_key_exists("HTTP_IF_MODIFIED_SINCE", $_SERVER)) $content
Definition: styles.css.inc:24

◆ handlePOST()

SectionContentAdminView::handlePOST ( )

Reimplemented from AbstractSectionContentAdminView.

Definition at line 130 of file section_content_manager.inc.

131  {
132  $doomed = new SectionContent();
133  checkNumeric($_POST["content"]);
134 
135  if (isset($_POST["content"]))
136  {
137  foreach($_POST["content"] as $identifier => $id)
138  {
139  $doomed->delete("WHERE section_content_id=$id");
140  }
141  }
142 
143  if (isset($_POST["available"]))
144  {
145  foreach($_POST["available"] as $identifier => $id)
146  {
147  $content = new SectionContent();
148  $content->section_id = $this->section->section_id;
149  $content->identifier = $identifier;
150  $content->save();
151  }
152  }
153  }
$_POST["owner_id"]
Definition: blog_form.inc:54
$identifier
Definition: rss.inc:37

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