コード例 #1
0
     $rwObj = new rewards();
     $code = $rwObj->fetchRewards($sort, $filter, $currentPage, true, $session->u->eligibility);
     break;
 case 'fetchRewardsPage':
     if (isset($_GET['sort'])) {
         $sort = $_GET['sort'];
     } else {
         $sort = 'default';
     }
     require_once PATH_CORE . "/classes/prizes.class.php";
     $rwObj = new rewards();
     $code = $rwObj->fetchRewardsPage($sort, $currentPage, true, '', $session->u->eligibility);
     break;
 case 'fetchWinners':
     require_once PATH_CORE . "/classes/prizes.class.php";
     $rwObj = new rewards();
     $code = $rwObj->fetchWinners('', $currentPage);
     // hack: wont work w/ custom wherestring
     break;
 case 'hideTip':
     $tip = requestStr('tip');
     require_once PATH_CORE . '/classes/user.class.php';
     $userObj = new UserInfoTable($db);
     $userObj->hideTip($userid, $tip);
     $code = '';
     break;
 case 'log':
     $action = requestStr('action');
     $itemid = requestInt('itemid');
     require_once PATH_CORE . '/classes/log.class.php';
     $logObj = new log($db);
コード例 #2
0
 function fetchRewards()
 {
     require_once PATH_CORE . '/classes/prizes.class.php';
     $rewards = new rewards($this->db);
     $code .= '<h2>Rewards</h2>' . $rewards->fetchRewardsForPublisher('pointCost', 1, false);
     $code .= '<input type="hidden" name="pubType" value="reward">';
     return $code;
 }
コード例 #3
0
    function fetchRewards($mode = 'random', $limit = 3)
    {
        if (!ENABLE_ACTION_REWARDS) {
            return '';
        }
        $modes = array('latest', 'grand', 'thisWeek', 'featured');
        $titles = array('Latest Rewards', 'Grand Prizes', 'This Week\'s Rewards', 'Featured Rewards');
        if ($mode == 'random') {
            $x = rand(0, 3);
            $mode = $modes[$x];
            $title = $titles[$x];
        }
        require_once PATH_CORE . '/classes/prizes.class.php';
        $rewards = new rewards($this->db);
        switch ($mode) {
            case 'latest':
                $code .= $rewards->fetchRewardsPanelList('dateStart', 1, $this->session->u->eligibility);
                break;
            case 'grand':
                $code .= $rewards->fetchRewardsPanelList('pointCost', 1, 'WHERE isGrand=1', $this->session->u->eligibility);
                break;
            case 'thisWeek':
                $code .= $rewards->fetchRewardsPanelList('pointCost', 1, 'WHERE isWeekly=1', $this->session->u->eligibility);
                break;
            default:
            case 'featured':
                $code .= $rewards->fetchRewardsPanelList('pointCost', 3, 'WHERE isFeatured=1', $this->session->u->eligibility);
                break;
        }
        $code = '<div class="list_rewards">' . $code . '</div>';
        $code = '<div class="panelBar clearfix">
	            <h2>' . $title . '</h2>
	            <div class="bar_link">' . $this->buildLink('rewards', 'See all', true, $inTeam) . '</div>
	        </div>' . $code;
        $code = '<div class="panel_2 clearfix">' . $code . '</div>';
        return $code;
    }
コード例 #4
0
    function fetchRewardPanel()
    {
        $this->templateObj->registerTemplates(MODULE_ACTIVE, 'rewards');
        // reward base page
        $inside .= '<div id="alltimeLeaderRewardHead">
			<div id="rewardsHead">
					<div class="panel_half float_left">
							<div class="storyBlockWrap">
							  <p>' . $this->templateObj->templates['leaderRewardAlltimeOverview'] . '</p>
								
							</div><!--end "storyBlockWrap"-->
					    </div><!--end "panel_half"-->
						<div class="panel_half float_right">' . $this->templateObj->templates['GrandPrize'] . '</div><!--end "panel_half"-->
				</div><!--end "rewardsHead"-->
			</div>';
        require_once PATH_CORE . '/classes/prizes.class.php';
        $rewards = new rewards($this->db);
        $pt = new PrizeTable($this->db);
        $weeklyPrizeList = $pt->getWeeklyPrizesByDate("NOW()", 'RAND()');
        $weeklyPrizeIds = array_keys($weeklyPrizeList);
        $id = $weeklyPrizeIds[0];
        // just show one prize for now
        //foreach ($weeklyPrizeIds as $id)
        $weekly .= '<div id="leaderWeeklyRewardBlock">' . $rewards->fetchRewardDetail($id, true, true) . '</div>';
        // bit of  a hack
        // this one hidden by default since thats the default state on page fetch
        $inside .= '<div id="weeklyLeaderRewardHead" class="hidden">
			<div id="rewardsHead">
					<div class="panel_half float_left">
							<div class="storyBlockWrap">
							  <p>' . $this->templateObj->templates['leaderRewardWeeklyOverview'] . '</p>								
								</div><!--end "storyBlockWrap"-->
					    </div><!--end "panel_half"-->
						<div class="panel_half float_right">
						
							' . $weekly . '</div><!--end "panel_half"-->
				</div><!--end "rewardsHead"-->
			</div>';
        return $inside;
    }
