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


PHP TagPeer::isValid方法代码示例

本文整理汇总了PHP中TagPeer::isValid方法的典型用法代码示例。如果您正苦于以下问题:PHP TagPeer::isValid方法的具体用法?PHP TagPeer::isValid怎么用?PHP TagPeer::isValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TagPeer的用法示例。


在下文中一共展示了TagPeer::isValid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: executeInvite

 public function executeInvite($request)
 {
     $user = $this->getUser()->getSubscriber();
     // fetch list of invites already sent by this user and hydrate users
     $this->invites = $user->getInvites();
     $this->wbForm = new InviteWebmailForm(array('provider' => 'yahoo'));
     $this->show_more = false;
     if ($request->isMethod('post')) {
         $this->form = new InviteForm($request->getParameter('invite'));
         if ($request->getParameter('step') == 'step2') {
             $message = trim($request->getParameter('message'));
             // re-validate emails
             $this->form->bind($request->getParameter('invite'));
             if (!$this->form->isValid()) {
                 // not valid, most likely user tried to mess up, so redirect back to invite
                 $this->redirect('@invite');
             }
             $emails = $this->form->getValue("emails");
             $requested = $request->getParameter("chkEmail");
             $jotags = $request->getParameter("jotags");
             $jotag_objects = array();
             // check selected jotags
             if ($jotags) {
                 foreach ($jotags as $tag) {
                     $obj = TagPeer::getFromField(TagPeer::JOTAG, $tag);
                     if ($obj && $obj->getUserId() == $user->getId() && TagPeer::isValid($obj)) {
                         $jotag_objects[] = $obj;
                     }
                 }
             }
             $sent = 0;
             foreach ($emails as $k => $email) {
                 if (!EmailPeer::getFromField(EmailPeer::EMAIL, $email["email"]) && !EmailPeer::getFromField(EmailPeer::ACTUAL_EMAIL, $email["email"])) {
                     if (in_array($k, $requested)) {
                         // create new invite
                         $invite = InvitePeer::newInvite($email, $user, $jotag_objects);
                         // send invite
                         Mailer::sendEmail($email["email"], 'invite', array('user' => $user, 'email' => $email, 'invite' => $invite, 'message' => $message), $this->getUser()->getSubscriber()->getPreferedLanguage());
                         $sent++;
                     }
                 }
             }
             $this->setMessage("SENT", "SUCCESS", $sent);
             $this->redirect('@invite');
         } else {
             $this->form->bind($request->getParameter('invite'));
             if ($this->form->isValid()) {
                 // here we have an already parsed email address
                 $this->emails = $this->form->getValue('emails');
                 $this->user = $user;
                 // check emails already registered in the system
                 $registered_count = 0;
                 $total_emails = 0;
                 foreach ($this->emails as $k => $v) {
                     if (!$v["email"]) {
                         continue;
                     }
                     $total_emails++;
                     if (EmailPeer::getFromField(EmailPeer::EMAIL, $v["email"]) || EmailPeer::getFromField(EmailPeer::ACTUAL_EMAIL, $v["email"])) {
                         $this->emails[$k]["registered"] = true;
                         $registered_count++;
                     } else {
                         $this->emails[$k]["registered"] = false;
                     }
                 }
                 // if all emails are already registered, redirect back to invite page
                 if ($registered_count == $total_emails) {
                     $this->setMessage("ALL_REGISTERED", "SUCCESS");
                     $this->redirect("@invite");
                 }
                 return $this->setTemplate('inviteStep2');
             } else {
                 // error in form, check if we should show extra lines
                 $invites = $request->getParameter('invite');
                 $invites = $invites["emails"];
                 for ($i = 3; $i < 6; $i++) {
                     if (@$invites[$i]["first_name"] || @$invites[$i]["last_name"] || @$invites[$i]["email"]) {
                         $this->show_more = true;
                         break;
                     }
                 }
             }
         }
     } else {
         $this->form = new InviteForm();
     }
 }
开发者ID:psskhal,项目名称:symfony-sample,代码行数:87,代码来源:actions.class.php

示例2: executeManageRequests

 /**
  * Handles manage requests action
  *
  * @param sfWebRequest $request Web request object
  */
 public function executeManageRequests($request)
 {
     $jotag = TagPeer::getFromField(TagPeer::JOTAG, $request->getParameter('jotag'));
     $this->jotag = $jotag;
     $this->forward404Unless($this->jotag && TagPeer::isValid($this->jotag) && $this->jotag->getUser()->getId() == $this->getUser()->getSubscriberId());
     // && ($jotag->getTagPrivacy()->getPrivacyType() == TagPrivacyPeer::PRIVACY_AUTH));
     $this->pending = $jotag->getTagAuthsJoinUser(TagAuthPeer::buildPendingCriteria());
     $this->authorized = $jotag->getTagAuthsJoinUser(TagAuthPeer::buildAuthorizedCriteria());
     $this->denied = $jotag->getTagAuthsJoinUser(TagAuthPeer::buildDeniedCriteria());
 }
开发者ID:psskhal,项目名称:symfony-sample,代码行数:15,代码来源:actions.class.php


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