Пример #1
0
function render_item($dbc, $row, $db_name)
{
    $id = $row[id];
    $name = $row[name];
    $def = $row[def];
    echo '<p class="lead">' . get_entity_link($id, $name, $db_name) . '</p>';
    if ($def != '') {
        echo $def;
    } else {
        echo get_summary($dbc, $db_name, PREFIX . $id);
    }
    echo '<br>';
    /*
     echo '<a class="btn btn-link" href="#" role="button">功效&nbsp; &raquo;</a>';
     echo '&nbsp;';
     echo '<a class="btn btn-link" href="#" role="button">化学成分&nbsp; &raquo;</a>';
     echo '&nbsp;';
     echo '<a class="btn btn-link" href="#" role="button">药理作用&nbsp; &raquo;</a>';
     echo '&nbsp;';
     echo '<a class="btn btn-link" href="#" role="button">化学实验&nbsp; &raquo;</a>';
     echo '&nbsp;';
     echo '<a class="btn btn-link" href="#" role="button">来源处方&nbsp; &raquo;</a>';
    */
    echo "<hr>";
}
Пример #2
0
function render_value($dbc, $db_name, $db_label, $name, $with_def = true)
{
    if (strpos($name, $db_name . ':o') === 0) {
        $id = str_replace($db_name . ':o', "", $name);
        $query = "select * from def where id ='{$id}'";
        $result = mysqli_query($dbc, $query) or die('Error querying database:' . $query);
        if ($row = mysqli_fetch_array($result)) {
            $name = $row[name];
            $def = $row[def];
            $result = get_entity_link($id, $name);
            if ($with_def) {
                if ($def == '') {
                    $def = get_summary($dbc, $db_name, $db_label, $db_name . ':o' . $id);
                }
                if ($def != '') {
                    $result .= '&nbsp;<em><small>(' . $def . ')' . '</small></em>';
                }
            }
        } else {
            $result = $name;
        }
    } else {
        $result = $name;
    }
    if ($with_def) {
        $result .= '&nbsp;(来源:<a href="db_profile.php?db_name=' . $db_name . '">' . $db_label . '</a>)';
    }
    return $result;
}
Пример #3
0
function show_summary()
{
    global $html_output, $html_file;
    if ($html_output) {
        fwrite($html_file, "<hr/>\n" . get_summary(true, true));
    }
    echo get_summary(true, false);
}
Пример #4
0
    /**
     * Muestra Toolbox: Ranking actual de los cursos del usuario y link
     * a las páginas de detalles.
     *
     * @return string HTML a mostrar
     */
    function toolbox()
    {
        //REVISAR obtenemos la funcion de contenido de toolbox
        global $USER, $CFG, $DB, $PAGE, $COURSE;
        if ($CFG->block_uai_local_modules && !in_array('toolbox', explode(',', $CFG->block_uai_local_modules))) {
            return false;
        }
        $categoryid = 0;
        if ($COURSE && $COURSE->id > 1) {
            $categoryid = $COURSE->category;
        } elseif ($PAGE->context instanceof context_coursecat) {
            $categoryid = intval($PAGE->context->__get('instanceid'));
        }
        if (!$categoryid) {
            return false;
        }
        $modulestatsnode = navigation_node::create(get_string('modulestats', 'local_uai'), new moodle_url("/local/uai/modulestats.php", array('id' => $categoryid)), navigation_node::TYPE_CUSTOM, null, null, new pix_icon('i/report', get_string('modulestats', 'local_uai')));
        //url para ver sedes
        $rootnode = navigation_node::create(get_string('pluginname', 'local_uai'));
        $rootnode->add_node($modulestatsnode);
        return $rootnode;
        require_once $CFG->dirroot . '/local/toolbox/lib.php';
        require_once $CFG->dirroot . '/course/lib.php';
        require_once $CFG->dirroot . '/lib/accesslib.php';
        require_once $CFG->dirroot . '/lib/moodlelib.php';
        require_once $CFG->dirroot . '/lib/weblib.php';
        $html = '';
        //Link to the page of ToolBox (view.php)
        $toolbox = $CFG->wwwroot . '/local/toolbox/view.php';
        $summary = get_summary();
        $valor = $summary['nivel'];
        $textscore = get_score_text($valor);
        $imagescore = get_img_source($valor);
        $context = context_course::instance($COURSE->id);
        //obtenemos el contexto del curso
        //revisamos la capacidad que tiene el usuario
        if (has_capability('local/toolbox:viewtoolboxstudent', $context)) {
            //alumno
            $html .= '<div><b><a href="' . $toolbox . '?view=miscursos">' . get_string('minivel', 'local_toolbox') . $textscore . ' (' . $summary["nivel"] . ')</a></b></div>
					<div><img src="' . $imagescore . '"></div>
							<hr>
							<div><a href="' . $toolbox . '?view=acerca">' . get_string('acerca', 'local_toolbox') . '</a></div>';
        } elseif (has_capability('local/toolbox:viewtoolboxteacher', $context)) {
            //profesor
            $ranking = get_ranking();
            $userid = $USER->id;
            $rank = null;
            if (isset($ranking[$userid])) {
                $rank = $ranking[$userid]->rank;
            }
            if ($rank) {
                // si tiene ranking, desplegamos su posicion en el ranking
                $totalProfesores = count($ranking);
                $html .= '<div><b>' . get_string('minivel', 'local_toolbox') . $textscore . ' (' . $summary["nivel"] . ')</b></div>
						<div><img src="' . $imagescore . '"></div>
								<div><b>' . get_string('miranking', 'local_toolbox') . $rank . get_string('mirankingde', 'local_toolbox') . $totalProfesores . '</b></div>
										<hr>
										<div><a href="' . $toolbox . '?view=miscursos">' . get_string('miscursos', 'local_toolbox') . '</a></div>
												<div><a href="' . $toolbox . '?view=acerca">' . get_string('acerca', 'local_toolbox') . '</a></div>';
            } else {
                //si no tiene ranking, se le muestra "Sin ranking"
                $totalProfesores = count($ranking);
                $html .= '<div><b>' . get_string('minivel', 'local_toolbox') . $textscore . ' (' . $summary["nivel"] . ')</b></div>
						<div><img src="' . $imagescore . '"></div>
								<div><b>' . get_string('miranking', 'local_toolbox') . get_string('sinranking', 'local_toolbox') . '</b></div>
										<hr>
										<div><a href="' . $toolbox . '?view=miscursos">' . get_string('miscursos', 'local_toolbox') . '</a></div>
												<div><a href="' . $toolbox . '?view=acerca">' . get_string('acerca', 'local_toolbox') . '</a></div>';
            }
        } elseif (has_capability('local/toolbox:viewtoolboxmanager', $context)) {
            //decano y rector y manager
            $ranking = get_ranking();
            $userid = $USER->id;
            $rank = $ranking[$userid]->rank;
            $totalProfesores = count($ranking);
            $html .= '<div><b>' . get_string('minivel', 'local_toolbox') . $textscore . ' (' . $summary["nivel"] . ')</b></div>
					<div><img src="' . $imagescore . '"></div>
							<div><b>' . get_string('miranking', 'local_toolbox') . $rank . get_string('mirankingde', 'local_toolbox') . $totalProfesores . '</b></div>
									<hr>
									<div><a href="' . $toolbox . '?view=miscursos">' . get_string('miscursos', 'local_toolbox') . '</a></div>
											<div><a href="' . $toolbox . '?view=ranking&rank=' . $summary["uai"] . '">' . get_string('ranking', 'local_toolbox') . '</a></div>
													<div><a href="' . $toolbox . '?view=acerca">' . get_string('acerca', 'local_toolbox') . '</a></div>';
        } elseif (has_capability('local/toolbox:viewtoolboxuser', $context)) {
            /////otro usuario
            $html = "";
        } else {
            $html = "";
        }
        $html = '

				<li class="type_course depth_2 collapsed contains_branch">
				<p class="tree_item branch">
				<span tabindex="0">' . get_string('toolbox', 'block_uai') . '</span>
						</p>
						<ul>
						<li class="type_custom depth_3 item_with_icon">
						' . $html . '
								</li>
								</ul>
								</li>
								';
        return $html;
    }
