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


PHP Campaign::getGroup方法代码示例

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


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

示例1: foreach

 include_once 'modules/Campaigns/include/Campaign.php';
 include_once 'modules/Campaigns/include/CampaignUser.php';
 include_once 'include/Site.php';
 $sql = 'SELECT id FROM campaigns where autosend = 1';
 $debug = false;
 if (@$argv[1] == 'debug') {
     $debug = true;
 }
 $results = Database::singleton()->query_fetch_all($sql);
 foreach ($results as &$campaign) {
     $campaign = new Campaign($campaign['id']);
     switch ($campaign->calcStatus(true)) {
         case 2:
             break;
         case 1:
             $sql = 'SELECT aut_email FROM auth WHERE aut_agp_id = ' . $campaign->getGroup() . ' LIMIT 1';
             $email = Database::singleton()->query_fetch($sql);
             $email = $email['aut_email'];
             $sql = 'SELECT agp_name FROM auth_groups WHERE agp_id = ' . $campaign->getGroup();
             $group = Database::singleton()->query_fetch($sql);
             $group = $group['agp_name'];
             $campaign->mailOut('votes', $group, $email);
             if ($debug) {
                 echo "Sent " . $campaign->getName() . " emails.\n";
             }
         default:
             $sql = 'UPDATE campaigns SET autosend = 0 WHERE id = ' . $campaign->getId();
             $result = Database::singleton()->query($sql);
             if ($debug) {
                 echo "Removed " . $campaign->getName() . "'s autosend.\n";
             }
开发者ID:swat30,项目名称:safeballot,代码行数:31,代码来源:autosender.php

示例2: getAdminInterface

 function getAdminInterface()
 {
     $this->addJS('/modules/Campaigns/js/voteadmin.js');
     $this->addCSS('/modules/Campaigns/css/campaign.css');
     switch (@$_REQUEST['section']) {
         case 'addedit':
             if ($this->user->hasPerm('addcampaign')) {
                 $campaign = new Campaign(@$_REQUEST['campaign_id']);
                 $form = $campaign->getAddEditForm();
                 $this->smarty->assign('form', $form);
                 $this->smarty->assign('status', $campaign->getId());
                 if ($form->isSubmitted() && isset($_REQUEST['submit'])) {
                     if ($form->validate()) {
                         return $this->topLevelAdmin();
                     }
                 }
                 return $this->smarty->fetch('admin/campaigns_addedit.tpl');
             }
             return $this->smarty->fetch('../../../cms/templates/error.tpl');
         case 'campaigndelete':
             $campaign = new Campaign($_REQUEST['campaign_id']);
             if ($this->user->hasPerm('addcampaign') && $this->user->getAuthGroup() == $campaign->getGroup() && strpos($campaign->getStatus(), 'pcoming') > 0) {
                 $campaign->delete();
                 unset($campaign);
                 return $this->topLevelAdmin();
             }
             return $this->smarty->fetch('../../../cms/templates/error.tpl');
         case 'viewresults':
             if ($this->user->hasPerm('viewcampaign')) {
                 $campaign = new Campaign($_REQUEST['campaign_id']);
                 $this->smarty->assign('campaign', $campaign);
                 $campaign->addResultViewer($this->user->getId());
                 return $this->smarty->fetch('admin/campaign_results.tpl');
             }
             return $this->smarty->fetch('admin/campaign_recips_addedit.tpl');
         case 'questionedit':
             if ($this->user->hasPerm('addcampaign')) {
                 $campaign = new Campaign($_REQUEST['campaign_id']);
                 $this->smarty->assign('campaign', $campaign);
                 if (isset($_REQUEST['choices_submit'])) {
                     if (!is_null(@$_REQUEST['choice'])) {
                         foreach ($_REQUEST['choice'] as $key => $achoice) {
                             if (is_numeric($key)) {
                                 $choice = new CampaignChoice($key);
                                 if (!empty($achoice['main'])) {
                                     $choice->setCampaign($_REQUEST['campaign_id']);
                                     $choice->setChoice($achoice['main']);
                                     $choice->save();
                                     if (is_array(@$_REQUEST['choice'][$key])) {
                                         $choice->createChildren($_REQUEST['choice'][$key]);
                                     }
                                 } else {
                                     $choice->delete();
                                 }
                             }
                         }
                     }
                     if (!is_null(@$_REQUEST['nChoice'])) {
                         if (isset($_REQUEST['nChoice'])) {
                             foreach ($_REQUEST['nChoice'] as $key => $achoice) {
                                 if (!empty($achoice['main'])) {
                                     $choice = new CampaignChoice();
                                     $choice->setCampaign($_REQUEST['campaign_id']);
                                     $choice->setChoice($achoice['main']);
                                     $choice->save();
                                     if (is_array(@$_REQUEST['nChoice'][$key])) {
                                         $choice->createChildren($_REQUEST['nChoice'][$key]);
                                     }
                                 }
                             }
                         }
                     }
                     return $this->topLevelAdmin();
                 }
                 return $this->smarty->fetch('admin/campaign_choices_addedit.tpl');
             }
             return $this->smarty->fetch('../../../cms/templates/error.tpl');
         case 'reciplist':
             return $this->recipTopLevelAdmin();
         case 'recipaddedit':
             if ($this->user->hasPerm('addcampaignrecips')) {
                 if (!is_null(@$_REQUEST['recipient_id'])) {
                     $recipient = new CampaignUser($_REQUEST['recipient_id']);
                 } else {
                     $recipient = new CampaignUser();
                     $recipient->setGroup($this->user->getAuthGroup());
                 }
                 $form = $recipient->getAddEditForm();
                 $this->smarty->assign('form', $form);
                 if ($form->isSubmitted() && isset($_REQUEST['submit'])) {
                     if ($form->validate()) {
                         return $this->recipTopLevelAdmin();
                     }
                 }
                 return $this->smarty->fetch('admin/campaign_recips_addedit.tpl');
             }
             return $this->smarty->fetch('../../../cms/templates/error.tpl');
         case 'recipcsvup':
             if ($this->user->hasPerm('addcampaignrecips')) {
                 $form = Campaign::getCSVForm();
//.........这里部分代码省略.........
开发者ID:swat30,项目名称:safeballot,代码行数:101,代码来源:Campaigns.php


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