예제 #1
0
function camila_export_action_select()
{
    global $_CAMILA;
    $mySelect = new CHAW_select('camila_export_action');
    require_once 'fs.class.php';
    $fs = new fs($_CAMILA['adm_user_group']);
    $mySelect->add_option(camila_get_translation('camila.export.download'), 'download');
    if (!CAMILA_FM_EXTFS_ENABLED) {
        if (!CAMILA_FM_EXPORT_SAVETO_DISABLED) {
            $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents'), '/', $_REQUEST['camila_export_last_action'] == '/' ? HAW_SELECTED : HAW_NOTSELECTED);
            $arr = $fs->scandir(CAMILA_FM_ROOTDIR, true, false);
            sort($arr);
            foreach ($arr as $value) {
                $item = substr($value, strlen(CAMILA_FM_ROOTDIR) + 1);
                if ($item != camila_get_translation('camila.documents.recyclebin')) {
                    if ('/' . $item == $_REQUEST['camila_export_last_action']) {
                        $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents') . '/' . $item, '/' . $item, HAW_SELECTED);
                    } else {
                        $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents') . '/' . $item, '/' . $item);
                    }
                }
            }
        }
    } else {
        $node = $fs->_tree_get_group_root_node($_CAMILA['adm_user_group']);
        $attributes = array('name');
        $wlk = $fs->_tree_walk_preorder($node);
        while ($curr = $fs->_tree_walk_next($wlk)) {
            $level = $fs->_tree_walk_level($wlk);
            $spaces = str_repeat('--', $level - 1);
            $att = reset($attributes);
            while ($att) {
                if ($level == 0) {
                    $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents'), $wlk['row']['id']);
                } elseif ($wlk['row']['file'] == '') {
                    $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents') . '/' . $spaces . $wlk['row'][$att], $wlk['row']['id']);
                }
                $att = next($attributes);
            }
        }
    }
    return $mySelect;
}