Пример #5
0
$start_time = time();
echo "TIME START " . date('Y-m-d H:i:s', $start_time) . "\n=====================================================================\n";
$test_cnt = count($test_files);
$test_idx = 0;
foreach ($test_files as $name) {
    $test_results[$name] = run_test($php, $name, $test_cnt, ++$test_idx);
}
$end_time = time();
// Summarize results
if (0 == count($test_results)) {
    echo "No tests were run.\n";
    return;
}
compute_summary();
echo "\n=====================================================================\nTIME END " . date('Y-m-d H:i:s', $end_time);
$summary = get_summary(true);
echo $summary;
define('PHP_QA_EMAIL', '*****@*****.**');
define('QA_SUBMISSION_PAGE', 'http://qa.php.net/buildtest-process.php');
/* We got failed Tests, offer the user to send an e-mail to QA team, unless NO_INTERACTION is set */
if (!getenv('NO_INTERACTION')) {
    $fp = fopen("php://stdin", "r+");
    echo "\nYou may have found a problem in PHP.\nWe would like to send this report automatically to the\n";
    echo "PHP QA team, to give us a better understanding of how\nthe test cases are doing. If you don't want to send it\n";
    echo "immediately, you can choose \"s\" to save the report to\na file that you can send us later.\n";
    echo "Do you want to send this report now? [Yns]: ";
    flush();
    $user_input = fgets($fp, 10);
    $just_save_results = strtolower($user_input[0]) == 's';
    if ($just_save_results || strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') {
        /*  
Пример #6
0
 /**
  * Obtiene un Listbox con un Título en donde el m�todo onChange consiste en redirigir a la pagina
  * actual con parametros adicionales.
  * @param array $datos arreglo con el valor y el texto de las opciones del listbox e.g.
  * array('valor1' => 'texto1', 'valor2' => 'texto2', etc.).
  * @param string $view texto que representa el contexto donde se requiere el listbox.
  * @param string $text texto que representa el nombre del listbox y adem�s se usa para generar
  * el t�tulo 'Filtro $text'.
  * @param int $selectedId valor de la opci�n del listbox que aparecer� seleccionada .
  * @param int $idExtra valor de alg�n parametro adicional para el evento onChange del listbox.
  * @param string|bool $nothing
  * @return string Fragmento HTML
  */
 public function show_barra_toolbox($datos, $view, $text, $selectedId = '', $idExtra = '', $nothing = true)
 {
     global $CFG;
     $output = html_writer::start_tag('div', array('class' => 'barraToolBox'));
     $output .= html_writer::empty_tag('br');
     if ($selectedId == 0) {
         $selectedId = '';
     }
     if ($idExtra == 0) {
         $idExtra = '';
     }
     if ($view == 'ranking') {
         $ruta = $CFG->wwwroot . '/localtoolbox/view.php?view=' . $view . '&idFacultad=';
     } else {
         if ($text == 'Profesor') {
             $ruta = $CFG->wwwroot . '/local/toolbox/view.php?view=profesores&idFacultad=' . $idExtra . '&idProfesor=';
         } else {
             $ruta = $CFG->wwwroot . '/local/toolbox/view.php?view=profesores&idProfesor=' . $idExtra . '&idFacultad=';
         }
     }
     $output .= html_writer::start_tag('table');
     $output .= html_writer::empty_tag('td');
     $output .= html_writer::select($datos, $text, $selectedId, $nothing, array('onchange' => 'window.location="' . $ruta . '"+this.options[this.selectedIndex].value'));
     $output .= html_writer::empty_tag('td');
     $ranking = get_summary();
     if ($selectedId == '' && !empty($ranking['uai'])) {
         $output .= html_writer::label('' . get_string('miranking', 'local_toolbox') . '', null, 'FALSE', array('style' => 'font-weight:bold;'));
         $output .= html_writer::label($ranking['uai'], null, 'FALSE', array('style' => 'font-weight:bold;'));
     } elseif (!empty($ranking['facultad']) && $selectedId == $ranking['idfacultad']) {
         $output .= html_writer::label('' . get_string('miranking', 'local_toolbox') . '', null, 'FALSE', array('style' => 'font-weight:bold;'));
         $output .= html_writer::label($ranking['facultad'], null, 'FALSE', array('style' => 'font-weight:bold;'));
     }
     $output .= html_writer::end_tag('table');
     $output .= html_writer::end_tag('div');
     return $output;
 }
Пример #7
0
    $cond = "luid IN ({$uid})";
} else {
    $cond = "1";
}
$res = $xoopsDB->query("SELECT min(mtime),max(mtime),1 FROM " . TLOG . " WHERE {$cond} GROUP BY 3");
list($stime, $ltime) = $xoopsDB->fetchRow($res);
$legends = array();
$legends[_MD_SUM_TOTAL] = legend_range($stime, $ltime);
$smonth = mktime($hour, $min, 0, $month, $bmon, $year);
$lmonth = mktime($hour, $min, 0, $month + 1, $bmon, $year);
get_summary($sums, $uid, $smonth, $lmonth);
$labs[] = $lab = formatTimestamp($smonth, _MD_SUM_MONTH);
$legends[$lab] = legend_range($smonth, $lmonth);
$sday = mktime($hour, $min, 0, $month, $day, $year);
$lday = mktime($hour, $min, 0, $month, $day + 1, $year);
get_summary($sums, $uid, $sday, $lday);
$labs[] = $lab = formatTimestamp($sday, _MD_SUM_DAY);
$legends[$lab] = legend_range($sday, $lday);
$labs = array_reverse($labs, true);
$xoopsTpl->assign('sums', $sums);
$xoopsTpl->assign('labels', $labs);
$xoopsTpl->assign('legends', $legends);
$xoopsTpl->assign(array('years' => $years, 'months' => $months, 'days' => $days, 'year' => $year, 'month' => $month, 'day' => $day, 'timestamp' => formatTimestamp(time(), "m")));
include XOOPS_ROOT_PATH . '/footer.php';
function get_summary(&$ret, $uid, $start = 0, $last = 0)
{
    global $xoopsDB, $myts, $xoopsConfig, $xoopsModule, $xoopsModuleConfig;
    if (preg_match('/^\\d+(,\\d+)+$/', $uid)) {
        // show multiple user log
        $cond = "luid IN ({$uid})";
        $disp = true;
Пример #8
0
echo '</form>';
if ($query != "*") {
    #Query has been provided
    #if ($review == "off") { $query = $query . " AND (NOT review)"; }
    if ($date_restrict == "on") {
        $query = $query . ' AND ("' . $date_from . '"[Date - Entrez] : "' . $date_to . '"[Date - Entrez]) ';
    }
    echo "Query: " . $query;
    echo "<br />";
    $query = urlencode($query);
    echo "Query: " . $query;
    echo "<hr />";
    list($PMID, $count) = get_PMIDs($query);
    echo $count . "<br>";
    if (1 == 1) {
        list($authors, $title, $abstract, $date_pubmed, $date_rec, $date_acc, $journal, $affil) = get_summary($PMID[3]);
        echo "<strong>authors</strong>:";
        print_r($authors);
        echo "<br />";
        echo "<strong>title</strong>:" . $title . "<br>";
        echo "<strong>abstract</strong>:" . $abstract . "<br>";
        echo "<strong>date (pubmed):</strong>";
        print_r($date_pubmed);
        echo "<br />";
        echo "<strong>date (received):</strong>";
        print_r($date_rec);
        echo "<br />";
        echo "<strong>date (accepted):</strong>";
        print_r($date_acc);
        echo "<br />";
        echo "<strong>journal:</strong>" . $journal . "<br />";
Пример #9
0
function htmlize_ip_dir($server_cfg)
{
    $prof_path = get_path($server_cfg);
    echo "<html><head><title>{$prof_path}</title></head>\n";
    echo "<body>\n<table border=1>\n";
    $profiles = glob($prof_path . "*:xhprof");
    echo "<tr><td>Profile</td><td>Wall Time</td><td>CPU Time</td><td>Mem Util</td><td>Peak Mem</td></tr>\n";
    foreach ($profiles as $prof) {
        $prof_parts = explode(":", basename($prof));
        $page = $prof_parts[3];
        $tod = date("Y/m/d G:i:s", $prof_parts[1]);
        echo "<tr><td><a href=\"" . get_prof_link($prof, $server_cfg) . "\">{$tod}, {$page}</a></td>";
        $smry = get_summary($prof);
        foreach (array("wt", "cpu", "pmu", "mu") as $metric) {
            ${$metric} = $smry[$metric];
            echo "<td align=\"right\">{$smry[$metric]}</td>";
        }
        echo "</tr>\n";
    }
    echo "</table>\n</body>\n";
    echo "</html>";
}
Пример #10
0
foreach (array('day', 'month', 'year') as $key) {
    if (isset($_GET[$key])) {
        $page[$key] = (int) $_GET[$key];
    }
}
if (isset($page['day'])) {
    if (!isset($page['month'])) {
        die('month is missing in URL');
    }
}
if (isset($page['month'])) {
    if (!isset($page['year'])) {
        die('year is missing in URL');
    }
}
$summary_lines = get_summary(@$page['year'], @$page['month'], @$page['day']);
// +-----------------------------------------------------------------------+
// | Display statistics header                                             |
// +-----------------------------------------------------------------------+
// page title creation
$title_parts = array();
$url = PHPWG_ROOT_PATH . 'admin.php?page=stats';
$title_parts[] = '<a href="' . $url . '">' . l10n('Overall') . '</a>';
$period_label = l10n('Year');
if (isset($page['year'])) {
    $url .= '&amp;year=' . $page['year'];
    $title_parts[] = '<a href="' . $url . '">' . $page['year'] . '</a>';
    $period_label = l10n('Month');
}
if (isset($page['month'])) {
    $url .= '&amp;month=' . $page['month'];
Пример #11
0
function htmlize_ip_dir($server_cfg)
{
    list($prof_path, $game, $ts) = get_path($server_cfg);
    echo "<html><head><title>{$prof_path}</title></head>\n";
    echo "<body>\n";
    echo get_day_list($server_cfg, $game, $ts);
    echo "<table border=1>\n";
    $profiles = glob($prof_path . "/*.xhprof");
    echo "<tr><td>Profile</td><td></td><td>Wall Time</td><td>CPU Time</td><td>Mem Util</td><td>Peak Mem</td></tr>\n";
    foreach ($profiles as $prof) {
        $prof_parts = explode(".", basename($prof));
        unset($prof_parts[-1]);
        $tod = date("Y/m/d G:i:s", $prof_parts[0] * 1800);
        unset($prof_parts[0]);
        $page = implode(".", $prof_parts);
        echo "<tr><td><a href=\"" . get_prof_link($prof, $server_cfg) . "\">{$tod}, {$page}</a></td>";
        echo "<td><a href=\"" . get_raw_link($prof, $server_cfg) . "\">raw</a></td>";
        $smry = get_summary($prof);
        foreach (array("wt", "cpu", "pmu", "mu") as $metric) {
            $v = ${$metric} = (int) $smry[$metric];
            echo "<td align=\"right\">{$v}</td>";
        }
        echo "</tr>\n";
    }
    echo "</table>\n</body>\n";
    echo "</html>";
}