';
}
/////////////////////// Most active users /////////////////////// Juan Carlos Raña Trabado
+
if ($_GET['action']=='mactiveusers')
{
echo ' ';
echo ''.get_lang('MostActiveUsers').' ';
- echo '';
- //TODO
+ echo '';
+
+ $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
+ $allpages=api_sql_query($sql,__FILE__,__LINE__);
+
+ echo '
';
+
}
/////////////////////// Most changed pages /////////////////////// Juan Carlos Raña Trabado
@@ -384,15 +499,38 @@ if ($_GET['action']=='mactiveusers')
if ($_GET['action']=='mostchanged')
{
echo ' ';
- echo ''.get_lang('MostChanges').' ';
+ echo ''.get_lang('MostChangesPages').' ';
echo '';
- $sql='SELECT *, MAX(version) AS MAX FROM '.$tbl_wiki.' WHERE '.$groupfilter.' GROUP BY reflink ORDER BY MAX DESC, reflink LIMIT 10'; //first ten users
+
+ 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 '
';
while ($row=Database::fetch_array($allpages))
{
- echo '
'; //TODO:check if hidden and assignment mode
}
echo '
';
@@ -405,13 +543,36 @@ if ($_GET['action']=='mvisited')
echo ' ';
echo ''.get_lang('MostVisitedPages').' ';
echo '';
+
+
+ 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
+ }
- $sql='SELECT *, SUM(hits) AS tsum FROM '.$tbl_wiki.' WHERE '.$groupfilter.' GROUP BY reflink ORDER BY tsum DESC, reflink LIMIT 10'; //first ten pages
$allpages=api_sql_query($sql,__FILE__,__LINE__);
echo '
';
while ($row=Database::fetch_array($allpages))
{
- echo '
'; //TODO:check if hidden and assignment mode
}
echo '
';
}
@@ -494,7 +655,7 @@ if ($_GET['action']=='orphaned')
while ($row=Database::fetch_array($allpages))
{
//$row['linksto']= str_replace("\n".$row["reflink"]."\n", "\n", $row["linksto"]); //remove self reference. TODO check
- $rf = explode("\n", trim($row["linksto"]));
+ $rf = explode(" ", trim($row["linksto"])); //TODO: check fix replace explode("\n", trim($row["linksto"])) with explode(" ", trim($row["linksto"]))
$refs = array_merge($refs, $rf);
if ($n++ > 299)
@@ -503,27 +664,50 @@ if ($_GET['action']=='orphaned')
$n=0;
} // (clean-up only every 300th loop). Thanks to Erfurt Wiki
}
-
+
//search each name of list linksto into list reflink
foreach($pages as $v)
{
if(!in_array($v, $refs))
{
- $orphaned[] = $v;
+ $orphaned[] = $v;
}
}
//change reflink by title
foreach($orphaned as $vshow)
- {
- $sql='SELECT * FROM '.$tbl_wiki.' WHERE '.$groupfilter.' AND reflink="'.$vshow.'" GROUP BY reflink';
- $allpages=api_sql_query($sql,__FILE__,__LINE__);
+ {
+ 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 '
';
while ($row=Database::fetch_array($allpages))
{
//$sort_orphaned[]=$row['title']; //TODO: check to delete this line
- echo '
';
}
@@ -704,15 +888,16 @@ if ($_GET['action']=='links')
$result=api_sql_query($sql,__FILE__,__LINE__); //necessary for pages with compound name. TODO: check if necessay after have fixed wanted pages with _
$row=Database::fetch_array($result);
- echo $LinksPagesFrom.': '.$row['title'].'';
-
+ echo $LinksPagesFrom.': '.$row['title'].'';
if ($page==get_lang('DefaultTitle'))
{
$page='index';
}
- $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
**/
function detect_external_link($input)
{
+
$exlink='';
}
- //teacher assignement title
+ //teacher assignment title
$title_orig=$_POST['title'];
- //teacher assignement reflink
+ //teacher assignment reflink
$link2teacher=$_POST['title']= $title_orig."_uass".api_get_user_id();
//first: teacher name, photo, and assignment description (original content)