/** * function getQuizUserListHtml: * Generates the User list with their total, section specific marks */ function getQuizUserListHtml($quizId) { // Evaluate the quiz, // retrieve list of users and their total marks, and display $quizRow = getQuizRow($quizId); $weights = getWeights($quizId); if (count($weights) > 0) { displayerror("Marks for questions with weight " . join(", ", $weights) . " is not set. Correct the quiz after setting marks for all weigh. You can set that in <a href='./+edit#quizWeightMarks'>Edit</a>."); return ''; } if (isset($_POST['btnCalculateMarks'])) { evaluateQuiz($quizId); updateSectionMarks($quizId); } $tableJqueryStuff = ""; $numSecColumns = 0; $userTable = MYSQL_DATABASE_PREFIX . 'users'; $markQuery = "SELECT `{$userTable}`.`user_email` AS `email`, `{$userTable}`.`user_id` AS `user_id`, SUM(`quiz_marksallotted`) AS `total`, MIN(`quiz_attemptstarttime`) AS `starttime`, MAX(`quiz_submissiontime`) AS `finishtime`, TIMEDIFF(MAX(`quiz_submissiontime`), MIN(`quiz_attemptstarttime`)) AS `timetaken` FROM `{$userTable}`, `quiz_userattempts` WHERE " . "`{$userTable}`.`user_id` = `quiz_userattempts`.`user_id` AND " . "`quiz_userattempts`.`page_modulecomponentid` = '{$quizId}' " . "GROUP BY `quiz_userattempts`.`user_id` ORDER BY `total` DESC, `timetaken`, `starttime`, `finishtime`, `email`"; $profileQuery = 'SELECT `form_elementname` FROM `form_elementdesc` WHERE `page_modulecomponentid` = 0 ORDER BY `form_elementrank`'; $profileResult = mysql_query($profileQuery); $profilecolumns = array(); while ($profileRow = mysql_fetch_row($profileResult)) { $profilecolumns['form0_' . $profileRow[0]] = $profileRow[0]; } $markResult = mysql_query($markQuery); if (!$markResult) { displayerror($markQuery . ' ' . mysql_error()); } $query = mysql_fetch_array(mysql_query("SELECT `quiz_title` FROM `quiz_descriptions` WHERE `page_modulecomponentid` = '{$quizId}'")); $result = mysql_query("SELECT `quiz_sectiontitle` FROM `quiz_sections` WHERE `page_modulecomponentid` = '{$quizId}' ORDER BY `quiz_sectionid`"); $sectionHead = ""; $secCols = ""; $toggleColumns = "<tr><td><input type='checkbox' onclick='fnShowHide(0);' checked />User Full Name<br/></td>"; $toggleColumns .= "<td><input type='checkbox' onclick='fnShowHide(1);' />User Email<br/></td>"; $toggleColumns .= "<td><input type='checkbox' onclick='fnShowHide(2);' checked />Marks<br/></td>"; $toggleColumns .= "<td><input type='checkbox' onclick='fnShowHide(3);' checked />Time Taken<br/></td>"; $toggleColumns .= "<td><input type='checkbox' onclick='fnShowHide(4);' />Started<br/></td>"; $toggleColumns .= "<td><input type='checkbox' onclick='fnShowHide(5);' />Finished<br/></td>"; $c = 6; while ($row = mysql_fetch_array($result)) { $sectionHead .= "<th>Section : {$row['quiz_sectiontitle']}</th>"; $tableJqueryStuff .= "null,"; if ($c % 6 == 0) { $secCols .= "</tr><tr>"; } $secCols .= "<td><input type='checkbox' onclick='fnShowHide({$c});' checked />Section : {$row['quiz_sectiontitle']}<br/></td>"; $numSecColumns++; $c++; } $toggleColumns .= $secCols; $columnNames = array(); foreach ($profilecolumns as $columnName => $columnTitle) { $sectionHead .= "<th>{$columnTitle}</th>\n"; $columnNames[] = $columnName; $checked = "checked"; if (!($columnName == "useremail" || $columnName == "registrationdate" || $columnName == "lastupdated")) { $tableJqueryStuff .= "/* {$columnTitle} */ { \"bVisible\": false },"; $checked = ""; } else { $tableJqueryStuff .= "null,"; } if ($c % 6 == 0) { $toggleColumns .= "</tr><tr>"; } $toggleColumns .= "<td><input type='checkbox' onclick='fnShowHide({$c});' {$checked} />{$columnTitle} <br/></td>"; $c = $c + 1; } $toggleColumns .= "</tr>"; global $urlRequestRoot, $cmsFolder, $STARTSCRIPTS; $tableJqueryStuff = <<<STUFF \t\t\t\t\t\t\tnull, \t\t\t\t\t\t\t{ "bVisible": false }, \t\t\t\t\t\t\tnull, \t\t\t\t\t\t\tnull, \t\t\t\t\t\t\t{ "bVisible": false }, \t\t\t\t\t\t\t{ "bVisible": false }, \t\t\t\t\t\t\t{$tableJqueryStuff} \t\t\t\t\t\t\tnull STUFF; $smarttable = smarttable::render(array('userstable'), array('userstable' => array('aoColumns' => "{$tableJqueryStuff}"))); $STARTSCRIPTS .= "initSmartTable();"; $userListHtml = <<<HEAD \t{$smarttable} \t<script type="text/javascript" charset="utf-8"> \t\t\tfunction fnShowHide( iCol ) \t\t\t{ \t\t\t\tvar bVis = oTable.fnSettings().aoColumns[iCol].bVisible; \t\t\t\toTable.fnSetColumnVis( iCol, bVis ? false : true ); \t\t\t} \t</script> HEAD; global $ICONS_SRC, $ICONS; $quizName = $query[0]; $userListHtml .= "<h3>User Submissions for Quiz: {$query[0]}</h3>\n\t\t<fieldset><legend>Select Columns</legend><table>{$toggleColumns}</table></fieldset>" . "<form action='./+correct' method=POST><input type='submit' value='Calculate Marks' name='btnCalculateMarks' />\n\t\t<form action='./+correct' method=POST><input type='submit' value='Save As Excel' name='save_as_excel' /></form>"; $userListTable = "\n\t\t<table class=\"userlisttable display\" border=\"1\" id='userstable'>" . "<thead><tr><th>User Full Name</th><th>User Email</th><th>Total Marks</th><th>Time Taken</th><th>Started</th><th>Finished</th>{$sectionHead}<th>Action</th></tr></thead><tbody>"; while ($markRow = mysql_fetch_assoc($markResult)) { $userMarks = ""; $marksResult = mysql_query("SELECT `quiz_marksallotted`,`quiz_sectionid` FROM `quiz_userattempts` WHERE `user_id` = '{$markRow['user_id']}' AND `page_modulecomponentid` = '{$quizId}' ORDER BY `quiz_sectionid`"); $cc = 1; while ($row = mysql_fetch_array($marksResult)) { if ($row['quiz_sectionid'] != $cc) { while ($row['quiz_sectionid'] > $cc) { $userMarks .= "<td>-0</td>"; $cc++; } } $userMarks .= "<td>{$row['quiz_marksallotted']}</td>"; $cc++; } while ($cc <= $numSecColumns) { $userMarks .= "<td>-0</td>"; $cc++; } if (is_null($markRow['finishtime'])) { $markRow['finished'] = 0; $markRow['finishtime'] = 'NULL'; } $userfullname = getUserFullNameFromEmail($markRow['email']); $elementDataQuery = 'SELECT `form_elementdata`, `form_elementdesc`.`form_elementid`, `form_elementdesc`.`form_elementname`, `form_elementdesc`.`form_elementtype` FROM `form_elementdesc`, `form_elementdata` WHERE ' . "`form_elementdata`.`page_modulecomponentid` = 0 AND `user_id` = '{$markRow['user_id']}' AND " . "`form_elementdata`.`page_modulecomponentid` = `form_elementdesc`.`page_modulecomponentid` AND " . "`form_elementdata`.`form_elementid` = `form_elementdesc`.`form_elementid` ORDER BY `form_elementrank`"; $elementDataResult = mysql_query($elementDataQuery) or die($elementDataQuery . '<br />' . mysql_error()); $elementRow = array(); while ($elementDataRow = mysql_fetch_assoc($elementDataResult)) { $elementRow['form0_' . $elementDataRow['form_elementname']] = $elementDataRow['form_elementdata']; if ($elementDataRow['form_elementtype'] == 'file') { $elementRow['form0_' . $elementDataRow['form_elementname']] = '<a href="./' . $elementDataRow['form_elementdata'] . '">' . $elementDataRow['form_elementdata'] . '</a>'; } } $display = array(); $columnCount = count($columnNames); for ($i = 0; $i < count($columnNames); $i++) { if (isset($elementRow[$columnNames[$i]])) { $display[] = $elementRow[$columnNames[$i]]; } // else { // $display[] = ' '; // } } $profileStuff = ''; if (count($display)) { $profileStuff = '<td>' . join($display, '</td><td>') . '</td>'; } if ($userfullname == "") { $userfullname = "Anonymous"; } $userListTable .= "<tr><td>{$userfullname}</td><td>{$markRow['email']}</td><td>{$markRow['total']}</td><td>{$markRow['timetaken']}</td><td>{$markRow['starttime']}</td><td>{$markRow['finishtime']}</td>{$userMarks} {$profileStuff}"; $userListTable .= '<td><form name="userclearform" method="POST" action=""><input type="hidden" name="hdnUserId" id="hdnUserId" value="' . $markRow['user_id'] . "\" /><a href=\"./+correct&useremail={$markRow['email']}\">" . $ICONS['Correct']['small'] . '</a><input type="image" src="' . $ICONS_SRC["Delete"]["small"] . '" name="btnDeleteUser" id="btnDeleteUser" value="Reject Submission" title="Reject Submission"/></form></td>'; $userListTable .= "</tr>\n"; } $userListTable .= "</tbody></table>\n"; if (isset($_POST['save_as_excel'])) { header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=\"{$quizName}.xls\";"); header("Content-Transfer-Encoding: binary"); echo $userListTable; exit(1); } return $userListHtml . $userListTable; }
/** * Determines which permissions a user can grant, and to which groups and users on a given page * @param $userid User id of the user attempting to grant permissions * @param $pagepath Array containing the page ids of the nodes on the path to the given page * @param $modifiableGroups Buffer to store the groups the user can grant permissions to * @param $grantableActions Buffer to store the list of actions the user can grant permissions for * @return Boolean, indicating whether the function was successful */ function grantPermissions($userid, $pageid) { //serving change permission requests if (isset($_GET['doaction']) && $_GET['doaction'] == "changePerm") { $permtype = escape($_GET['permtype']); $pageid = escape($_GET['pageid']); $usergroupid = escape($_GET['usergroupid']); $permid = escape($_GET['permid']); $perm = escape($_GET['perm']); $flag = true; if ($perm == 'Y' || $perm == 'N') { if ($permission = mysql_fetch_array(mysql_query("SELECT `perm_permission` FROM `" . MYSQL_DATABASE_PREFIX . "userpageperm` WHERE `perm_type` = '{$permtype}' AND `page_id` = '{$pageid}' AND `usergroup_id` = '{$usergroupid}' AND `perm_id` = '{$permid}'"))) { if ($permission['perm_permission'] != $perm) { mysql_query("UPDATE `" . MYSQL_DATABASE_PREFIX . "userpageperm` SET `perm_permission` = '{$perm}' WHERE `perm_type` = '{$permtype}' AND `page_id` = '{$pageid}' AND `usergroup_id` = '{$usergroupid}' AND `perm_id` = '{$permid}'"); if (mysql_affected_rows() == 0) { $flag = false; } } } else { mysql_query("INSERT `" . MYSQL_DATABASE_PREFIX . "userpageperm`(`perm_type`, `page_id`, `usergroup_id`, `perm_id`, `perm_permission`) VALUES('{$permtype}','{$pageid}','{$usergroupid}','{$permid}','{$perm}')"); if (mysql_affected_rows() == 0) { $flag = false; } } } else { if ($permission = mysql_fetch_array(mysql_query("SELECT `perm_permission` FROM `" . MYSQL_DATABASE_PREFIX . "userpageperm` WHERE `perm_type` = '{$permtype}' AND `page_id` = '{$pageid}' AND `usergroup_id` = '{$usergroupid}' AND `perm_id` = '{$permid}'"))) { mysql_query("DELETE FROM `" . MYSQL_DATABASE_PREFIX . "userpageperm` WHERE `perm_type` = '{$permtype}' AND `page_id` = '{$pageid}' AND `usergroup_id` = '{$usergroupid}' AND `perm_id` = '{$permid}'"); if (mysql_affected_rows() == 0) { $flag = false; } } } if ($flag) { echo "1"; } else { echo "0"; } disconnect(); exit; } //serving refresh permissions request if (isset($_GET['doaction']) && $_GET['doaction'] == 'getpermvars' && isset($_GET['pageid'])) { global $cmsFolder, $urlRequestRoot, $templateFolder; $pageid = escape($_GET['pageid']); if (mysql_fetch_array(mysql_query("SELECT `page_name` FROM `" . MYSQL_DATABASE_PREFIX . "pages` WHERE `page_id` = '{$pageid}'"))) { $pagepath = array(); parseUrlDereferenced($pageid, $pagepath); $pageid = $pagepath[count($pagepath) - 1]; $groups = array_reverse(getGroupIds($userid)); $virtue = ''; $maxPriorityGroup = getMaxPriorityGroup($pagepath, $userid, $groups, $virtue); if ($maxPriorityGroup == -1) { return 'You do not have the required permissions to view this page.'; } if ($virtue == 'user') { $grantableActions = getGroupPermissions($groups, $pagepath, $userid); } else { $grantableActions = getGroupPermissions($groups, $pagepath); } $actionCount = count($_POST['permission']); $checkedActions = array(); for ($i = 0; $i < $actionCount; $i++) { list($modTemp, $actTemp) = explode('_', escape($_POST['permission'][$i]), 2); if (isset($_POST[$modTemp . $actTemp])) { if (isset($grantableActions[$modTemp])) { for ($j = 0; $j < count($grantableActions[$modTemp]); $j++) { if ($grantableActions[$modTemp][$j][1] == $actTemp) { $checkedActions[$modTemp][] = $grantableActions[$modTemp][$j]; break; } } } } } if (count($checkedActions) > 0) { $grantableActions = $checkedActions; } $modifiableGroups = getModifiableGroups($userid, $maxPriorityGroup); $modifiableGroupIds = array(0, 1); for ($i = 0; $i < count($modifiableGroups); $i++) { $modifiableGroupIds[] = $modifiableGroups[$i]['group_id']; } $permissions = formattedPermissions($pagepath, $modifiableGroupIds, $grantableActions); $ret = <<<RET pageid = {$pageid}; {$permissions} RET; echo $ret; } else { echo "Error: Invalid Pageid passed"; } disconnect(); exit; } global $cmsFolder, $urlRequestRoot; $pagepath = array(); parseUrlDereferenced($pageid, $pagepath); $pageid = $pagepath[count($pagepath) - 1]; $groups = array_reverse(getGroupIds($userid)); $virtue = ''; $maxPriorityGroup = getMaxPriorityGroup($pagepath, $userid, $groups, $virtue); if ($maxPriorityGroup == -1) { return 'You do not have the required permissions to view this page.'; } if ($virtue == 'user') { $grantableActions = getGroupPermissions($groups, $pagepath, $userid); } else { $grantableActions = getGroupPermissions($groups, $pagepath); } if (isset($_POST['permission'])) { $actionCount = count($_POST['permission']); } else { $actionCount = ""; } $checkedActions = array(); for ($i = 0; $i < $actionCount; $i++) { list($modTemp, $actTemp) = explode('_', escape($_POST['permission'][$i]), 2); if (isset($_POST[$modTemp . $actTemp])) { if (isset($grantableActions[$modTemp])) { for ($j = 0; $j < count($grantableActions[$modTemp]); $j++) { if ($grantableActions[$modTemp][$j][1] == $actTemp) { $checkedActions[$modTemp][] = $grantableActions[$modTemp][$j]; break; } } } } } if (count($checkedActions) > 0) { $grantableActions = $checkedActions; } $modifiableGroups = getModifiableGroups($userid, $maxPriorityGroup); $modifiableGroupIds = array(0, 1); for ($i = 0; $i < count($modifiableGroups); $i++) { $modifiableGroupIds[] = $modifiableGroups[$i]['group_id']; } $perms = json_encode(formatPermissions($grantableActions)); $permissions = formattedPermissions($pagepath, $modifiableGroupIds, $grantableActions); $groups = customGetGroups($maxPriorityGroup); $users = customGetAllUsers(); global $templateFolder; $smarttableconfig = array('permtable' => array('sPaginationType' => 'two_button', 'bAutoWidth' => 'false', 'aoColumns' => '{ "sWidth": "100px" }'), 'permtable2' => array('sPaginationType' => 'two_button', 'bAutoWidth' => 'false', 'aoColumns' => '{ "sWidth": "100px" }')); $ret = smarttable::render(array('permtable', 'permtable2'), $smarttableconfig); $globals = getGlobalSettings(); $baseURL = "./+grant&doaction=changePerm"; if ($globals['url_rewrite'] == 'false') { $baseURL = prettyurl($baseURL); } $selected = "var selected = {'permissions' : [], 'users' : [], 'groups' : []};"; if (isset($_GET['doaction']) && $_GET['doaction'] == 'getUserPerm') { $get_selectedPerms = array(); $get_selectedGroups = array(); $get_selectedUsers = array(); foreach ($_POST as $key => $var) { if (substr($key, 0, 12) == "permissions_") { $get_selectedPerms[] = (int) substr($key, 12); } } list($get_sortedGroupPerms, $get_sortedUserPerms) = getAllPermissionsOnPage($pagepath, $modifiableGroupIds, $grantableActions); $save = 0; foreach ($get_sortedGroupPerms['Y'] as $get_groupId => $get_data) { $found = false; foreach ($get_sortedGroupPerms['Y'][$get_groupId] as $get_permId) { foreach ($get_selectedPerms as $selected_perm) { if ($selected_perm == $get_permId) { $get_selectedGroups[] = (int) $get_groupId; $found = true; } } if ($found) { break; } } if ($get_groupId == 0 && $found) { $save += 1; } if ($get_groupId == 1 && $found) { $save += 2; } } foreach ($get_sortedUserPerms['Y'] as $get_userId => $get_data) { $found = false; foreach ($get_sortedUserPerms['Y'][$get_userId] as $get_permId) { foreach ($get_selectedPerms as $selected_perm) { if ($selected_perm == $get_permId) { $get_selectedUsers[] = (int) $get_userId; $found = true; } } if ($found) { break; } } } $get_selectedGroups = filterByPriority($maxPriorityGroup, $get_selectedGroups); if ($save % 2 == 1) { $get_selectedGroups[] = 0; } if ($save / 2 == 1) { $get_selectedGroups[] = 1; } $selected = "var selected = {'permissions' : " . json_encode($get_selectedPerms) . ", 'users' : " . json_encode($get_selectedUsers) . ", 'groups' : " . json_encode($get_selectedGroups) . "};"; } if (isset($_GET['doaction']) && $_GET['doaction'] == 'getPermUser') { $get_selectedPerms = array(); $get_selectedGroups = array(); $get_selectedUsers = array(); foreach ($_POST as $key => $var) { if (substr($key, 0, 6) == "users_") { $get_selectedUsers[] = (int) substr($key, 6); } else { if (substr($key, 0, 7) == "groups_") { $get_selectedGroups[] = (int) substr($key, 7); } } } list($get_sortedGroupPerms, $get_sortedUserPerms) = getAllPermissionsOnPage($pagepath, $modifiableGroupIds, $grantableActions); $save = 0; foreach ($get_sortedGroupPerms['Y'] as $get_groupId => $get_data) { if (isPresent($get_groupId, $get_selectedGroups)) { foreach ($get_sortedGroupPerms['Y'][$get_groupId] as $get_permId) { if (!isPresent($get_permId, $get_selectedPerms)) { $get_selectedPerms[] = $get_permId; } } } } foreach ($get_sortedUserPerms['Y'] as $get_userId => $get_data) { if (isPresent($get_userId, $get_selectedUsers)) { foreach ($get_sortedUserPerms['Y'][$get_userId] as $get_permId) { if (!isPresent($get_permId, $get_selectedPerms)) { $get_selectedPerms[] = $get_permId; } } } } $selected = "var selected = {'permissions' : " . json_encode($get_selectedPerms) . ", 'users' : " . json_encode($get_selectedUsers) . ", 'groups' : " . json_encode($get_selectedGroups) . "};"; } $ret .= <<<RET <style type="text/css" title="currentStyle"> \tdiv#permtable_filter input { width: 90px; } \tdiv#permtable2_filter input { width: 90px; } </style> <script type="text/javascript" language="javascript" src="{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/scripts/permissionsTable.js"></script> <script type="text/javascript"> var baseURL = "{$baseURL}"; var pageid = {$pageid}; var permissions = {$perms}; var permGroups; var permUsers; var groups = {{$groups}}; var users = {{$users}}; {$permissions} {$selected} </script> <div id='info'></div> <INPUT type=checkbox id='skipAlerts'> Skip Alerts <br> <div id='permTable'> </div> <table width=100%> <tr> <td width=50%> <a href='javascript:selectAll1()'>Select All</a> <a href='javascript:clearAll1()'>Clear All</a> <a href='javascript:toggle1()'>Toggle</a> <a href='javascript:getuserperm()'>Check Users having selected Permission</a><br> <form action='./+grant&doaction=getUserPerm' method="POST" id='getuserperm'> <table class="userlisttable display" id='permtable' name='permtable'><thead><tr><th>Permissions</th></thead><tbody id='actionsList'> </tbody></table> </form> </td> <td width=50%> <a href='javascript:selectAll2()'>Select All</a> <a href='javascript:clearAll2()'>Clear All</a> <a href='javascript:toggle2()'>Toggle</a> <a href='javascript:getpermuser()'>Check Permissions selected User is having</a><br> <form action='./+grant&doaction=getPermUser' method="POST" id='getpermuser'> <table class="userlisttable display" id='permtable2' name='permtable2'><thead><tr><th>Users</th></thead><tbody id='usersList'> </tbody></table> </form> </td> </tr> </table> <a href='javascript:populateList()'>Click here if the lists are empty</a> RET; global $STARTSCRIPTS; $STARTSCRIPTS .= " populateList();"; return $ret; }
function registeredUsersList($type, $act, $allfields, $userInfo = NULL) { global $urlRequestRoot, $cmsFolder, $moduleFolder, $templateFolder, $sourceFolder; require_once "{$sourceFolder}/{$moduleFolder}/form/viewregistrants.php"; $extraColumns = getColumnList(0, false, false, false, false, false); $xcolumnIds = array(); $xcolumnNames = array(); $xcolumnFieldVars = array(); foreach ($extraColumns as $columnid => $colname) { $xcolumnIds[] = $columnid; $xcolumnNames[] = $colname; $xcolumnFieldVars[] = 'user' . ucfirst($colname); ${'user' . ucfirst($colname)} = array(); } if ($userInfo == NULL) { getAllUsersInfo($userId, $userName, $userEmail, $userFullName, $userPassword, $userLastLogin, $userRegDate, $userActivated, $userLoginMethod); } else { $userId = $userInfo['user_id']; $userName = $userInfo['user_name']; $userEmail = $userInfo['user_email']; $userFullName = $userInfo['user_fullname']; $userPassword = $userInfo['user_password']; $userLastLogin = $userInfo['user_lastlogin']; $userRegDate = $userInfo['user_regdate']; $userActivated = $userInfo['user_activated']; $userLoginMethod = $userInfo['user_loginmethod']; } foreach ($userId as $userid) { $xinfo = generateFormDataRow(0, $userid, $xcolumnIds); foreach ($xinfo as $j => $info) { ${$xcolumnFieldVars[$j]}[] = $info; } } $userfieldprettynames = array_merge(array("User ID", "Username", "Email", "Full Name", "Password", "Registration", "Last Login", "Activated", "Login Method"), array_map('ucfirst', $xcolumnNames)); function replace10byYesNo(&$value, $key) { if ($value == '1') { $value = "Yes"; } else { if ($value == '0') { $value = "No"; } } } array_walk($userActivated, 'replace10byYesNo'); $userlisttdids = array_merge(array("user_id", "user_name", "user_email", "user_fullname", "user_password", "user_regdate", "user_lastlogin", "user_activated", "user_loginmethod"), $xcolumnIds); $userfieldvars = array_merge(array("userId", "userName", "userEmail", "userFullName", "userPassword", "userRegDate", "userLastLogin", "userActivated", "userLoginMethod"), $xcolumnFieldVars); $userlist = ""; $columns = count($userfieldvars); if ($act == "edit") { $userlist .= "<form name='user_edit_form' method='POST' action='./+admin&subaction=useradmin&userid=' >\n"; $userlist .= "<input type='hidden' name='editusertype' value='{$type}' />"; $columns += 3; } $userlist .= smarttable::render(array('userstable'), null); global $STARTSCRIPTS; $STARTSCRIPTS .= "initSmartTable();"; $userlist .= <<<USERLIST \t \t<script language="javascript"> \tfunction checkDelete(butt,userDel,userId) \t{ \t\tif(confirm('Are you sure you want to delete '+userDel+' (User ID='+userId+')?')) \t\t{ \t\t\tbutt.form.action+=userId; \t\t} \t\telse return false; \t} \tfunction checkDeleteAll(butt) { \t\tif(!confirm('Are you sure you want to delete all selected users?')) { \t\t\treturn false; \t\t} \t\tbutt.form.action+='-1'; \t\treturn true; \t} \t</script> \t<a name='userlist'></a> USERLIST; global $ICONS_SRC; $userlisttable = ""; if ($act == "edit") { $userlisttable = <<<TABLE \t<input title='Activate Selected Users' type='image' src='{$ICONS_SRC['Activate']['small']}' onclick=\\"this.form.action+='-1'\\" name='user_selected_activate' value='Activate'> \t<input title='Deactivate Selected Users' type='image' src='{$ICONS_SRC['Deactivate']['small']}' onclick=\\"this.form.action+='-1'\\" name='user_selected_deactivate' value='Deactivate'> \t<input title='Delete Selected Users' type='image' src='{$ICONS_SRC['Delete']['small']}' onclick=\\"return checkDeleteAll(this)\\" name='user_selected_delete' value='Delete'> TABLE; } $userlisttable .= <<<TABLE \t<table class="userlisttable display" border="1" id='userstable'> \t<thead> \t<tr><th colspan="{$columns}">Users Registered on the Website</th></tr> \t<tr> TABLE; $defCols = getTableFieldsName('users'); $usertablefields = array_merge($defCols, $xcolumnIds); $displayfieldsindex = array(); $c = 0; for ($i = 0; $i < count($usertablefields); $i++) { if (isset($_POST[$usertablefields[$i] . '_sel']) || $allfields) { $userlisttable .= "<th>" . $userfieldprettynames[$i]; if ($act == "edit") { $userlist .= "<input type='hidden' name='{$usertablefields[$i]}_sel' value='checked'/>"; } $userlisttable .= "</th>"; $displayfieldsindex[$c++] = $i; } } $userlist .= "<input type='hidden' name='not_first_time' />"; if ($act == "edit") { $userlisttable .= "<th>Actions</th>"; } $userlisttable .= "</tr></thead><tbody>"; $rowclass = "oddrow"; $flag = false; $usercount = 0; for ($i = 0; $i < count($userId); $i++) { if ($type == "activated" && $userActivated[$i] == "No") { continue; } if ($type == "nonactivated" && $userActivated[$i] == "Yes") { continue; } $flag = true; $userlisttable .= "<tr class='{$rowclass}'>"; for ($j = 0; $j < count($displayfieldsindex); $j++) { $userlisttable .= "<td class='{$userlisttdids[$j]}'>" . ${$userfieldvars[$displayfieldsindex[$j]]}[$i] . "</td>"; } if ($act == "edit") { $userlisttable .= "<td id='user_editactions'>"; $userlisttable .= "<input type='checkbox' name='selected_{$userId[$i]}' />"; if ($userActivated[$i] == "No") { $userlisttable .= "<input title='Activate User' type='image' src='{$ICONS_SRC['Activate']['small']}' onclick=\"this.form.action+='{$userId[$i]}'\" name='user_activate' value='Activate'>\n"; } else { $userlisttable .= "<input title='Deactivate User' type='image' src='{$ICONS_SRC['Deactivate']['small']}' onclick=\"this.form.action+='{$userId[$i]}'\" name='user_deactivate' value='Deactivate'>\n"; } $userlisttable .= "<input title='Edit User' type='image' src='{$ICONS_SRC['Edit']['small']}' onclick=\"this.form.action+='{$userId[$i]}'\" name='user_info' value='Edit'>\n"; $userlisttable .= "<input title='Delete User' type='image' src='{$ICONS_SRC['Delete']['small']}' onclick=\"return checkDelete(this,'" . $userName[$i] . "','" . $userId[$i] . "')\" name='user_delete' value='Delete'>\n"; $userlisttable .= "</td>"; } $userlisttable .= "</tr>"; $rowclass = $rowclass == "evenrow" ? "oddrow" : "evenrow"; $usercount++; } $userlisttable .= "</tbody></table>"; ///If users wants to download as excel sheet if (isset($_POST['save_reg_users_excel']) || isset($_POST['save_activated_users_excel']) || isset($_POST['save_nonactivated_users_excel'])) { header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=\"users.xls\";"); header("Content-Transfer-Encoding: binary"); echo $userlisttable; exit(1); } if ($act == "edit") { $userlist .= $userlisttable . "</form>"; } else { $userlist .= $userlisttable; } return $flag ? $userlist : "No Users Found!"; }
/** * Returns a form which displays the list of files uploaded in that page and if the user has sufficient permissions option to delete files. * @param $moduleComponentId page_modulecomponentid. * @param $moduleName The module which is calling this function. * @param $deleteFormAction The page or action that must be taken on clicking the delete option in the final form, * @return A variable that has the required form. * */ function getUploadedFilePreviewDeleteForm($moduleComponentId, $moduleName, $deleteFormAction = './+edit') { global $uploadedFormNumber; if (!isset($uploadedFormNumber)) { $uploadedFormNumber = 1; } $uploadedFormNumber += 1; if (isset($_POST['file_deleted']) && $_POST['file_deleted'] == "form_{$uploadedFormNumber}") { if (isset($_GET['deletefile'])) { if (deleteFile($moduleComponentId, $moduleName, escape($_GET['deletefile']))) { displayinfo("The file " . escape($_GET['deletefile']) . " has been removed"); } else { displayinfo("Unable to remove the file."); } } } $uploadedFiles = getUploadedFiles($moduleComponentId, $moduleName); $uploadedFilesString = ""; foreach ($uploadedFiles as $file) { $uploadedUserEmail = getUserEmail($file['user_id']); $uploadedUserName = getUserFullName($file['user_id']); $fileDelete = addslashes($file['upload_filename']); $uploadedFilesString .= <<<UPLOADEDFILESSTRING \t\t<tr> \t\t\t<td><a href="./{$file['upload_filename']}" onMouseOver="javascript:showPath('{$fileDelete}')" target="previewIframe_{$uploadedFormNumber}">{$file['upload_filename']}</a></td> \t\t\t<td>{$uploadedUserName}</td> \t\t\t<td>{$uploadedUserEmail}</td> \t\t\t<td>{$file['upload_time']}</td> \t\t\t<td><input type='submit' value='Delete' onclick="return checkDeleteUpload(this, '{$fileDelete}');"></td> \t\t</tr> UPLOADEDFILESSTRING; } global $urlRequestRoot; global $cmsFolder; global $STARTSCRIPTS; if (count($uploadedFiles) > 0) { $smarttablestuff = smarttable::render(array('filestable'), null); $STARTSCRIPTS .= "initSmartTable();"; $uploadedFilesString = <<<UPLOADEDFILESSTRING \t<form action="{$deleteFormAction}" method="POST" name="deleteFile"> \t\t<script language="javascript"> \t \tfunction showPath(fileName) { \t \t\tpath = document.location.pathname; \t\t\t\tpath = path.split('+'); \t\t\t\tpath = path[0].split('&'); \t\t\t\tdocument.getElementById("preview_uploadedfile_{$uploadedFormNumber}").setAttribute('value',path[0]+fileName); \t\t\t} \t\t\tfunction checkDeleteUpload(butt,fileDel) { \t\t\t\tif(confirm('Are you sure you want to delete '+fileDel+'?')) { \t\t\t\t\tbutt.form.action+='&deletefile='+fileDel; \t\t\t\t\tbutt.form.submit(); \t\t\t\t} \t\t\t\telse \t\t\t\t\treturn false; \t\t\t} \t\t\t \t </script> \t\t{$smarttablestuff} \t\t<table border="1" width="100%"> \t\t\t\t<tr> \t\t\t\t\t \t\t\t\t\t<td height="100" width="100%" style="overflow:scroll"> \t\t\t\t\t<center>Preview (only for images)</center> \t\t\t\t\t<iframe name="previewIframe_{$uploadedFormNumber}" width="100%" style="min-height:200px" ></iframe> \t\t\t\t\t</td> \t\t\t\t\t \t\t\t\t</tr> \t\t\t<tr> \t\t\t\t<td> \t\t\t\t\t<b>Click</b> for preview \t\t\t\t</td> \t\t\t\t \t\t\t</tr> \t\t\t<tr> \t\t\t\t<td> \t\t\t\t\t<table class="display" id="filestable" border="1" width="100%"> \t\t\t\t\t\t<thead> \t\t\t\t\t\t<tr> \t\t\t\t\t\t\t<th>File</th> \t\t\t\t\t\t\t<th>Uploaded By</th> \t\t\t\t\t\t\t<th>Email Id</th> \t\t\t\t\t\t\t<th>Upload Time</th> \t\t\t\t\t\t\t<th>Delete</th> \t\t\t\t\t\t</tr> \t\t\t\t\t\t</thead> \t\t\t\t\t\t<tbody> \t\t\t\t\t\t{$uploadedFilesString} \t\t\t\t\t\t</tbody> \t\t\t\t\t</table> \t\t\t\t</td> \t\t\t\t \t\t\t</tr> \t\t\t<tr> \t\t\t\t<td align="right">Path for file (move mouse over name): \t\t\t\t \t\t\t\t\t<input type="text" style="width:97%" readonly="readonly" id="preview_uploadedfile_{$uploadedFormNumber}" value="Copy the path from here" /> \t\t\t\t</td> \t\t\t</tr> \t\t\t</table> \t\t\t\t<input type="hidden" name="file_deleted" value="form_{$uploadedFormNumber}"> \t\t\t</form> UPLOADEDFILESSTRING; } else { $uploadedFilesString = "No files associated with this page."; } return $uploadedFilesString; }
public function actionTreasurer() { global $urlRequestRoot, $moduleFolder, $cmsFolder, $templateFolder, $sourceFolder, $STARTSCRIPTS; require_once $sourceFolder . "/" . $moduleFolder . "/qaos1/qaos_common.php"; $mcid = $this->moduleComponentId; $treasureraction = ""; if (isset($_POST['CKEditor1'])) { disclaimerUpdate($mcid, "getTreasurerAcceptance", escape($_POST['CKEditor1'])); } if (isset($_GET['subaction']) && $_GET['subaction'] == 'getsuggestions' && isset($_GET['forwhat'])) { echo $this->getFormSuggestions(escape($_GET['forwhat'])); exit; } if (isset($_POST['eventNameForDownload'])) { downloadAsZipFile($mcid, getEventIdFromName(escape($_POST['eventNameForDownload']), $mcid)); } if (isset($_POST['printthis']) && isset($_POST['printHiddenId'])) { if ($_POST['printHiddenId'] != "") { $pos = strpos($_POST['printHiddenId'], "printTreasurerBill"); if ($pos == 0) { $treasureraction = printDataForTreasurerId($mcid, substr(escape($_POST['printHiddenId']), 18)); } } } if (isset($_POST['qhid']) && isset($_GET['subaction']) && $_GET['subaction'] == "finalApprove") { $_POST["qhid2"] = addslashes($_POST["qhid2"]); $_POST["qhid1"] = addslashes($_POST["qhid1"]); $_POST["qhid"] = addslashes($_POST["qhid"]); if ($_POST["qhid"] < 4 && $_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); } } } $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_formstatus', 'table_funreq_treasurer', 'filestable'), null); $STARTSCRIPTS .= "initSmartTable();"; $treasureraction .= <<<AB \t\t{$smarttablestuff} \t\t\t<link href="{$css1}" rel="stylesheet"> \t\t\t <script type="text/javascript"> \t \t\t \t function qaosfund(a) \t\t\t \t { \t\t\t\t\t\t\tvar k=document.getElementById("qstatus"+a+"1"); \t\t\t\t\t\tvar k1=document.getElementById("qstatus"+a+"2"); \t \t\t\t\t\t\tif(k.checked) document.getElementById("qhid"+a).value=3; \t\t\t\t\t\telse if(k1.checked) document.getElementById("qhid"+a).value=2; \t\t\t\t\t\telse {alert("select any one of button");return false;} \t\t\t\t\t\t\tdocument.getElementById("1qhid"+a).value=document.getElementById("qdescription"+a).value; \t\t\t\t\t\t\t\$.ajax({ \t\t\t\t\t\t\t\ttype: "POST", \t\t\t\t \t\t\t\turl: "./+treasurer&subaction=finalApprove", \t\t\t\t \tdata: "qhid="+\$("#qhid"+a).val()+"&qhid1="+\$("#1qhid"+a).val()+"&qhid2="+\$("#2qhid"+a).val() \t \t\t\t\t\t }); \t\t\t\t\t\t\t\$("#trt"+a).css({'display':'none'}); \t \t\t\t\t\t\treturn false; \t\t\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\t\t\t\t\$(".forms").css({'display':'none'}); \t\t\t\t\t\$(".buttons").css({'display':'block'}); \t\t\t\t\t\t\$("#dtreasurerfundreq").css({'display':'block'}); \t\t\t\t\t\$("#btreasurer_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\$("#bformfund").click(function() \t\t\t\t\t\t{ \t\t\t\t\t\tdispfundform(); \t\t\t\t \t\t}); \t\t\t \t\$("#bviewbills").click(function() \t\t\t\t\t\t{ \t\t\t\t\t\tdispbills(); \t\t\t\t \t\t}); \t\t\t\t\t\$("#bdisplaydisclaimer").click(function() \t\t\t\t\t\t{ \t\t\t\t\t\t \$(".forms").css({'display':'none'}); \t\t\t\t\t\t \$("#displayBillDisclaimer").css({'display':'block'}); \t\t\t\t\t\t}); \t\t\t\t\tfunction dispfundreq() \t\t \t\t \t\t { \t\t\t\t\t\t\t\$(".forms").css({'display':'none'}); \t\t\t\t\t\t\t\$("#dtreasurerfundreq").css({'display':'block'}); \t\t\t\t\t\t} \t\t\t\t\tfunction 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\tfunction dispbills() \t\t\t\t \t { \t\t\t\t\t\t\$(".forms").css({'display':'none'}); \t\t\t\t\t\t\$("#dviewbills").css({'display':'block'}); \t\t\t\t\t } \t\t\t\t\t \$("#dtreasurerfundreq").css({'width':'100%'}); \t\t\t\t\t \$(".viewbuttons").css({'height':'25px'}); \t\t\t\t\t \$(".viewbuttonsdiv").css({'width':'100%'}); \t\t\t\t\t}); \t\t\t\t\t</script>\t\t \t\t\t\t\t<div id="buttonsDiv" class="buttonsClass">\t\t\t \t\t\t\t\t<input type="button" id="bformfund" class="viewbuttons" value="Fund"/>\t\t\t\t\t \t\t\t\t\t<input type="button" id="btreasurer_fundreq" class="viewbuttons" value="Fund Status"/> \t\t\t\t\t<input type="button" id="bviewbills" class="viewbuttons" value="Bills"/> \t\t\t\t \t\t\t\t\t<input type="button" id="bdisplaydisclaimer" class="viewbuttons" value="Disclaimer"/> \t\t\t\t \t\t\t\t\t</div>\t\t\t\t\t \t\t\t\t\t<div id="formfund" class="forms"> \t\t\t\t\t<h2>Form status</h2>\t\t\t\t\t \t\t\t\t\t<table class="display" id="table_formstatus" border="1" width="100%" > \t\t\t\t\t<thead>\t \t\t\t\t\t\t<tr> \t\t\t\t\t\t\t<th>EVENT NAME</th> \t\t\t\t\t\t\t<th>ITEM</th> \t\t\t\t\t\t\t<th>QUANTITY</th> \t\t\t\t\t\t\t<th>AMOUNT</th> \t\t\t\t\t\t\t<th>REASON</th> \t\t\t\t\t\t\t<th>STATUS</th> \t\t\t\t\t\t\t<th>DEADLINE</th> \t\t\t\t\t <th>ADDED BY</th> \t\t\t\t\t\t\t<th>DESCRIPTION</th> \t\t\t\t\t <th>SUBMIT</th> \t\t\t\t\t\t</tr></thead> AB; while ($result1 = mysql_fetch_array($res1)) { $userName = getUserName($result1['userid']); $event1 = $result1['fundreq_Id']; if ($result1['fundreq_Status'] == 1) { $status1 = 3; } else { $status1 = 1; } if ($status1 == 3) { $treasureraction .= <<<AB \t\t\t\t\t \t\t\t <tr id="trt{$event1}"> \t\t\t\t\t \t\t\t <td>{$result1["fundreq_name"]}</td> \t\t\t\t\t \t\t\t <td>{$result1['fundreq_Request']}</td> \t\t\t \t\t\t\t\t <td>{$result1['fundreq_Quantity']}</td> \t\t\t\t\t \t\t\t <td>Rs.{$result1["fundreq_Amount"]}</td> \t\t\t\t \t\t\t <td>{$result1["fundreq_reason"]}</td> \t\t\t\t\t\t\t\t\t\t <td> \t\t\t\t\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\t\t<input type="radio" name="qstatus{$event1}" id="qstatus{$event1}2" value="2">Decline<br/> \t\t\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\t\t\t\t\t\t <td>{$userName}</td>\t\t\t\t \t\t\t\t\t \t\t\t <td><textarea id="qdescription{$event1}"></textarea></td> \t\t\t\t\t \t\t\t <td> \t\t\t\t\t\t\t\t <form action="./+treasurer&subaction=finalApprove" method="post" onsubmit=" return qaosfund({$event1})"> \t\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\t <input type="hidden" value="{$event1}" id="2qhid{$event1}" name="qhid2"> \t\t\t\t\t\t\t \t\t <input type="hidden" value="" id="1qhid{$event1}" name="qhid1"> \t\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\t </td> \t\t\t\t\t\t\t\t </tr> AB; } } $treasureraction .= <<<AB \t\t\t\t\t\t</table> \t\t\t\t\t\t</div> \t\t\t\t\t<div class="forms" id="dtreasurerfundreq"> \t\t\t <h2>Fund Request Status</h2> \t\t\t \t\t\t \t \t\t \t\t\t<table id="table_funreq_treasurer" class="display" border="1" width="100%"> \t\t\t \t\t <thead> <tr> \t\t\t\t\t\t\t<th>ITEM</th> \t\t\t\t \t\t\t<th>QUANTITY</th> \t\t\t\t \t\t\t<th>EVENT NAME</th> \t\t\t\t \t\t\t<th>REASON</th> \t\t\t\t \t\t\t<th>STATUS</th> \t\t\t\t\t <th>ADDED BY</th> \t\t\t\t \t\t\t<th>DEADLINE</th> \t\t\t\t \t\t\t<th>DESCRIPTION</th> \t\t\t\t \t\t\t<th>PRINT BILL</th> \t\t\t \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"; } } } } $treasureraction .= <<<AB \t\t\t\t\t\t <tr class="tr{$result1['fundreq_Status']}"> \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_name']}</td> \t\t\t\t\t\t\t <td>{$result1['fundreq_reason']}</td> \t\t\t\t\t\t\t <td>{$status1}</td> \t\t\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\t <td>{$result1['fundreq_Desc']}</td> \t\t\t\t\t\t\t <td> \t\t\t\t\t\t\t\t<form method="post" action="./+treasurer"> <input type="submit" name="printthis" value="PRINT"/> \t\t\t\t\t\t\t\t <input type="hidden" name="printHiddenId" value="printTreasurerBill{$result1['fundreq_Id']}" />\t \t\t\t\t\t\t\t\t</form> </td> \t \t\t\t\t\t\t </tr> AB; } $bills = displayBills($mcid, 1); $txtBoxForDownload = displaySuggestionBox("eventNameForDownload", "suggestionsBoxForDownload", "treasurer", "userBox1"); $contentDisclaimer = getDisclaimer("getTreasurerAcceptance", $mcid); $displayDisclaimerBill = getCkBody($contentDisclaimer, "treasurer"); $treasureraction .= <<<BILLS \t\t\t\t </table></div> \t\t\t\t <div class='forms' id='dviewbills'> \t\t\t\t {$bills} \t\t\t\t <form action="./+treasurer" method="post" enctype="multipart/form-data"> \t\t\t\t <table> \t\t\t\t <tr> \t\t\t\t <td>Event Name(Blank if u want to download all bills): </td> \t\t\t\t <td>{$txtBoxForDownload}</td> \t\t\t\t </tr> \t\t\t\t <tr><td colspan="2"><input type="submit" value="submit" /></td></tr> \t\t\t\t </table> \t\t\t\t </form> \t\t\t\t </div> \t\t\t\t <div class="forms" id="displayBillDisclaimer"> \t\t\t\t {$displayDisclaimerBill} \t\t\t\t </div> \t\t\t\t\t\t\t\t\t BILLS; return $treasureraction; }
function displayUsersRegisteredToAccoWithDelete($mcId) { global $STARTSCRIPTS; $smarttablestuff = smarttable::render(array('table_accousers'), null); $STARTSCRIPTS .= "initSmartTable();"; $userDetails = <<<TABLE {$smarttablestuff} <table class="display" id="table_accousers" width="100%" border="1"> <thead> <tr> <th>Delete</th> <th>Pragyan Id</th> <th>Name</th> <th>E mail</th> <th>Check In Time</th> <th>Check Out Time</th> <th>Amount Refunded</th> <th>Hostel</th> <th>Room No</th> <th>Disclaimer</th> </tr> </thead> TABLE; $getRegisteredUserDetailAccoQuery = "SELECT * FROM `prhospi_accomodation_status` AS status\n LEFT JOIN `prhospi_hostel` AS hostel ON hostel.hospi_room_id = status.hospi_room_id AND\n hostel.page_modulecomponentid=status.page_modulecomponentid \n WHERE status.page_modulecomponentid={$mcId}"; $getRegisteredUserPR = mysql_query($getRegisteredUserDetailAccoQuery) or displayerror("Error on viewing registered user" . mysql_error()); while ($res = mysql_fetch_assoc($getRegisteredUserPR)) { $name = getUserName($res['user_id']); $email = getUserEmail($res['user_id']); $userDetails .= <<<TR <tr> <td> <form method="POST" action="./+hospihead&subaction=deleteUsers"> <input type="submit" name="" value="DELETE"/> <input type="hidden" name="txtFormUserId" value="{$email} - {$res['user_id']}" /> </form> </td> <td>{$res['user_id']}</td> <td>{$name}</td> <td>{$email}</td> <td>{$res['hospi_actual_checkin']}</td> <td>{$res['hospi_actual_checkout']}</td> <td>{$res['hospi_cash_refunded']}</td> <td>{$res['hospi_hostel_name']}</td> <td>{$res['hospi_room_no']}</td> <td> <form method="POST" target="_blank" action="./+hospihead"> <input type="submit" name="printthis" value="PRINT"/> <input type="hidden" name="printHiddenId" value="printHostelAllotmentBill{$res['user_id']}" /> </form> </td> </tr> TR; } $userDetails .= <<<TABLEEND </table> TABLEEND; return $userDetails; }
public function actionEdit() { $editPageContent = ''; $paramSqlQuery = ''; $paramPageTitle = ''; $useParams = false; if (isset($_POST['btnSubmitQueryData'])) { if (!isset($_POST['pagetitle']) || !isset($_POST['sqlquery'])) { displayerror('Error. Incomplete form data.'); } $pageTitle = $_POST['pagetitle']; $sqlQuery = $_POST['sqlquery']; if ($this->saveQueryEditForm($pageTitle, $sqlQuery)) { displayinfo('Changes saved successfully.'); } } elseif (isset($_POST['btnPreviewResults'])) { if (!isset($_POST['pagetitle']) || !isset($_POST['sqlquery'])) { displayerror('Error. Incomplete form data.'); } $pageTitle = $_POST['pagetitle']; $sqlQuery = $_POST['sqlquery']; $editPageContent = "<h2>{$pageTitle} (Preview)</h2><br />\n" . $this->generatePageData(stripslashes($sqlQuery)) . "<br />\n"; $useParams = true; $paramSqlQuery = stripslashes($sqlQuery); $paramPageTitle = $pageTitle; } $editPageContent .= $this->getQueryEditForm($paramPageTitle, $paramSqlQuery, $useParams); $helptext = ""; if (isset($_POST['btnListTables']) || isset($_GET['subaction']) && $_GET['subaction'] == "listalltables") { $helptext .= "<h2>Tables of Database " . MYSQL_DATABASE . "</h2><br/><table id='sqlhelptable' name='sqlhelptable' class='display'><thead></tr><tr><th>Table Name</th><th>Columns Information</th><th>Rows Information</th></tr></thead><tbody>"; $query = "SHOW TABLES"; $res = mysql_query($query); while ($row = mysql_fetch_row($res)) { $helptext .= "<tr><td>{$row[0]}</td><td><a href='./+edit&subaction=tablecols&tablename={$row[0]}'>View Columns</a></td><td><a href='./+edit&subaction=tablerows&tablename={$row[0]}'>View Rows</a></td></tr>"; } $helptext .= "</tbody></table>"; } if (isset($_POST['btnListRows']) && $_POST['tablename'] != "" || isset($_GET['subaction']) && $_GET['subaction'] == "tablerows") { if (isset($_POST['tablename'])) { $tablename = escape(safe_html($_POST['tablename'])); } else { if (isset($_GET['tablename'])) { $tablename = escape(safe_html($_GET['tablename'])); } else { displayerror("Table name missing"); return $editPageContent; } } $query = "SELECT * FROM '{$tablename}'"; $res = mysql_query($query); $numfields = mysql_num_fields($res); $helptext .= "<table id='sqlhelptable' name='sqlhelptable' class='display'><thead><tr><th colspan=" . $numfields . ">Rows of Table {$tablename} <br/><a href='./+edit&subaction=tablecols&tablename={$tablename}'>View Columns</a> <a href='./+edit&subaction=listalltables'>View All Tables</a></th></tr>"; $helptext .= "<tr>"; for ($i = 0; $i < $numfields; $i++) { $name = mysql_field_name($res, $i); if (!$name) { displayerror("Field name could not be retrieved"); break; } $helptext .= "<th>{$name}</th>"; } $helptext .= "</tr></thead><tbody>"; while ($row = mysql_fetch_row($res)) { $helptext .= "<tr>"; for ($i = 0; $i < $numfields; $i++) { $helptext .= "<td>{$row[$i]}</td>"; } $helptext .= "</tr>"; } $helptext .= "</tbody></table>"; } if (isset($_POST['btnListColumns']) && $_POST['tablename'] != "" || isset($_GET['subaction']) && $_GET['subaction'] == "tablecols") { if (isset($_POST['tablename'])) { $tablename = escape(safe_html($_POST['tablename'])); } else { if (isset($_GET['tablename'])) { $tablename = escape(safe_html($_GET['tablename'])); } else { displayerror("Table name missing"); return $editPageContent; } } $helptext .= "<table id='sqlhelptable' name='sqlhelptable' class='display'><thead><tr><th colspan=6>Column Information of Table {$tablename} <br/><a href='./+edit&subaction=tablerows&tablename={$tablename}'>View Rows</a> <a href='./+edit&subaction=listalltables'>View All Tables</a> </th></tr>"; $helptext .= "<tr><th>Column Name</th><th>Column Type</th><th>Maximum Length</th><th>Default Value</th><th>Not Null</th><th>Primary Key</th></tr></thead><tbody>"; $query = "SELECT * FROM '{$tablename}' LIMIT 1"; $res = mysql_query($query); for ($i = 0; $i < mysql_num_fields($res); $i++) { $meta = mysql_fetch_field($res, $i); if (!$meta) { displayerror("Field information could not be retrieved"); break; } $helptext .= "<tr><td>{$meta->name}</td><td>{$meta->type}</td><td>{$meta->max_length}</td><td>{$meta->def}</td><td>{$meta->not_null}</td><td>{$meta->primary_key}</td></tr>"; } $helptext .= "</tbody></table>"; } global $urlRequestRoot, $cmsFolder, $STARTSCRIPTS; $smarttable = smarttable::render(array('sqlhelptable'), null); $STARTSCRIPTS .= "initSmartTable();"; global $ICONS; if ($helptext != "") { $helptext = "<fieldset><legend>{$ICONS['Database Information']['small']}Database Information</legend>{$smarttable} {$helptext}</fieldset>"; } return $helptext . $editPageContent; }
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; } }
/** * @uses generateFormDataRow($moduleCompId,$userId) * @uses getFormElementInfo($moduleCompId) (once it is made in formelementdescclass.php) * * @param $rowSortOrder "asc" or "desc" * @param $rowSortField "registrationdate" or "lastupdated" or "useremail" or "userfullname" or "elementid_".$i * @param $showEditButtons Whether to show edit and delete buttons or not: helps with editregistrants */ function generateFormDataTable($moduleComponentId, $sortField, $sortOrder, $action = 'viewregistrants') { global $sourceFolder, $templateFolder, $urlRequestRoot, $cmsFolder, $moduleFolder; $formDescQuery = 'SELECT `form_showuseremail`, `form_showuserfullname`, `form_showregistrationdate`, `form_showlastupdatedate`, `form_showuserprofiledata`,`form_heading` FROM `form_desc` ' . 'WHERE `page_modulecomponentid` = \'' . $moduleComponentId . "'"; $formDescResult = mysql_query($formDescQuery); $showUserEmail = $showUserFullName = false; $showRegistrationDate = $showLastUpdateDate = true; $showUserProfileData = false; $formName = ''; if ($formDescRow = mysql_fetch_row($formDescResult)) { $showUserEmail = $formDescRow[0] == 1; $showUserFullName = $formDescRow[1] == 1; $showRegistrationDate = $formDescRow[2] == 1; $showLastUpdateDate = $formDescRow[3] == 1; $showUserProfileData = $formDescRow[4] == 1; $formName = $formDescRow[5]; } $showEditButtons = $action == 'editregistrants'; $columnList = getColumnList($moduleComponentId, $showUserEmail, $showUserFullName, $showRegistrationDate, $showLastUpdateDate, $showUserProfileData); $columnNames = array(); /*$normalImage = "<img alt=\"Sort by this field\" height=\"12\" width=\"12\" style=\"padding:0px\" src=\"$urlRequestRoot/$cmsFolder/$templateFolder/common/icons/16x16/actions/view-refresh.png\" />"; $orderedImage = "<img alt=\"Sort by this field\" height=\"12\" width=\"12\" style=\"padding:0px\" src=\"$urlRequestRoot/$cmsFolder/$templateFolder/common/icons/16x16/actions/go-" . ($sortOrder == 'asc' ? 'up' : 'down') . ".png\" />"; $tableCaptions = "<thead><tr>\n<th nowrap=\"nowrap\" class=\"sortable-numeric\">S. No.</th>\n"; if($showEditButtons) { $tableCaptions .= '<th nowrap="nowrap">Edit</th><th nowrap="nowrap">Delete</th>'; } foreach($columnList as $columnName => $columnTitle) { $tableCaptions .= "<th nowrap=\"nowrap\" class=\"sortable-text\">$columnTitle</th>\n"; $columnNames[] = $columnName; } $tableCaptions .= "</tr></thead>\n";*/ $tableCaptions = "<thead><tr>\n<th>S. No.</th>\n"; $toggleColumns = "<fieldset><legend>Select Columns</legend><table><tr>"; $tableJqueryStuff = ""; $c = 0; $d = 0; if ($showEditButtons) { $tableCaptions .= '<th>Actions</th>'; $tableJqueryStuff = "null,"; $c++; } foreach ($columnList as $columnName => $columnTitle) { $tableCaptions .= "<th>{$columnTitle}</th>\n"; $columnNames[] = $columnName; $c = $c + 1; $checked = "checked"; if (!($columnName == "useremail" || $columnName == "registrationdate" || $columnName == "lastupdated")) { $tableJqueryStuff .= "/* {$columnTitle} */ { \"bVisible\": false },"; $checked = ""; } else { $tableJqueryStuff .= "null,"; } if ($d != 0 && $d % 5 == 0) { $toggleColumns .= "</tr><tr>"; } $d = $d + 1; $toggleColumns .= "<td><input type='checkbox' onclick='fnShowHide({$c});' {$checked} />{$columnTitle} <br/></td>"; } $tableCaptions .= "</tr></thead>\n"; $toggleColumns .= "</tr></table></fieldset>"; $userIds = getDistinctRegistrants($moduleComponentId, $sortField, $sortOrder); $userCount = count($userIds); global $ICONS; $editImage = $ICONS['Edit']['small']; $deleteImage = $ICONS['Delete']['small']; $tableBody = '<tbody>'; for ($i = 0; $i < $userCount; $i++) { $tableBody .= '<tr><td>' . ($i + 1) . '</td>'; if ($showEditButtons) { if ($userIds[$i] <= 0) { $tableBody .= '<td align="center"> </td>'; } else { $tableBody .= '<td align="center"><a title="Edit" href="./+editregistrants&subaction=edit&useremail=' . getUserEmail($userIds[$i]) . '" />' . $editImage . '</a> '; } if ($userIds[$i] <= 0) { $tableBody .= '<a style="cursor:pointer" title="Delete" onclick="return gotopage(\'./+editregistrants&subaction=delete&&useremail=' . getUserEmail($userIds[$i]) . '®istrantid=' . $userIds[$i] . '\',\'' . getUserEmail($userIds[$i]) . '\')" />' . $deleteImage . '</a></td>'; } else { $tableBody .= '<a style="cursor:pointer" title="Delete" onclick="return gotopage(\'./+editregistrants&subaction=delete&useremail=' . getUserEmail($userIds[$i]) . '\',\'' . getUserEmail($userIds[$i]) . '\')" />' . $deleteImage . '</a></td>'; } } $tableBody .= '<td>' . join(generateFormDataRow($moduleComponentId, $userIds[$i], $columnNames, $showUserProfileData), '</td><td>') . "</td></tr>\n"; } $tableBody .= "</tbody>"; $tableJqueryStuff = "/* S. No. */ null, {$tableJqueryStuff}"; $smarttable = smarttable::render(array('registrantstable'), array('registrantstable' => array('aoColumns' => "{$tableJqueryStuff}"))); global $STARTSCRIPTS; $STARTSCRIPTS .= "initSmartTable();"; $javascriptBody = <<<JAVASCRIPTBODY \t\t{$smarttable} \t\t<script> \t\t\tfunction fnShowHide( iCol ) \t\t\t{ \t\t\t\tvar bVis = oTable.fnSettings().aoColumns[iCol].bVisible; \t\t\t\toTable.fnSetColumnVis( iCol, bVis ? false : true ); \t\t\t} \t\t</script> \t\t<script language="javascript"> \t\t\tfunction gotopage(pagepath,useremail) { \t\t\t\tif(confirm("Are you sure you want to remove "+useremail+" from this form?")) \t\t\t\t\twindow.location = pagepath; \t\t\t} \t </script> JAVASCRIPTBODY; $imagesFolder = $urlRequestRoot . "/" . $cmsFolder . "/templates/common/images"; $editRegistrantsView = '<br />'; if ($action == 'editregistrants') { $editRegistrantsView .= <<<EDITREGISTRANTSVIEW \t\t\t<form name="addusertoformform" method="POST" action="./+editregistrants" style="float:left"> \t\t\t\t<script type="text/javascript" language="javascript" src="{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/scripts/ajaxsuggestionbox.js"> \t\t\t\t</script> \t\t\t\t<input type="text" name="useremail" id="userEmail" autocomplete="off" style="width: 256px" /> \t\t\t\t<div id="suggestionsBox" class="suggestionbox"></div> \t\t\t\t \t\t\t\t<input type="submit" name="btnAddUserToForm" value="Add User to Form" /> \t\t\t\t<script language="javascript" type="text/javascript"> \t\t\t\t<!-- \t\t\t\t\tvar userBox = new SuggestionBox(document.getElementById('userEmail'), document.getElementById('suggestionsBox'), "./+editregistrants&subaction=getsuggestions&forwhat=%pattern%"); \t\t\t\t\tuserBox.loadingImageUrl = '{$imagesFolder}/ajaxloading.gif'; \t\t\t\t--> \t\t\t\t</script> \t\t\t</form> \t\t\t<br /><br /> EDITREGISTRANTSVIEW; } //$editRegistrantsView .= $javascriptBody.'<table border="1" id="registrantstable" class="paginate-20 max-pages-5 no-arrow rowstyle-alt colstyle-alt sortable display">' . $tableCaptions . $tableBody . '</table><br />'; $editRegistrantsView .= $javascriptBody . $toggleColumns . '<table border="1" id="registrantstable" class="display">' . $tableCaptions . $tableBody . '</table><br />'; if (!$showEditButtons && isset($_POST['save_as_excel'])) { header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=\"{$formName}.xls\";"); header("Content-Transfer-Encoding: binary"); echo '<table>' . $tableCaptions . $tableBody . '</table>'; exit(1); } if ($action == 'editregistrants') { $editRegistrantsView .= '<form name="emptyregistrants" method="POST" action="./+editregistrants" onsubmit="return confirm(\'Are you sure you wish to remove all registrants from this form? This will also remove the users from any groups associated with this form.\')">' . '<input type="submit" name="btnEmptyRegistrants" value="Delete All Registrants" title="Deletes all registrations to this form" />' . '</form>'; } return $editRegistrantsView; }
function displayEmail($template = "") { global $sourceFolder, $urlRequestRoot; $newSelected = ""; if ($template == "" || $template == "new") { $newSelected = " selected"; $content = ""; } $emailTemplates = "<select id='emailtemplates' name='emailtemplates'><option value='new'{$newSelected}>Create New Template</option>"; $dir = "{$sourceFolder}/languages/" . LANGUAGE . "/email/templates/"; $handle = opendir($dir); $subject = ""; $content = ""; while ($file = readdir($handle)) { if (substr($file, -4, 4) == ".txt") { $name = substr($file, 0, -4); if ($name == $template) { $emailTemplates .= "<option value='{$name}' selected> {$name} </option>"; $content = fread(fopen($dir . $file, 'r'), filesize($dir . $file)); $subject = $name; } else { $emailTemplates .= "<option value='{$name}'> {$name} </option>"; } } } $emailTemplates .= "</select>"; global $ICONS; $groups = getAllGroups(); $users = getAllUsers(); $ret = smarttable::render(array('rcpttable'), null); $ret .= <<<RET \t<script type='text/javascript'> \tvar grouplist = { {$groups} }; \tvar userlist = { {$users} }; \tfunction fetchEmail() { \t\twindow.location = './+admin&subaction=openemail&name=' + document.getElementById('emailtemplates').value; \t} \t \tfunction saveEmail(e) { \t\tvar name = prompt("enter name for template", document.getElementById('subject').value); \t\tif(name != '') { \t\t\te.form.action += 'save&name='; \t\t\te.form.action += name; \t\t\te.form.submit(); \t\t} \t} \t \tfunction renderCheckList(arr,class) { \t\tvar ret = '<table name="rcptlisttable" id="rcpttable" class="userlisttable display"><thead><tr><th>Select Recipients</th></thead><tbody>'; \t\tfor(var key in arr) \t\t\tret += "<tr><td><INPUT type=checkbox class=" + class + " value='" + key + "'> " + arr[key] + "</td></tr>"; \t\tret += "</tbody></table>"; \t\treturn ret; \t} \t \tfunction selectAll() { \t\tdocument.getElementById('recipient').innerHTML = 'All'; \t\tdocument.getElementById('list').innerHTML = 'All users selected'; \t} \t \tfunction selectGroups() { \t\tdocument.getElementById('recipient').innerHTML = 'Selected Groups'; \t\tdocument.getElementById('list').innerHTML = "Group List:<br>" + renderCheckList(grouplist,'grouplist'); \t\tinitSmartTable(); \t} \t \tfunction selectUsers() { \t\tdocument.getElementById('recipient').innerHTML = 'Selected Users'; \t\tdocument.getElementById('list').innerHTML = "User List:<br>" + renderCheckList(userlist,'userlist'); \t\tinitSmartTable(); \t} \t \tfunction getList(class) { \t\tvar listarr = new Array(); \t\tvar list = document.getElementsByClassName(class); \t\tvar l = list.length; \t\tfor(var i = 0; i<l; i++) \t\t\tif(list[i].checked) \t\t\t\tlistarr.push(list[i].value); \t\treturn listarr; \t} \t \tfunction renderRecipient(arr) { \t\tvar ret = ''; \t\tfor(var ele in arr) \t\t\tret += arr[ele] + ', ' \t\tvar l = ret.length; \t\tif(l>0) \t\t\tret = ret.substring(0,l-2); \t\treturn ret; \t} \t \tfunction sendMail(e) { \t\tvar recipient = document.getElementById('recipient').innerHTML; \t\tvar recipients = 'all'; \t\tif(recipient == 'Selected Groups') \t\t\trecipients = 'groups:' + renderRecipient(getList('grouplist')); \t\telse if(recipient == 'Selected Users') \t\t\trecipients = 'users:' + renderRecipient(getList('userlist')); \t\tdocument.getElementById('recipients').value = recipients; \t\te.form.action += 'send'; \t\te.form.submit(); \t} \t</script> \t<fieldset> \t<legend>{$ICONS['Email Registrants']['small']}Email Registrants</legend> \t<form name=emailcontent action='./+admin&subaction=email' method=POST> \t<input type='hidden' id='recipients' name='recipients' value='all'> \t<table border=0 margin=0 width=100%> \t<tr><td> \tSubject: <input type=text value='{$subject}' id=subject name=subject> \t</td></tr> \t<tr><td> \tContent: \t{$emailTemplates} <input type=button value=Open onClick='fetchEmail()'> <input type=button id=btnSave value=Save onClick='saveEmail(this);'> \t<textarea cols=60 rows=15 name=templateContent>{$content}</textarea> \t</td></tr> \t</table> \t<table border=0 margin=0 width=100%> \t<tr><td style="text-align:center"> \tRecipients: <span id='recipient'>All</span><br/> \t<input type=button value=All onClick='selectAll()'> <input type=button value='Select Groups' onClick='selectGroups()'> <input type=button value='Select Users' onClick='selectUsers()'></td> \t</td></tr> \t<tr><td> \t<span id='list'> \tAll users selected \t</span> \t</td> \t</tr> \t</table> \t<input type=button value='Send Email' onClick='sendMail(this);'> \t</form> \t</fieldset> RET; return $ret; }
function displayBills($mcid, $active = false) { global $urlRequestRoot, $cmsFolder, $STARTSCRIPTS, $sourceFolder, $smarttablestuff; $billQuery = "SELECT * FROM `qaos1_bills` WHERE `page_modulecomponentid`={$mcid}"; $billResult = mysql_query($billQuery) or displayerror(mysql_error()); if ($billQuery == "") { return ""; } require_once $sourceFolder . "/upload.lib.php"; $uploadedFilesString = ""; while ($result = mysql_fetch_assoc($billResult)) { $evtName = getEventNameFromId($result['qaos1_eventid'], $mcid); $billAddedBy = getUserName($result['userid']); $uploadedFilesString .= <<<TABLEROW <tr> <td>{$result['bill_no']}</td> <td><a href="./{$result['qaos1_imgname']}">{$result['qaos1_imgname']}</a></td> <td>{$evtName}</td> \t<td>{$billAddedBy}</td>\t\t\t\t\t\t\t\t\t\t </tr>\t\t\t\t\t TABLEROW; } if (!$active) { $smarttablestuff = smarttable::render(array('filestable'), null); $STARTSCRIPTS .= "initSmartTable();"; } $displayBills = <<<BILLS {$smarttablestuff} <table class="display" id="filestable" border="1" width="100%"> <thead> <tr> <th>Bill No.</th> <th>File</th> <th>Event Name</th> <th>Added By</th> </tr> </thead> <tbody> {$uploadedFilesString} </tbody> </table> BILLS; return $displayBills; }
function reg_status($mcId) { global $STARTSCRIPTS; $smarttablestuff = smarttable::render(array('table_accousers'), null); $STARTSCRIPTS .= "initSmartTable();"; $userDetails = <<<TABLE {$smarttablestuff} <table class="display" id="table_accousers" width="100%" border="1"> <thead> <th>Total No. Of Registrations</th> <th>Total No. Of 500 Plan</th> <th>Total No. Of 700 Plan</th> </thead> TABLE; $getRegStatus700 = mysql_query("SELECT * FROM `oc_form_reg` WHERE `amount`='700' AND `page_moduleComponentId`={$mcId}") or displayerror(mysql_error()); $getRegStatus500 = mysql_query("SELECT * FROM `oc_form_reg` WHERE `amount`='500' AND `page_moduleComponentId`={$mcId}") or displayerror(mysql_error()); $totalReg = mysql_query("SELECT `user_id` FROM `oc_form_reg` WHERE `page_moduleComponentId`={$mcId}") or displayerror(mysql_error()); $countReg = mysql_num_rows($totalReg); $countReg500 = mysql_num_rows($getRegStatus500); $countReg700 = mysql_num_rows($getRegStatus700); $userDetails .= <<<TR <tr> <td>{$countReg}</td> <td>{$countReg500}</td> <td>{$countReg700}</td> </tr> TR; $userDetails .= <<<TABLEEND </table> TABLEEND; return $userDetails; }