本文整理匯總了PHP中Campaign::getName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Campaign::getName方法的具體用法?PHP Campaign::getName怎麽用?PHP Campaign::getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Campaign
的用法示例。
在下文中一共展示了Campaign::getName方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: foreach
$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";
}
break;
}
}
}
示例2: getAdminInterface
//.........這裏部分代碼省略.........
$form = Campaign::getCSVForm();
$this->smarty->assign('form', $form);
if ($form->validate() && $form->isSubmitted() && $_POST['submit']) {
return $this->recipTopLevelAdmin();
}
return $this->smarty->fetch('admin/campaign_csvup.tpl');
}
return $this->smarty->fetch('../../../cms/templates/error.tpl');
case 'recipdelete':
if ($this->user->hasPerm('addcampaignrecips')) {
if (!is_null($_REQUEST['id']) && CampaignUser::exists($_REQUEST['id'])) {
$recipient = new CampaignUser($_REQUEST['id']);
if ($recipient->getGroup() == $this->user->getAuthGroup()) {
$recipient->delete();
unset($_REQUEST['id']);
} else {
return $this->smarty->fetch('../../../cms/templates/error.tpl');
}
}
return $this->recipTopLevelAdmin();
}
return $this->smarty->fetch('../../../cms/templates/error.tpl');
case 'votesend':
if ($this->user->hasPerm('addcampaignrecips')) {
$campaign = new Campaign($_REQUEST['campaign_id']);
return $campaign->mailOut('votes');
}
return 'You do not have permission to perform this action.';
case 'voteprint':
if ($this->user->hasPerm('generatereciplist')) {
$campaign = new Campaign($_REQUEST['campaign_id']);
$campaign->preparePdf();
}
return $this->topLevelAdmin();
case 'resultsend':
if ($this->user->hasPerm('addcampaignrecips')) {
$campaign = new Campaign($_REQUEST['campaign_id']);
return $campaign->mailOut('results');
}
return 'You do not have permission to perform this action.';
case 'listbilling':
if ($this->user->hasPerm('admin')) {
$groups = Group::getGroups();
$this->smarty->assign('groups', $groups);
return $this->smarty->fetch('admin/billing_list.tpl');
}
case 'viewbilling':
if ($this->user->hasPerm('admin')) {
$group = new Group($_REQUEST['group_id']);
$this->smarty->assign('group', $group);
$campaigns = Campaign::getCampaigns($_REQUEST['group_id']);
$campaignsSorted = array_merge($campaigns['upcoming'], $campaigns['progress'], $campaigns['ended']);
$this->smarty->assign('campaigns', $campaignsSorted);
return $this->smarty->fetch('admin/billing_view.tpl');
}
case 'togglestatus':
if ($this->user->hasPerm('admin')) {
$group = new Group($_REQUEST['group_id']);
if ($group->getStatus() > 0) {
$group->setStatus(0);
} else {
$group->setStatus(1);
}
$group->save();
}
$groups = Group::getGroups();
$this->smarty->assign('groups', $groups);
return $this->smarty->fetch('admin/billing_list.tpl');
break;
case 'whovoted':
if ($this->user->hasPerm('addcampaign')) {
$campaign = new Campaign($_REQUEST['campaign_id']);
$this->smarty->assign('votedlist', $campaign->userVotedList());
$this->smarty->assign('notvotedlist', $campaign->userVotedList(false));
$this->smarty->assign('campaignName', $campaign->getName());
return $this->smarty->fetch('admin/voted_list.tpl');
}
return $this->topLevelAdmin();
case 'archivecampaign':
if ($this->user->hasPerm('addcampaign')) {
$campaign = new Campaign($_REQUEST['campaign_id']);
$campaign->setArchiveStatus(1);
$campaign->save();
}
return $this->topLevelAdmin();
case 'viewarchive':
if ($this->user->hasPerm('viewcampaign')) {
$campaigns = Campaign::getCampaigns($this->user->getAuthGroup(), 1, 'endDate ASC');
$this->smarty->assign('campaigns', $campaigns);
$this->smarty->assign('company', $this->user->getAuthGroupName());
return $this->smarty->fetch('admin/campaign_archive.tpl');
}
return $this->topLevelAdmin();
default:
if ($this->user->hasPerm('admin') && !$this->user->hasPerm('viewcampaign')) {
header("Location: /admin/Campaigns§ion=listbilling");
}
return $this->topLevelAdmin();
}
}
示例3: actionRecovery
/**
* Recovery password
*/
public function actionRecovery()
{
$form = new UserRecoveryForm();
Yii::app()->theme = 'client';
if (Yii::app()->user->id) {
$this->redirect(Yii::app()->controller->module->returnUrl);
} else {
$email = isset($_GET['email']) ? $_GET['email'] : '';
$activkey = isset($_GET['activkey']) ? $_GET['activkey'] : '';
if ($email && $activkey) {
$form2 = new UserChangePassword();
$find = User::model()->notsafe()->findByAttributes(array('email' => $email));
if (isset($find) && $find->activkey == $activkey) {
if (isset($_POST['UserChangePassword'])) {
$form2->attributes = $_POST['UserChangePassword'];
if ($form2->validate()) {
$find->password = Yii::app()->controller->module->encrypting($form2->password);
$find->activkey = Yii::app()->controller->module->encrypting(microtime() . $form2->password);
if ($find->status == 0) {
$find->status = 1;
}
$find->save();
Yii::app()->user->setFlash('recoveryMessage', UserModule::t("New password is saved."));
$this->redirect(Yii::app()->controller->module->recoveryUrl);
}
}
$this->render('changepassword', array('form' => $form2));
} else {
Yii::app()->user->setFlash('recoveryMessage', UserModule::t("Incorrect recovery link."));
$this->redirect(Yii::app()->controller->module->recoveryUrl);
}
} else {
if (isset($_POST['UserRecoveryForm'])) {
$form->attributes = $_POST['UserRecoveryForm'];
if ($form->validate()) {
$user = User::model()->notsafe()->findbyPk($form->user_id);
$user->activkey = UserModule::encrypting(microtime() . $user->password);
$user->save();
$activation_url = 'http://' . $_SERVER['HTTP_HOST'] . $this->createUrl(implode(Yii::app()->controller->module->recoveryUrl), array("activkey" => $user->activkey, "email" => $user->email));
/*
$this->createUrl(implode(Yii::app()->controller->module->recoveryUrl));
$subject = UserModule::t("You have requested the password recovery site {site_name}",
array(
'{site_name}'=>Yii::app()->name,
));
$message = UserModule::t("You have requested the password recovery site {site_name}. To receive a new password, go to <a href=\"{activation_url}\">{activation_url}</a>.",
array(
'{site_name}'=>Yii::app()->name,
'{activation_url}'=>$activation_url,
));
UserModule::sendMail($user->email,$subject,$message);
*/
// новая служба системных сообщений
$type_id = Emails::TYPE_10;
$email = new Emails();
/*$criteria = new CDbCriteria();
$criteria->order = 'id DESC';
$criteria->limit = 1;
$user = User::model()->findAll($criteria);
$user = $user[0];*/
$email->from_id = 1;
$email->to_id = $form->user_id;
// = $user->id;
$rec = Templates::model()->findAll("`type_id`='{$type_id}'");
$id = Campaign::getId();
$email->campaign = Campaign::getName();
$email->name = $user->full_name;
$email->login = $user->username;
$email->password = $soucePassword;
$email->page_psw = $activation_url;
$email->page_cabinet = 'http://' . $_SERVER['SERVER_NAME'] . '/user/profile/edit';
$email->sendTo($user->email, $rec[0]->title, $rec[0]->text, $type_id);
Yii::app()->user->setFlash('recoveryMessage', UserModule::t("Please check your email. An instructions was sent to your email address."));
$this->refresh();
}
}
$this->render('recovery', array('form' => $form));
}
}
}
示例4: actionRegistration
/**
* Registration user
*/
public function actionRegistration()
{
$model = new RegistrationForm();
if (isset($_GET['role']) && $_GET['role'] == 'Customer') {
$role = 'Customer';
} elseif (isset($_GET['role']) && $_GET['role'] == 'Author') {
$role = 'Author';
} elseif (isset($_GET['role']) && $_GET['role'] == 'Manager') {
$role = 'Manager';
} else {
$role = 'Customer';
}
if (Yii::app()->user->id && (!Yii::app()->user->hasFlash('reg_success') && !Yii::app()->user->hasFlash('reg_failed'))) {
$this->redirect(Yii::app()->controller->module->profileUrl);
} else {
if (isset($_POST['RegistrationForm'])) {
$model->attributes = $_POST['RegistrationForm'];
if ($model->validate()) {
$soucePassword = $this->generate_password(8);
$model->password = UserModule::encrypting($soucePassword);
$model->superuser = 0;
$model->status = 1;
$model->username = $model->email;
if ($model->save()) {
$AuthAssignment = new AuthAssignment();
$AuthAssignment->attributes = array('itemname' => $role, 'userid' => $model->id);
$AuthAssignment->save();
//$login_url = '<a href="'.$this->createAbsoluteUrl('/user/login').'">'.Yii::app()->name.'</a>';
//UserModule::sendMail($model->email,UserModule::t("You registered from {site_name}",array('{site_name}'=>Yii::app()->name)),UserModule::t("You have registred from {login_url}<br /><br />Your password: {pass}",array('{login_url}'=>$login_url, '{pass}'=>$soucePassword)));
// новая служба системных сообщений
$type_id = Emails::TYPE_11;
$email = new Emails();
$criteria = new CDbCriteria();
$criteria->order = 'id DESC';
$criteria->limit = 1;
$user = User::model()->findAll($criteria);
$user = $user[0];
$email->from_id = 1;
$email->to_id = $user->id;
$rec = Templates::model()->findAll("`type_id`='{$type_id}'");
$title = $rec[0]->title;
$body = $rec[0]->text;
$id = Campaign::getId();
$email->campaign = Campaign::getName();
$email->name = $model->full_name;
$email->login = $model->username;
$email->password = $soucePassword;
$email->page_cabinet = 'http://' . $_SERVER['SERVER_NAME'] . '/user/profile/edit';
$email->sendTo($user->email, $body, $type_id);
$identity = new UserIdentity($model->username, $soucePassword);
$identity->authenticate();
Yii::app()->user->login($identity, 0);
//$this->redirect(Yii::app()->controller->module->returnUrl);
Yii::app()->user->setFlash('reg_success', UserModule::t("Thank you for your registration. Password has been sent to your e-mail. Please check your e-mail ({{email}}) before start.", ['{{email}}' => $model->email]));
$this->refresh();
//Yii::app()->end();
} else {
Yii::app()->user->setFlash('reg_failed', UserModule::t("Sorry, something wrong... :("));
$this->refresh();
}
}
}
Yii::app()->theme = 'client';
$this->render('/user/registration', array('model' => $model, 'role' => $role));
}
}
示例5: getByEmail
public static function getByEmail($addr)
{
if (eregi('^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\\.([a-zA-Z]{2,4})$', $addr)) {
$sql = 'SELECT id FROM campaign_recipients WHERE email = \'' . e($addr) . "'";
$result = Database::singleton()->query_fetch_all($sql);
if ($result && count($result) == 1) {
$id = $result[0]['id'];
$sql = 'INSERT INTO campaign_hash_requests SET IP = \'' . $_SERVER['REMOTE_ADDR'] . '\', email = \'' . e($addr) . '\'';
Database::singleton()->query($sql);
$sql = 'SELECT hash,campaign_id FROM campaign_hash WHERE user_id = ' . $id;
$results = Database::singleton()->query_fetch_all($sql);
$body = "This e-mail address was used to request the retrieval of hash keys on the SafeBallot system. " . "If you believe you have received this message in error, please contact the person in charge of voting " . "campaigns at your organization and ensure to keep the original copy of this contact.\n\nHash keys:\n";
if ($results) {
for ($i = 0; $i < count($results); $i++) {
$cid = $results[$i]["campaign_id"];
$hash = $results[$i]["hash"];
$campaign = new Campaign($cid);
if ($campaign->calcStatus(true) == 1) {
$body .= "\nCampaign '" . $campaign->getName() . "' -> " . $hash;
}
}
} else {
$body .= "There are currently no voting campaigns in progress.";
}
mail($addr, 'Hash Key Retrieval', $body, "From: Safeballot <safeballot@safeballot.com>");
return true;
}
}
return false;
}