当前位置: 首页>>代码示例>>PHP>>正文


PHP Banner::GetText方法代码示例

本文整理汇总了PHP中Banner::GetText方法的典型用法代码示例。如果您正苦于以下问题:PHP Banner::GetText方法的具体用法?PHP Banner::GetText怎么用?PHP Banner::GetText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Banner的用法示例。


在下文中一共展示了Banner::GetText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testBanner

 public function testBanner()
 {
     $this->startCodeCoverage();
     $banner = new Banner();
     ob_start();
     $result = $banner->SetText('banner');
     $output = ob_get_contents();
     ob_end_clean();
     if ($result) {
         $this->fail('SetText() should return false when ProjectId is -1');
         return 1;
     }
     if (strpos($output, 'Banner::SetText(): no ProjectId specified') === false) {
         $this->fail("'no ProjectId specified' not found from SetText()");
         return 1;
     }
     //set a reasonable project id
     $banner->SetProjectId(1);
     //test insert
     $banner->SetText('banner');
     //test update
     $banner->SetText('banner');
     if ($banner->GetText() != 'banner') {
         $this->fail("GetText() should have returned 'banner'.");
         return 1;
     }
     $this->pass('Passed');
     $this->stopCodeCoverage();
     return 0;
 }
开发者ID:kitware,项目名称:cdash,代码行数:30,代码来源:test_banner.php

示例2: echo_main_dashboard_JSON

