*
* Source Code: https://github.com/cornernote/minetest-gamewiki
* License: GPLv3
*/
require('globals.php');
?>
query('SELECT id, mod, type, name, description, data FROM "item" WHERE name = "' . $name . '"');
$row = $q->fetchArray();
$data = json_decode($row['data']);
?>
options->inventory_image) ? is_array($data->options->inventory_image) ? $data->options->inventory_image : array($data->options->inventory_image) : array(),
isset($data->options->tiles) ? (array)$data->options->tiles : array(),
isset($data->options->tile_images) ? (array)$data->options->tile_images : array()
);
if (!empty($images)) {
echo '
Images
';
echo gamewiki::images($images, array('fullsize' => true, 'class' => 'image'));
}
// created by crafts
$output = false;
ob_start();
echo '
Created By Crafts
';
$q = $db->query('SELECT id, mod, type, output, quantity, data FROM "craft" WHERE output = "' . $name . '"');
echo '
';
echo '';
echo 'Mod | ';
echo 'Type | ';
echo 'Recipe | ';
echo ' | ';
echo '
';
while ($row_c = $q->fetchArray()) {
$data = json_decode($row_c['data']);
echo '';
echo '' . $row_c['mod'] . ' | ';
echo '' . $row_c['type'] . ' | ';
echo '' . (isset($data->options->recipe) ? gamewiki::craft_recipe($data->options->recipe, $row_c['type'], true) : $row_c['type']) . ' | ';
echo 'view craft | ';
echo '
';
$output = true;
}
echo '
';
$contents = ob_get_clean();
if ($output) echo $contents;
// used for crafts
$output = false;
ob_start();
echo '
Used For Crafts
';
$q = $db->query('SELECT id, mod, type, output, quantity, data FROM "craft_to_itemname" LEFT JOIN "craft" ON "craft"."id"="craft_to_itemname"."craft_id" WHERE name = "' . $name . '" ORDER BY output');
echo '
';
echo '';
echo 'Mod | ';
echo 'Type | ';
echo 'Recipe | ';
echo 'Output | ';
echo ' | ';
echo '
';
while ($row_c = $q->fetchArray()) {
$data = json_decode($row_c['data']);
echo '';
echo '' . $row_c['mod'] . ' | ';
echo '' . $row_c['type'] . ' | ';
echo '' . (isset($data->options->recipe) ? gamewiki::craft_recipe($data->options->recipe, $row_c['type'], true) : $row_c['type']) . ' | ';
if ($row_c['type'] == 'fuel') {
echo '' . gamewiki::item('default:furnace_active', null, true) . ' | ';
}
else {
echo '' . ($row_c['output'] ? gamewiki::item($row_c['output'], $row_c['quantity'], true) : 'no output') . ' | ';
}
echo 'view craft | ';
echo '
';
$output = true;
}
echo '
';
$contents = ob_get_clean();
if ($output) echo $contents;
// used by abms
$rows = array();
$q = $db->query('SELECT id FROM "abm_to_itemname" LEFT JOIN "abm" ON "abm"."id"="abm_to_itemname"."abm_id" WHERE name = "' . $name . '"');
while ($row_a = $q->fetchArray()) {
$rows[] = '
view abm';
}
if ($rows) {
echo '
Used By ABMs
';
echo implode(' ', $rows);
}
// used by aliases
$output = false;
ob_start();
echo '
Used By Aliases
';
$q = $db->query('SELECT id, name, mod FROM "alias" WHERE itemname = "' . $name . '"');
echo '
';
echo '';
echo 'Mod | ';
echo 'Alias | ';
echo '
';
while ($row_a = $q->fetchArray()) {
$output = true;
echo '';
echo '' . $row_a['mod'] . ' | ';
echo '' . $row_a['name'] . ' | ';
echo '
';
}
echo '
';
$contents = ob_get_clean();
if ($output) echo $contents;
// other data
echo '
Data
';
echo '
mod:' . $row['mod'] . '
';
print '
';
print_r($data);
print '
';
?>