Example #1
0
    public function actionQahead()
    {
        global $urlRequestRoot, $sourceFolder, $templateFolder, $cmsFolder, $moduleFolder;
        $moduleComponentId = $this->moduleComponentId;
        $userId = $this->userId;
        require_once "{$sourceFolder}/{$moduleFolder}/events/events_common.php";
        require_once "{$sourceFolder}/{$moduleFolder}/events/events_forms.php";
        require_once "{$sourceFolder}/{$moduleFolder}/events/events.config.php";
        require_once $sourceFolder . "/" . $moduleFolder . "/qaos1/excel.php";
        require_once $sourceFolder . "/upload.lib.php";
        if (isset($_GET['subaction'])) {
            if ($_GET['subaction'] == "viewEvent") {
                if (isset($_POST['eventId'])) {
                    $eventId = escape($_POST['eventId']);
                    return displayEventOptions('qahead', $moduleComponentId, $eventId);
                }
            } else {
                if ($_GET['subaction'] == 'getParticipant') {
                    if (isset($_POST['eventId'])) {
                        $eventId = escape($_POST['eventId']);
                        $userId = escape($_POST['userId']);
                        $eventAdd = "<p>SEARCH RESULTS </p>";
                        if ($userId[0] == 'F' || $userId[1] == 'f') {
                            $bookletId = $userId;
                            $userId = getUserIdFromBookletId($moduleComponentId, $userId);
                        } else {
                            if ($userId > 200000 && $userId < 30000) {
                                $userId -= 180000;
                            }
                            $bookletId = getBookletIdFromUserId($userId, $moduleComponentId);
                        }
                        $eventAdd .= searchParticipant('qahead', $pmcId, 1);
                        $eventAdd .= "<h2>Profile</h2>";
                        $eventAdd .= returnUserProfileDetails($userId);
                        $eventAdd .= "<h2>PR & Hospi Details</h2>";
                        $eventAdd .= "<table><tr style='font-size:10px'>";
                        $eventAdd .= "<th>PR CHECK IN TIME</th>";
                        $eventAdd .= "<th>PR CHECK OUT TIME</th>";
                        $eventAdd .= "<th>AMOUNT RECIEVED AT PR</th>";
                        $eventAdd .= "<th>AMOUNT REFUNDED AT PR</th>";
                        $eventAdd .= "<th>HOSPI CHECK IN TIME</th>";
                        $eventAdd .= "<th>HOSPI CHECK OUT TIME</th>";
                        $eventAdd .= "<th>AMOUNT RECIEVED AT HOSPI</th>";
                        $eventAdd .= "<th>AMOUNT REFUNDED AT HOSPI</th>";
                        $eventAdd .= "<th>No. of days of stay</th></tr>";
                        $prStatus = "SELECT * FROM `prhospi_pr_status` WHERE `user_id`='{$userId}' and `page_moduleComponentId`={$moduleComponentId}";
                        $prQuery = mysql_query($prStatus) or displayerror(mysql_error());
                        $prRows = mysql_fetch_array($prQuery);
                        $checkintime_pr = $prRows['hospi_checkin_time'];
                        $checkoutime_pr = $prRows['hospi_checkpout_time'];
                        $amount_recieved_pr = $prRows['amount_recieved'];
                        $amount_refunded_pr = $prRows['amount_refunded'];
                        $HospiStatus = "SELECT * FROM `prhospi_accomodation_status` WHERE `user_id`='{$userId}' and `page_modulecomponentid`={$moduleComponentId}";
                        $HospiQuery = mysql_query($HospiStatus) or displayerror(mysql_error());
                        $HospiRows = mysql_fetch_array($HospiQuery);
                        $checkintime_hospi = $HospiRows['hospi_actual_checkin'];
                        $checkoutime_hospi = $HospiRows['hospi_actual_checkout'];
                        $amount_recieved_hospi = $HospiRows['hospi_cash_recieved'];
                        $amount_refunded_hospi = $HospiRows['hospi_cash_refunded'];
                        $no_of_days = $HospiRows['no_of_days'];
                        $hospi_room_id = $HospiRows['hospi_room_id'];
                        $eventAdd .= "<td>" . $checkintime_pr . "</td>";
                        $eventAdd .= "<td>" . $checkoutime_pr . "</td>";
                        $eventAdd .= "<td>" . $amount_recieved_pr . "</td>";
                        $eventAdd .= "<td>" . $amount_refunded_pr . "</td>";
                        $eventAdd .= "<td>" . $checkintime_hospi . "</td>";
                        $eventAdd .= "<td>" . $checkoutime_hospi . "</td>";
                        $eventAdd .= "<td>" . $amount_recieved_hospi . "</td>";
                        $eventAdd .= "<td>" . $amount_refunded_hospi . "</td>";
                        $eventAdd .= "<td>{$no_of_days}</td>";
                        $eventAdd .= "</tr></table>";
                        $hostelQuery = "SELECT * FROM `prhospi_hostel` WHERE `hospi_room_id`={$hospi_room_id} and `page_modulecomponentid`={$moduleComponentId}";
                        $hostelQueryResult = mysql_query($hostelQuery) or displayerror(mysql_error());
                        $hostelDetails = mysql_fetch_array($hostelQueryResult);
                        $eventAdd .= "<h2>Hostel Details</h2>";
                        $eventAdd .= "<table>";
                        $eventAdd .= "<th>HOSTEL</th>";
                        $eventAdd .= "<th>FLOOR</th>";
                        $eventAdd .= "<th>ROOM</th>";
                        $eventAdd .= "<tr>";
                        $eventAdd .= "<td>{$hostelDetails['hospi_hostel_name']}</td>";
                        $eventAdd .= "<td>{$hostelDetails['hospi_floor']}</td>";
                        $eventAdd .= "<td>{$hostelDetails['hospi_room_no']}</td>";
                        $eventAdd .= "</tr>";
                        $eventAdd .= "</table>";
                        $eventAdd .= "<h2>Event Details</h2>";
                        $eventAdd .= "<table><tr>";
                        $eventAdd .= "<th>EVENT</th>";
                        $eventAdd .= "<th>EVENT RANK</th>";
                        $eventAdd .= "<th>PRIZE MONEY</th>";
                        $eventAdd .= "<th>TEAMMATES </th>";
                        $userDetails = "SELECT * FROM `events_result`  WHERE `user_id`='{$userId}' and `page_moduleComponentId`={$moduleComponentId}";
                        $userDetailsRows = mysql_query($userDetails) or displayerror(mysql_error());
                        while ($row = mysql_fetch_array($userDetailsRows)) {
                            $eventAdd .= "<tr>";
                            $eventDetails = "SELECT * FROM `events_details` WHERE `event_id`='{$row['event_id']}'";
                            $eventResults = mysql_query($eventDetails) or displayerror(mysql_error());
                            $eventsResults = mysql_fetch_array($eventResults);
                            $eventAdd .= "<td>" . $eventsResults['event_name'] . "</td>";
                            $eventAdd .= "<td>" . $row['user_rank'] . "</td>";
                            $userPrizeDetails = "SELECT * FROM `events_participants` WHERE `user_pid`='{$userId}' ";
                            $userPrizeQuery = mysql_query($userPrizeDetails) or displayerror(mysql_error());
                            $userPrizeRows = mysql_fetch_array($userPrizeQuery);
                            $eventAdd .= "<td>" . $userPrizeRows['prize_money'] . "</td>";
                            $teamMateDetails = "SELECT * FROM `events_participants` WHERE `user_pid`='{$userId}' and `event_id` ='{$row['event_id']}'";
                            displayerror($teamMateDetails);
                            $teamMateQuery = mysql_query($teamMateDetails) or displayerror(mysql_error);
                            $teamMateDetails = mysql_fetch_assoc($teamMateQuery);
                            $teamMates = $teamMateDetails['user_team_id'];
                            $teamMateDetails = "SELECT * FROM `events_participants` WHERE `user_team_id`={$teamMates}  and `event_id` ='{$row['event_id']}'";
                            $teamMateQuery = mysql_query($teamMateDetails) or displayerror(mysql_error);
                            $eventAdd .= "<td>";
                            while ($newRow = mysql_fetch_array($teamMateQuery)) {
                                $eventAdd .= $newRow['user_pid'] . "  ";
                            }
                            $eventAdd .= "</td>";
                        }
                        $eventAdd .= "</table>";
                        return $eventAdd;
                    }
                } else {
                    if ($_GET['subaction'] == 'addParticipant') {
                        if (isset($_POST['eventId'])) {
                            $eventId = escape($_POST['eventId']);
                            $fileUploadableField = getFileUploadField('fileUploadFieldPart', "events");
                            $eventAdd = <<<FORM
                        <p>Upload Event Excel File:</p>
           <form action="./+qahead&subaction=viewEvent" method="post" enctype='multipart/form-data'>
           {$fileUploadableField}
           <input type='hidden' name='eventId' value='{$eventId}'>
           <input type='submit' name='submit' value='Upload'>
           </form>
FORM;
                            return $eventAdd;
                        }
                    } else {
                        if ($_GET['subaction'] == "editParticipant") {
                            $editFormId = escape($_POST['formId']);
                            $editUserId = escape($_POST['userId']);
                            $teamId = escape($_POST['teamId']);
                            $rowValue = escape($_POST['rowValue']);
                            $rowId = escape($_POST['rowId']);
                            $eventId = escape($_POST['eventId']);
                            if (!empty($userId)) {
                                //return $rowId;
                                echo editParticipant('qahead', $moduleComponentId, $eventId, $editFormId, $editUserId, $teamId, $rowValue, $rowId);
                                die;
                            }
                        } else {
                            if ($_GET['subaction'] == "lockEvent") {
                                $eventId = trim(escape($_POST['eventId']));
                                if (!empty($eventId)) {
                                    return lockEvent($moduleComponentId, $eventId);
                                }
                            } else {
                                if ($_GET['subaction'] == 'unlockEvent') {
                                    $eventId = trim(escape($_POST['eventId']));
                                    if (!empty($eventId)) {
                                        return unlockEvent($moduleComponentId, $eventId);
                                    }
                                } else {
                                    if ($_GET['subaction'] == "downloadExcel") {
                                        //$eventId = escape($_POST['eventId']);
                                        //error_log($eventId);
                                        //getUserDetailsTable($moduleComponentId,$eventId);
                                        getUserDetailsTable('qahead', $moduleComponentId, escape($_GET['event_id']));
                                    } else {
                                        if ($_GET['subaction'] == "deleteParticipant") {
                                            $userId = escape($_POST['userId']);
                                            $eventId = escape($_POST['eventId']);
                                            return deleteParticipant($moduleComponentId, $userId, $eventId);
                                        } else {
                                            if ($_GET['subaction'] == "deleteEvent") {
                                                $eventId = escape($_POST['eventId']);
                                                return deleteEventQa($moduleComponentId, $eventId);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            /*else if($_GET['subaction'] == "getDetails"){
            			if(isset($_POST['eventId'])){
            				$eventId = escape($_POST['eventId']);
            				return 
            			}
            		}*/
        } else {
            //return displayQa($moduleComponentId);
            return qaHeadOptions($moduleComponentId);
        }
    }
Example #2
0
function displayEventOptions($gotoaction, $pmcId, $eventId)
{
    global $cmsFolder, $moduleFolder, $urlRequestRoot, $sourceFolder;
    $scriptFolder = "{$urlRequestRoot}/{$cmsFolder}/{$moduleFolder}/events";
    $eventDetails = <<<SCRIPT
    <script src="{$scriptFolder}/events.js"></script>
    <script src="{$scriptFolder}/jquery.js"></script>
SCRIPT;
    if (isset($_FILES['fileUploadFieldPart']['name'])) {
        displaywarning("Query Here");
        syncExcelFile($pmcId, $eventId, $_FILES['fileUploadFieldPart']['tmp_name'][0]);
    }
    if (isset($_FILES['fileUploadField']['name'])) {
        syncExcelFile($pmcId, $eventId, $_FILES['fileUploadField']['tmp_name'][0]);
    }
    if ($gotoaction == 'qa') {
        $eventDetails .= displayQa($pmcId) . '<br/><br/><h2>' . getEventName($pmcId, $eventId) . '</h2>';
        $eventDetails .= searchParticipant($gotoaction, $pmcId, $eventId);
    } else {
        if ($gotoaction == 'qahead') {
            $eventDetails .= qaHeadOptions($pmcId) . '<br/><br/>asdasdasd<h2>' . getEventName($pmcId, $eventId) . '</h2>';
            $checkLockedQuery = "SELECT `event_id` FROM `events_locked` WHERE `page_moduleComponentId`='{$pmcId}' AND `event_id`='{$eventId}'";
            $checkLockedRes = mysql_query($checkLockedQuery) or displayerror(mysql_error());
            if (mysql_num_rows($checkLockedRes) > 0) {
                $eventDetails .= <<<FORM
            <br/><p>Event Locked</p>
            <table><tr><td>
            <a href='./+{$gotoaction}&subaction=downloadExcel&event_id={$eventId}'>Download Details</a></td><td>
            <form method='POST' action='./+qahead&subaction=unlockEvent' onsubmit='return unlockConfirm();'>
            <input type='hidden' value='{$eventId}' name='eventId'>
            <input type='submit' id='lockButton' value='UNLOCK EVENT'>
            </form></td></tr></table>
FORM;
                return $eventDetails;
            }
        }
    }
    /*if(isset($_FILES['fileUploadField']['name'])){
      syncExcelFile($pmcId,$eventId,$_FILES['fileUploadField']['tmp_name'][0]);
    }*/
    $checkParticipantsQuery = "SELECT `user_pid` FROM `events_participants` WHERE `page_moduleComponentId`='{$pmcId}' AND `event_id`='{$eventId}' LIMIT 1";
    $checkParticipantsRes = mysql_query($checkParticipantsQuery) or displayerror(mysql_error());
    if (mysql_num_rows($checkParticipantsRes) == 0) {
        //Show FileUpload Details
        $fileUploadableField = getFileUploadField('fileUploadField', "events");
        $eventDetails .= <<<ADDROOMFORM
       <!--<br/><br/>
       <form action="./+{$gotoaction}&subaction=viewEvent" method="post">
            <input type="submit" name="downloadSampleFormat" value="Download Sample Form"><br/>
       </form>-->
       <p>Upload Event Excel File:</p>
       <form action="./+{$gotoaction}&subaction=viewEvent" method="post" enctype='multipart/form-data'>
       {$fileUploadableField}
       <input type='hidden' name='eventId' value='{$eventId}'>
       <input type='submit' name='submit' value='Upload'>
       </form>
ADDROOMFORM;
    } else {
        $eventDetails .= <<<PRINTTABLE
    <table><tr><td>
    <a href='./+{$gotoaction}&subaction=downloadExcel&event_id={$eventId}'>Download Details</a>
    </td><td>
    <form method="POST" action='./+{$gotoaction}&subaction=lockEvent' onsubmit='return lockConfirm();'>
    <input type='hidden' value='{$eventId}' name='eventId'>
    <input type='submit' id='lockButton' value='LOCK EVENT'>
    </form></td></tr>
    <!--<button onclick="downloadDetails('{$gotoaction}',{$eventId})" value='Download Details'>Download Details</button>-->
PRINTTABLE;
        //$downloadTable = getUserDetailsTable($pmcId,$eventId);
        //$eventDetails.=displayExcelForTable($downloadTable);
        if ($gotoaction == 'qahead' && mysql_num_rows($checkLockedRes) == 0) {
            $eventDetails .= deleteEventForm($pmcID, $eventId);
            $eventDetails .= addParticipant($gotoaction, $pmcId, $eventId);
            $eventDetails .= searchParticipant($gotoaction, $pmcId, $eventId);
        }
        if ($gotoaction == 'qa' && mysql_num_rows($checkLockedRes) == 0) {
            $eventDetails .= addParticipant($gotoaction, $pmcId, $eventId);
        }
        $eventParticipants = displayEventParticipants($gotoaction, $pmcId, $eventId);
        //displayExcelForTable($eventParticipants);
        $eventDetails .= $eventParticipants;
    }
    return $eventDetails;
}