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_user.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 $panel_manager_class_name = 'NEWS_USER_PANEL_MANAGER';
30 require_once ($App->page_template_for ('webcore/pages/view_user.php'));
31 ?>
32
Source for template: webcore/pages/view_user.php
00 <?php
01
02 /****************************************************************************
03
04 Copyright (c) 2002-2014 Marco Von Ballmoos
05
06 This file is part of earthli Webcore.
07
08 earthli Webcore 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 Webcore 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 Webcore; 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 Webcore, visit:
23
24 http://www.earthli.com/software/webcore
25
26 ****************************************************************************/
27
28 $name = read_var ('name');
29
30 if ($name)
31 {
32 $user_query = $App->user_query ();
33 $user = $user_query->object_at_name ($name);
34 }
35
36 if (isset ($user) && $App->login->is_allowed (Privilege_set_user, Privilege_view, $user))
37 {
38 $App->set_referer ();
39 $App->set_search_text (read_var ('search_text'));
40
41 $class_name = $App->final_class_name ('USER_PANEL_MANAGER', 'webcore/gui/panel.php');
42 /** @var $panel_manager USER_PANEL_MANAGER */
43 $panel_manager = new $class_name ($user);
44 $panel = $panel_manager->selected_panel ();
45
46 $Page->title->add_object ($user);
47 $num_objects = $panel->num_objects();
48 if ($num_objects)
49 {
50 $Page->title->subject = $num_objects . ' ' . $panel->raw_title();
51 }
52 else
53 {
54 $Page->title->subject = $panel->raw_title();
55 }
56
57 $Page->newsfeed_options->title->group = $App->title;
58 $Page->newsfeed_options->title->add_object ($user);
59 $Page->newsfeed_options->file_name = '{app}/view_user_rss.php?name=' . $user->title;
60
61 $Page->location->add_root_link ();
62 $Page->location->append ("Users", "view_users.php");
63 $Page->location->add_object_text ($user);
64 $Page->location->append($Page->title->subject);
65
66 $Page->start_display ();
67 ?>
68 <div class="top-box">
69 <div class="columns text-flow">
70 <div class="grid-content">
71 <?php
72 $renderer = $user->handler_for (Handler_html_renderer);
73 $options = $renderer->options ();
74 $options->show_as_summary = true;
75 $options->show_users = false;
76 $renderer->display ($user);
77 ?>
78 </div>
79 <div>
80 <h4>Contents</h4>
81 <div class="panels">
82 <?php $panel_manager->display (); ?>
83 </div>
84 </div>
85 </div>
86 </div>
87 <div class="main-box">
88 <div class="menu-bar-top">
89 <?php
90 if ($panel->uses_time_selector)
91 {
92 $panel_manager->display_time_menu ();
93 }
94 $pager = $panel->get_pager();
95
96 if ($pager)
97 {
98 $pager->pages_to_show = 0;
99 $pager->display();
100 }
101
102 $grid = $panel->get_grid();
103 if ($grid)
104 {
105 $grid->show_pager = false;
106 }
107
108 /** @var MENU_RENDERER $renderer */
109 $renderer = $user->handler_for (Handler_menu);
110 $renderer->set_size(Menu_size_standard);
111 $renderer->num_important_commands = 2;
112 /** @var COMMANDS $commands */
113 $commands = $user->handler_for(Handler_commands);
114 $renderer->display($commands);
115 ?>
116 </div>
117 <?php
118 $panel->display ();
119
120 if ($panel->num_objects ())
121 {
122 // don't show the bottom selector if there are no objects
123 ?>
124 <div class="menu-bar-bottom">
125 <?php
126 if ($panel->uses_time_selector)
127 {
128 $panel_manager->display_time_menu ();
129 }
130 if ($pager)
131 {
132 $pager->pages_to_show = 5;
133 $pager->display(true);
134 }
135 ?>
136 </div>
137 <?php
138 }
139 ?>
140 </div>
141 <?php
142 $Page->finish_display ();
143 }
144 else
145 {
146 if (isset($user))
147 {
148 $Page->raise_security_violation ('You are not allowed to see this user.', $user);
149 }
150 else
151 {
152 $Page->raise_error ('Please specify a user.', 'Invalid parameters');
153 }
154 }
155 ?>