Ejemplo n.º 1
0
 private function getRequestedUserType()
 {
     $allowedTypes = array(UserPeer::getTypeFromValue('user'), UserPeer::getTypeFromValue('expert'));
     $requestedType = $this->getRequestParameter('utype');
     if (in_array($requestedType, $allowedTypes)) {
         return $requestedType;
     }
     return UserPeer::getTypeFromValue('user');
 }
Ejemplo n.º 2
0
    private function sendBestResponseMessage($post)
    {
        $user = UserPeer::retrieveByPK($post->getPosterId());
        $thread = ThreadPeer::retrieveByPK($post->getThreadId());
        $cats = CategoryPeer::getForExpertCategoryUserId($user->getId());
        $cat_tab = array();
        foreach ($cats as $cat) {
            $cat_tab[] = $cat->getName();
        }
        $cat_list = join(', ', $cat_tab);
        if ($user->getType() == UserPeer::getTypeFromValue('expert')) {
            $subject = 'Best Response Selected';
            $body = 'Hi ' . $user->getName() . ',<br><br>
          Your reply to the question, "' . $thread->getTitle() . '" on the question boards, was just selected as the best response.<br><br>
		  Rayku SYS';
            //Grab the user object
            $currentuser = UserPeer::retrieveByPK($this->getUser()->getRaykuUserId());
            //Send the messages
            $currentuser->sendMessage($user->getId(), $subject, $body);
        } else {
            $subject = 'Best Response Selected';
            $body = 'Hi ' . $user->getName() . ',<br><br>
          Congratulations! Your reply to the question, "' . $thread->getTitle() . '" on the question boards, was just selected as the best response.<br><br>
          Your expert score has been increased accordingly.<br><br>
		  Thanks!<br>
		  Rayku SYS';
            //Grab the user object
            $currentuser = UserPeer::retrieveByPK($this->getUser()->getRaykuUserId());
            //Send the messages
            $currentuser->sendMessage($user->getId(), $subject, $body);
        }
        $sub1 = 'You have selected an Expert Best Response';
        $body1 = 'Hi ' . $this->getUser()->getRaykuUser()->getName() . ',<br><br>
      Thank you for selecting a best response for your question. The author of the response is ' . $user->getName() . ', who is an expert in the following subjects: <br>
	  ' . $cat_list . '<br><br>
      ' . $user->getName() . ' has been teaching avid learners with Rayku since ' . $user->getCreatedAt('Y-m-d') . '. Take a look at the following link, for information on spending an 1-on-1 session with ' . $user->getName() . ':<br><br>
	  <a href="' . sfConfig::get('app_rayku_url') . '/expertmanager/portfolio/' . $user->getUsername() . '">http://www.rayku.com/expertmanager/portfolio/' . $user->getUsername() . '</a><br><br>
	  Rayku SYS';
        //Grab the user object
        $expertuser = UserPeer::retrieveByPK($user->getId());
        //Send the messages
        $expertuser->sendMessage($this->getUser()->getRaykuUserId(), $sub1, $body1);
    }
Ejemplo n.º 3
0
?>
 </div>
          <div style="font-weight:normal;color:#666;width:200px;margin-left:240px;">6 characters or more</div>
          <div class="spacer"></div>
        </div>
      </div>
      <div class="bottom"></div>
      <div class="spacer"></div>
    </div>
    <?php 
//include_partial('registerCreditCard');
//include_partial('registerRefferal');
?>
    <!-- for expert categories //-->
    <?php 
if ($requestedUserType == UserPeer::getTypeFromValue('expert')) {
    ?>
    <div class="box">
      <div class="top"></div>
      <div class="content">
        <div class="title">Select Expert Categories</div>
        <div class="subtitle">Every expert needs to select atleast one category (You may select multiple categories using the shift button)</div>
        <div class="entry">
          <div class="ttle">Categories</div>
          <div style="clear:left;">
            <?php 
    $options = array();
    ?>
            <?php 
    $categories = CategoryPeer::getAll();
    ?>
Ejemplo n.º 4
0
 protected function setUserTypeCredentials($userType)
 {
     $credentials = array();
     switch ($userType) {
         case UserPeer::getTypeFromValue('admin'):
             $credentials[] = 'admin';
             break;
         case UserPeer::getTypeFromValue('expert'):
             $credentials[] = 'expert';
             break;
         case UserPeer::getTypeFromValue('user'):
             $credentials[] = 'student';
             break;
     }
     $this->clearCredentials();
     $this->addCredentials($credentials);
 }