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


PHP Invitation::setRoleId方法代码示例

本文整理汇总了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());
 }
开发者ID:br00k,项目名称:yavom,代码行数:42,代码来源:actions.class.php


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