The best way to learn how to use the WebCore is by example. See the documentation for more information.

The requested URL is always shown first; if a page uses one or more WebCore templates, those are shown afterwards.

Source for: https://www.earthli.com/news/view_folder.php

Uses WebCore template(s):

00 <?php
01
02 /****************************************************************************
03  
04 Copyright (c) 2002-2014 Marco Von Ballmoos
05  
06 This file is part of earthli News.
07  
08 earthli News is free software; you can redistribute it and/or modify
09 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12  
13 earthli News is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17  
18 You should have received a copy of the GNU General Public License
19 along with earthli News; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  
22 For more information about the earthli News, visit:
23  
24 http://www.earthli.com/software/webcore/news
25  
26 ****************************************************************************/
27  
28   require_once ('news/start.php');
29   require_once ($App->page_template_for ('webcore/pages/view_folder.php'));
30 ?>
31

Source for template: webcore/pages/view_folder.php

00 <?php
01
02 /****************************************************************************
03  
04 Copyright (c) 2002-2014 Marco Von Ballmoos
05  
06 This file is part of earthli Albums.
07  
08 earthli Albums is free software; you can redistribute it and/or modify
09 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12  
13 earthli Albums is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17  
18 You should have received a copy of the GNU General Public License
19 along with earthli Albums; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  
22 For more information about the earthli Albums, visit:
23  
24 http://www.earthli.com/software/webcore/albums
25  
26 ****************************************************************************/
27  
28   $folder_query = $App->login->folder_query ();
29   /** @var $folder FOLDER */
30   $folder = $folder_query->object_at_id (read_var ('id'));
31   
32   if (isset ($folder) && $App->login->is_allowed (Privilege_set_folder, Privilege_view, $folder))
33   {
34     $App->set_referer ();
35  
36     $Page->social_options->enabled = true;
37     $folder->set_social_options($Page->social_options);
38  
39     /* get the folder from the folder query because the tree has
40      * been built and the sub-folders have been cached.
41      */
42      
43     $folders = $folder_query->tree ($folder->id, $folder->root_id);
44     $folder = $folder_query->object_at_id ($folder->id);
45  
46     $class_name = $App->final_class_name ('FOLDER_PANEL_MANAGER', 'webcore/gui/panel.php');
47     /** @var $panel_manager FOLDER_PANEL_MANAGER */
48     $panel_manager = new $class_name ($folder);
49     $panel = $panel_manager->selected_panel ();
50  
51     $Page->title->add_object ($folder);
52     $Page->title->subject = $panel->num_objects () . ' ' . $panel->raw_title();
53  
54     $Page->location->add_folder_text ($folder, 'panel=' . $panel_manager->selected_panel_id);
55     $Page->location->append($Page->title->subject);
56  
57     $Page->add_script_file ('{scripts}webcore_forms.js');
58     
59     $Page->newsfeed_options->title->group = $App->title;
60     $Page->newsfeed_options->title->add_object ($folder);
61     $Page->newsfeed_options->file_name = '{app}/view_folder_rss.php?id=' . $folder->id;
62  
63     $Page->start_display ();
64 ?>
65     <div class="top-box">
66       <div class="columns text-flow">
67         <?php
68
69         /** @var $renderer OBJECT_RENDERER */
70         $renderer = $folder->handler_for (Handler_html_renderer);
71         $options = $renderer->options ();
72         $options->show_as_summary = true;
73         $options->show_users = false;
74  
75         $text = $renderer->display_to_string ($folder);
76  
77         if ($text)
78         {
79           ?>
80           <div class="left-sidebar">
81             <?php echo $text; ?>
82           </div>
83           <?php
84         }
85  
86         ?>
87         <div>
88           <h4>Contents</h4>
89           <div class="panels">
90             <?php $panel_manager->display (); ?>
91           </div>
92         </div>
93         <?php
94         if (! empty ($folders))
95         {
96           $folder_type_info = $App->type_info_for ('FOLDER');
97           ?>
98           <div class="tree-content">
99             <h4>Sub-<?php echo $folder_type_info->plural_title; ?></h4>
100             <?php
101             $tree = $App->make_tree_renderer ();
102             include_once ('webcore/gui/folder_tree_node_info.php');
103             $tree->node_info = new FOLDER_TREE_NODE_INFO ($App);
104             $tree->node_info->page_args = read_vars (array ('panel', 'time_frame'));
105             $tree->display ($folders);
106             ?>
107           </div>
108           <?php
109         }
110         ?>
111         <div>
112           <h4>Search</h4>
113           <div class="form-content">
114             <?php
115             $class_name = $App->final_class_name ('EXECUTE_SEARCH_FORM', 'webcore/forms/execute_search_form.php');
116             $search = null;
117             $selected_panel = $panel_manager->selected_panel ();
118             /** @var $form EXECUTE_SEARCH_FORM */
119             $form = new $class_name ($App, $search);
120             $form->load_with_defaults ();
121             $form->set_value ('state', $selected_panel->state);
122             $form->set_value ('folder_ids', $folder->id);
123             $form->set_value ('folder_search_type', Search_user_constant);
124             $form->display ();
125             ?>
126           </div>
127         </div>
128       </div>
129     </div>
130     <div class="main-box">
131       <div class="menu-bar-top">
132         <?php
133         if ($panel->uses_time_selector)
134         {
135           $panel_manager->display_time_menu ();
136         }
137         $pager = $panel->get_pager();
138  
139         if ($pager)
140         {
141           $pager->pages_to_show = 0;
142           $pager->display();
143         }
144  
145         $grid = $panel->get_grid();
146         if ($grid)
147         {
148           $grid->show_pager = false;
149         }
150  
151         /** @var MENU_RENDERER $renderer */
152         $renderer = $folder->handler_for (Handler_menu);
153         $renderer->set_size(Menu_size_standard);
154         $renderer->num_important_commands = 2;
155         /** @var COMMANDS $commands */
156         $commands = $folder->handler_for(Handler_commands);
157         $renderer->display($commands);
158         ?>
159       </div>
160       <?php
161         $panel->display ();
162  
163         if ($panel->num_objects ())
164         {
165           // don't show the bottom selector if there are no objects
166         ?>
167         <div class="menu-bar-bottom">
168         <?php
169           if ($panel->uses_time_selector)
170           {
171             $panel_manager->display_time_menu ();
172           }
173           if ($pager)
174           {
175             $pager->pages_to_show = 5;
176             $pager->display(true);
177           }
178         ?>
179         </div>
180         <?php
181         }
182         ?>
183     </div>
184 <?php
185     $Page->finish_display ();
186   }
187   else
188   {
189     $Page->raise_security_violation ('You are not allowed to view this folder.', $folder);
190   }
191 ?>