function echo_main_dashboard_JSON($project_instance, $date)
{
    $start = microtime_float();
    $noforcelogin = 1;
    include_once dirname(dirname(dirname(__DIR__))) . '/config/config.php';
    require_once 'include/pdo.php';
    include 'public/login.php';
    include_once 'models/banner.php';
    include_once 'models/build.php';
    include_once 'models/subproject.php';
    $response = array();
    $db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
    if (!$db) {
        $response['error'] = 'Error connecting to CDash database server';
        echo json_encode($response);
        return;
    }
    if (!pdo_select_db("{$CDASH_DB_NAME}", $db)) {
        $response['error'] = 'Error selecting CDash database';
        echo json_encode($response);
        return;
    }
    $projectid = $project_instance->Id;
    $project = pdo_query("SELECT * FROM project WHERE id='{$projectid}'");
    if (pdo_num_rows($project) > 0) {
        $project_array = pdo_fetch_array($project);
        $projectname = $project_array['name'];
        if (isset($project_array['testingdataurl']) && $project_array['testingdataurl'] != '') {
            $testingdataurl = make_cdash_url(htmlentities($project_array['testingdataurl']));
        }
    } else {
        $response['error'] = "This project doesn't exist. Maybe the URL you are trying to access is wrong.";
        echo json_encode($response);
        return;
    }
    if (!checkUserPolicy(@$_SESSION['cdash']['loginid'], $project_array['id'], 1)) {
        $response['requirelogin'] = 1;
        echo json_encode($response);
        return;
    }
    $response = begin_JSON_response();
    $response['title'] = "CDash - {$projectname}";
    $response['feed'] = $CDASH_ENABLE_FEED;
    $response['showcalendar'] = 1;
    $Banner = new Banner();
    $Banner->SetProjectId(0);
    $text = $Banner->GetText();
    $banners = array();
    if ($text !== false) {
        $banners[] = $text;
    }
    $Banner->SetProjectId($projectid);
    $text = $Banner->GetText();
    if ($text !== false) {
        $banners[] = $text;
    }
    $response['banners'] = $banners;
    $site_response = array();
    // If parentid is set we need to lookup the date for this build
    // because it is not specified as a query string parameter.
    if (isset($_GET['parentid'])) {
        $parentid = pdo_real_escape_numeric($_GET['parentid']);
        $parent_build = new Build();
        $parent_build->Id = $parentid;
        $date = $parent_build->GetDate();
        $response['parentid'] = $parentid;
    } else {
        $response['parentid'] = -1;
    }
    list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $project_array['nightlytime']);
    // Main dashboard section
    get_dashboard_JSON($projectname, $date, $response);
    $response['displaylabels'] = $project_array['displaylabels'];
    $page_id = 'index.php';
    $response['childview'] = 0;
    if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/models/proProject.php')) {
        include_once 'local/models/proProject.php';
        $pro = new proProject();
        $pro->ProjectId = $projectid;
        $response['proedition'] = $pro->GetEdition(1);
    }
    if ($currentstarttime > time() && !isset($_GET['parentid'])) {
        $response['error'] = 'CDash cannot predict the future (yet)';
        echo json_encode($response);
        return;
    }
    // Menu definition
    $response['menu'] = array();
    $beginning_timestamp = $currentstarttime;
    $end_timestamp = $currentstarttime + 3600 * 24;
    $beginning_UTCDate = gmdate(FMT_DATETIME, $beginning_timestamp);
    $end_UTCDate = gmdate(FMT_DATETIME, $end_timestamp);
    if ($project_instance->GetNumberOfSubProjects($end_UTCDate) > 0) {
        $response['menu']['subprojects'] = 1;
    }
    if (isset($_GET['parentid'])) {
        $page_id = 'indexchildren.php';
        $response['childview'] = 1;
        // When a parentid is specified, we should link to the next build,
        // not the next day.
//.........这里部分代码省略.........
开发者ID:kitware,项目名称:cdash,代码行数:101,代码来源:index.php

示例3: generate_subprojects_dashboard_XML

/** Generate the subprojects dashboard */
function generate_subprojects_dashboard_XML($project_instance, $date)
{
    $start = microtime_float();
    $noforcelogin = 1;
    include_once "cdash/config.php";
    require_once "cdash/pdo.php";
    include 'login.php';
    include_once "models/banner.php";
    include_once "models/subproject.php";
    $db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
    if (!$db) {
        echo "Error connecting to CDash database server<br>\n";
        return;
    }
    if (!pdo_select_db("{$CDASH_DB_NAME}", $db)) {
        echo "Error selecting CDash database<br>\n";
        return;
    }
    $Project = $project_instance;
    $projectid = $project_instance->Id;
    $homeurl = make_cdash_url(htmlentities($Project->HomeUrl));
    checkUserPolicy(@$_SESSION['cdash']['loginid'], $projectid);
    $xml = begin_XML_for_XSLT();
    $xml .= "<title>CDash - " . $Project->Name . "</title>";
    $Banner = new Banner();
    $Banner->SetProjectId(0);
    $text = $Banner->GetText();
    if ($text !== false) {
        $xml .= "<banner>";
        $xml .= add_XML_value("text", $text);
        $xml .= "</banner>";
    }
    $Banner->SetProjectId($projectid);
    $text = $Banner->GetText();
    if ($text !== false) {
        $xml .= "<banner>";
        $xml .= add_XML_value("text", $text);
        $xml .= "</banner>";
    }
    global $CDASH_SHOW_LAST_SUBMISSION;
    if ($CDASH_SHOW_LAST_SUBMISSION) {
        $xml .= "<showlastsubmission>1</showlastsubmission>";
    }
    list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $Project->NightlyTime);
    $svnurl = make_cdash_url(htmlentities($Project->CvsUrl));
    $homeurl = make_cdash_url(htmlentities($Project->HomeUrl));
    $bugurl = make_cdash_url(htmlentities($Project->BugTrackerUrl));
    $googletracker = htmlentities($Project->GoogleTracker);
    $docurl = make_cdash_url(htmlentities($Project->DocumentationUrl));
    // Main dashboard section
    $xml .= "<dashboard>\n  <datetime>" . date("l, F d Y H:i:s T", time()) . "</datetime>\n  <date>" . $date . "</date>\n  <unixtimestamp>" . $currentstarttime . "</unixtimestamp>\n  <svn>" . $svnurl . "</svn>\n  <bugtracker>" . $bugurl . "</bugtracker>\n  <googletracker>" . $googletracker . "</googletracker>\n  <documentation>" . $docurl . "</documentation>\n  <logoid>" . $Project->getLogoID() . "</logoid>\n  <projectid>" . $projectid . "</projectid>\n  <projectname>" . $Project->Name . "</projectname>\n  <projectname_encoded>" . urlencode($Project->Name) . "</projectname_encoded>\n  <previousdate>" . $previousdate . "</previousdate>\n  <projectpublic>" . $Project->Public . "</projectpublic>\n  <nextdate>" . $nextdate . "</nextdate>";
    if (empty($Project->HomeUrl)) {
        $xml .= "<home>index.php?project=" . urlencode($Project->Name) . "</home>";
    } else {
        $xml .= "<home>" . $homeurl . "</home>";
    }
    if ($CDASH_USE_LOCAL_DIRECTORY && file_exists("local/models/proProject.php")) {
        include_once "local/models/proProject.php";
        $pro = new proProject();
        $pro->ProjectId = $projectid;
        $xml .= "<proedition>" . $pro->GetEdition(1) . "</proedition>";
    }
    if ($currentstarttime > time()) {
        $xml .= "<future>1</future>";
    } else {
        $xml .= "<future>0</future>";
    }
    $xml .= "</dashboard>";
    // Menu definition
    $xml .= "<menu>";
    if (!has_next_date($date, $currentstarttime)) {
        $xml .= add_XML_value("nonext", "1");
    }
    $xml .= "</menu>";
    $beginning_timestamp = $currentstarttime;
    $end_timestamp = $currentstarttime + 3600 * 24;
    $beginning_UTCDate = gmdate(FMT_DATETIME, $beginning_timestamp);
    $end_UTCDate = gmdate(FMT_DATETIME, $end_timestamp);
    // User
    if (isset($_SESSION['cdash'])) {
        $xml .= "<user>";
        $userid = $_SESSION['cdash']['loginid'];
        $user2project = pdo_query("SELECT role FROM user2project WHERE userid='{$userid}' and projectid='{$projectid}'");
        $user2project_array = pdo_fetch_array($user2project);
        $user = pdo_query("SELECT admin FROM " . qid("user") . "  WHERE id='{$userid}'");
        $user_array = pdo_fetch_array($user);
        $xml .= add_XML_value("id", $userid);
        $isadmin = 0;
        if ($user2project_array["role"] > 1 || $user_array["admin"]) {
            $isadmin = 1;
        }
        $xml .= add_XML_value("admin", $isadmin);
        $xml .= add_XML_value("projectrole", $user2project_array['role']);
        $xml .= "</user>";
    }
    // Get some information about the project
    $xml .= "<project>";
    $xml .= add_XML_value("nbuilderror", $Project->GetNumberOfErrorBuilds($beginning_UTCDate, $end_UTCDate, true));
    $xml .= add_XML_value("nbuildwarning", $Project->GetNumberOfWarningBuilds($beginning_UTCDate, $end_UTCDate, true));
//.........这里部分代码省略.........
开发者ID:josephsnyder,项目名称:CDash,代码行数:101,代码来源:index.php

示例4: echo_subprojects_dashboard_JSON

function echo_subprojects_dashboard_JSON($project_instance, $date)
{
    $start = microtime_float();
    $noforcelogin = 1;
    include_once dirname(dirname(dirname(__DIR__))) . '/config/config.php';
    require_once 'include/pdo.php';
    include 'public/login.php';
    include_once 'models/banner.php';
    include_once 'models/subproject.php';
    $response = array();
    $db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
    if (!$db) {
        $response['error'] = 'Error connecting to CDash database server';
        echo json_encode($response);
        return;
    }
    if (!pdo_select_db("{$CDASH_DB_NAME}", $db)) {
        $response['error'] = 'Error selecting CDash database';
        echo json_encode($response);
        return;
    }
    $Project = $project_instance;
    $projectid = $project_instance->Id;
    if (!checkUserPolicy(@$_SESSION['cdash']['loginid'], $projectid, 1)) {
        $response['requirelogin'] = 1;
        echo json_encode($response);
        return;
    }
    $response = begin_JSON_response();
    $response['title'] = 'CDash - ' . $Project->Name;
    $response['showcalendar'] = 1;
    $banners = array();
    $Banner = new Banner();
    $Banner->SetProjectId(0);
    $text = $Banner->GetText();
    if ($text !== false) {
        $banners[] = $text;
    }
    $Banner->SetProjectId($projectid);
    $text = $Banner->GetText();
    if ($text !== false) {
        $banners[] = $text;
    }
    $response['banners'] = $banners;
    global $CDASH_SHOW_LAST_SUBMISSION;
    if ($CDASH_SHOW_LAST_SUBMISSION) {
        $response['showlastsubmission'] = 1;
    }
    list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $Project->NightlyTime);
    // Main dashboard section
    get_dashboard_JSON($Project->GetName(), $date, $response);
    $projectname_encoded = urlencode($Project->Name);
    if ($currentstarttime > time()) {
        $response['error'] = 'CDash cannot predict the future (yet)';
        echo json_encode($response);
        return;
    }
    $linkparams = 'project=' . urlencode($Project->Name);
    if (!empty($date)) {
        $linkparams .= "&date={$date}";
    }
    $response['linkparams'] = $linkparams;
    // Menu definition
    $menu_response = array();
    $menu_response['subprojects'] = 1;
    $menu_response['previous'] = "viewSubProjects.php?project={$projectname_encoded}&date={$previousdate}";
    $menu_response['current'] = "viewSubProjects.php?project={$projectname_encoded}";
    if (!has_next_date($date, $currentstarttime)) {
        $menu_response['nonext'] = 1;
    } else {
        $menu_response['next'] = "viewSubProjects.php?project={$projectname_encoded}&date={$nextdate}";
    }
    $response['menu'] = $menu_response;
    $beginning_timestamp = $currentstarttime;
    $end_timestamp = $currentstarttime + 3600 * 24;
    $beginning_UTCDate = gmdate(FMT_DATETIME, $beginning_timestamp);
    $end_UTCDate = gmdate(FMT_DATETIME, $end_timestamp);
    // Get some information about the project
    $project_response = array();
    $project_response['nbuilderror'] = $Project->GetNumberOfErrorBuilds($beginning_UTCDate, $end_UTCDate, true);
    $project_response['nbuildwarning'] = $Project->GetNumberOfWarningBuilds($beginning_UTCDate, $end_UTCDate, true);
    $project_response['nbuildpass'] = $Project->GetNumberOfPassingBuilds($beginning_UTCDate, $end_UTCDate, true);
    $project_response['nconfigureerror'] = $Project->GetNumberOfErrorConfigures($beginning_UTCDate, $end_UTCDate, true);
    $project_response['nconfigurewarning'] = $Project->GetNumberOfWarningConfigures($beginning_UTCDate, $end_UTCDate, true);
    $project_response['nconfigurepass'] = $Project->GetNumberOfPassingConfigures($beginning_UTCDate, $end_UTCDate, true);
    $project_response['ntestpass'] = $Project->GetNumberOfPassingTests($beginning_UTCDate, $end_UTCDate, true);
    $project_response['ntestfail'] = $Project->GetNumberOfFailingTests($beginning_UTCDate, $end_UTCDate, true);
    $project_response['ntestnotrun'] = $Project->GetNumberOfNotRunTests($beginning_UTCDate, $end_UTCDate, true);
    if (strlen($Project->GetLastSubmission()) == 0) {
        $project_response['lastsubmission'] = 'NA';
    } else {
        $project_response['lastsubmission'] = $Project->GetLastSubmission();
    }
    $response['project'] = $project_response;
    // Look for the subproject
    $row = 0;
    $subprojectids = $Project->GetSubProjects();
    $subprojProp = array();
    foreach ($subprojectids as $subprojectid) {
        $SubProject = new SubProject();
//.........这里部分代码省略.........
开发者ID:kitware,项目名称:cdash,代码行数:101,代码来源:viewSubProjects.php

示例5: Banner

        $xml .= add_XML_value('id', $project_array['id']);
        $xml .= add_XML_value('name', $project_array['name']);
        if ($project_array['id'] == $projectid) {
            $xml .= add_XML_value('selected', '1');
        }
        $xml .= '</availableproject>';
    }
    $Banner = new Banner();
    $Banner->SetProjectId($projectid);
    // If submit has been pressed
    @($updateMessage = $_POST['updateMessage']);
    if (isset($updateMessage)) {
        $Banner->SetText(htmlspecialchars(pdo_real_escape_string($_POST['message'])));
    }
    /* We start generating the XML here */
    // List the available project
    if ($projectid >= 0) {
        $xml .= '<project>';
        $xml .= add_XML_value('id', $Project->Id);
        $xml .= add_XML_value('text', $Banner->GetText());
        if ($projectid > 0) {
            $xml .= add_XML_value('name', $Project->GetName());
            $xml .= add_XML_value('name_encoded', urlencode($Project->GetName()));
        }
        $xml .= add_XML_value('id', $Project->Id);
        $xml .= '</project>';
    }
    $xml .= '</cdash>';
    // Now doing the xslt transition
    generate_XSLT($xml, 'manageBanner');
}
开发者ID:kitware,项目名称:cdash,代码行数:31,代码来源:manageBanner.php

