Esempio n. 1
0
    function print_startmenu($task, $cat_parent)
    {
        global $mtconf;
        $database =& JFactory::getDBO();
        # Count the number of pending links/cats/reviews/reports/claims
        $database->setQuery("SELECT COUNT(*) FROM #__mt_cats WHERE cat_approved='0'");
        $pending_cats = $database->loadResult();
        $database->setQuery("SELECT COUNT(*) FROM #__mt_links WHERE link_approved <= 0");
        $pending_links = $database->loadResult();
        $database->setQuery("SELECT COUNT(*) FROM #__mt_reviews WHERE rev_approved='0'");
        $pending_reviews = $database->loadResult();
        $database->setQuery("SELECT COUNT(*) FROM #__mt_reports WHERE rev_id = 0 && link_id > 0");
        $pending_reports = $database->loadResult();
        $database->setQuery("SELECT COUNT(*) FROM #__mt_reviews WHERE ownersreply_text != '' AND ownersreply_approved = '0'");
        $pending_reviewsreply = $database->loadResult();
        $database->setQuery("SELECT COUNT(*) FROM #__mt_reports WHERE rev_id > 0 && link_id > 0");
        $pending_reviewsreports = $database->loadResult();
        $database->setQuery("SELECT COUNT(*) FROM #__mt_claims");
        $pending_claims = $database->loadResult();
        HTML_mtree::print_style();
        ?>
	<table cellpadding="3" cellspacing="0" border="0" width="100%">
	<tr>
		<td align="left" valign="top" width="160" height="0">

			<style type="text/css">

			</style>

			<table cellpadding="2" cellspacing="0" border="0" width="160" height="100%" align="left" style="border: 1px solid #cccccc;">
				<tr><td colspan="2" style="background: #DDE1E6; border-bottom: 1px solid #cccccc;font-weight:bold;"><?php 
        echo JText::_('Title');
        ?>
</td></tr>
				
				<?php 
        if (!$mtconf->get('admin_use_explorer')) {
            ?>
				<tr>
					<td width="20" align="center" style="background-color:#DDE1E6"><img src="../includes/js/ThemeOffice/home.png" width="16" height="16" /></td>
					<td width="100%" style="background-color:#F1F3F5"> <a class="mt_menu<?php 
            echo $task == "listcats" || $task == "editcat" || $task == "" ? "_selected" : "";
            ?>
" href="index2.php?option=com_mtree&task=listcats"><?php 
            echo JText::_('Navigate tree');
            ?>
</a></td>
				</tr>
				<?php 
        }
        ?>
				<tr>
					<td align="center" style="background-color:#DDE1E6"><img src="../components/com_mtree/img/page_white_add.png" width="16" height="16" /></td>
					<td style="background-color:#F1F3F5"> <a class="mt_menu<?php 
        echo $task == "newlink" ? "_selected" : "";
        ?>
" href="index2.php?option=com_mtree&amp;task=newlink&amp;cat_parent=<?php 
        echo $cat_parent;
        ?>
"><?php 
        echo JText::_('Add listing');
        ?>
</a></td>
				</tr>

				<tr>
					<td align="center" style="background-color:#DDE1E6"><img src="../components/com_mtree/img/folder_add.png" width="16" height="16" /></td>
					<td style="background-color:#F1F3F5"> <a class="mt_menu<?php 
        echo $task == "newcat" ? "_selected" : "";
        ?>
" href="index2.php?option=com_mtree&amp;task=newcat&amp;cat_parent=<?php 
        echo $cat_parent;
        ?>
"><?php 
        echo JText::_('Add cat');
        ?>
</a></td>
				</tr>
				<?php 
        # Pending Approvals
        if ($pending_links > 0 or $pending_cats > 0 or $pending_reviews > 0 or $pending_reports > 0 or $pending_reviewsreply > 0 or $pending_reviewsreports > 0 or $pending_claims > 0) {
            ?>
				<tr><td colspan="2" style="background: #DDE1E6; border-bottom: 1px solid #cccccc;border-top: 1px solid #cccccc;font-weight:bold;"><?php 
            echo JText::_('Pending approval');
            ?>
</td></tr>
					
				<?php 
            if ($pending_cats > 0) {
                ?>
				<tr>
					<td style="background-color:#DDE1E6"><img src="../components/com_mtree/img/folder.png" width="18" height="18" /></td>
					<td style="background-color:#F1F3F5">&nbsp;<a class="mt_menu<?php 
                echo $task == "listpending_cats" ? "_selected" : "";
                ?>
" href="index2.php?option=com_mtree&task=listpending_cats"><?php 
                echo JText::_('Categories');
                ?>
 (<?php 
                echo $pending_cats;
                ?>
)</a></td>
				</tr>
					<?php 
            }
            if ($pending_links > 0) {
                ?>
				<tr>
					<td style="background-color:#DDE1E6"><img src="../components/com_mtree/img/page_white.png" width="16" height="16" /></td>
					<td style="background-color:#F1F3F5">&nbsp;<a class="mt_menu<?php 
                echo $task == "listpending_links" ? "_selected" : "";
                ?>
" href="index2.php?option=com_mtree&task=listpending_links"><?php 
                echo JText::_('Listings');
                ?>
 (<?php 
                echo $pending_links;
                ?>
)</a></td>
				</tr>
				<?php 
            }
            if ($pending_reviews > 0) {
                ?>
				<tr>
					<td style="background-color:#DDE1E6"><img src="../components/com_mtree/img/comment.png" width="16" height="16" /></td>
					<td style="background-color:#F1F3F5">&nbsp;<a class="mt_menu<?php 
                echo $task == "listpending_reviews" ? "_selected" : "";
                ?>
" href="index2.php?option=com_mtree&task=listpending_reviews"><?php 
                echo JText::_('Reviews');
                ?>
 (<?php 
                echo $pending_reviews;
                ?>
)</a></td>
				</tr>
				<?php 
            }
            if ($pending_reports > 0) {
                ?>
				<tr>
					<td style="background-color:#DDE1E6"><img src="../components/com_mtree/img/error.png" width="16" height="16" /></td>
					<td style="background-color:#F1F3F5">&nbsp;<a class="mt_menu<?php 
                echo $task == "listpending_reports" ? "_selected" : "";
                ?>
" href="index2.php?option=com_mtree&task=listpending_reports"><?php 
                echo JText::_('Reports');
                ?>
 (<?php 
                echo $pending_reports;
                ?>
)</a></td>
				</tr>
				<?php 
            }
            if ($pending_reviewsreply > 0) {
                ?>
				<tr>
					<td style="background-color:#DDE1E6"><img src="../components/com_mtree/img/user_comment.png" width="16" height="16" /></td>
					<td style="background-color:#F1F3F5">&nbsp;<a class="mt_menu<?php 
                echo $task == "listpending_reviewsreply" ? "_selected" : "";
                ?>
" href="index2.php?option=com_mtree&task=listpending_reviewsreply"><?php 
                echo JText::_('Owners replies');
                ?>
 (<?php 
                echo $pending_reviewsreply;
                ?>
)</a></td>
				</tr>
				<?php 
            }
            if ($pending_reviewsreports > 0) {
                ?>
				<tr>
					<td style="background-color:#DDE1E6"><img src="../components/com_mtree/img/error.png" width="16" height="16" /></td>
					<td style="background-color:#F1F3F5">&nbsp;<a class="mt_menu<?php 
                echo $task == "listpending_reviewsreports" ? "_selected" : "";
                ?>
" href="index2.php?option=com_mtree&task=listpending_reviewsreports"><?php 
                echo JText::_('Reviews reports');
                ?>
 (<?php 
                echo $pending_reviewsreports;
                ?>
)</a></td>
				</tr>
				<?php 
            }
            if ($pending_claims > 0) {
                ?>
				<tr>
					<td style="background-color:#DDE1E6"><img src="../components/com_mtree/img/user_green.png" width="16" height="16" /></td>
					<td style="background-color:#F1F3F5">&nbsp;<a class="mt_menu<?php 
                echo $task == "listpending_claims" ? "_selected" : "";
                ?>
" href="index2.php?option=com_mtree&task=listpending_claims"><?php 
                echo JText::_('Claims');
                ?>
 (<?php 
                echo $pending_claims;
                ?>
)</a></td>
				</tr>
				<?php 
            }
        }
        # End of Pending Approvals
        # dTree
        if ($mtconf->get('admin_use_explorer')) {
            ?>
				<tr><td colspan="2" style="background: #DDE1E6; border-bottom: 1px solid #cccccc;border-top: 1px solid #cccccc;font-weight:bold;"><?php 
            echo JText::_('Explorer');
            ?>
</td></tr>
				<tr><td colspan="2" style="background-color:#F1F3F5;">
				<?php 
            $cats = HTML_mtree::getChildren(0, $mtconf->get('explorer_tree_level'));
            ?>
				<link rel="StyleSheet" href="components/com_mtree/dtree.css" type="text/css" />
				<script type="text/javascript" src="../components/com_mtree/js/dtree.js"></script>

				<script type="text/javascript">
					<!--
					
					fpath = '../components/com_mtree/img/dtree/folder.gif';
					d = new dTree('d');

					d.config.closeSameLevel = true; 

					d.icon.root = '../includes/js/ThemeOffice/home.png',
					d.icon.folder = '../components/com_mtree/img/dtree/folder.gif',
					d.icon.folderOpen = '../components/com_mtree/img/dtree/folderopen.gif',
					d.icon.node = '../components/com_mtree/img/dtree/page.gif',
					d.icon.empty = '../components/com_mtree/img/dtree/empty.gif',
					d.icon.line = '../components/com_mtree/img/dtree/line.png',
					d.icon.join = '../components/com_mtree/img/dtree/join.png',
					d.icon.joinBottom = '../components/com_mtree/img/dtree/joinbottom.png',
					d.icon.plus = '../components/com_mtree/img/dtree/plus.png',
					d.icon.plusBottom = '../components/com_mtree/img/dtree/plusbottom.png',
					d.icon.minus = '../components/com_mtree/img/dtree/minus.gif',
					d.icon.minusBottom = '../components/com_mtree/img/dtree/minusbottom.gif',
					d.icon.nlPlus = '../components/com_mtree/img/dtree/nolines_plus.gif',
					d.icon.nlMinus = '../components/com_mtree/img/dtree/nolines_minus.gif'

					d.add(0,-1,'<?php 
            echo JText::_('Root');
            ?>
', 'index2.php?option=com_mtree');
					<?php 
            foreach ($cats as $cat) {
                echo "\nd.add(";
                echo $cat->cat_id . ",";
                echo $cat->cat_parent . ",";
                // Print Category Name
                echo "'" . addslashes(htmlspecialchars($cat->cat_name, ENT_QUOTES));
                echo "',";
                echo "pp(" . $cat->cat_id . "),";
                echo "'','',";
                echo "fpath";
                echo ");";
            }
            ?>
					document.write(d);
					
					function pp(cid) {
						return 'index2.php?option=com_mtree&task=listcats&cat_id='+cid;
					}
					//-->
				</script>

				</td></tr>
				<?php 
        }
        # End of  dTree
        # This Directory
        if ($task == 'listcats' || $task == 'editcat' || $task == 'editcat_browse_cat' || $task == 'editcat_add_relcat' || $task == 'editcat_remove_relcat') {
            if ($cat_parent > 0) {
                # Lookup all information about this directory
                $thiscat = new mtCats($database);
                $thiscat->load($cat_parent);
                ?>
				<tr><td colspan="2" align="left" style="color: black; padding-left: 20px;font-weight:bold;background: #DDE1E6 url(../components/com_mtree/img/dtree/folderopen.gif) no-repeat center left; border-bottom: 1px solid #cccccc;border-top: 1px solid #cccccc;"><?php 
                echo JText::_('This category');
                ?>
</td></tr>
				<tr class="row0"><td colspan="2" style="background-color:#F1F3F5">
					<?php 
                $published_img = $thiscat->cat_published ? 'tick.png' : 'publish_x.png';
                $featured_img = $thiscat->cat_featured ? 'tick.png' : 'publish_x.png';
                $tcat = new mtDisplay();
                $tcat->add(JText::_('Name'), '<a href="index2.php?option=com_mtree&task=editcat&cat_id=' . $thiscat->cat_id . '&cat_parent=' . $thiscat->cat_parent . '">' . $thiscat->cat_name . '</a>');
                $tcat->add(JText::_('Cat id'), $thiscat->cat_id);
                $tcat->add(JText::_('Listings'), $thiscat->cat_links);
                $tcat->add(JText::_('Categories'), $thiscat->cat_cats);
                $tcat->add(JText::_('Related categories2'), $thiscat->getNumOfRelCats());
                $tcat->add(JText::_('Published'), '<img src="images/' . $published_img . '" width="12" height="12" border="0" alt="" />');
                $tcat->add(JText::_('Featured'), '<img src="images/' . $featured_img . '" width="12" height="12" border="0" alt="" />');
                $tcat->display();
                ?>
				</td></tr>

				<?php 
            }
            # This Listing
        } elseif ($task == 'editlink' || $task == 'editlink_change_cat' || $task == 'reviews_list' || $task == 'newreview' || $task == 'editreview' || $task == 'editlink_browse_cat' || $task == 'editlink_add_cat' || $task == 'editlink_remove_cat') {
            global $link_id;
            if ($link_id[0] > 0) {
                $thislink = new mtLinks($database);
                $thislink->load($link_id[0]);
                $database->setQuery('SELECT COUNT(*) FROM #__mt_reviews WHERE link_id = ' . $database->quote($link_id[0]) . ' AND rev_approved = 1');
                $reviews = $database->loadResult();
                ?>
				<tr><td colspan="2" align="left" style="color: black; padding-left: 20px;font-weight:bold;background: #DDE1E6 url(../includes/js/ThemeOffice/document.png) no-repeat center left; border-bottom: 1px solid #cccccc;border-top: 1px solid #cccccc;"><?php 
                echo JText::_('This listing');
                ?>
</td></tr>
				<tr class="row0"><td colspan="2" style="background-color:#F1F3F5">
					<?php 
                $tlisting = new mtDisplay();
                $tlisting->add(JText::_('Name'), '<a href="index2.php?option=com_mtree&task=editlink&link_id=' . $thislink->link_id . '">' . $thislink->link_name . '</a>');
                $tlisting->add(JText::_('Listing id'), $thislink->link_id);
                $tlisting->add(JText::_('Category'), '<a href="index2.php?option=com_mtree&task=listcats&cat_id=' . $thislink->cat_id . '">' . $thislink->getCatName() . '</a>');
                $tlisting->add(JText::_('Reviews'), '<a href="index2.php?option=com_mtree&task=reviews_list&link_id=' . $thislink->link_id . '">' . $reviews . '</a>');
                $tlisting->add(JText::_('Hits'), $thislink->link_hits);
                $tlisting->add(JText::_('Modified2'), tellDateTime($thislink->link_modified));
                $tlisting->display();
                ?>
				</td></tr>
						<?php 
            }
        }
        // Search
        $search_text = JRequest::getVar('search_text', '', 'post');
        $search_where = JRequest::getInt('search_where', 0, 'post');
        // 1: Listing, 2: Category
        ?>

				<tr><td colspan="2" style="background: #DDE1E6; border-bottom: 1px solid #cccccc;border-top: 1px solid #cccccc;font-weight:bold;"><?php 
        echo JText::_('Search');
        ?>
</td></tr>
				<tr><td colspan="2" align="left" style="background-color:#F1F3F5">
					<form action="index2.php" method="post">
					<input class="text_area" type="text" name="search_text" size="10" maxlength="250" value="<?php 
        echo $search_text;
        ?>
" /> <input type="submit" value="<?php 
        echo JText::_('Search');
        ?>
" class="button" />
					<select name="search_where" class="inputbox" size="1">
						<option value="1"<?php 
        echo $search_where == 1 ? ' selected' : '';
        ?>
><?php 
        echo JText::_('Listings');
        ?>
</option>
						<option value="2"<?php 
        echo $search_where == 2 ? ' selected' : '';
        ?>
><?php 
        echo JText::_('Categories');
        ?>
</option>
					</select>
					<a href="index2.php?option=com_mtree&task=advsearch"><?php 
        echo JText::_('Advanced search short');
        ?>
</a>
					<input type="hidden" name="option" value="com_mtree" />
					<input type="hidden" name="task" value="search" />
					<input type="hidden" name="limitstart" value="0" />
					</form>
				</td></tr>

				<tr><td colspan="2" style="background: #DDE1E6; border-bottom: 1px solid #cccccc;border-top: 1px solid #cccccc;font-weight:bold;"><?php 
        echo JText::_('More');
        ?>
</td></tr>
				<tr>
					<td style="background: #DDE1E6;"><img src="../components/com_mtree/img/zoom.png" width="16" height="16" /></td>
					<td style="background-color:#F1F3F5">&nbsp;<a class="mt_menu" href="index2.php?option=com_mtree&task=spy"><?php 
        echo JText::_('Spy directory');
        ?>
</a></td>
				</tr>
				<tr>
					<td style="background: #DDE1E6;"><img src="../includes/js/ThemeOffice/config.png" width="16" height="16" /></td>
					<td style="background-color:#F1F3F5">&nbsp;<a class="mt_menu<?php 
        echo $task == "config" ? "_selected" : "";
        ?>
" href="index2.php?option=com_mtree&task=config"><?php 
        echo JText::_('Configuration');
        ?>
</a></td>
				</tr>
				<?php 
        /* ?>
        			<tr>
        				<td style="background: #DDE1E6;"><img src="../components/com_mtree/img/table_link.png" width="16" height="16" /></td>
        				<td style="background-color:#F1F3F5">&nbsp;<a class="mt_menu<?php echo ($task=="linkchecker") ? "_selected": ""; ?>" href="index2.php?option=com_mtree&task=linkchecker"><?php echo JText::_( 'Link checker' ) ?></a></td>
        			</tr>
        			<?php */
        ?>
				<tr>
					<td style="background: #DDE1E6;"><img src="../includes/js/ThemeOffice/template.png" width="16" height="16" /></td>
					<td style="background-color:#F1F3F5">&nbsp;<a class="mt_menu<?php 
        echo $task == "templates" ? "_selected" : "";
        ?>
" href="index2.php?option=com_mtree&task=templates"><?php 
        echo JText::_('Templates');
        ?>
</a></td>
				</tr>
				<tr>
					<td style="background: #DDE1E6;"><img src="../includes/js/ThemeOffice/content.png" width="16" height="16" /></td>
					<td style="background-color:#F1F3F5">&nbsp;<a class="mt_menu<?php 
        echo $task == "customfields" ? "_selected" : "";
        ?>
" href="index2.php?option=com_mtree&task=customfields"><?php 
        echo JText::_('Custom fields');
        ?>
</a></td>
				</tr>

				<tr>
					<td style="background: #DDE1E6;"><img src="../includes/js/ThemeOffice/query.png" width="16" height="16" /></td>
					<td style="background-color:#F1F3F5">&nbsp;<a class="mt_menu<?php 
        echo $task == "csv" ? "_selected" : "";
        ?>
" href="index2.php?option=com_mtree&task=csv"><?php 
        echo JText::_('Export');
        ?>
</a></td>
				</tr>
				<tr>
					<td style="background: #DDE1E6;"><img src="../includes/js/ThemeOffice/globe3.png" width="16" height="16" /></td>
					<td style="background-color:#F1F3F5">&nbsp;<a class="mt_menu" href="index.php?option=com_mtree&amp;task=geocode"><?php 
        echo JText::_('Locate Listings in Map');
        ?>
</a></td>
				</tr>
				<tr>
					<td style="background: #DDE1E6;"><img src="../includes/js/ThemeOffice/globe3.png" width="16" height="16" /></td>
					<td style="background-color:#F1F3F5">&nbsp;<a class="mt_menu" href="index2.php?option=com_mtree&amp;task=globalupdate"><?php 
        echo JText::_('Recount categories listings');
        ?>
</a></td>
				</tr>
				<tr>
					<td style="background: #DDE1E6;"><img src="../includes/js/ThemeOffice/credits.png" width="16" height="16" /></td>
					<td style="background-color:#F1F3F5">&nbsp;<a class="mt_menu<?php 
        echo $task == "about" ? "_selected" : "";
        ?>
" href="index2.php?option=com_mtree&task=about"><?php 
        echo JText::_('About mosets tree');
        ?>
</a></td>
				</tr>

			</table>		
		</td>
		<td valign="top">
		<?php 
    }