コード例 #1
0
ファイル: qaos1.lib.php プロジェクト: ksb1712/pragyan
    public function actionHead()
    {
        global $urlRequestRoot, $moduleFolder, $cmsFolder, $templateFolder, $sourceFolder, $STARTSCRIPTS;
        require_once $sourceFolder . "/" . $moduleFolder . "/qaos1/qaos_common.php";
        require_once $sourceFolder . "/upload.lib.php";
        require_once $sourceFolder . "/" . $moduleFolder . "/qaos1/excel.php";
        $mcid = $this->moduleComponentId;
        if (isset($_POST['downloadFormatExcel'])) {
            displayEventFormatExcel();
        }
        if (isset($_FILES['fileUploadField']['name'])) {
            $date = date_create();
            $timeStamp = date_timestamp_get($date);
            $tempVar = $sourceFolder . "/uploads/temp/" . $timeStamp . $_FILES['fileUploadField']['name'][0];
            move_uploaded_file($_FILES["fileUploadField"]["tmp_name"][0], $tempVar);
            $excelData = readExcelSheet($tempVar);
            $success = 1;
            for ($i = 2; $i <= count($excelData); $i++) {
                if ($excelData[$i][1] == NULL) {
                    continue;
                }
                $checkIfExistQuery = "SELECT * FROM `qaos1_events` WHERE `events_name`='{$excelData[$i][1]}' AND `page_modulecomponentid`={$mcid}";
                $checkIfExistRes = mysql_query($checkIfExistQuery) or displayerror(mysql_error());
                if (mysql_num_rows($checkIfExistRes)) {
                    continue;
                }
                $insertIntoEventTableQuery = "INSERT IGNORE INTO `qaos1_events` (events_name,page_modulecomponentid) VALUES ('{$excelData[$i][1]}',{$mcid})";
                $res = mysql_query($insertIntoEventTableQuery) or displayerror(mysql_error());
                if ($res == "") {
                    $success = 0;
                }
            }
            if (!$success) {
                displayerror("Datas are not inserted");
            }
        }
        if (isset($_POST['uploadEventName'])) {
        }
        if (isset($_POST['hid'])) {
            $_POST["hid2"] = addslashes($_POST["hid2"]);
            $_POST["hid1"] = addslashes($_POST["hid1"]);
            $_POST["hid"] = addslashes($_POST["hid"]);
            if ($_POST["hid"] < 3 && $_POST["hid"] >= 0) {
                if ($_POST["hid"] != 2 || $_POST["hid1"] != "") {
                    $query = "update qaos1_evtproc set evtproc_Status = '{$_POST["hid"]}',evtproc_Desc ='{$_POST["hid1"]}' where evtproc_Id ='{$_POST["hid2"]}' AND modulecomponentid={$this->moduleComponentId}";
                    $res = mysql_query($query);
                }
            }
        }
        if (isset($_GET['subaction']) && $_GET['subaction'] == "apFundReq" && isset($_POST['qhid'])) {
            $_POST["qhid2"] = addslashes($_POST["qhid2"]);
            $_POST["qhid1"] = addslashes($_POST["qhid1"]);
            $_POST["qhid"] = addslashes($_POST["qhid"]);
            if ($_POST["qhid"] < 3 && $_POST["qhid"] >= 0) {
                if ($_POST["qhid"] != 2 || $_POST["qhid1"] != "") {
                    $query = "update qaos1_fundreq set fundreq_Status = '{$_POST["qhid"]}',fundreq_Desc ='{$_POST["qhid1"]}' where fundreq_Id ='{$_POST["qhid2"]}' AND modulecomponentid={$this->moduleComponentId}";
                    $res = mysql_query($query);
                }
            }
        }
        $query = "SELECT * FROM qaos1_evtproc WHERE modulecomponentid={$this->moduleComponentId}";
        $res = mysql_query($query);
        $query1 = "SELECT * FROM qaos1_fundreq WHERE modulecomponentid={$this->moduleComponentId}";
        $res1 = mysql_query($query1);
        $css1 = $urlRequestRoot . "/" . $cmsFolder . "/" . $moduleFolder . "/qaos1/styles/main.css";
        $smarttablestuff = smarttable::render(array('table_evtprocrequest', 'table_fundreqform', 'table_eventproc_head', 'table_funreq_head'), null);
        $STARTSCRIPTS .= "initSmartTable();";
        $headaction = <<<AB
\t\t  {$smarttablestuff}
\t\t\t\t<link href="{$css1}" rel="stylesheet">

\t     \t  \t    <script type="text/javascript">
\t     \t     \t       function qaosproc(a)
                       \t\t{
\t\t\t\t\tvar k=document.getElementById("status"+a+"1");
\t\t     \t\t\tvar k1=document.getElementById("status"+a+"2");
\t\t     \t\t\tif(k.checked) document.getElementById("hid"+a).value=1;
\t\t     \t\t\telse if(k1.checked) document.getElementById("hid"+a).value=2;
\t\t     \t\t\telse {alert("select any one of button");return false;}
\t\t     \t\t\tdocument.getElementById("hi1d"+a).value=document.getElementById("description"+a).value;
\t\t\t\t
\t\t\t\t\t\$.ajax({
\t\t\t\t\ttype: "POST",
\t\t\t\t  \turl: "./+head&subaction=apEventProc",
\t\t\t\t  \tdata: "hid="+\$("#hid"+a).val()+"&hid1="+\$("#hi1d"+a).val()+"&hid2="+\$("#hi2d"+a).val()
\t\t\t      \t\t});
\t\t\t\t
\t\t\t\t\t\$("#tr"+a).css({'display':'none'});      
\t     \t\t\t\treturn false;
\t\t\t\t}
\t\t\t       function qaosfund(a)
       \t\t       \t\t{
\t\t\t\t\tvar k=document.getElementById("qstatus"+a+"1");
       \t\t\t\t\tvar k1=document.getElementById("qstatus"+a+"2");
      \t\t\t\t\tif(k.checked) document.getElementById("qhid"+a).value=1;
       \t\t\t\t\telse if(k1.checked) document.getElementById("qhid"+a).value=2;
      \t\t\t\t\telse {alert("select any one of button");return false;}
\t\t       \t\t\tdocument.getElementById("qhi1d"+a).value=document.getElementById("qdescription"+a).value;
\t\t\t\t\t
\t\t\t\t\t\$.ajax({
\t\t\t\t\ttype: "POST",
\t\t\t\t  \turl: "./+head&subaction=apFundReq",
\t\t\t  \t\tdata: "qhid="+\$("#qhid"+a).val()+"&qhid1="+\$("#qhi1d"+a).val()+"&qhid2="+\$("#qhi2d"+a).val()
\t\t\t      \t\t});
\t\t\t\t\t
\t\t\t\t\t\$("#trf"+a).css({'display':'none'});      
\t     \t\t\t\treturn false;
\t\t\t       }
 \t        \t   </script>
\t\t\t   <script type="text/javascript">
  \t\t \t   \t   \$(document).ready(function() 
\t         \t\t   \t{
\t\t\t\t\t\$(".forms").css({'display':'none'});
\t\t\t\t\t\$(".buttons").css({'display':'block'});
\t\t\t\t\t\$("#dheadfundreq").css({'display':'block'});
\t\t\t\t\t\$("#bhead_evtproc").click(function()
\t\t\t\t\t\t{
\t\t\t\t\t\t\tdispevtproc();
\t\t\t\t\t\t});
\t\t\t\t\t\$("#bhead_fundreq").click(function()
\t\t\t\t\t\t{
\t\t\t\t\t\t\tdispfundreq();
\t\t\t\t\t\t});
\t\t\t\t\t\t\t\t
\t\t\t\t\t\$("#bformevt").click(function(){
\t\t\t\t\t\tdispevtform();
\t\t\t\t\t});
\t            \t\t       \$("#bformfund").click(function(){
\t\t\t\t\t\tdispfundform();
\t\t\t\t \t\t});
\t            \t\t       \$("#bhead_evtUpload").click(function(){
\t\t\t\t\t   dispEventUploadForm();
\t\t\t\t\t });

     \t\t\t\t\tfunction dispevtproc()
       \t\t \t\t \t {
\t\t\t\t\t\t\$(".forms").css({'display':'none'});
\t\t\t\t\t\t\$("#dheadeventproc").css({'display':'block'});
\t\t\t\t\t }
\t\t\t\t\tfunction dispfundreq()
\t\t \t\t \t {
\t\t\t\t\t\t\$(".forms").css({'display':'none'});
\t\t\t\t\t\t\$("#dheadfundreq").css({'display':'block'});
\t\t\t       \t\t }
\t\t\t\t\tfunction dispevtform()
\t\t\t\t    \t {
\t\t\t\t\t\t\$(".forms").css({'display':'none'});
\t\t\t\t\t\t\$("#formevt").css({'display':'block'});
\t\t\t\t\t }
\t\t\t            \t function dispfundform()
\t\t\t\t    \t  {
\t\t\t\t\t\t\$(".forms").css({'display':'none'});
\t\t\t\t\t\t\$("#formfund").css({'display':'block'});
\t\t\t\t\t  }
\t\t\t\t\t function dispEventUploadForm() 
\t\t\t\t\t {
\t\t\t\t\t   \$(".forms").css({'display':'none'});
\t\t\t\t\t   \$("#formEvtName").css({'display':'block'});
\t\t\t\t\t }
\t\t\t\t\t\$("#dheadeventproc").css({'width':'100%'});
\t\t\t\t\t\$("#dheadfundreq").css({'width':'100%'});
\t\t\t\t\$(".viewbuttons").css({'height':'25px'});

\t\t\t\t\t});\t 
       \t\t\t</script>
\t\t\t<div id="buttonsDiv" class="viewButtonsDiv">
\t   \t\t<input type="button" id="bformevt" class="viewbuttons" value="Event procurement "/>
\t    \t\t<input type="button" id="bformfund" value="Fund" class="viewbuttons" />
      \t\t\t<input type="button" id="bhead_evtproc" value="Event procurement details" class="viewbuttons" />
      \t\t\t<input type="button" id="bhead_fundreq" value="Fund details" class="viewbuttons" />
\t\t\t<input type="button" id="bhead_evtUpload" value="Upload Event Name" class="viewbuttons" />
    
      \t\t</div>
\t\t\t<div id="formevt" class="forms">
     \t\t\t\t<h2>Event Procurement Request</h2>

      \t\t\t<table class="qaostables display" id="table_evtprocrequest" width="100%" border="1">
\t\t\t\t<thead><tr>
\t\t\t\t\t<th>EVENT NAME</th>
\t\t\t\t\t<th>ITEM</th>
\t\t\t\t\t<th>QUANTITY</th>
\t\t\t\t\t<th>REASON</th>
\t\t\t\t\t<th>STATUS</th>
 \t\t\t\t\t<th>DEADLINE</th>
\t\t\t\t\t<th>ADDED BY</th>
\t\t\t\t\t<th>DESCRIPTION</th>
\t\t\t\t\t<th>SUBMIT</th>
\t\t\t\t</tr></thead>
AB;
        while ($result = mysql_fetch_array($res)) {
            $event = $result['evtproc_Id'];
            $userName = getUserName($result['userid']);
            if ($result['evtproc_Status'] == 0) {
                $status = 0;
            } else {
                $status = 1;
            }
            if ($status == 0) {
                $headaction .= <<<AB
\t        \t\t\t      <tr id="tr{$event}" >
\t \t\t\t     \t  <td>{$result["evtproc_name"]}</td>
\t \t\t\t\t\t  <td>{$result['evtproc_Request']}</td>
\t \t\t\t\t\t  <td>{$result['evtproc_Quantity']}</td>
\t\t\t\t\t\t  <td>{$result['evtproc_reason']}</td>
\t\t\t\t\t\t  <td>
\t\t\t\t\t\t\t<input type="radio" name="status{$event}" id="status{$event}1" value="1">ACCEPT<br/ >
\t \t\t\t\t\t  \t<input type="radio" name="status{$event}" id="status{$event}2" value="2">Decline<br/>
\t\t\t\t\t\t  </td>
\t\t\t\t\t\t  <td>{$result['evtproc_date']}</td>
\t\t\t\t\t\t   <td>{$userName}</td>\t\t\t\t   
\t\t\t\t\t\t  <td><textarea id="description{$event}"></textarea></td>
\t\t\t\t\t\t  <td>
\t\t\t\t\t\t\t<form action="./+head&subaction=apEventProc" method="post" onsubmit="return qaosproc({$event})">
\t\t\t\t\t\t\t      <input type="hidden" value="" id="hid{$event}" name="hid">
\t\t\t\t\t\t\t      <input type="hidden" value="{$event}" id="hi2d{$event}" name="hid2">
\t\t\t\t\t\t\t      <input type="hidden" value="" id="hi1d{$event}" name="hid1">
\t\t\t\t\t\t\t      <input type="submit" value="submit">
\t\t\t\t\t\t\t</form>
\t\t\t\t\t\t   </td>
\t\t\t\t\t     </tr>
AB;
            }
        }
        $headaction .= <<<AB
\t\t     \t   </table>
\t\t\t\t   </div>
\t\t\t\t   <div id="formfund" class="forms">
\t\t   \t\t<h2>Fund request</h2>
\t\t\t\t   \t<table class="qaostables display" id="table_fundreqform" border="1" width="100%">
\t\t\t\t\t <thead>   <tr>
\t\t\t\t\t\t<th>EVENT NAME</th>
\t\t\t\t\t\t<th>ITEM</th>
\t\t\t\t\t\t<th>QUANTITY</th>
\t\t\t\t\t\t<th>AMOUNT</th>
\t\t\t\t\t\t<th>REASON</th>
\t\t\t\t\t\t<th>STATUS</th>
\t\t\t\t\t\t<th>DEADLINE</th>
\t\t                                <th>ADDED BY</th>
\t\t\t\t\t\t<th>DESCRIPTION</th>
\t\t                                <th>SUBMIT</th>
\t\t\t\t\t    </tr></thead>
AB;
        while ($result1 = mysql_fetch_array($res1)) {
            $event1 = $result1['fundreq_Id'];
            $userName = getUserName($result1['userid']);
            if ($result1['fundreq_Status'] == 0) {
                $status1 = 0;
            } else {
                $status1 = 1;
            }
            if ($status1 == 0) {
                $headaction .= <<<AB
\t     \t\t\t\t\t      <tr id="trf{$event1}">
\t   \t\t\t\t\t     <td>{$result1["fundreq_name"]}</td>
\t    \t\t\t\t\t\t  <td>{$result1['fundreq_Request']}</td>
\t    \t\t\t\t\t\t  <td>{$result1['fundreq_Quantity']}</td>
\t   \t\t\t\t\t\t  <td>{$result1["fundreq_Amount"]}</td>
\t   \t\t\t\t\t\t  <td>{$result1["fundreq_reason"]}</td>
\t   \t\t\t\t\t\t  <td>
\t\t\t\t\t\t\t\t<input type="radio" name="qstatus{$event1}" id="qstatus{$event1}1" value="1">ACCEPT<br/ >
\t  \t\t\t\t\t\t\t<input type="radio" name="qstatus{$event1}" id="qstatus{$event1}2" value="2">Decline<br/>
\t\t\t\t\t\t\t  </td>
\t\t\t\t\t\t\t\t  <td>{$result1["fundreq_date"]}</td>
  \t\t\t\t\t\t\t          <td>{$userName}</td>\t\t
\t   \t\t\t\t\t\t  <td><textarea id="qdescription{$event1}"></textarea></td>
\t  \t\t\t\t\t\t  <td>
\t\t\t\t\t\t\t\t<form action="./+head&&subaction=apFundReq" method="post" onsubmit="return qaosfund({$event1})">
\t\t\t\t\t\t\t  \t       <input type="hidden" value="" id="qhid{$event1}" name="qhid">
\t \t\t\t\t\t\t\t       <input type="hidden" value="{$event1}" id="qhi2d{$event1}" name="qhid2">
\t \t\t\t\t\t\t\t       <input type="hidden" value=""     id="qhi1d{$event1}" name="qhid1">
\t \t\t\t\t\t\t\t       <input type="submit" value="submit">
\t\t\t\t\t\t\t  \t</form>
\t\t\t\t\t\t\t  </td>
\t\t\t\t\t\t       </tr>
AB;
            }
        }
        $headaction .= <<<AB
\t\t\t\t\t\t</table>
\t\t\t\t\t \t</div>
\t\t\t\t\t\t<div class="headdisplay" id="headdisplayevt">
AB;
        $hist1 = "SELECT *FROM qaos1_evtproc WHERE modulecomponentid={$this->moduleComponentId}";
        $res = mysql_query($hist1);
        $headaction .= <<<AB
\t \t    <div id="dheadeventproc" class="forms">
\t\t\t\t\t<h2>Event Procurement Status</h2>\t       \t    \t
\t       \t   <table id="table_eventproc_head" class="display"border="1" width="100%" class="qaostables">
\t       \t\t    <thead><tr>
\t\t\t\t\t\t<th>ITEM</th>
\t\t\t\t\t\t<th>QUANTITY</th>
\t\t\t\t\t\t<th>EVENT NAME</th>
\t\t\t\t\t\t<th>REASON</th>\t\t\t\t  \t\t
 \t\t\t\t  \t\t<th>STATUS</th>
\t\t                                <th>ADDED BY</th>
\t\t\t\t  \t\t<th>DEADLINE</th>
\t\t\t\t  \t\t<th>DESCRIPTION</th>
\t\t\t\t\t </tr></thead>
AB;
        while ($result = mysql_fetch_array($res)) {
            $userName = getUserName($result['userid']);
            if ($result['evtproc_Status'] == 0) {
                $status = "Pending";
            } else {
                if ($result['evtproc_Status'] == 1) {
                    $status = "Accepted By QA";
                } else {
                    if ($result['evtproc_Status'] == 2) {
                        $status = "Decline";
                    } else {
                        if ($result['evtproc_Status'] == 3) {
                            $status = "Accepted By OC";
                        }
                    }
                }
            }
            $headaction .= <<<AB
\t\t\t\t   <tr class="tr{$result['evtproc_Status']}">
\t\t\t\t       <td>{$result['evtproc_Request']}</td>
\t\t\t\t       <td>{$result['evtproc_Quantity']}</td>
\t\t\t\t        <td>{$result['evtproc_name']}</td>
\t\t\t\t       <td>{$result['evtproc_reason']}</td>\t\t\t\t       
\t\t\t\t       <td>{$status}</td>
\t\t\t\t\t<td>{$userName}</td>\t\t
\t\t\t\t       <td>{$result['evtproc_date']}</td>
\t\t\t\t       <td>{$result['evtproc_Desc']}</td>
\t\t\t \t   </tr>
AB;
        }
        $headaction .= <<<AB
          </table></div>
\t\t\t<div  class="forms" id="dheadfundreq">
\t\t\t<h2>Fund Request Status</h2>
\t\t      <table id="table_funreq_head" class="display"border="1" width="100%" class="qaostables">
\t\t\t   <thead>
\t\t\t    <tr>
\t\t\t\t     <th>ITEM</th>
\t\t\t\t     <th>QUANTITY</th>
\t\t\t\t     <th>EVENT NAME</th>
\t\t\t\t     <th>Reason</th>
\t\t\t\t     <th>STATUS</th>
                                     <th>ADDED BY</th>
\t\t\t\t     <th>DEADLINE</th>
\t\t\t\t     <th>DESCRIPTION</th>
 \t\t\t     </tr></thead>
AB;
        $hist2 = "SELECT *  FROM qaos1_fundreq WHERE modulecomponentid={$this->moduleComponentId}";
        $res1 = mysql_query($hist2);
        while ($result1 = mysql_fetch_array($res1)) {
            $userName = getUserName($result1['userid']);
            if ($result1['fundreq_Status'] == 0) {
                $status1 = "Pending";
            } else {
                if ($result1['fundreq_Status'] == 1) {
                    $status1 = "Accepted by QA";
                } else {
                    if ($result1['fundreq_Status'] == 2) {
                        $status1 = "Decline";
                    } else {
                        if ($result1['fundreq_Status'] == 3) {
                            $status1 = "collect the amt from treasurer";
                        }
                    }
                }
            }
            $headaction .= <<<AB
\t\t\t\t<tr class="tr{$result1['fundreq_Status']}">
        \t\t\t\t<td>{$result1['fundreq_Request']}</td>
\t\t\t\t\t<td>{$result1['fundreq_Quantity']}</td> 
\t\t\t\t\t<td>{$result1['fundreq_name']}</td> 
\t\t\t\t\t<td>{$result1['fundreq_reason']}</td> 
\t\t\t\t\t<td>{$status1}</td>
\t\t\t\t\t<td>{$userName}</td>\t\t
\t\t\t\t\t<td>{$result1['fundreq_date']}</td>
\t\t\t\t\t<td>{$result1['fundreq_Desc']}</td>
\t\t\t\t</tr>
AB;
        }
        $uploadEventName = getFileUploadForm($this->moduleComponentId, "qaos1", './+head', UPLOAD_SIZE_LIMIT, 1);
        $headaction .= <<<AB
\t  </table></div>
\t  <div  class="forms" id="formEvtName">
\t         <h2>Upload Event Details</h2>
\t   <form action="./+head" method="post">
\t      <input type="submit" name="downloadFormatExcel" value="Download Event Sample Format"/>
\t   </form>
\t     {$uploadEventName}
          
\t   </div>



AB;
        return $headaction;
    }
