本文整理汇总了PHP中Campaign类的典型用法代码示例。如果您正苦于以下问题:PHP Campaign类的具体用法?PHP Campaign怎么用?PHP Campaign使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Campaign类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($options = null)
{
parent::__construct($options);
$emailCategoryOptionList = array('Invite non-sparks to join campaign' => $this->getView()->translate('Admin_Non-Sparks_Invitation'), 'Invite sparks to join campaign' => $this->getView()->translate('Admin_Sparks_Invitation'), 'Send mail to sparks' => $this->getView()->translate('Admin_Send_Mail_To_Sparks'));
$emailCategory = new Zend_Form_Element_Select('emailCategory');
$emailCategory->setMultiOptions($emailCategoryOptionList);
$emailList = new Zend_Form_Element_Textarea('emailList');
$emailList->setAttribs(array('rows' => 5, 'cols' => 150, 'onChange' => 'datetable()'))->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(0, 65535))));
$subject = new Zend_Form_Element_Text('subject');
$subject->setAttribs(array('size' => 150))->addFilter('StringTrim');
$message = new Zend_Form_Element_Textarea('message');
$message->setAttribs(array('rows' => 30, 'cols' => 150))->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(0, 65535))));
$optionList = array();
$campaign = new Campaign();
$campaigns = $campaign->fetchAll(null, "id desc", null, null);
foreach ($campaigns as $campaign) {
$optionList[$campaign->id] = $campaign->name;
}
$optionList['0'] = $this->getView()->translate('ADMIN_NOT_AUTO_INVITATION');
$campaignId = new Zend_Form_Element_Select('campaignId');
$campaignId->setMultiOptions($optionList);
$code_source = new Zend_Form_Element_Text('code_source');
$code_source->addFilter('StringTrim');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel($this->getView()->translate('INVITATION_MAIL_SEND'));
$this->addElements(array($emailCategory, $emailList, $subject, $message, $campaignId, $code_source, $submit));
}
示例2: getIndex
public function getIndex()
{
$campaign = new Campaign();
$image = $campaign->getCampaignImage();
$users = new Users();
$member = $users->getRecentUsers();
$this->layout->foot = View::make("landing.foot")->with(array('data' => $image, 'data2' => $member));
$this->layout->title = "Welcome to Sagip.ph";
if (Session::has('userid')) {
$username = Session::get('username');
$logstatus = true;
$userid = Session::get('userid');
$profile = new Profile();
$pic = "#";
$result = $profile->getProfile($userid);
if ($result) {
$pic = $result->profilepic;
}
$data = array('username' => $username, 'logstatus' => $logstatus, 'profilepic' => $pic);
$campaign = new Campaign();
$data2 = $campaign->getCampaignHome();
$this->layout->head = View::make("landing.head")->with($data);
$this->layout->body = View::make("landing.bodycontributordash")->with($data);
} else {
$logstatus = false;
$data = array('logstatus' => $logstatus);
$campaign = new Campaign();
$data2 = $campaign->getCampaignHome();
$this->layout->head = View::make("landing.head")->with($data);
$this->layout->body = View::make("landing.bodycontributordash")->with($data);
}
}
示例3: updateCampaign
/**
* Update a specific email campaign
* @param string $accessToken - Constant Contact OAuth2 access token
* @param Campaign $campaign - Campaign to be updated
* @return Campaign
*/
public function updateCampaign($accessToken, Campaign $campaign)
{
$baseUrl = Configs::get('endpoints.base_url') . sprintf(Configs::get('endpoints.campaign'), $campaign->id);
$url = $this->buildUrl($baseUrl);
$response = parent::getRestClient()->put($url, parent::getHeaders($accessToken), $campaign->toJson());
return Campaign::create(json_decode($response->body, true));
}
示例4: setup
public function setup()
{
global $current_user;
$current_user = SugarTestUserUtilities::createAnonymousUser();
//for the purpose of this test, we need to create a campaign and relate it to a campaign tracker object
//create campaign
$c = new Campaign();
$c->name = 'CT test ' . time();
$c->campaign_type = 'Email';
$c->status = 'Active';
$timeDate = new TimeDate();
$c->end_date = $timeDate->to_display_date(date('Y') + 1 . '-01-01');
$c->assigned_id = $current_user->id;
$c->team_id = '1';
$c->team_set_id = '1';
$c->save();
$this->campaign = $c;
//create campaign tracker
$ct = new CampaignTracker();
$ct->tracker_name = 'CampaignTrackerTest' . time();
$ct->tracker_url = 'sugarcrm.com';
$ct->campaign_id = $this->campaign->id;
$ct->save();
$this->campaign_tracker = $ct;
}
示例5: queryByCampaign
/**
*
* @param Campaign $campaign
* @param bool $fetch_user
* @return Doctrine_Query
*/
public function queryByCampaign(Campaign $campaign, $fetch_user = true)
{
$query = $this->createQuery('cr')->where('cr.campaign_id = ?', $campaign->getId());
if ($fetch_user) {
$query->leftJoin('cr.User u')->addSelect('cr.*, u.*');
}
return $query;
}
示例6: build
/**
* @param Campaign $campaign
* @param $locale
* @return string
*/
public function build(Campaign $campaign, $locale)
{
//it's simple, just load all the shit! :-)
$campaign->load(['translations', 'widgets', 'widgets.translations', 'widgets.resource', 'widgets.otherResource', 'widgets.image', 'widgets.imageLeft', 'widgets.imageRight']);
$campaign->widgets->setData();
$translation = $campaign->translate($locale);
return view('marketing::newsletter.campaign', ['translation' => $translation, 'campaign' => $campaign, 'locale' => $locale])->render();
}
示例7: queryByCampaign
/**
*
* @param Campaign $campaign
* @return Doctrine_Query
*/
public function queryByCampaign(Campaign $campaign, $active_only = false, $deleted_too = false)
{
$query = $this->createQuery('ml')->orderBy('ml.id')->where('ml.campaign_id = ?', $campaign->getId());
if ($active_only) {
$query->andWhere('ml.status = ?', MailingListTable::STATUS_ACTIVE);
} else {
if (!$deleted_too) {
$query->andWhere('ml.status != ?', MailingListTable::STATUS_DELETED);
}
}
return $query;
}
示例8: sendCampaign
public function sendCampaign()
{
// get abandoned cart :
$sql = "SELECT * FROM (\n\t\tSELECT\n\t\tCONCAT(LEFT(c.`firstname`, 1), '. ', c.`lastname`) `customer`, a.id_cart total, ca.name carrier, c.id_customer, a.id_cart, a.date_upd,a.date_add,\n\t\t\t\tIF (IFNULL(o.id_order, 'Non ordered') = 'Non ordered', IF(TIME_TO_SEC(TIMEDIFF('" . date('Y-m-d H:i:s') . "', a.`date_add`)) > 86400, 'Abandoned cart', 'Non ordered'), o.id_order) id_order, IF(o.id_order, 1, 0) badge_success, IF(o.id_order, 0, 1) badge_danger, IF(co.id_guest, 1, 0) id_guest\n\t\tFROM `" . _DB_PREFIX_ . "cart` a \n\t\t\t\tJOIN `" . _DB_PREFIX_ . "customer` c ON (c.id_customer = a.id_customer)\n\t\t\t\tLEFT JOIN `" . _DB_PREFIX_ . "currency` cu ON (cu.id_currency = a.id_currency)\n\t\t\t\tLEFT JOIN `" . _DB_PREFIX_ . "carrier` ca ON (ca.id_carrier = a.id_carrier)\n\t\t\t\tLEFT JOIN `" . _DB_PREFIX_ . "orders` o ON (o.id_cart = a.id_cart)\n\t\t\t\tLEFT JOIN `" . _DB_PREFIX_ . "connections` co ON (a.id_guest = co.id_guest AND TIME_TO_SEC(TIMEDIFF('" . date('Y-m-d H:i:s') . "', co.`date_add`)) < 1800)\n\t\t) AS toto WHERE id_order='Abandoned cart'";
$currency = Context::getContext()->currency->sign;
$defaultLanguage = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
$abandoned_carts = Db::getInstance()->ExecuteS($sql);
// get all available campaigns
$sqlCampaigns = 'SELECT * FROM `' . _DB_PREFIX_ . 'campaign` WHERE active=1';
$allCampaigns = Db::getInstance()->ExecuteS($sqlCampaigns);
// loop on all abandoned carts
foreach ($abandoned_carts as $abncart) {
// loop on all available campaigns
foreach ($allCampaigns as $camp) {
$cartIsOnCampaign = $this->checkIfCartIsOnCampaign($abncart['date_add'], $camp['execution_time_day'], $camp['execution_time_hour']);
if ($cartIsOnCampaign) {
$id_lang = (int) Configuration::get('PS_LANG_DEFAULT');
$customer = new Customer($abncart['id_customer']);
$cR = new CartRule($camp['id_voucher'], $id_lang);
$cart = new Cart($abncart['id_cart']);
$products = $cart->getProducts();
$campM = new Campaign($camp['id_campaign']);
if (!empty($products)) {
$cart_content = $campM->getCartContentHeader();
} else {
$cart_content = '';
}
foreach ($products as $prod) {
$p = new Product($prod['id_product'], true, $id_lang);
$price_no_tax = Product::getPriceStatic($p->id, false, null, 2, null, false, true, 1, false, null, $abncart['id_cart'], null, $null, true, true, null, false, false);
$total_no_tax = $prod['cart_quantity'] * $price_no_tax;
$images = Image::getImages((int) $id_lang, (int) $p->id);
$link = new Link();
$cart_content .= '<tr >
<td align="center" ><img src="' . $link->getImageLink($p->link_rewrite, $images[0]['id_image']) . '" width="80"/></td>
<td align="center" ><a href="' . $link->getProductLink($p) . '"/>' . $p->name . '</a></td>
<td align="center" >' . Tools::displayprice($price_no_tax) . '</td>
<td align="center" >' . $prod['cart_quantity'] . '</td>
<td align="center" >' . Tools::displayprice($total_no_tax) . '</td>
</tr>';
}
$tpl_vars = array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{coupon_name}' => $cR->name, '{coupon_code}' => $cR->code, '{cart_content}' => $cart_content, '{coupon_value}' => $camp['voucher_amount_type'] == 'percent' ? $cR->reduction_percent . '%' : $currency . $cR->reduction_amount, '{coupon_valid_to}' => date('d/m/Y', strtotime($cR->date_to)), '{campaign_name}' => $camp['name']);
$path = _PS_ROOT_DIR_ . '/modules/superabandonedcart/mails/';
// send email to customer :
Mail::Send($id_lang, $campM->getFileName(), $camp['name'], $tpl_vars, $customer->email, null, null, null, null, null, $path, false, Context::getContext()->shop->id);
// Email to admin :
Mail::Send($id_lang, $campM->getFileName(), Mail::l(sprintf('Email sent to %s %s for campaign %s', $customer->lastname, $customer->firstname, $camp['name'])), $tpl_vars, Configuration::get('PS_SHOP_EMAIL'), null, null, null, null, null, $path, false, Context::getContext()->shop->id);
// echo 'ID ' . $abncart['id_cart'];
}
}
}
}
示例9: adminexportdataAction
function adminexportdataAction()
{
$this->_helper->layout->disableLayout();
$idValue = explode('&', $this->_request->getParam('id'));
$this->campaign_id = $idValue[0];
$campaignModel = new Campaign();
$this->view->campaign = $campaignModel->fetchRow('id = ' . $this->campaign_id);
$this->view->flag = 0;
if ($this->_request->isPost()) {
$postData = $this->_request->getPost();
$this->view->flag = 1;
$db = Zend_Registry::get('db');
$select = $db->select();
$select->from('campaign', null);
$select->join('campaign_invitation', 'campaign.id = campaign_invitation.campaign_id', array('create_date', 'state'));
$select->join('consumer', "consumer.id = campaign_invitation.consumer_id");
switch ($postData['action']) {
case 'all':
$select->join('campaign_participation', 'campaign_invitation.id = campaign_participation.campaign_invitation_id', array('accept_date', 'state'));
break;
case 'sent':
$select->join('campaign_participation', 'campaign_invitation.id = campaign_participation.campaign_invitation_id and campaign_participation.state="KIT SENT"', array('accept_date', 'state'));
break;
case 'notsent':
$select->join('campaign_participation', 'campaign_invitation.id = campaign_participation.campaign_invitation_id and campaign_participation.state<>"KIT SENT"', array('accept_date', 'state'));
break;
}
$select->where('campaign_invitation.campaign_id = ?', $this->campaign_id)->where('consumer.pest is null or consumer.pest != 1');
$campaignParticipations = $db->fetchAll($select);
// Zend_Debug::dump($campaignParticipations);die();
$campaignUsers = array();
$file = $this->campaign_id . '_' . date('Y-m-d_H_i_s') . "participation.csv";
if ($campaignParticipations) {
$i = 0;
foreach ($campaignParticipations as $val) {
$campaignUsers[] = array($i, $val['name'], $val['email'], $val['login_phone'], $val['recipients_name'], $val['province'], $val['city'], $val['address1'], $val['phone'], $val['qq'], $val['id'], $val['create_date'], $val['accept_date']);
$i++;
}
$header = array('No.', 'Name', 'Email', 'Login_phone', 'Recipients_name', 'Province', 'City', 'Address1', 'Phone', 'QQ', 'UserID', 'InvitateDate', 'AcceptedDate');
$handle = fopen(dirname(dirname(dirname(__FILE__))) . '/public/csv/' . $file, "w");
// Zend_Debug::dump(dirname ( dirname ( dirname ( __FILE__ ) ) ) . '/public/csv/' . $file);die();
fputcsv($handle, $header);
foreach ($campaignUsers as $line) {
fputcsv($handle, $line);
}
fclose($handle);
}
$this->view->file = file_exists(dirname(dirname(dirname(__FILE__))) . '/public/csv/' . $file) ? dirname(dirname(dirname(__FILE__))) . '/public/csv/' . $file : false;
$this->view->filename = $file;
}
}
示例10: saveCampaign
public function saveCampaign(Campaign $campaign)
{
$data = $campaign->getArrayData();
$id_campana = (int) $campaign->id_campana;
if ($id_campana == 0) {
$this->tableGateway->insert($data);
} else {
if ($this->getCampaign($id_campana)) {
$this->tableGateway->update($data, array('ID_CAMPANA' => $id_campana));
} else {
//throw new \Exception("Could not find row $uid");
return null;
}
}
}
示例11: run
/**
* @see BaseJob::run()
*/
public function run()
{
// we need either this or need to call forget() on each campaign we are processing inside tests
Campaign::forgetAll();
$util = new CampaignItemsUtil();
return $util->generateCampaignItemsForDueCampaigns();
}
示例12: get_instance
public static function get_instance()
{
if (self::$campaign == NULL) {
self::$campaign = new Campaign();
}
return self::$campaign;
}
示例13: viewAction
function viewAction()
{
$clearArray = array('flags');
$this->filter($clearArray);
if (empty($this->params)) {
$today = date("d.m.Y");
$this->params['dates'] = $today . '-' . $today;
}
$pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
$models = AFActiveDataProvider::models('ProspectEmail', $this->params, $pagination);
$dataProvider = $models->getAll();
$filterFields = $models->getoutFilterFields($clearArray, array('dates'));
// set ajax table
if (AF::isAjaxRequestModels()) {
$this->view->includeFile('_table', array('application', 'views', 'emails'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields));
die;
}
$campaigns = Campaign::model()->cache()->findAllInArray();
$templates = Template::model()->cache()->findAllInArray();
$flags = ProspectEmail::getEmailFlags();
/*
$campaignsFilter = $models->getFilterCampaigns();
$templatesFilter = $models->getFilterTemplates();
$flagsFilter = $models->getFilterFlags();
*/
Assets::css('jquery-ui');
Assets::js('jquery-ui');
Assets::js('dateRange/jquery.daterange');
Assets::js('ajax_table');
Assets::js('af_input_field');
$this->addToPageTitle(__('prospect_emails'));
$this->render('view', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'models' => $models, 'filterFields' => $filterFields, 'campaigns' => $campaigns, 'templates' => $templates, 'flags' => $flags));
}
示例14: markProcessedCampaignsAsCompleted
/**
* @param null $pageSize | int $pageSize
* @return bool
*/
public static function markProcessedCampaignsAsCompleted($pageSize = null)
{
if ($pageSize != null) {
$resolvedPageSize = $pageSize + 1;
} else {
$resolvedPageSize = $pageSize;
}
$processingCampaigns = Campaign::getByStatus(Campaign::STATUS_PROCESSING, $resolvedPageSize);
$campaignsProcessed = 0;
foreach ($processingCampaigns as $processingCampaign) {
if ($campaignsProcessed < $pageSize || $pageSize == null) {
if (static::areAllCampaignItemsProcessed($processingCampaign->id)) {
$processingCampaign->status = Campaign::STATUS_COMPLETED;
if (!$processingCampaign->save()) {
return false;
}
}
$campaignsProcessed++;
} else {
Yii::app()->jobQueue->add('CampaignMarkCompleted', 5);
break;
}
}
return true;
}
示例15: newretentionAction
function newretentionAction()
{
$clearArray = array('campaign_id', 'aff_id');
$this->filter($clearArray);
if (!isset($this->params['dates_r'])) {
$dataFrom = mktime(0, 0, 0, date("m") - 1, date("d"), date("Y"));
$fromDate = date("d.m.Y", $dataFrom);
$today = date("d.m.Y");
$this->params['dates_r'] = $fromDate . '-' . $today;
}
if (!isset($this->params['initial_dates'])) {
$fromDate = date("d.m.Y", time() - 777600);
$today = date("d.m.Y");
$this->params['initial_dates'] = $fromDate . '-' . $today;
}
if (!isset($this->params['billing_cycle'])) {
$this->params['billing_cycle'] = 1;
}
$pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params));
$models = AFActiveDataProvider::models('Retention', $this->params, $pagination);
$report = $models->getForGraph();
$filterFields = $models->getoutFilterFields($clearArray, array('dates_r', 'initial_dates'));
$campaigns = Campaign::model()->cache()->findAllInArray();
$affiliates = Affiliate::model()->cache()->findAllInArray();
Assets::css('jquery-ui');
Assets::js('//code.jquery.com/ui/1.10.3/jquery-ui.js');
Assets::js('dateRange/jquery.daterange');
Assets::js('//www.google.com/jsapi');
//<script type="text/javascript" src="https://www.google.com/jsapi"></script>
$this->addToPageTitle(__('sales_by_retention_chart'));
$this->render('newretention', array('report' => $report, 'campaigns' => $campaigns, 'affiliates' => $affiliates, 'filterFields' => $filterFields));
}