示例6: Banner

        }
        $xml .= "</availableproject>";
    }
    $Banner = new Banner();
    $Banner->SetProjectId($projectid);
    // If submit has been pressed
    @($updateMessage = $_POST["updateMessage"]);
    if (isset($updateMessage)) {
        $Banner->SetText(htmlspecialchars(pdo_real_escape_string($_POST["message"])));
    }
    /** We start generating the XML here */
    // List the available project
    if ($projectid >= 0) {
        $xml .= "<project>";
        $xml .= add_XML_value("id", $Project->Id);
        $xml .= add_XML_value("text", $Banner->GetText());
        if ($projectid > 0) {
            $xml .= add_XML_value("name", $Project->GetName());
            $xml .= add_XML_value("name_encoded", urlencode($Project->GetName()));
        }
        $xml .= add_XML_value("id", $Project->Id);
        $xml .= "</project>";
    }
    $xml .= "</cdash>";
    // Now doing the xslt transition
    generate_XSLT($xml, "manageBanner");
}
// end session OK
?>

开发者ID:rpshaw,项目名称:CDash,代码行数:29,代码来源:manageBanner.php

示例7: dirname

  See LICENSE or http://www.cdash.org/licensing/ for details.

  This software is distributed WITHOUT ANY WARRANTY; without even
  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  PURPOSE. See the above copyright notices for more information.
=========================================================================*/
$noforcelogin = 1;
include dirname(dirname(dirname(__DIR__))) . '/config/config.php';
require_once 'include/pdo.php';
include 'public/login.php';
include_once 'models/banner.php';
$start = microtime_float();
$response = begin_JSON_response();
$Banner = new Banner();
$Banner->SetProjectId(0);
$text = $Banner->GetText();
if ($text !== false) {
    $response['banner'] = $text;
}
$response['hostname'] = $_SERVER['SERVER_NAME'];
$response['date'] = date('r');
// Check if the database is up to date
$query = 'SELECT changeid FROM build LIMIT 1';
$dbTest = pdo_query($query);
if ($dbTest === false) {
    $response['upgradewarning'] = 1;
}
$response['title'] = $CDASH_MAININDEX_TITLE;
$response['subtitle'] = $CDASH_MAININDEX_SUBTITLE;
$response['googletracker'] = $CDASH_DEFAULT_GOOGLE_ANALYTICS;
if (isset($CDASH_NO_REGISTRATION) && $CDASH_NO_REGISTRATION == 1) {
开发者ID:kitware,项目名称:cdash,代码行数:31,代码来源:viewProjects.php


注:本文中的Banner::GetText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。