コード例 #5
0
    function fetch($mode = 'fullPage')
    {
        // build the prizes page
        if (isset($_GET['currentPage'])) {
            $currentPage = $_GET['currentPage'];
        } else {
            $currentPage = 1;
        }
        if (isset($_GET['id'])) {
            $id = $_GET['id'];
        } else {
            $id = NULL;
        }
        if (isset($_GET['step'])) {
            $step = $_GET['step'];
        } else {
            $step = NULL;
        }
        if (isset($_GET['message'])) {
            $message = $_GET['message'];
        } else {
            $message = '';
        }
        if ($_GET['debug']) {
            echo '<pre>' . print_r($_GET, true) . '</pre>';
        }
        require_once PATH_FACEBOOK . '/classes/actionTeam.class.php';
        $this->teamObj = new actionTeam($this->page);
        $tabs .= $this->teamObj->buildSubNav('rewards');
        $inside = '<div id="col_left"><!-- begin left side -->';
        require_once PATH_CORE . '/classes/prizes.class.php';
        $rewards = new rewards($this->db);
        require_once PATH_CORE . '/classes/prizes.class.php';
        $pt = new PrizeTable($this->db);
        $prize = $pt->getRowObject();
        if ($step == 'submit') {
            $id = $_POST['prizeid'];
        }
        if (!$id || !$prize->load($id)) {
            $inside .= 'Error: cannot redeem a prize with no id specified';
        } else {
            $inside .= $rewards->fetchRewardDetail($id, true);
            if ($step != 'submit') {
                if (!$this->checkOrderPossible(&$prize, &$this->page->session->u, &$this->page->session->ui, $message)) {
                    $inside .= $this->page->buildMessage('error', "There is a problem redeeming this prize", $message);
                } else {
                    // order form
                    $inside .= $this->buildOrderForm(&$prize, &$this->page->session->u, &$this->page->session->ui);
                }
            } else {
                // repopulate form with get vars
                $user =& $this->page->session->u;
                $userinfo =& $this->page->session->ui;
                //$user->email = $_GET['email'];
                $uipostfields = array('address1', 'address2', 'city', 'state', 'phone', 'zip');
                //echo '<pre>'.print_r($_POST, true). '</pre>';
                foreach ($uipostfields as $field) {
                    if (isset($_POST[$field])) {
                        $userinfo->{$field} = $_POST[$field];
                    }
                }
                $userinfo->update();
                // sync updated address info to database
                //echo '<pre>'.print_r($userinfo, true). '</pre>';
                $message = '';
                if (!$this->validateOrderFields($prize, $user, $userinfo, $message)) {
                    $inside .= $this->page->buildMessage('error', "There was a problem with your submission", $message);
                    $inside .= $this->buildOrderForm(&$prize, &$this->page->session->u, &$this->page->session->ui);
                } else {
                    // success
                    $orderid = $this->processPrizeOrder($prize->id, $user->userid, $message);
                    // TODO: make this function a bit faster by using whats stored in the session
                    if (!$orderid) {
                        $inside .= $this->page->buildMessage('error', "There was a problem redeeming this prize", $message);
                    } else {
                        $inside .= $this->page->buildMessage('success', "Order received", $message);
                        require_once PATH_FACEBOOK . '/pages/pageOrders.class.php';
                        $orders = new pageOrders($this->page);
                        $inside .= '<div class="panel_1">' . '<div class="panelBar clearfix">
								<h2>Order Details</h2>
								<div class="bar_link"><a href="?p=orders" onclick="setTeamTab(\'orders\'); return false;">See all</a></div>
								</div><!__end "panelBar"__>' . $orders->fetchOrderDetail($orderid) . '</div><!-- end panel_1 -->';
                    }
                }
            }
        }
        $inside .= '</div><!-- end left side --><div id="col_right">';
        $inside .= $this->teamObj->fetchSidePanel('challenges');
        $inside .= '</div> <!-- end right side -->';
        //$inside.='<input type="hidden" id="pagingFunction" value="fetchChallenges">';
        if ($mode == 'teamWrap') {
            return $inside;
        }
        $inside = $tabs . '<div id="teamWrap">' . $inside . '<!-- end teamWrap --></div>';
        if ($this->page->isAjax) {
            return $inside;
        }
        $code = $this->page->constructPage('team', $inside, '');
        return $code;
    }
