Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F6562656
home.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
home.php
View Options
<?php
/**
* _, __, _, _ __, _ _, _, _
* / \ |_) (_ | | \ | /_\ |\ |
* \ / |_) , ) | |_/ | | | | \|
* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
*
* Controller for homepage content
*
* @package ObsidianWorkspaces
* @subpackage Controllers
* @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @filesource
*
*/
/**
* Homepage controller
*/
class
HomepageController
extends
Controller
{
/**
* Handles controller request
*/
public
function
handleRequest
()
{
$smarty
=
$this
->
context
->
templateEngine
;
$workspace
=
$this
->
context
->
workspace
;
if
(
$workspace
==
null
)
{
//We need a list of workspaces to allow user
//to select the one he wishes to access.
//The header has already grabbed it for us.
if
(
array_key_exists
(
'workspaces'
,
$smarty
->
tpl_vars
))
{
$workspaces
=
$smarty
->
tpl_vars
[
'workspaces'
]->
value
;
}
else
{
$workspaces
=
$this
->
context
->
user
->
get_workspaces
();
$smarty
->
assign
(
'workspaces'
,
$workspaces
);
}
switch
(
count
(
$workspaces
))
{
case
0
:
//No workspace error message
$smarty
->
assign
(
'PAGE_TITLE'
,
lang_get
(
"Home"
));
$template
=
"home_noworkspace.tpl"
;
break
;
case
1
:
//Autoselect workspace
$this
->
context
->
workspace
=
$workspaces
[
0
];
$workspace
=
$workspaces
[
0
];
$this
->
context
->
workspace
->
loadConfiguration
(
$this
->
context
);
break
;
default
:
//Select workspace template
$smarty
->
assign
(
'PAGE_TITLE'
,
lang_get
(
"PickWorkspace"
));
$template
=
"home_pickworkspace.tpl"
;
}
}
if
(
$workspace
!=
null
)
{
$smarty
->
assign
(
'PAGE_TITLE'
,
$workspace
->
name
);
$template
=
"home_workspace.tpl"
;
if
(
count
(
$workspace
->
configuration
->
disclaimers
))
{
$disclaimers
=
[];
foreach
(
$workspace
->
configuration
->
disclaimers
as
$disclaimer
)
{
$disclaimers
[]
=
Disclaimer
::
get
(
$disclaimer
);
}
$smarty
->
assign
(
'disclaimers'
,
$disclaimers
);
}
}
//Serves header
HeaderController
::
run
(
$this
->
context
);
//Serves relevant template
$smarty
->
display
(
$template
);
//Serves footer
FooterController
::
run
(
$this
->
context
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Apr 2, 18:18 (12 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2535275
Default Alt Text
home.php (2 KB)
Attached To
Mode
rOBSIDIAN Obsidian Workspaces
Attached
Detach File
Event Timeline
Log In to Comment