| Current Path : /var/www/html/mmishra/mm/air1/ |
| Current File : /var/www/html/mmishra/mm/air1/webregroup.php |
<?php
checkAdmin($webid, $user);
if (!authenticate($webid, $user) == 'admin')
die('Admin page');
?>
Regroup pages according to your need. Webmaster can create and maintain content under the top level menu.
<?php
$rowid = $_REQUEST['rowid'];
$parentid = $_REQUEST['parentid'];
if (!$parentid) $parentid = 0;
$dateexpiry = $_POST['dateexpiry'];
if (!$dateexpiry || $dateexpiry == '0000-00-00 00:00:00') $dateexpiry = next_month();//date('Y-m-d');
$status = $_POST['status'];
$submit = $_POST['submit'];
$tbl = 'webpages';
if ($submit == 'SAVE') {
if (mysql_num_rows(mysql_query("select * from $tbl where rowid=$rowid"))) {
mysql_query("update $tbl set parentid=$parentid,status='$status',dateexpiry='$dateexpiry'
where rowid=$rowid");
}
}
if ($rowid > 0 && !$parentid) {
$rs = mysql_query("select * from $tbl where rowid=$rowid");
if ($o = mysql_fetch_object($rs)) {
$parentid = $o->parentid;
}
}
//get the parentid of page under updation
$parent = '';
foreach ($contentcategories as $key => $cc) {
if ($parentid == $key)
$parent = $cc;
else
$parents .= "[<a href='admin.php?conf=$conf&parentid=$key'>$cc</a>]";
}
if (!$parent) {
$rs = mysql_query("select hypertext from $tbl where webid='$webid' and rowid=$parentid");
if ($o = mysql_fetch_object($rs)) {
$parent = $o->hypertext;
}
}
if ($role == 'admin') {
echo "<div class='error'>Under ";
if ($parent) echo "$parent $parents";
echo "</div>";
echo "<table cellpadding='5' border='1' width='95%'style='border-collapse: collapse'>
<tr><th>Page Link</th><th>Page Groups</th></tr>";
$rs = mysql_query("select * from $tbl where webid='$webid' and parentid=$parentid order by rowid");
while ($o = mysql_fetch_object($rs)) {
if ($o->rowid == $rowid) {
echo "<tr valign='top'><td rowspan='2'><b>$o->hypertext</b><br>
Page access: $o->pageaccess<br>Page type: $o->pagetype ";
if ($o->pagetype == 'menu') echo "[ <a href='admin.php?conf=$conf&parentid=$o->rowid'>Submenu</a> ]";
echo "<br>Dated: $o->datecreation</td><th>Move Into <select name='parentid'>";
$sr = mysql_query("select rowid,hypertext from $tbl where webid='$webid' and pagetype='menu' order by hypertext");
echo "<option value='0'>Homepage</option>";
while ($q = mysql_fetch_object($sr)) {
echo "<option value='$q->rowid'";
if ($o->parentid == $q->rowid) echo " selected";
echo ">$q->hypertext</option>";
}
echo "</select><br>
Status <select name='status'>";
foreach ($statuss as $st) {
echo "<option value='$st'";
if ($status == $st) echo " selected";
echo ">$st</option>";
}
echo "</select><input type='hidden' name='rowid' value='$o->rowid'><br>Expiry: ";
$yr = date("Y", strtotime($o->dateexpiry));
$mth = date("m", strtotime($o->dateexpiry));
$dt = date("d", strtotime($o->dateexpiry));
//instantiate class and set properties
$myCalendar = new tc_calendar("dateexpiry", true, false);
$myCalendar->setIcon("images/calendar.gif");
$myCalendar->setDate($dt, $mth, $yr);
$myCalendar->setPath("classes/");
$myCalendar->setYearInterval(2010, 2025);
$myCalendar->dateAllow('2010-01-01', '2025-12-31');
$myCalendar->setDateFormat('j F Y');
//output the calendar
$myCalendar->writeScript();
echo "</th></tr><tr><th><input type='submit' name='submit' value='SAVE'></th></tr>";
} else {
echo "<tr valign='top'><td><a href='admin.php?conf=$conf&rowid=$o->rowid'>$o->hypertext</a><br>
Page access: $o->pageaccess<br>Page type: $o->pagetype";
if ($o->pagetype == 'menu') echo " [ <a href='admin.php?conf=$conf&parentid=$o->rowid'>Submenu</a> ]";
echo "<br>Dated: $o->datecreation</td><th>Status $o->status<br>Expiry $o->dateexpiry</th></tr>";
}
}
/*
foreach ($contentcategories as $key => $cc) {
echo "<tr valign='top'><td colspan='2'><a href='admin.php?conf=$conf&parentid=$key'>$cc</a></td></tr>";
}
*/
echo "</table>";
} else
echo "<h3>Access permission denied</h3>";
?>
These pages are stored in the database and is accessible through click of some menu link.