コード例 #1
0
ファイル: BaseShoutPeer.php プロジェクト: rayku/rayku
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(ShoutPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(ShoutPeer::DATABASE_NAME);
         $criteria->add(ShoutPeer::ID, $pks, Criteria::IN);
         $objs = ShoutPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
コード例 #2
0
ファイル: BaseShout.php プロジェクト: rayku/rayku
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = ShoutPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setPosterId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setRecipientId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setCreatedAt($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setContent($arr[$keys[4]]);
     }
 }
コード例 #3
0
ファイル: actions.class.php プロジェクト: rayku/rayku
    /**
     * Action to handle getting a confirmation code. Confirms user and spits out
     * a success page if the code checks out... spits out an error page otherwise
     */
    public function executeConfirmUser()
    {
        $user = UserPeer::doSelectFromConfirmationCode($this->getRequestParameter('code'));
        if (!$user) {
            $newCode = $this->getRequestParameter('code');
            $oC = new Criteria();
            $oC->add(UserPeer::ID, "SHA1(CONCAT(user.password, 'salt', user.id)) = '{$newCode}'", Criteria::CUSTOM);
            $oC->add(UserPeer::TYPE, '1');
            $userCheck = UserPeer::doSelectOne($oC);
            if (!$userCheck) {
                return sfView::ERROR;
            }
        }
        if ($user) {
            $user->setTypeConfirmed();
            $user->save();
        }
        if ($user) {
            $this->getUser()->signIn($user);
        } else {
            $this->getUser()->signIn($userCheck);
        }
        if ($kinkarsoUser) {
            if ($user) {
                $query = mysql_query("select * from  shout where recipient_id=" . $user->getId() . " and  poster_id=" . $kinkarsoUser->getId() . "") or die(mysql_error());
                if (mysql_num_rows($query) == 0) {
                    ShoutPeer::createWelcomeComment($user, $kinkarsoUser);
                }
            }
            $subject = 'Here\'s how to start tutoring on Rayku';
            if ($user) {
                $body = 'Hey ' . $user->getName() . ', welcome to Rayku.com!<br><br>';
            }
            $body .= 'Thanks for joining our community!<br><br>

                Before you get started, there are 3 important steps before you can start tutoring!<br><br>
                1) Activated your tutor status by clicking \'on\' in your <a href="' . sfConfig::get('app_rayku_url') . '/dashboard">dashboard page</a>.<br>
                2) Important: Learn how to tutor on Rayku in 10 minutes by watching our <a href="' . sfConfig::get('app_rayku_url') . '/tutorshelp">tutor help videos</a>.<br>
                3) Prepare to receive question notifications by connecting to our <strong><a href="' . sfConfig::get('app_notification_bot_url') . '/download/rayku.dmg">MacOS</a> / <a href="http://notification-bot.rayku.com/download/rayku.exe">Windows</a> notification software</strong>, <a href="http://rayku.com/dashboard/gtalk">google talk</a> and <a href="http://rayku.com/dashboard/facebook">facebook chat</a>.<br><br>

                Enjoy, and do let us know if you ever have any questions - we\'re here to help!<br><br>

                Thanks!<br>
                Rayku Administration';
            $currentuser = $kinkarsoUser;
            //Send the message
            if ($user) {
                $currentuser->sendMessage($user->getId(), $subject, $body);
            }
        }
        $this->forward('regtutor', 'profile');
    }
コード例 #4
0
ファイル: User.php プロジェクト: rayku/rayku
 function createShoutFor($recipient, $content)
 {
     ShoutPeer::createComment($recipient, $this, $content);
 }
コード例 #5
0
ファイル: BaseUser.php プロジェクト: rayku/rayku
 /**
  * Returns the number of related Shout objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      PropelPDO $con
  * @return     int Count of related Shout objects.
  * @throws     PropelException
  */
 public function countShoutsRelatedByRecipientId(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(UserPeer::DATABASE_NAME);
     } else {
         $criteria = clone $criteria;
     }
     if ($distinct) {
         $criteria->setDistinct();
     }
     $count = null;
     if ($this->collShoutsRelatedByRecipientId === null) {
         if ($this->isNew()) {
             $count = 0;
         } else {
             $criteria->add(ShoutPeer::RECIPIENT_ID, $this->id);
             $count = ShoutPeer::doCount($criteria, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // the following code is to determine if a new query is
             // called for.  If the criteria is the same as the last
             // one, just return count of the collection.
             $criteria->add(ShoutPeer::RECIPIENT_ID, $this->id);
             if (!isset($this->lastShoutRelatedByRecipientIdCriteria) || !$this->lastShoutRelatedByRecipientIdCriteria->equals($criteria)) {
                 $count = ShoutPeer::doCount($criteria, $con);
             } else {
                 $count = count($this->collShoutsRelatedByRecipientId);
             }
         } else {
             $count = count($this->collShoutsRelatedByRecipientId);
         }
     }
     return $count;
 }