Esempio n. 1
0
     $smarty->assign('path', $template_dir . "/edit_items.tpl");
     $smarty->assign('mod_dir', $mod_dir);
     $breadcrumbs->addElement($room['title'], makeURL($mod, array('roomid' => $roomid)));
     $breadcrumbs->addElement($lang->get('edit_items'), makeURL($mod, array('roomid' => $roomid, 'mode' => 'items')));
     $smarty->assign('room', $room);
     if (isset($_POST['save'])) {
         saveItems($room);
     }
     $items = $db->selectList($tbl_i, "*", "`roomid`=" . $roomid);
     $smarty->assign('items', $items);
     $matrix = makeItemMatrix($items, $room['height'], $room['width']);
     $smarty->assign('matrix', $matrix);
     $smarty->assign('typematrix', getTypeMatrix());
     $roomlist = $db->selectList($tbl_r, "*", 'eventid=' . $room['eventid']);
     $smarty->assign('roomlist', $roomlist);
     $smarty->assign('image_white', itemTypeToImage(0));
     break;
 case 'edit':
     if (!$isallowed) {
         break;
     }
     $menu->addSubElement($mod, $lang->get('room_remove'), 'remove', array('roomid' => $roomid));
     if (isset($_POST['do'])) {
         if ($_POST['title'] != '' && (int) $_POST['height'] > 0 && (int) $_POST['width'] > 0) {
             $db->update($tbl_r, "`title`='" . secureMySQL($_POST['title']) . "',\r\n\t\t\t\t\t\t\t\t\t`description`='" . secureMySQL($_POST['description']) . "',\r\n\t\t\t\t\t\t\t\t\t`height`=" . (int) $_POST['height'] . ",\r\n\t\t\t\t\t\t\t\t\t`width`=" . (int) $_POST['width'] . ",\r\n\t\t\t\t\t\t\t\t\t`eventid`=" . (int) $_POST['event'], "`roomid`=" . $roomid);
         }
     }
     $smarty->assign('path', $template_dir . "/add_edit.tpl");
     $smarty->assign('action', $lang->get('room_edit'));
     $room = $db->selectOneRow($tbl_r, "*", "`roomid`=" . $roomid);
     $smarty->assign('room', $room);
Esempio n. 2
0
function getTypeMatrix()
{
    global $type;
    global $ignore_type;
    $x = 0;
    $y = 0;
    foreach ($type as $i => $t) {
        if (!in_array($i, $ignore_type)) {
            $out[$y][$x]['img'] = itemTypeToImage($i);
            $out[$y][$x]['type'] = $i;
            $x++;
            if ($x > 11) {
                $x = 0;
                $y++;
            }
        }
    }
    return $out;
}