Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F390557
ship.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
ship.php
View Options
<?php
/**
* Ship
*
* Zed. The immensity of stars. The HyperShip. The people.
*
* (c) 2010, Dereckson, some rights reserved.
* Released under BSD license.
*
* This controller handle the /ship URL
*
* It allows the user to let personal notes about the ship.
*
* It uses the Ship model and the ship.tpl view
*
* @package Zed
* @subpackage Controllers
* @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
* @copyright 2010 Sébastien Santoro aka Dereckson
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @version 0.1
* @link http://scherzo.dereckson.be/doc/zed
* @link http://zed.dereckson.be/
* @filesource
*
* @todo prints information indicating if we're or not in the ship
* @todo implement a console to control the ship
*/
//
// Load library and language file
//
require_once
(
'includes/objects/ship.php'
);
lang_load
(
'ships.conf'
);
//
// Ship information
//
//Gets ship from URL
if
(
count
(
$url
)
<
2
)
{
//No parameter, gets ship perso is aboard
if
(!
$code
=
$CurrentPerso
->
location
->
ship_code
)
{
message_die
(
GENERAL_ERROR
,
lang_get
(
"NotAboardNoCode"
),
lang_get
(
"URLError"
));
//"
}
$code
=
'S'
.
$code
;
}
else
{
//Code have been specified
$code
=
$url
[
1
];
if
(!
preg_match
(
"/^S[0-9]{5}$/"
,
$code
))
{
message_die
(
GENERAL_ERROR
,
lang_get
(
"InvalidShipCode"
),
lang_get
(
"URLError"
));
}
}
//Gets relevant information
$ship
=
Ship
::
get
(
$code
);
$note
=
$CurrentPerso
->
get_note
(
$code
);
//Determines the spatial relation between perso and ship
//dieprint_r($CurrentPerso->location->ship_code);
//
// Actions handling
//
if
(
$_REQUEST
[
'action'
]
==
'ship.setnote'
&&
$_REQUEST
[
'note'
]
!=
$note
)
{
//Updates note content
$CurrentPerso
->
set_note
(
$code
,
$_REQUEST
[
'note'
]);
$note
=
$_REQUEST
[
'note'
];
}
//
// HTML output
//
//Serves header
$smarty
->
assign
(
'PAGE_TITLE'
,
$ship
->
name
);
include
(
'header.php'
);
//Serves content
$smarty
->
assign
(
'note'
,
$note
);
$smarty
->
assign
(
'ship'
,
$ship
);
$smarty
->
display
(
'ship.tpl'
);
//Serves footer
include
(
'footer.php'
);
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Feb 22, 15:27 (8 h, 14 s ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
22399
Default Alt Text
ship.php (2 KB)
Attached To
rZED Zed
Event Timeline
Log In to Comment