function render_select($arr, $selected = 0, $level = 0) { $html = ''; foreach ($arr as $opt) { // $html .= print_r($opt, 1); $iselected = $opt['id'] == $selected ? 'selected' : ''; $html .= '<option value="' . $opt['id'] . '" ' . $iselected . '>' . str_repeat('-', $level) . ' ' . $opt['name'] . '</option>'; if (isset($opt['children']) && count($opt['children'])) { $html .= render_select($opt['children'], $selected, $level + 1); } } return $html; }
<?php // Copyright (C) 2010-2011 Aron Racho <*****@*****.**> // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. ?> <p class="row"> <span class="left_col colhead req" data-fld="fld_sex"><?php echo xl('Sex'); ?> </span> <span class="end_col"> <?php echo render_select(array("target" => "fld_sex", "name" => "fld_sex", "value" => $criteria->value, "options" => $criteria->getOptions())); ?> </span> </p> <br/> <!-- optional/required and inclusion/exclusion fields --> <?php echo common_fields(array("criteria" => $criteria));
// Copyright (C) 2010-2011 Aron Racho <*****@*****.**> // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. ?> <p class="row"> <span class="left_col colhead req" data-fld="fld_lifestyle"><?php echo out($criteria->getTitle()); ?> </span> <span class="end_col"> <?php echo render_select(array("target" => "fld_lifestyle", "name" => "fld_lifestyle", "value" => $criteria->type, "options" => $criteria->getOptions())); ?> </span> </p> <br/> <p class="lifestyle"> <span class="left_col colhead req"><?php echo out(xl('Value')); ?> </span> <span class="end_col"> <input type="radio" name="fld_value_type" class="field" value="match" <?php echo !is_null($criteria->matchValue) ? "CHECKED" : "";
<span class="end_col"> <?php echo render_select(array("id" => "fld_table", "target" => "fld_table", "name" => "fld_table", "options" => $criteria->getTableNameOptions(), "value" => out($criteria->table))); ?> </span> </p> <!-- column --> <p class="row"> <span class="left_col colhead" data-field="fld_table"><?php echo out(xl('Column')); ?> </span> <span class="end_col"> <?php echo render_select(array("id" => "fld_column", "target" => "fld_column", "name" => "fld_column", "options" => array(), "value" => null)); ?> </span> </p> <!-- value --> <p class="row"> <span class="left_col colhead req" data-field="fld_value"><?php echo xl('Value'); ?> </span> <span class="end_col"> <select data-grp-tgt="" type="dropdown" name="fld_value_comparator" id=""> <option id="" value="">--<?php echo xl("Select"); ?>
} } ?> </div> <div class="right"><?php h($admin); ?> | <a href="#" onclick="showManuals(this);return false;"><?php hm("manuals"); ?> <span style="font-size:11px">▼</span></a> | <a href="<?php h(url("plugins.index")); ?> " target="right">Plugins</a> | <a href="<?php h($logoutUrl); ?> " target="_top"><?php hm("logout"); ?> </a> | <?php render_select("language", rock_load_languages(), __LANG__, array("style" => "width:100px", "onchange" => "window.top.location='index.php?action=admin.changeLang&lang='+this.value")); ?> | <a href="<?php h(url("admin.about")); ?> " target="right">RockMongo v<?php h(ROCK_MONGO_VERSION); ?> </a></div> <div class="clear"></div> </div>
/** * Render server hosts * * @param string $name tag name * @param string|null $selected selected host index * @since 1.1.0 */ function render_select_hosts($name = "host", $selected = null) { global $MONGO; $hosts = array(); foreach ($MONGO["servers"] as $config) { $server = new MServer($config); $hosts[] = $server->mongoName(); } render_select($name, $hosts, $selected, array("class" => "select_hosts")); }