|
@@ 4228-4294 (lines=67) @@
|
| 4225 |
|
/** |
| 4226 |
|
* @param string $action |
| 4227 |
|
*/ |
| 4228 |
|
public function getMostChangedPages($action) |
| 4229 |
|
{ |
| 4230 |
|
$_course = $this->courseInfo; |
| 4231 |
|
$tbl_wiki = $this->tbl_wiki; |
| 4232 |
|
$course_id = $this->course_id; |
| 4233 |
|
$condition_session = $this->condition_session; |
| 4234 |
|
$groupfilter = $this->groupfilter; |
| 4235 |
|
|
| 4236 |
|
echo '<div class="actions">'.get_lang('MostChangedPages').'</div>'; |
| 4237 |
|
|
| 4238 |
|
if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden |
| 4239 |
|
$sql = 'SELECT *, MAX(version) AS MAX FROM '.$tbl_wiki.' |
| 4240 |
|
WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' |
| 4241 |
|
GROUP BY reflink';//TODO:check MAX and group by return last version |
| 4242 |
|
} else { |
| 4243 |
|
$sql = 'SELECT *, MAX(version) AS MAX FROM '.$tbl_wiki.' |
| 4244 |
|
WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' AND visibility=1 |
| 4245 |
|
GROUP BY reflink'; //TODO:check MAX and group by return last version |
| 4246 |
|
} |
| 4247 |
|
|
| 4248 |
|
$allpages = Database::query($sql); |
| 4249 |
|
|
| 4250 |
|
//show table |
| 4251 |
|
if (Database::num_rows($allpages) > 0) { |
| 4252 |
|
$rows = array(); |
| 4253 |
|
while ($obj = Database::fetch_object($allpages)) { |
| 4254 |
|
//get type assignment icon |
| 4255 |
|
$ShowAssignment = ''; |
| 4256 |
|
if ($obj->assignment == 1) { |
| 4257 |
|
$ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL); |
| 4258 |
|
} elseif ($obj->assignment == 2) { |
| 4259 |
|
$ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL); |
| 4260 |
|
} elseif ($obj->assignment == 0) { |
| 4261 |
|
$ShowAssignment = Display::return_icon('px_transparent.gif'); |
| 4262 |
|
} |
| 4263 |
|
|
| 4264 |
|
$row = array(); |
| 4265 |
|
$row[] = $ShowAssignment; |
| 4266 |
|
$row[] = '<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
| 4267 |
|
api_htmlentities($obj->title).'</a>'; |
| 4268 |
|
$row[] = $obj->MAX; |
| 4269 |
|
$rows[] = $row; |
| 4270 |
|
} |
| 4271 |
|
|
| 4272 |
|
$table = new SortableTableFromArrayConfig( |
| 4273 |
|
$rows, |
| 4274 |
|
2, |
| 4275 |
|
10, |
| 4276 |
|
'MostChangedPages_table', |
| 4277 |
|
'', |
| 4278 |
|
'', |
| 4279 |
|
'DESC' |
| 4280 |
|
); |
| 4281 |
|
$table->set_additional_parameters( |
| 4282 |
|
array( |
| 4283 |
|
'cidReq' => Security::remove_XSS($_GET['cidReq']), |
| 4284 |
|
'action' => Security::remove_XSS($action), |
| 4285 |
|
'session_id' => intval($_GET['session_id']), |
| 4286 |
|
'group_id' => intval($_GET['group_id']), |
| 4287 |
|
) |
| 4288 |
|
); |
| 4289 |
|
$table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;')); |
| 4290 |
|
$table->set_header(1, get_lang('Title'), true); |
| 4291 |
|
$table->set_header(2, get_lang('Changes'), true); |
| 4292 |
|
$table->display(); |
| 4293 |
|
} |
| 4294 |
|
} |
| 4295 |
|
|
| 4296 |
|
/** |
| 4297 |
|
* Restore page |
|
@@ 4743-4812 (lines=70) @@
|
| 4740 |
|
/** |
| 4741 |
|
* Most visited |
| 4742 |
|
*/ |
| 4743 |
|
public function getMostVisited() |
| 4744 |
|
{ |
| 4745 |
|
$tbl_wiki = $this->tbl_wiki; |
| 4746 |
|
$course_id = $this->course_id; |
| 4747 |
|
$groupfilter = $this->groupfilter; |
| 4748 |
|
$condition_session = $this->condition_session; |
| 4749 |
|
$_course = $this->courseInfo; |
| 4750 |
|
|
| 4751 |
|
echo '<div class="actions">'.get_lang('MostVisitedPages').'</div>'; |
| 4752 |
|
|
| 4753 |
|
if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden |
| 4754 |
|
$sql = 'SELECT *, SUM(hits) AS tsum FROM '.$tbl_wiki.' |
| 4755 |
|
WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' |
| 4756 |
|
GROUP BY reflink'; |
| 4757 |
|
} else { |
| 4758 |
|
$sql = 'SELECT *, SUM(hits) AS tsum FROM '.$tbl_wiki.' |
| 4759 |
|
WHERE |
| 4760 |
|
c_id = '.$course_id.' AND |
| 4761 |
|
'.$groupfilter.$condition_session.' AND |
| 4762 |
|
visibility=1 |
| 4763 |
|
GROUP BY reflink'; |
| 4764 |
|
} |
| 4765 |
|
|
| 4766 |
|
$allpages = Database::query($sql); |
| 4767 |
|
|
| 4768 |
|
//show table |
| 4769 |
|
if (Database::num_rows($allpages) > 0) { |
| 4770 |
|
$rows = array(); |
| 4771 |
|
while ($obj = Database::fetch_object($allpages)) { |
| 4772 |
|
//get type assignment icon |
| 4773 |
|
$ShowAssignment = ''; |
| 4774 |
|
if ($obj->assignment == 1) { |
| 4775 |
|
$ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL); |
| 4776 |
|
} elseif ($obj->assignment == 2) { |
| 4777 |
|
$ShowAssignment = $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL); |
| 4778 |
|
} elseif ($obj->assignment == 0) { |
| 4779 |
|
$ShowAssignment = Display::return_icon('px_transparent.gif'); |
| 4780 |
|
} |
| 4781 |
|
|
| 4782 |
|
$row = array(); |
| 4783 |
|
$row[] = $ShowAssignment; |
| 4784 |
|
$row[] = '<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
| 4785 |
|
api_htmlentities($obj->title).'</a>'; |
| 4786 |
|
$row[] = $obj->tsum; |
| 4787 |
|
$rows[] = $row; |
| 4788 |
|
} |
| 4789 |
|
|
| 4790 |
|
$table = new SortableTableFromArrayConfig( |
| 4791 |
|
$rows, |
| 4792 |
|
2, |
| 4793 |
|
10, |
| 4794 |
|
'MostVisitedPages_table', |
| 4795 |
|
'', |
| 4796 |
|
'', |
| 4797 |
|
'DESC' |
| 4798 |
|
); |
| 4799 |
|
$table->set_additional_parameters( |
| 4800 |
|
array( |
| 4801 |
|
'cidReq' => Security::remove_XSS($_GET['cidReq']), |
| 4802 |
|
'action' => Security::remove_XSS($this->action), |
| 4803 |
|
'session_id' => intval($_GET['session_id']), |
| 4804 |
|
'group_id' => intval($_GET['group_id']), |
| 4805 |
|
) |
| 4806 |
|
); |
| 4807 |
|
$table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;')); |
| 4808 |
|
$table->set_header(1, get_lang('Title'), true); |
| 4809 |
|
$table->set_header(2, get_lang('Visits'), true); |
| 4810 |
|
$table->display(); |
| 4811 |
|
} |
| 4812 |
|
} |
| 4813 |
|
|
| 4814 |
|
/** |
| 4815 |
|
* Get actions bar |