예제 #1
0
function edit_data_navigator(&$app)
{
    global $lang;
    $p =& $app->ui;
    $dep =& $app->db->def;
    $class = $app->arg('class');
    $table = $app->arg('table');
    $id = $app->arg('id');
    $otable = $app->arg('otable');
    $oid = $app->arg('oid');
    $p->link($lang['cmd defaultview'], 'defaultview');
    show_directory_index($app, $otable, $oid, true);
    $p->link($lang['cmd back/quit'], 'return2caller');
    $p->headline($lang['available objects']);
    $xtable = $otable;
    $xid = $oid;
    echo '<table border="0">';
    do {
        $obj = new DBOBJ($app->db, $class, $dep, $xtable, $xid);
        if (!isset($obj->data)) {
            break;
        }
        # Get source directory of the found object.
        $t = $obj->data['_table'];
        $i = $obj->data['_id'];
        # Mark the path if the object is currently displayed.
        if ($t == $table && $i == $id) {
            echo '<td><b>' . $lang['current'] . '</b></td><td>-</td>';
        } else {
            echo '<td>&nbsp;</td><td>';
            $e = new event('copy_object', array('class' => $class, 'table' => $otable, 'id' => $oid, 'srctable' => $obj->data['_table'], 'srcid' => $obj->data['_id']));
            $e->set_next($app->event());
            $p->link($lang['copy to current'], $e);
            echo '</td>';
        }
        # Print the path to the directory.
        echo '<td>';
        $p->link($app->db->traverse_refs_from($app, $t, $i, 'nav_linkpath', false, false), new event('edit_data', array('table' => $t, 'id' => $i, 'class' => $class, 'otable' => $otable, 'oid' => $oid)));
        echo '</td></tr>';
        # Fetch parent directory's position and break if there is none.
        $xtable = $t;
        $xid = $i;
        dbitree_get_parent($app->db, $xtable, $xid);
    } while ($xid);
    echo '</table>';
}
예제 #2
0
function generic_list(&$app, $conf)
{
    global $lang;
    $db =& $app->db;
    $def =& $db->def;
    $p =& $app->ui;
    $id = $app->arg('id', ARG_OPTIONAL);
    $app->event()->set_arg('table', $conf->table);
    # Required by _object_box().
    $p->headline($lang["title " . $app->event()->name]);
    $p->link($lang['cmd defaultview'], 'defaultview', 0);
    if ($conf->table) {
        show_directory_index($app, $conf->table, $id, false);
        generic_list_siblings($app, $conf);
        generic_list_editor($app, $conf);
        show_directory_objects($app, $conf->table, $id, $app->args());
    }
    generic_list_children($app, $conf);
}