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


PHP Campaign::CreateFromQuery方法代码示例

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


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

示例1: AND

/* This cronjob will send out donation reminder e-mails for every user
 * that hasn't received an e-mail in the past month. It will also 
 * re-generate statistics for every campaign, and store them in the
 * historical statistics logs.
 */
/* First, we will update the exchange rates. */
Currency::UpdateRates();
/* Then, we'll start out sending reminder e-mails. */
try {
    $sSubscriptions = Subscription::CreateFromQuery("SELECT * FROM subscriptions WHERE `Confirmed` = 1 AND `Active` = 1 AND (`LastEmail` IS NULL OR `LastEmail` < DATE_SUB(NOW(), INTERVAL 1 MONTH))");
} catch (NotFoundException $e) {
    $sSubscriptions = array();
}
foreach ($sSubscriptions as $sSubscription) {
    $sSubscription->SendPaymentRequest();
}
/* Now, we'll log a historical statistics snapshot for every campaign. */
try {
    $sCampaigns = Campaign::CreateFromQuery("SELECT * FROM campaigns");
    $found = true;
} catch (NotFoundException $e) {
    /* No campaigns are in the database yet. */
    $found = false;
}
if ($found) {
    foreach ($sCampaigns as $sCampaign) {
        $sCampaign->UpdateStatistics();
        $sStatisticsEntry = $sCampaign->CreateStatisticsEntry();
        $sStatisticsEntry->InsertIntoDatabase();
    }
}
开发者ID:GodOfConquest,项目名称:redonate,代码行数:31,代码来源:cron.daily.php

示例2: die

/*
 * ReDonate is more free software. It is licensed under the WTFPL, which
 * allows you to do pretty much anything with it, without having to
 * ask permission. Commercial use is allowed, and no attribution is
 * required. We do politely request that you share your modifications
 * to benefit other developers, but you are under no enforced
 * obligation to do so :)
 * 
 * Please read the accompanying LICENSE document for the full WTFPL
 * licensing text.
 */
if (!isset($_APP)) {
    die("Unauthorized.");
}
try {
    $sCampaign = Campaign::CreateFromQuery("SELECT * FROM campaigns WHERE `UrlName` = :UrlName", array(":UrlName" => $router->uParameters[1]), 5, true);
} catch (NotFoundException $e) {
    throw new RouterException("Campaign does not exist.");
}
if ($sCampaign->VerifyAdministratorAccess($_SESSION['user_id']) === false) {
    throw new RouterException("Not authorized to administrate this campaign.");
}
$sCampaign->UpdateStatistics();
$sPaymentMethods = array();
try {
    foreach (PaymentMethod::CreateFromQuery("SELECT * FROM payment_methods WHERE `CampaignId` = :CampaignId", array(":CampaignId" => $sCampaign->sId)) as $sPaymentMethod) {
        $sNewMethod = $sPaymentMethod->GetLogo();
        $sNewMethod['address'] = $sPaymentMethod->sAddress;
        $sNewMethod['id'] = $sPaymentMethod->sId;
        $sPaymentMethods[] = $sNewMethod;
    }
开发者ID:GodOfConquest,项目名称:redonate,代码行数:31,代码来源:dashboard.php

示例3: die

 * to benefit other developers, but you are under no enforced
 * obligation to do so :)
 * 
 * Please read the accompanying LICENSE document for the full WTFPL
 * licensing text.
 */
if (!isset($_APP)) {
    die("Unauthorized.");
}
$sCampaigns = array();
$sPercentages = array();
$sTotals = array();
$sProjections = array();
$sSubscribers = array();
try {
    foreach (Campaign::CreateFromQuery("SELECT * FROM campaigns WHERE `OwnerId` = :UserId", array(":UserId" => $sCurrentUser->sId)) as $sCampaign) {
        $sCampaign->UpdateStatistics();
        $sPaymentMethods = array();
        try {
            foreach (PaymentMethod::CreateFromQuery("SELECT * FROM payment_methods WHERE `CampaignId` = :CampaignId", array(":CampaignId" => $sCampaign->sId)) as $sPaymentMethod) {
                $sPaymentMethods[] = $sPaymentMethod->GetLogo();
            }
        } catch (NotFoundException $e) {
            /* No payment methods...? */
        }
        if ($sCampaign->sHaveData) {
            $sPercentages[] = $sCampaign->sDonationRate;
            $sTotals[] = $sCampaign->sMonthlyTotal;
            $sProjections[] = $sCampaign->sMonthlyProjection;
        }
        $sSubscribers[] = $sCampaign->sSubscriberCount;
开发者ID:GodOfConquest,项目名称:redonate,代码行数:31,代码来源:dashboard.php


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