Beispiel #1
0
function getFundReq($fundReqId, $mcId)
{
    $query = "SELECT * FROM `qaos1_fundreq` WHERE `modulecomponentid` = {$mcId} AND `fundreq_Id` = {$fundReqId}";
    $result = mysql_query($query);
    $row = mysql_fetch_array($result);
    $columnDetail = mysql_query("SHOW COLUMNS FROM `qaos1_fundreq`");
    $ret = array();
    $cnt = 0;
    while ($res = mysql_fetch_array($columnDetail)) {
        $ret[strtoupper($res[0])] = $row[$cnt++];
    }
    return array_merge(assignVars($row[8]), $ret);
}
Beispiel #2
0
function printDisclaimer($mcid, $data, $team)
{
    $updateQuery = "UPDATE `prhospi_accomodation_status` \n                  SET `hospi_printed` = 1 \n                  WHERE `page_modulecomponentid`={$mcid} AND `user_id`={$data}";
    $updateRes = mysql_query($updateQuery) or displayerror(mysql_error());
    global $sourceFolder, $moduleFolder;
    require_once $sourceFolder . "/" . $moduleFolder . "/qaos1/excel.php";
    $displayFn = assignVars($data, $mcid);
    $content = getDisclaimer($team, $mcid);
    //escape quotes
    $content = str_replace("'", "\\'", $content);
    //replace the vars in file content with those defined
    $content = preg_replace('#\\{([a-z0-9\\-_]*?)\\}#is', "' . ((isset(\$displayFn['\\1'])) ? \$displayFn['\\1'] : '') . '", $content);
    //Make the content parseable
    eval("\$content = '{$content}';");
    //  displayinfo($content);
    //get parser done
    //  displayinfo($content);
    return printContent($content);
}
Beispiel #3
0
    public function actionHospihead()
    {
        global $urlRequestRoot, $sourceFolder, $templateFolder, $cmsFolder, $moduleFolder;
        $moduleComponentId = $this->moduleComponentId;
        $scriptsFolder = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/scripts";
        $imagesFolder = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/images";
        require_once "{$sourceFolder}/{$moduleFolder}/prhospi/prhospi_common.php";
        require_once "{$sourceFolder}/{$moduleFolder}/prhospi/accommodation.php";
        require_once $sourceFolder . "/" . $moduleFolder . "/qaos1/excel.php";
        require_once $sourceFolder . "/upload.lib.php";
        if (isset($_GET['subaction']) && $_GET['subaction'] == 'getsuggestions' && isset($_GET['forwhat'])) {
            echo getSuggestionsForIdOrEmail(escape($_GET['forwhat']));
            exit;
        }
        if (isset($_POST['txtFormUserId']) && $_POST['txtFormUserId'] != '') {
            $detailsGiven = explode("- ", escape($_POST['txtFormUserId']));
            deleteAccomodatedUser($detailsGiven[1], $moduleComponentId);
        }
        displayinfo(print_r(assignVars($this->userId, $moduleComponentId), true));
        if (isset($_POST['amountDetail'])) {
            $amt = mysql_real_escape_string($_POST['amountDetail']);
            $insertQuery = "UPDATE `prhospi_disclaimer` SET `team_cost`={$amt} WHERE `page_modulecomponentid`={$this->moduleComponentId} AND ";
            $insertQuery .= "`disclaimer_team`='hospihead'";
            $updateRes = mysql_query($insertQuery) or displayerror(mysql_error());
            if ($updateRes != '') {
                displayinfo("Amount Updated to Rs. {$amt}");
            }
        }
        if (isset($_POST['amountDetail1'])) {
            $amt = mysql_real_escape_string($_POST['amountDetail1']);
            $insertQuery = "UPDATE `prhospi_disclaimer` SET `team_cost`={$amt} WHERE `page_modulecomponentid`={$this->moduleComponentId} AND ";
            $insertQuery .= "`disclaimer_team`='hospihead1'";
            $updateRes = mysql_query($insertQuery) or displayerror(mysql_error());
            if ($updateRes != '') {
                displayinfo("Amount Updated to Rs. {$amt}");
            }
        }
        if (isset($_POST['CKEditor1'])) {
            $editorData = escape($_POST['CKEditor1']);
            $insertQuery = "UPDATE `prhospi_disclaimer` SET `disclaimer_desc`='{$editorData}' WHERE `page_modulecomponentid`={$this->moduleComponentId} ";
            $insertQuery .= "AND `disclaimer_team`='hospihead'";
            $updateRes = mysql_query($insertQuery) or displayerror(mysql_error());
            if ($updateRes != '') {
                displayinfo("Details Successfully updated !!!");
            }
        }
        if (isset($_POST['downloadSampleFormat'])) {
            downloadSampleFormatForRoomUpload();
        }
        if (isset($_FILES['fileUploadField']['name'])) {
            $excelData = readExcelSheet($_FILES['fileUploadField']['tmp_name'][0]);
            $success = 1;
            for ($i = 2; $i <= count($excelData); $i++) {
                for ($j = $excelData[$i][2]; $j <= $excelData[$i][3]; $j++) {
                    if ($excelData[$i][1] == NULL) {
                        continue;
                    }
                    $checkIfExistQuery = "SELECT * FROM `prhospi_hostel` \n                                WHERE `hospi_hostel_name`='{$excelData[$i][1]}' AND \n                                      `hospi_room_no`={$j} AND `page_modulecomponentid`={$moduleComponentId}";
                    $checkIfExistRes = mysql_query($checkIfExistQuery) or displayerror(mysql_error());
                    if (mysql_num_rows($checkIfExistRes)) {
                        $updateFieldQuery = "UPDATE `prhospi_hostel` \n                                 SET `hospi_room_capacity`={$excelData[$i][4]} , `hospi_floor` =  {$excelData[$i][5]}\n                                 WHERE `page_modulecomponentid`={$moduleComponentId} AND \n                                       `hospi_hostel_name`='{$excelData[$i][1]}' AND `hospi_room_no`={$j}";
                        $updateResult = mysql_query($updateFieldQuery) or displayerror(mysql_error());
                        continue;
                    }
                    $insertIntoHospiQuery = "INSERT INTO `prhospi_hostel` (page_modulecomponentid,hospi_hostel_name,hospi_room_capacity,\n                                                                      hospi_room_no,hospi_floor)                                                                                            VALUES ({$moduleComponentId},'{$excelData[$i][1]}',{$excelData[$i][4]},{$j},{$excelData[$i][5]})";
                    $res = mysql_query($insertIntoHospiQuery) or displayerror(mysql_error());
                    if ($res == "") {
                        $success = 0;
                    }
                }
            }
            if (!$success) {
                displayerror("Datas are not inserted");
            }
        }
        $hospiview = "";
        $hospiview .= <<<VIEW
\t<table>
         <a onClick="history.go(-1)">BACK</a><br/>
         <tr>
           <td><a href="./+hospihead&subaction=addRoom"> <div>Add Rooms</div></a></td>
           <td><a href="./+hospihead&subaction=viewStatus"><div>View All Rooms</div></a></td>
           <td><a href="./+hospihead&subaction=ckEditor"><div>Update Disclaimer</div></a></td>
           <td><a href="./+hospihead&subaction=deleteUsers"><div>Delete User in Accomodation</div></a></td>
           <td><a href="./+hospihead&subaction=blockRooms"><div>Block Rooms</div></a></td>
         </tr>
        </table>

VIEW;
        if (isset($_GET['subaction'])) {
            if ($_GET['subaction'] == 'blockRooms') {
                $hospiview .= blockRoom($this->moduleComponentId);
            }
            if ($_GET['subaction'] == 'ckEditor') {
                $hospiview .= $this->getCkBody("", "hospihead");
            } else {
                if ($_GET['subaction'] == 'addRoom') {
                    $fileUploadableForm = getFileUploadForm($this->moduleComponentId, "prhospi", './+hospihead', UPLOAD_SIZE_LIMIT, 1);
                    $hospiview .= <<<ADDROOMFORM
           <br/><br/>
           <form action="./+hospihead" method="post">
               <input type="submit" name="downloadSampleFormat" value="Download Sample Form"><br/>
           </form>
       {$fileUploadableForm}
ADDROOMFORM;
                } else {
                    if ($_GET['subaction'] == 'viewStatus') {
                        $hospiview .= displayRooms($moduleComponentId);
                    } else {
                        if ($_GET['subaction'] == 'deleteUsers') {
                            $deleteUserForm = displayUsersRegisteredToAccoWithDelete($moduleComponentId);
                            $hospiview .= <<<HOSPI
\t  {$deleteUserForm}
<form method="POST" action="./+hospihead">
\t  Enter UserId or Email:<input type="text" name="txtFormUserId" id="txtFormUserId"  autocomplete="off" style="width: 256px" />
\t  <div id="suggestionsBox" style="background-color: white; width: 260px; border: 1px solid black; position: absolute; overflow-y: scroll; max-height: 180px; display: none"></div>
\t  <input type="submit" Value="Find User"/>
\t  <script type="text/javascript" language="javascript" src="{$scriptsFolder}/ajaxsuggestionbox.js">
\t  </script>
\t  <script language="javascript">
\t  var userBox = new SuggestionBox(document.getElementById('txtFormUserId'), document.getElementById('suggestionsBox'), "./+hospihead&subaction=getsuggestions&forwhat=%pattern%");
\tuserBox.loadingImageUrl = '{$imagesFolder}/ajaxloading.gif';
\t</script>
\t</form>
HOSPI;
                        }
                    }
                }
            }
        }
        return $hospiview;
    }