コード例 #1
0
ファイル: events.lib.php プロジェクト: ksb1712/pragyan
 public function actionPrhead()
 {
     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'] == 'viewEventList') {
             return displayPr('prhead', $moduleComponentId);
         }
         if ($_GET['subaction'] == "viewEvent") {
             $eventId = trim(escape($_POST['eventId']));
             if (!empty($eventId)) {
                 return viewEventResult('prhead', $moduleComponentId, $eventId);
             }
         } else {
             if ($_GET['subaction'] == "downloadExcel") {
                 //$eventId = escape($_POST['eventId']);
                 //error_log($eventId);
                 //getUserDetailsTable($moduleComponentId,$eventId);
                 return getUserDetailsTable('prhead', $moduleComponentId, escape($_GET['event_id']));
             } else {
                 if ($_GET['subaction'] == 'unlockEvent') {
                     $eventId = trim(escape($_POST['eventId']));
                     if (!empty($eventId)) {
                         return unlockEvent($moduleComponentId, $eventId);
                     }
                 } else {
                     if ($_GET['subaction'] == 'viewWorkshopList') {
                         return getWorkshopsList($moduleComponentId);
                     } else {
                         if ($_GET['subaction'] == 'viewWorkshopDetails') {
                             $workshopId = escape($_POST['workshopId']);
                             return viewWorkshopDetails($workshopId, $moduleComponentId);
                         } else {
                             if ($_GET['subaction'] == "downloadExcel") {
                                 //$eventId = escape($_POST['eventId']);
                                 //error_log($eventId);
                                 //getUserDetailsTable($moduleComponentId,$eventId);
                                 return getWorkshopDetailsTable($moduleComponentId, escape($_GET['workshop_id']));
                             } else {
                                 if ($_GET['subaction'] == "editParticipant") {
                                     $editFormId = escape($_POST['formId']);
                                     $editUserId = escape($_POST['userId']);
                                     $rowValue = escape($_POST['rowValue']);
                                     $teamId = escape($_POST['teamId']);
                                     $rowId = escape($_POST['rowId']);
                                     $workshopId = escape($_POST['eventId']);
                                     if (!empty($userId)) {
                                         //return $rowId;
                                         echo editWorkshopParticipant('prhead', $moduleComponentId, $workshopId, $editFormId, $editUserId, $teamId, $rowValue, $rowId);
                                         die;
                                     }
                                 } else {
                                     if ($_GET['subaction'] == "printCerti") {
                                         if (isset($_POST['eventId'])) {
                                             $eventAction = 'event';
                                             $eventId = trim(escape($_POST['eventId']));
                                         } else {
                                             if (isset($_POST['workshopId'])) {
                                                 $eventAction = 'workshop';
                                                 $eventId = trim(escape($_POST['workshopId']));
                                             }
                                         }
                                         return printCertificates($eventAction, $moduleComponentId, $eventId);
                                     } else {
                                         if ($_GET['subaction'] == "printIndividualCerti") {
                                             if (isset($_POST['eventId'])) {
                                                 $action = 'event';
                                                 $eventId = escape($_POST['eventId']);
                                             } else {
                                                 if (isset($_POST['workshopId'])) {
                                                     if (isset($_POST['workshopId'])) {
                                                         //return "sadasd";
                                                         $eventId = $_POST['workshopId'];
                                                     }
                                                     $action = 'workshop';
                                                 }
                                             }
                                             $userId = escape($_POST['userId']);
                                             //error_log($eventId." ".$userId);
                                             return printIndividualCerti('prhead', $action, $moduleComponentId, $userId, $eventId);
                                         } else {
                                             if ($_GET['subaction'] == "userDetailForm") {
                                                 return searchByUserId('prhead', $moduleComponentId);
                                             } else {
                                                 if ($_GET['subaction'] == "userEventDetails") {
                                                     $userBookletId = escape($_POST['userId']);
                                                     return getUserDetails('prhead', $moduleComponentId, $userBookletId);
                                                 } else {
                                                     if ($_GET['subaction'] == "printUserCerti") {
                                                         $userId = escape($_POST['userId']);
                                                         printUserCerti($moduleComponentId, $userId);
                                                     } else {
                                                         if ($_GET['subaction'] == "viewEventOptions") {
                                                             return getPrHeadOptions($moduleComponentId);
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         /*else if($_GET['subaction'] == "viewEvent"){
         					$eventId = trim(escape($_POST['eventId']));
         					if(!empty($eventId)){
         						return viewEventResult($moduleComponentId,$eventId);
         					}
         				}
         				else if($_GET['subaction'] == "printCerti"){
         					$eventId = trim(escape($_POST['eventId']));
         					return printCertificates($moduleComponentId,$eventId);
         				}
         
         				else if($_GET['subaction'] == 'unlockEvent'){
         					$eventId = trim(escape($_POST['eventId']));
         					if(!empty($eventId)){
         						return unlockEvent($moduleComponentId,$eventId);
         					}
         				}*/
     } else {
         return prMain('prhead', $moduleComponentId);
     }
 }
コード例 #2
0
ファイル: events_common.php プロジェクト: ksb1712/pragyan
function getUserDetails($gotoaction, $pmcId, $userBookletId)
{
    global $STARTSCRIPTS;
    $smarttable = smarttable::render(array('user_table'), null);
    $STARTSCRIPTS .= "initSmartTable();";
    $userEventListTable = "";
    $userBookletId = escape($userBookletId);
    $pmcId = escape($pmcId);
    $userEventListTable .= searchByUserId($gotoaction, $pmcId);
    if ($userBookletId[0] == 'P') {
        $userId = getUserIdFromBookletId($userBookletId, $pmcId);
    } else {
        $userId = $userBookletId;
    }
    $getUserDetailsQuery = "SELECT * FROM `events_participants` WHERE `user_pid`='{$userId}' AND `page_moduleComponentId`='{$pmcId}' AND `event_id` IN(SELECT `event_id` FROM `events_locked` WHERE `page_moduleComponentId`='{$pmcId}')";
    $getUserDetailsRes = mysql_query($getUserDetailsQuery) or displayerror(mysql_error());
    if (mysql_num_rows($getUserDetailsRes) == 0) {
        displayerror("No info found.");
    } else {
        $getUserNameQuery = "SELECT `user_fullname` FROM `" . MYSQL_DATABASE_PREFIX . "users` WHERE `user_id`='{$userId}'";
        $getUserNameRes = mysql_query($getUserNameQuery) or displayerror(mysql_error());
        $userEventListTable .= "<br/><h4>" . mysql_result($getUserNameRes, 0) . "</h4><br/>";
        $userEventListTable .= <<<FORM
\t\t\t<form method='post' action='./+{$gotoaction}&subaction=printUserCerti'>
\t\t\t\t<input type='hidden' value='{$userId}' name='userId'/>
\t\t\t\t<input type='submit' name='submit' value='Print User Certificates'/>
\t\t\t</form>
FORM;
        $userEventListTable .= "{$smarttable}<table id='user_table' class='display' width='100%' border='1'><thead><th>User FID</th><th>Event Name</th><th>User Rank</th></thead>";
        while ($userEvent = mysql_fetch_assoc($getUserDetailsRes)) {
            $eventName = getEventName($pmcId, $userEvent['event_id']);
            $getUserRankQuery = "SELECT `user_rank` FROM `events_result` WHERE `page_moduleComponentId`='{$pmcId}' AND `user_id`='{$userId}' AND `event_id`='{$userEvent['event_id']}'";
            $getUserRankRes = mysql_query($getUserRankQuery) or displayerror(mysql_error());
            $userRank = mysql_result($getUserRankRes, 0);
            $userEventListTable .= "<tr><td>" . $userId . "</td><td>" . $eventName . "</td><td>" . $userRank . "</td></tr>";
        }
        $userEventListTable .= "</table>";
        return $userEventListTable;
    }
}