/web/generatedCode/simple-example/opencms/CMS_ONLINE_RESOURCES/listCMS_ONLINE_RESOURCES.php
PHP | 211 lines | 186 code | 25 blank | 0 comment | 20 complexity | e1c7d8e6b056d2e27a8a1509fef0fce4 MD5 | raw file
- <?php
- include_once("../common/dbConnection.php");
- include_once("../common/header.php");
- ?>
- <?
- $initStartLimit = 0;
- $limitPerPage = 10;
- $startLimit = $_REQUEST['startLimit'];
- $numberOfRows = $_REQUEST['rows'];
- $sortBy = $_REQUEST['sortBy'];
- $sortOrder = $_REQUEST['sortOrder'];
- if ($startLimit=="")
- {
- $startLimit = $initStartLimit;
- }
- if ($numberOfRows=="")
- {
- $numberOfRows = $limitPerPage;
- }
- if ($sortOrder=="")
- {
- $sortOrder = "DESC";
- }
- if ($sortOrder == "DESC") { $newSortOrder = "ASC"; } else { $newSortOrder = "DESC"; }
- $limitQuery = " LIMIT ".$startLimit.",".$numberOfRows;
- $nextStartLimit = $startLimit + $limitPerPage;
- $previousStartLimit = $startLimit - $limitPerPage;
- if ($sortBy!="")
- {
- $orderByQuery = " ORDER BY ".$sortBy." ".$sortOrder;
- }
- $sql = "SELECT * FROM CMS_ONLINE_RESOURCES".$orderByQuery.$limitQuery;
- $result = MYSQL_QUERY($sql);
- $numberOfRows = MYSQL_NUM_ROWS($result);
- ?>
- <?
- if ($numberOfRows==0) {
- ?>
- Sorry. No records found !!
- <?
- }
- else if ($numberOfRows>0) {
- $i=0;
- ?>
- <br>
- <?
- if ($_REQUEST['startLimit'] != "")
- {
- ?>
- <a href="<? echo $_SERVER['PHP_SELF']; ?>?startLimit=<? echo $previousStartLimit; ?>&limitPerPage=<? echo $limitPerPage; ?>&sortBy=<? echo $sortBy; ?>&sortOrder=<? echo $sortOrder; ?>">Previous <? echo $limitPerPage; ?> Results</a>....
- <? } ?>
- <?
- if ($numberOfRows == $limitPerPage)
- {
- ?>
- <a href="<? echo $_SERVER['PHP_SELF']; ?>?startLimit=<? echo $nextStartLimit; ?>&limitPerPage=<? echo $limitPerPage; ?>&sortBy=<? echo $sortBy; ?>&sortOrder=<? echo $sortOrder; ?>">Next <? echo $limitPerPage; ?> Results</a>
- <? } ?>
- <br><br>
- <TABLE CELLSPACING="0" CELLPADDING="3" BORDER="0" WIDTH="100%">
- <TR>
- <TD>
- <a href="<? echo $PHP_SELF; ?>?sortBy=RESOURCE_ID&sortOrder=<? echo $newSortOrder; ?>&startLimit=<? echo $startLimit; ?>&rows=<? echo $limitPerPage; ?>">
- <B>RESOURCE_ID</B>
- </a>
- </TD>
- <TD>
- <a href="<? echo $PHP_SELF; ?>?sortBy=RESOURCE_TYPE&sortOrder=<? echo $newSortOrder; ?>&startLimit=<? echo $startLimit; ?>&rows=<? echo $limitPerPage; ?>">
- <B>RESOURCE_TYPE</B>
- </a>
- </TD>
- <TD>
- <a href="<? echo $PHP_SELF; ?>?sortBy=RESOURCE_FLAGS&sortOrder=<? echo $newSortOrder; ?>&startLimit=<? echo $startLimit; ?>&rows=<? echo $limitPerPage; ?>">
- <B>RESOURCE_FLAGS</B>
- </a>
- </TD>
- <TD>
- <a href="<? echo $PHP_SELF; ?>?sortBy=RESOURCE_STATE&sortOrder=<? echo $newSortOrder; ?>&startLimit=<? echo $startLimit; ?>&rows=<? echo $limitPerPage; ?>">
- <B>RESOURCE_STATE</B>
- </a>
- </TD>
- <TD>
- <a href="<? echo $PHP_SELF; ?>?sortBy=RESOURCE_SIZE&sortOrder=<? echo $newSortOrder; ?>&startLimit=<? echo $startLimit; ?>&rows=<? echo $limitPerPage; ?>">
- <B>RESOURCE_SIZE</B>
- </a>
- </TD>
- <TD>
- <a href="<? echo $PHP_SELF; ?>?sortBy=DATE_CONTENT&sortOrder=<? echo $newSortOrder; ?>&startLimit=<? echo $startLimit; ?>&rows=<? echo $limitPerPage; ?>">
- <B>DATE_CONTENT</B>
- </a>
- </TD>
- <TD>
- <a href="<? echo $PHP_SELF; ?>?sortBy=SIBLING_COUNT&sortOrder=<? echo $newSortOrder; ?>&startLimit=<? echo $startLimit; ?>&rows=<? echo $limitPerPage; ?>">
- <B>SIBLING_COUNT</B>
- </a>
- </TD>
- <TD>
- <a href="<? echo $PHP_SELF; ?>?sortBy=DATE_CREATED&sortOrder=<? echo $newSortOrder; ?>&startLimit=<? echo $startLimit; ?>&rows=<? echo $limitPerPage; ?>">
- <B>DATE_CREATED</B>
- </a>
- </TD>
- <TD>
- <a href="<? echo $PHP_SELF; ?>?sortBy=DATE_LASTMODIFIED&sortOrder=<? echo $newSortOrder; ?>&startLimit=<? echo $startLimit; ?>&rows=<? echo $limitPerPage; ?>">
- <B>DATE_LASTMODIFIED</B>
- </a>
- </TD>
- <TD>
- <a href="<? echo $PHP_SELF; ?>?sortBy=USER_CREATED&sortOrder=<? echo $newSortOrder; ?>&startLimit=<? echo $startLimit; ?>&rows=<? echo $limitPerPage; ?>">
- <B>USER_CREATED</B>
- </a>
- </TD>
- <TD>
- <a href="<? echo $PHP_SELF; ?>?sortBy=USER_LASTMODIFIED&sortOrder=<? echo $newSortOrder; ?>&startLimit=<? echo $startLimit; ?>&rows=<? echo $limitPerPage; ?>">
- <B>USER_LASTMODIFIED</B>
- </a>
- </TD>
- <TD>
- <a href="<? echo $PHP_SELF; ?>?sortBy=PROJECT_LASTMODIFIED&sortOrder=<? echo $newSortOrder; ?>&startLimit=<? echo $startLimit; ?>&rows=<? echo $limitPerPage; ?>">
- <B>PROJECT_LASTMODIFIED</B>
- </a>
- </TD>
- <TD>
- <a href="<? echo $PHP_SELF; ?>?sortBy=RESOURCE_VERSION&sortOrder=<? echo $newSortOrder; ?>&startLimit=<? echo $startLimit; ?>&rows=<? echo $limitPerPage; ?>">
- <B>RESOURCE_VERSION</B>
- </a>
- </TD>
- </TR>
- <?
- while ($i<$numberOfRows)
- {
- if (($i%2)==0) { $bgColor = "#FFFFFF"; } else { $bgColor = "#C0C0C0"; }
- $thisRESOURCE_ID = MYSQL_RESULT($result,$i,"RESOURCE_ID");
- $thisRESOURCE_TYPE = MYSQL_RESULT($result,$i,"RESOURCE_TYPE");
- $thisRESOURCE_FLAGS = MYSQL_RESULT($result,$i,"RESOURCE_FLAGS");
- $thisRESOURCE_STATE = MYSQL_RESULT($result,$i,"RESOURCE_STATE");
- $thisRESOURCE_SIZE = MYSQL_RESULT($result,$i,"RESOURCE_SIZE");
- $thisDATE_CONTENT = MYSQL_RESULT($result,$i,"DATE_CONTENT");
- $thisSIBLING_COUNT = MYSQL_RESULT($result,$i,"SIBLING_COUNT");
- $thisDATE_CREATED = MYSQL_RESULT($result,$i,"DATE_CREATED");
- $thisDATE_LASTMODIFIED = MYSQL_RESULT($result,$i,"DATE_LASTMODIFIED");
- $thisUSER_CREATED = MYSQL_RESULT($result,$i,"USER_CREATED");
- $thisUSER_LASTMODIFIED = MYSQL_RESULT($result,$i,"USER_LASTMODIFIED");
- $thisPROJECT_LASTMODIFIED = MYSQL_RESULT($result,$i,"PROJECT_LASTMODIFIED");
- $thisRESOURCE_VERSION = MYSQL_RESULT($result,$i,"RESOURCE_VERSION");
- ?>
- <TR BGCOLOR="<? echo $bgColor; ?>">
- <TD><? echo $thisRESOURCE_ID; ?></TD>
- <TD><? echo $thisRESOURCE_TYPE; ?></TD>
- <TD><? echo $thisRESOURCE_FLAGS; ?></TD>
- <TD><? echo $thisRESOURCE_STATE; ?></TD>
- <TD><? echo $thisRESOURCE_SIZE; ?></TD>
- <TD><? echo $thisDATE_CONTENT; ?></TD>
- <TD><? echo $thisSIBLING_COUNT; ?></TD>
- <TD><? echo $thisDATE_CREATED; ?></TD>
- <TD><? echo $thisDATE_LASTMODIFIED; ?></TD>
- <TD><? echo $thisUSER_CREATED; ?></TD>
- <TD><? echo $thisUSER_LASTMODIFIED; ?></TD>
- <TD><? echo $thisPROJECT_LASTMODIFIED; ?></TD>
- <TD><? echo $thisRESOURCE_VERSION; ?></TD>
- <TD><a href="editCMS_ONLINE_RESOURCES.php?RESOURCE_IDField=<? echo $thisRESOURCE_ID; ?>">Edit</a></TD>
- <TD><a href="confirmDeleteCMS_ONLINE_RESOURCES.php?RESOURCE_IDField=<? echo $thisRESOURCE_ID; ?>">Delete</a></TD>
- </TR>
- <?
- $i++;
- } // end while loop
- ?>
- </TABLE>
- <br>
- <?
- if ($_REQUEST['startLimit'] != "")
- {
- ?>
- <a href="<? echo $_SERVER['PHP_SELF']; ?>?startLimit=<? echo $previousStartLimit; ?>&limitPerPage=<? echo $limitPerPage; ?>&sortBy=<? echo $sortBy; ?>&sortOrder=<? echo $sortOrder; ?>">Previous <? echo $limitPerPage; ?> Results</a>....
- <? } ?>
- <?
- if ($numberOfRows == $limitPerPage)
- {
- ?>
- <a href="<? echo $_SERVER['PHP_SELF']; ?>?startLimit=<? echo $nextStartLimit; ?>&limitPerPage=<? echo $limitPerPage; ?>&sortBy=<? echo $sortBy; ?>&sortOrder=<? echo $sortOrder; ?>">Next <? echo $limitPerPage; ?> Results</a>
- <? } ?>
- <br><br>
- <?
- } // end of if numberOfRows > 0
- ?>
- <?php
- include_once("../common/footer.php");
- ?>