Пример #1
0
 public function getTitle()
 {
     $titles = get_external_apis_titles();
     if (!isset($titles[$this->job_type])) {
         throw new GraphException("No such external API type '{$this->job_type}'");
     }
     return $titles[$this->job_type];
 }
Пример #2
0
/**
 * Return a list of (id => title).
 * Could be cached.
 */
function get_external_status_titles()
{
    $result = array();
    $q = db()->prepare("SELECT * FROM external_status_types");
    $q->execute();
    $titles = get_external_apis_titles();
    while ($type = $q->fetch()) {
        // we want the title, not the key; and only types that have titles
        if (isset($titles[$type['job_type']])) {
            $result[$type['id']] = $titles[$type['job_type']];
        }
    }
    return $result;
}
Пример #3
0
<?php

/**
 * This page displays external API historical data publically.
 */
require __DIR__ . "/../layout/graphs.php";
require __DIR__ . "/../layout/templates.php";
$messages = array();
$errors = array();
$type = require_get('type');
$titles = get_external_apis_titles();
if (!isset($titles[$type])) {
    set_temporary_errors(t("No such external API type ':type'.", array(':type' => htmlspecialchars($type))));
    redirect(url_for('external'));
}
$api_title = $titles[$type];
$graph = array('graph_type' => 'external_historical', 'width' => 8, 'height' => 4, 'page_order' => 0, 'days' => 45, 'delta' => '', 'id' => 0, 'arg0_resolved' => $type, 'public' => true, 'no_technicals' => true);
page_header(t("External API Status: :api_title", array(':api_title' => $api_title)), "page_external_historical", array('jsapi' => true));
?>
  <h1><?php 
echo ht("External API Status: :api_title", array(':api_title' => $api_title));
?>
</h1>

  <p class="backlink">
    <a href="<?php 
echo htmlspecialchars(url_for('external'));
?>
"><?php 
echo ht("< Back to External API Status");
?>