コード例 #2
0
ファイル: events_common.php プロジェクト: ksb1712/pragyan
function syncExcelFileWorkshop($pmcId, $workshopId, $fileLoc)
{
    $excelData = readExcelSheet($fileLoc);
    for ($i = 1; $i <= count($excelData); $i++) {
        for ($j = 1; $j <= count($excelData[$i]); $j++) {
            $userPid = $excelData[$i][$j];
            if ($userPid[0] == 'F' || $userPid[0] == 'f') {
                $userPid = getUserIdFromBookletId($userPid, $pmcId);
            }
            if (!empty($excelData[$i][$j])) {
                $checkDuplicateQuery = "SELECT `user_id` FROM `events_workshop_participants` WHERE `page_moduleComponentId`='{$pmcId}' AND `workshop_id`='{$workshopId}' AND `user_id`='{$userPid}'";
                $checkDuplicateRes = mysql_query($checkDuplicateQuery) or displayerror(mysql_error());
                if (mysql_num_rows($checkDuplicateRes) == 0) {
                    $saveUserIdQuery = "INSERT INTO `events_workshop_participants`(`page_moduleComponentId`,`workshop_id`,`user_id`,`user_team_id`) VALUES('{$pmcId}','{$workshopId}','{$userPid}','{$i}')";
                    $saveUserIdRes = mysql_query($saveUserIdQuery) or displayerror(mysql_error());
                }
            }
        }
    }
}
コード例 #3
0
ファイル: oc.lib.php プロジェクト: ksb1712/pragyan
    public function actionOchead()
    {
        global $urlRequestRoot, $moduleFolder, $cmsFolder, $templateFolder, $sourceFolder, $STARTSCRIPTS;
        require_once $sourceFolder . "/upload.lib.php";
        require_once $sourceFolder . "/" . $moduleFolder . "/qaos1/excel.php";
        require_once $sourceFolder . "/" . $moduleFolder . "/oc/oc_common.php";
        $mcId = $this->moduleComponentId;
        $userId = $this->userId;
        if (isset($_POST['downloadFormatExcel'])) {
            displayOCDownload();
        }
        if (isset($_FILES['fileUploadField']['name'])) {
            $date = date_create();
            $timeStamp = date_timestamp_get($date);
            $tempVar = $sourceFolder . "/uploads/temp/" . $timeStamp . $_FILES['fileUploadField']['name'][0];
            move_uploaded_file($_FILES["fileUploadField"]["tmp_name"][0], $tempVar);
            $excelData = readExcelSheet($tempVar);
            $success = 1;
            for ($i = 2; $i <= count($excelData); $i++) {
                $email = $excelData[$i][2] . '@nitt.edu';
                $query = "INSERT IGNORE INTO `oc_valid_emails` (`page_moduleComponentId`,`oc_name`,`oc_valid_email`) \n                                            VALUES ({$mcId},'{$excelData[$i][1]}','{$email}')";
                mysql_query($query) or displayerror($email);
            }
            //echo $c." ".$d;
        }
        $retOcHead = "";
        $uploadValidEmail = getFileUploadForm($mcId, "oc", './+ochead', UPLOAD_SIZE_LIMIT, 1);
        $retOcHead .= <<<FORM
    <form action="./+ochead" method="post">
      <input type="submit" name="downloadFormatExcel" value="Download Event Sample Format"/>
    </form>
FORM;
        $retOcHead .= $uploadValidEmail;
        $displayTags = <<<TAG
    <table>
      <tr>
        <td><a href="./+ochead&subaction=view_whitelist_users"> <div>View Whitelist Registrants</div></a></td>
        <td><a href="./+ochead&subaction=view_registered_users"><div>Registred Users</div></a></td>
        <td><a href="./+ochead&subaction=add_whitelist_email"><div>Add Whitelist Email</div></a></td>
        <td><a href="./+ochead&subaction=availability"><div>Check Availability</div></a></td>
        <td><a href="./+ochead&subaction=reg_status"><div>Current Registration Status</div></a></td>
        <td><a href="./+ochead&subaction=reg_status"><div>Current Registration Status</div></a></td>
        <td><a href="./+ochead&subaction=upload_tshirt_list"><div>Upload TShirt List</div></a></td>
        <td><a href="./+ochead&subaction=download_black_list"><div>Download Black List</div></a></td>
      </tr>
    </table>
TAG;
        if (isset($_GET['subaction']) && $_GET['subaction'] == 'view_registered_users') {
            return $retOcHead . $displayTags . view_registered_users($mcId);
        }
        if (isset($_GET['subaction']) && $_GET['subaction'] == 'view_whitelist_users') {
            return $retOcHead . $displayTags . view_whitelist_emails($mcId);
        }
        if (isset($_GET['subaction']) && $_GET['subaction'] == 'add_whitelist_email') {
            return $retOcHead . $displayTags . add_whitelist_email($mcId);
        }
        if (isset($_GET['subaction']) && $_GET['subaction'] == 'availability') {
            return $retOcHead . $displayTags . availability($mcId);
        }
        if (isset($_GET['subaction']) && $_GET['subaction'] == 'reg_status') {
            return $retOcHead . $displayTags . reg_status($mcId);
        }
        if (isset($_GET['subaction']) && $_GET['subaction'] == 'upload_tshirt_list') {
            return $retOcHead . $displayTags . upload_tshirt_list($mcId);
        }
        if (isset($_GET['subaction']) && $_GET['subaction'] == 'download_black_list') {
            return $retOcHead . $displayTags . download_black_list($mcId);
        }
        return $retOcHead . $displayTags . view_registered_users($mcId);
    }