コード例 #6
0
 function fetchSummaryPage($textOnly = false)
 {
     require_once PATH_CORE . '/classes/prizes.class.php';
     $rewards = new rewards($this->db);
     if (!$textOnly) {
         $currentPage = 1;
         $inside .= '<h1>Summary of ' . SITE_TITLE . ' ' . SITE_TEAM_TITLE . ' Rewards</h1>';
         $inside .= '<a name="ingroup" />';
         /* REDEEM: $inside.='<h1>Rewards available to in-group members</h1> 
         					<a href="#outgroup">See rewards available to out-group members</a>';
         		
         			$inside.='<h5>Redeemable with Earned Points</h5><p>Eligible action team members can redeem their points for these rewards. Points turned in for prizes are not subtracted from your totals for weekly, grand and runners-up prizes.</p>';		
         			$inside.=$rewards->fetchRewards('pointCost','redeemable', $currentPage,true, 
         												'team');
         			*/
         /* REDEEM:
         			$inside.='<h5>Weekly Rewards</h5><p>These will be given to the top eligible participants for a specified week during the life of the Action Team period.</p>';													
         			$inside.=$rewards->fetchRewards('pointCost','weekly', $currentPage,true, 
         												'team');
         			*/
         $inside .= '<h5>Weekly Rewards</h5>' . '<p>These will be given to the top eligible participants for a specified week during the life of the ' . SITE_TEAM_TITLE . ' contest.';
         'The top scorer(s) will receive the first reward on the left; next-highest scoring members receive the next reward, etc.</p>';
         $inside .= $this->fetchWeeklyPrizeSchedule();
         $inside .= '<h5>Grand and Runners-up Rewards</h5><p>These will be awarded to the top eligible participants at the end of the ' . SITE_TEAM_TITLE . ' contest.</p>';
         $inside .= $rewards->fetchRewards('dollarValue', 'grand', $currentPage, true, 'team');
         /* REDEEM:
         			$inside.='<a name="outgroup" />';
         			$inside.='<h1>Rewards available to out-group members</h1>
         				<a href="#ingroup">See rewards available to in-group members</a>';
         			
         			$inside.='<h2>Redeemable</h2>';		
         			$inside.=$rewards->fetchRewards('pointCost','redeemable', $currentPage,true, 
         												'general');
         				
         			$inside.='<h2>Weekly</h2>';													
         			$inside.=$rewards->fetchRewards('pointCost','weekly', $currentPage,true, 
         												'general');
         												
         			$inside.='<h2>Grand and Runner-up</h2>';													
         			$inside.=$rewards->fetchRewards('pointCost','grand', $currentPage,true, 
         												'general');
         		*/
     } else {
         // build bloggable text summary of rewards available
         require_once PATH_CORE . '/classes/template.class.php';
         $this->templateObj = new template($this->db);
         $this->templateObj->registerTemplates(MODULE_ACTIVE, 'rewards');
         $temp .= '<h2>Grand and Runners-up Rewards</h2><p>These will be awarded to the top eligible participants at the end of the ' . SITE_TEAM_TITLE . ' contest.</p>';
         $prizeList = $this->templateObj->db->query("SELECT SQL_CALC_FOUND_ROWS * FROM Prizes WHERE isGrand>0 ORDER BY dollarValue DESC ;");
         if ($this->templateObj->db->countQ($prizeList) > 0) {
             $temp .= $this->templateObj->mergeTemplate($this->templateObj->templates['rewardList'], $this->templateObj->templates['rewardItemTextFinal']);
         }
         $temp .= '<h2>Weekly Rewards</h2>' . '<p>These will be given to the top eligible participants for a specified week during the life of the ' . SITE_TEAM_TITLE . ' contest.';
         'The top scorer(s) will receive the first reward on the left; next-highest scoring members receive the next reward, etc.</p>';
         $prizeList = $this->templateObj->db->query("SELECT SQL_CALC_FOUND_ROWS *,DATE_FORMAT(dateEnd, '%c/%e') AS shortDateEnd FROM Prizes WHERE isWeekly=1 ORDER BY dateEnd ASC, dollarValue DESC;");
         if ($this->templateObj->db->countQ($prizeList) > 0) {
             $temp .= $this->templateObj->mergeTemplate($this->templateObj->templates['rewardList'], $this->templateObj->templates['rewardItemTextWeekly']);
         }
         $inside .= $temp;
         $this->templateObj->cacheContent('rewardListText', $temp);
     }
     return $inside;
 }