예제 #1
0
                     <a class="bittooltip">Available Points: ' . $points_details['balance_points'] . '<span class="classic" style="font-size:15px;">The total amount of points you have currently available to redeem rewards</span></a> &nbsp&nbsp
                     <a class="bittooltip" href="' . CController::createUrl('pl/home/sa/surveys') . '">Pending Points: ' . $point . '<span class="classic" style="font-size:15px; width:auto">Points associated with studies where we are awaiting validation of your completed survey before we can release those points to Available Points</span></a>';
?>
            </span>
        </h3>
        <p style="display: inline-block">
        <table class="InfoForm" style="width: 95%; margin: 0px auto;">
            <tr>
                <th>Name</th>
                <th>Reward points required for redemption</th>
                <th>Redeem</th>
            </tr>
            <?php 
$row = 0;
$date = date('Y-m-d');
$rewarlist = rewardsview('', $date);
if (count($rewarlist) > 0) {
    foreach ($rewarlist as $val) {
        if ($val['IsActive'] == 1) {
            $row++;
            if ($row / 2 == floor($row / 2)) {
                $cssclass = 'odd';
            } else {
                $cssclass = 'even';
            }
            echo '<tr class="' . $cssclass . '">
                            <td>' . $val['title'] . '</td>
                            <td>' . $val['points'] . '</td>
                            <td>';
            if ($points_details['balance_points'] < $val['points']) {
                echo '<input type="submit" value="Redeem" disabled="disabled">**Insufficient points';
예제 #2
0
 function mod()
 {
     $clang = Yii::app()->lang;
     if (!Permission::model()->hasGlobalPermission('rewards', 'update')) {
         Yii::app()->setFlashMessage($clang->gT("You do not have sufficient rights to access this page."), 'error');
         $this->getController()->redirect(array("admin/index"));
     }
     $action = isset($_POST['action']) ? $_POST['action'] : '';
     $aData = array();
     $aViewUrls = array();
     if (Permission::model()->hasGlobalPermission('', 'create')) {
         if ($action == "editreward") {
             // Project details
             $id = (int) Yii::app()->request->getPost("reward_id");
             $short_title = flattenText($_POST['short_title'], false, true, 'UTF-8', true);
             $title = flattenText($_POST['title'], false, true, 'UTF-8', true);
             $type = flattenText($_POST['type'], false, true, 'UTF-8', true);
             $image = "";
             if (isset($_FILES['image']) && count($_FILES['image']['error']) == 1 && $_FILES['image']['error'][0] > 0) {
                 //file not selected
             } else {
                 if (isset($_FILES['image'])) {
                     //this is just to check if isset($_FILE). Not required.
                     //file selected
                     $random = rand(100, 999);
                     $filename = $random . $_FILES["image"]["name"];
                     move_uploaded_file($_FILES["image"]["tmp_name"], Yii::app()->baseurl . "/upload/images/" . $filename);
                     $image = $filename;
                 }
             }
             $points = (int) $_POST['points'];
             $amount = (int) $_POST['amount'];
             $sorder = flattenText($_POST['sorder'], false, true, 'UTF-8', true);
             $IsActive = flattenText(Yii::app()->request->getPost("IsActive"));
             $is_active = 0;
             if ($IsActive) {
                 $is_active = 1;
             }
             if ($short_title == '') {
                 $aViewUrls['message'] = array('title' => $clang->gT("Failed to Edit Reward"), 'message' => $clang->gT("Reward Title is invalid."), 'class' => 'warningheader');
             } else {
                 $oUser = reward::model()->findbypk($id);
                 $oUser->short_title = $short_title;
                 $oUser->title = $title;
                 $oUser->type = $type;
                 if ($image != "") {
                     $oUser->image = $image;
                 }
                 $oUser->points = $points;
                 $oUser->amount = $amount;
                 $oUser->IsActive = $is_active;
                 $oUser->sorder = $sorder;
                 $oUser->expiration_date = date('Y-m-d', strtotime($_POST['expiration_date']));
                 $oUser->modified_date = Date('y-m-d h:i:s');
                 $NewReward = $oUser->save();
                 if ($NewReward) {
                     Yii::app()->setFlashMessage($clang->gT("Reward Updated successfully"));
                     $this->getController()->redirect(array("admin/rewards/index"));
                 }
             }
         } else {
             if (isset($_POST['id'])) {
                 $aData['row'] = 0;
                 $aData['usr_arr'] = array();
                 // Project detail
                 $id = (int) Yii::app()->request->getPost("id");
                 $action = Yii::app()->request->getPost("action");
                 $sresult = rewardsview($id);
                 // only use in view_editcompany
                 $aData['id'] = $id;
                 $aData['mur'] = $sresult;
                 $this->_renderWrappedTemplate('panellist/rewards', 'editreward_view', $aData);
                 return;
             }
         }
     }
     Yii::app()->setFlashMessage(Yii::app()->lang->gT("You do not have sufficient rights to access this page."), 'error');
     $this->getController()->redirect(array("admin/rewards/index"));
 }