コード例 #4
0
ファイル: prhospi.lib.php プロジェクト: ksb1712/pragyan
    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;
    }
コード例 #5
0
ファイル: oc_common.php プロジェクト: ksb1712/pragyan
function upload_tshirt_list($mcId)
{
    global $sourceFolder, $moduleFolder;
    require_once $sourceFolder . "/" . $moduleFolder . "/qaos1/excel.php";
    if (isset($_FILES['uploadTShirtDetail']['name'][0])) {
        $date = date_create();
        $timeStamp = date_timestamp_get($date);
        $tempVar = $sourceFolder . "/uploads/temp/" . $timeStamp . $_FILES['uploadTShirtDetail']['name'][0];
        move_uploaded_file($_FILES["uploadTShirtDetail"]["tmp_name"][0], $tempVar);
        $excelData = readExcelSheet($tempVar);
        $success = 1;
        for ($i = 2; $i <= count($excelData); $i++) {
            $name = $excelData[$i][1];
            $rollNumber = $excelData[$i][2];
            $tsize = $excelData[$i][3];
            if ($tsize == '') {
                $tsize = 'N';
            }
            $query = "INSERT IGNORE INTO `oc_form_reg` (`page_modulecomponentid`,`name`,`amount`,`user_id`,`Tshirt_size`,`updated_time`,`oc_roll_no`) \n                                 VALUES ('{$mcId}','{$name}','700','0','{$tsize}',NOW(),'{$rollNumber}')";
            mysql_query($query) or displayerror(mysql_error());
            //      $query = "UPDATE `oc_form_reg` SET Tshirt_size='{$tsize}' WHERE page_modulecomponentid='{$mcId}' AND oc_roll_no='{$rollNumber}'";
            // mysql_query($query) or displayerror(mysql_error());
        }
    }
    $uploadValidEmail = getFileUploadForm($mcId, "oc", './+ochead&subaction=upload_tshirt_list', false, 1, 'uploadTShirtDetail');
    return $uploadValidEmail;
}