$sql='SELECT *, COUNT(*) AS NEDIT FROM '.$tbl_wiki.' WHERE '.$groupfilter.' GROUP BY user_id ORDER BY NEDIT DESC LIMIT 10'; //first ten users with more versions
if(api_is_allowed_to_edit() || api_is_platform_admin()) //only by professors if page is hidden
{
$sql='SELECT *, MAX(version) AS MAX FROM '.$tbl_wiki.' WHERE '.$groupfilter.' GROUP BY reflink ORDER BY MAX DESC, reflink LIMIT 10'; //first ten users
}
else
{
$sql='SELECT *, MAX(version) AS MAX FROM '.$tbl_wiki.' WHERE '.$groupfilter.' AND visibility=1 GROUP BY reflink ORDER BY MAX DESC, reflink LIMIT 10';//first ten users
}
$allpages=api_sql_query($sql,__FILE__,__LINE__);
echo '<ul>';
while ($row=Database::fetch_array($allpages))
{
echo '<li><ahref="'.$_SERVER['PHP_SELF'].'?cidReq='.$_course[id].'&action=showpage&title='.urlencode($row['reflink']).'&group_id='.Security::remove_XSS($_GET['group_id']).'">'.$row['title'].'</a> '.get_lang('With').' '.$row['MAX'].' '.get_lang('Changes').'</li>'; //TODO:check if hidden and assignment mode
if(api_is_allowed_to_edit() || api_is_platform_admin()) //only by professors if page is hidden
{
$sql='SELECT *, SUM(hits) AS tsum FROM '.$tbl_wiki.' WHERE '.$groupfilter.' GROUP BY reflink ORDER BY tsum DESC, reflink LIMIT 10'; //first ten pages
}
else
{
$sql='SELECT *, SUM(hits) AS tsum FROM '.$tbl_wiki.' WHERE '.$groupfilter.' AND visibility=1 GROUP BY reflink ORDER BY tsum DESC, reflink LIMIT 10'; //first ten pages
}
$allpages=api_sql_query($sql,__FILE__,__LINE__);
echo '<ul>';
while ($row=Database::fetch_array($allpages))
{
echo '<li><ahref="'.$_SERVER['PHP_SELF'].'?cidReq='.$_course[id].'&action=showpage&title='.urlencode($row['reflink']).'&group_id='.Security::remove_XSS($_GET['group_id']).'">'.$row['title'].'</a> '.get_lang('With').' '.$row['tsum'].' '.get_lang('Visits').'</li>'; //TODO:check if hidden and assignment mode
@ -515,15 +676,38 @@ if ($_GET['action']=='orphaned')
//change reflink by title
foreach($orphaned as $vshow)
{
if(api_is_allowed_to_edit() || api_is_platform_admin()) //only by professors if page is hidden
{
$sql='SELECT * FROM '.$tbl_wiki.' WHERE '.$groupfilter.' AND reflink="'.$vshow.'" GROUP BY reflink';
}
else
{
$sql='SELECT * FROM '.$tbl_wiki.' WHERE '.$groupfilter.' AND reflink="'.$vshow.'" AND visibility=1 GROUP BY reflink';
}
$allpages=api_sql_query($sql,__FILE__,__LINE__);
echo '<ul>';
while ($row=Database::fetch_array($allpages))
{
//$sort_orphaned[]=$row['title']; //TODO: check to delete this line
echo '<li><ahref="'.$_SERVER['PHP_SELF'].'?cidReq='.$_course[id].'&action=showpage&title='.urlencode($row['reflink']).'&group_id='.Security::remove_XSS($_GET['group_id']).'">'.$row['title'].'</a></li>'; //TODO:check if hidden and assignment mode
$sql="SELECT * FROM ".$tbl_wiki." WHERE ".$groupfilter." AND linksto LIKE '%".html_entity_decode(Database::escape_string(stripslashes(urldecode($page))))."%' GROUP BY reflink ORDER BY title ASC";
$sql="SELECT * FROM ".$tbl_wiki." WHERE ".$groupfilter." AND linksto LIKE '%".html_entity_decode(Database::escape_string(stripslashes(urldecode($page))))." %' GROUP BY reflink ORDER BY title ASC"; //add blank space after like '%" " %' to identify each word
$result=api_sql_query($sql,__LINE__,__FILE__);
//show result
@ -1726,6 +1911,7 @@ author Juan Carlos Raña Trabado