本文整理汇总了PHP中Invitation::setRoleId方法的典型用法代码示例。如果您正苦于以下问题:PHP Invitation::setRoleId方法的具体用法?PHP Invitation::setRoleId怎么用?PHP Invitation::setRoleId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invitation
的用法示例。
在下文中一共展示了Invitation::setRoleId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeCreate
public function executeCreate(sfWebRequest $request)
{
$i18n = sfContext::getInstance()->getI18N();
$form = new InvitePrincipalForm();
$a = $request->getParameter($form->getName());
$oid = $a['o_id'];
$form->bind($request->getParameter('invite'));
if (!$form->isValid()) {
$this->getUser()->setFlash('notice', $i18n->__('Could not send the invitation, please check the e-mail address and try again!'));
$this->redirect("show/index?id=" . $oid);
}
$emails = $form->getValue('email');
$o_id = $form->getValue('o_id');
$role_id = $form->getValue('role_id');
$m = $form->getValue('message');
$o = Doctrine::getTable('Organization')->find($o_id);
$p = $this->getUser()->getPrincipal();
foreach ($emails as $email) {
$uuid = uniqid();
$i = new Invitation();
$i->setEmail($email);
$i->setOrganization($o);
$i->setUuid($uuid);
$i->setCreatedAt(date('Y-m-d H:i:s'));
$i->setCounter(1);
$i->setInviter($p);
$i->setStatus('pending');
$i->setRoleId($role_id);
$i->save();
$r = $i->getRole();
/* Send email */
$params = array("i" => $i, "m" => $m, "o" => $o, "p" => $p, "r" => $r, "reinvite" => FALSE);
$email_params = array("to" => $i->getEmail(), "subject" => $i18n->__('Invitation to %organization% organization', array("%organization%" => $o)), "bodyhtml" => $this->getPartial('invitePrincipal/inviteHtml', $params));
$this->sendEmail($email_params);
$to = $o->getManagersEmailArray();
$params = array("o" => $o, "p" => $p, "r" => $r, "email" => $email);
$email_params = array("to" => $to, "subject" => $i18n->__('Invitation of %email% to %organization% organization', array("%email%" => $email, "%organization%" => $o)), "bodyhtml" => $this->getPartial('invitePrincipal/inviteNoticeHtml', $params));
$this->sendEmail($email_params);
}
$this->getUser()->setFlash('notice', $i18n->__('The invitation has been sent.'));
$this->redirect("show/index?id=" . $o->getId());
}