コード例 #1
0
ファイル: awards.php プロジェクト: mined-gatech/hubzero-cms
 /**
  * Mark an entry as opted out
  *
  * @return  mixed
  */
 public function award()
 {
     if (!$this->uid) {
         return NULL;
     }
     $opts = new ModIncrementalRegistrationOptions();
     $awardPer = $opts->getAwardPerField();
     $fieldMap = array('name' => 'Fullname', 'orgtype' => 'Employment', 'organization' => 'Organization', 'countryorigin' => 'Citizenship', 'countryresident' => 'Residency', 'gender' => 'Sex', 'url' => 'URL', 'reason' => 'Reason', 'race' => 'Race', 'phone' => 'Phone', 'disability' => 'Disability');
     $alreadyComplete = 0;
     $eligible = array();
     $newAmount = 0;
     $completeSql = 'UPDATE `#__profile_completion_awards` SET edited_profile = 1';
     $optedOut = NULL;
     foreach ($this->awards as $k => $complete) {
         if ($k === 'opted_out') {
             $optedOut = $complete;
             continue;
         }
         if ($complete) {
             continue;
         }
         if ($k === 'picture') {
             self::$dbh->setQuery('SELECT picture FROM `#__xprofiles` WHERE uidNumber = ' . $this->uid);
             if (self::$dbh->loadResult()) {
                 $completeSql .= ', ' . $k . ' = 1';
                 $alreadyComplete += $awardPer;
             } else {
                 $eligible['picture'] = 1;
             }
             continue;
         }
         $regField = $fieldMap[$k];
         if ((bool) $this->profile->get($k)) {
             $completeSql .= ', ' . $k . ' = 1';
             $alreadyComplete += $awardPer;
         } else {
             $eligible[$k == 'url' ? 'web' : $k] = 1;
         }
     }
     self::$dbh->setQuery('SELECT SUM(amount) AS amount FROM `#__users_transactions` WHERE type = \'deposit\' AND category = \'registration\' AND uid = ' . $this->uid);
     $prior = self::$dbh->loadResult();
     self::$dbh->setQuery($completeSql . ' WHERE user_id = ' . $this->uid);
     self::$dbh->execute();
     if ($alreadyComplete) {
         self::$dbh->setQuery('SELECT COALESCE((SELECT balance FROM `#__users_transactions` WHERE uid = ' . $this->uid . ' AND id = (SELECT MAX(id) FROM `#__users_transactions` WHERE uid = ' . $this->uid . ')), 0)');
         $newAmount = self::$dbh->loadResult() + $alreadyComplete;
         $BTL = new \Hubzero\Bank\Teller(self::$dbh, $this->uid);
         $BTL->deposit($alreadyComplete, 'Profile completion award', 'registration', 0);
     }
     return array('prior' => $prior, 'new' => $alreadyComplete, 'eligible' => $eligible, 'opted_out' => $optedOut);
 }
コード例 #2
0
ファイル: default.php プロジェクト: mined-gatech/hubzero-cms
}
?>

	<?php 
if ($isUser && $isIncrementalEnabled) {
    $awards = new ModIncrementalRegistrationAwards($this->profile);
    $awards = $awards->award();
    $increm = '<div id="award-info">';
    $increm .= '<p>' . Lang::txt('PLG_MEMBERS_PROFILE_INCREMENTAL_OFFERING_POINTS', Route::url('index.php?option=com_store')) . '</p>';
    if ($awards['prior']) {
        $increm .= '<p>' . Lang::txt('PLG_MEMBERS_PROFILE_INCREMENTAL_AWARDED_POINTS', $awards['prior']) . '</p>';
    }
    if ($awards['new']) {
        $increm .= '<p>' . Lang::txt('PLG_MEMBERS_PROFILE_INCREMENTAL_EARNED_POINTS', $awards['new']) . '</p>';
    }
    $increm .= '<p>' . Lang::txt('PLG_MEMBERS_PROFILE_INCREMENTAL_EARN_MORE_POINTS', $incrOpts->getAwardPerField(), Route::url('index.php?option=com_store'), Route::url('index.php?option=com_answers'), Route::url('index.php?option=com_wishlist')) . '</p>';
    $increm .= '</div>';
    $increm .= '<div id="wallet"><span>' . ($awards['prior'] + $awards['new']) . '</span></div>';
    $increm .= '<script type="text/javascript">
							window.bonus_eligible_fields = ' . json_encode($awards['eligible']) . ';
							window.bonus_amount = ' . $incrOpts->getAwardPerField() . ';
						</script>';
    echo $increm;
    $this->js('incremental', 'com_members');
}
?>

	<?php 
if (isset($update_missing) && in_array("usageAgreement", array_keys($update_missing))) {
    ?>
		<div id="usage-agreement-popup">