本文整理汇总了PHP中Campaign::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Campaign::create方法的具体用法?PHP Campaign::create怎么用?PHP Campaign::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Campaign
的用法示例。
在下文中一共展示了Campaign::create方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
示例2: store
/**
* Store a newly created resource in storage.
* POST /campaigns
*
* @return Response
*/
public function store()
{
$data = Input::all();
$data['user_id'] = Auth::user()->id;
$campaigns = Campaign::create($data);
if ($campaigns) {
return ['status' => true, 'data' => $campaigns];
} else {
return ['status' => false];
}
}
示例3: postCreate
public function postCreate()
{
$data = Input::all();
$data['item_vendor_id'] = Auth::user()->id;
$validator = Validator::make($data, Campaign::$rules);
if ($validator->passes()) {
$campaign = Campaign::create($data);
$cover = Input::file('cover', null);
if (null !== $cover) {
Croppa::delete('uploads/campaigns/covers/' . $id . '.png');
$destination_path = 'uploads/campaigns/covers';
$file_name = $category->id;
$path_parts = explode('.', $cover->getClientOriginalName());
$ext = $path_parts[count($path_parts) - 1];
$cover_passes = Input::file('cover')->move($destination_path, $file_name . '.png');
} else {
$cover_passes = true;
}
if (is_bool($cover_passes) && $cover_passes == false) {
return Redirect::back()->with('message', Lang::get('campaigns.cover.bad_upload_error'))->withInput();
}
$thumb = Input::file('thumb', null);
if (null !== $thumb) {
Croppa::delete('uploads/campaigns/thumbs/' . $id . '.png');
$destination_path = 'uploads/campaigns/thumbs';
$file_name = $category->id;
$path_parts = explode('.', $thumb->getClientOriginalName());
$ext = $path_parts[count($path_parts) - 1];
$thumb_passes = Input::file('thumb')->move($destination_path, $file_name . '.png');
} else {
$thumb_passes = true;
}
if (is_bool($thumb_passes) && $thumb_passes == false) {
return Redirect::back()->with('message', Lang::get('campaigns.thumb.bad_upload_error'))->withInput();
}
return Redirect::back()->with('message', Lang::get('campaigns.new.message', array('title' => Input::get('title'))));
} else {
return Redirect::back()->with('message', Lang::get('campaigns.new.error'))->withErrors($validator)->withInput();
}
}
示例4: array
<?php
/**
* Envoi d'une campagne de SMS
*
* PHP version 5
*
* @category Ajax
* @package LeQG
* @author Damien Senger <hi@hiwelo.co>
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0
* @link http://leqg.info
*/
$campagne = array('titre' => $_GET['titre'], 'message' => $_GET['message']);
$campaign = Campaign::create('sms');
$campaign = new Campaign($campaign);
$campaign->update('titre', $campagne['titre']);
$campaign->update('message', $campagne['message']);
$var = $_GET;
$var['criteres'] = trim($var['criteres'], ';');
$campaign->addRecipients(People::listing($var, 0, false));
echo $campaign->get('id');
示例5: trim
* Création d'une nouvelle campagne Email
*
* PHP version 5
*
* @category Ajax
* @package LeQG
* @author Damien Senger <hi@hiwelo.co>
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0
* @link http://leqg.info
*/
// On lance la création de la campagne
if (isset($_GET)) {
// On récupère les données
$user = User::ID();
// On crée la nouvelle mission en récupérant l'identifiant créé
$campagne = Campaign::create("email");
// On tâche de récupérer la liste des contacts concernés par l'envoi
$var = $_GET;
// On retraite les critères complexes
$var['criteres'] = trim($var['criteres'], ';');
// On charge les identifiants des fiches correspondantes
$contacts = People::listing($var, 0, false);
// On prépare la requête d'ajout des destinataires
$query = Core::query('campagne-destinataires');
// On enregistre les contacts concernés
foreach ($contacts as $contact) {
$query->bindParam(':campagne', $campagne, PDO::PARAM_INT);
$query->bindParam(':contact', $contact, PDO::PARAM_INT);
$query->execute();
}
echo $campagne;
示例6: array
<?php
$errors = array();
if (!empty($_POST)) {
$domain = filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING);
$own_domain = filter_input(INPUT_POST, 'own_domain', FILTER_SANITIZE_URL);
$candidate_number = filter_input(INPUT_POST, 'candidate_number', FILTER_SANITIZE_NUMBER_INT);
$plan_id = filter_input(INPUT_POST, 'plan_id', FILTER_SANITIZE_NUMBER_INT);
$state = filter_input(INPUT_POST, 'state', FILTER_SANITIZE_NUMBER_INT);
$city = filter_input(INPUT_POST, 'city', FILTER_SANITIZE_NUMBER_INT);
$observations = filter_input(INPUT_POST, 'observations', FILTER_SANITIZE_STRING);
$campaign = new Campaign(array('domain' => $domain, 'own_domain' => $own_domain, 'plan_id' => $plan_id, 'candidate_number' => $candidate_number, 'state' => $state, 'city' => $city, 'observations' => $observations));
if ($campaign->validate()) {
$campaign->create();
if (switch_to_blog($campaign->blog_id)) {
wp_redirect(home_url());
} else {
//TODO: improve error handling for campaign creation
$errors = array('error' => Campaign::getStrings('NaoFoiPossivelCriar'));
}
} else {
$errors = $campaign->errorHandler->errors;
}
}
// hack to make the redirection above work (without using noheader
// the call to wp_redirect generate a headers already sent warning)
if (isset($_GET['noheader'])) {
require_once ABSPATH . 'wp-admin/admin-header.php';
}
?>
示例7: array
<?php
/**
* Préparation d'une campagne de publipostage
*
* PHP version 5
*
* @category Ajax
* @package LeQG
* @author Damien Senger <hi@hiwelo.co>
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0
* @link http://leqg.info
*/
$campagne = array('titre' => $_GET['titre'], 'message' => $_GET['message']);
$campaign = Campaign::create('publi');
$campaign = new Campaign($campaign);
$campaign->update('titre', $campagne['titre']);
$campaign->update('message', $campagne['message']);
$var = $_GET;
$var['criteres'] = trim($var['criteres'], ';');
$contacts = People::listing($var, 0, false);
$fichier = array();
$nomFichier = 'publi-' . md5($campaign->get('id')) . '.csv';
$file = fopen('exports/' . $nomFichier, 'w+');
$entete = array('nom', 'nom_usage', 'prenoms', 'numero', 'rue', 'cp', 'ville', 'pays', 'origine');
fputcsv($file, $entete, ';', '"');
foreach ($contacts as $contact) {
$person = new People($contact);
$address = $person->postal_array();
if (isset($address['reel'])) {
$address = $address['reel'];