';
$html .= Display::url($url, $url, array('target'=>'_blank'));
diff --git a/main/inc/lib/certificate.lib.php b/main/inc/lib/certificate.lib.php
index 2e2811a0c7..3a6a403c65 100644
--- a/main/inc/lib/certificate.lib.php
+++ b/main/inc/lib/certificate.lib.php
@@ -5,7 +5,8 @@
* gradebook tool.
* @package chamilo.library.certificates
*/
-class Certificate extends Model {
+class Certificate extends Model
+{
var $table;
var $columns = array('id','cat_id','score_certificate','created_at','path_certificate');
/**
@@ -313,7 +314,7 @@ class Certificate extends Model {
* course* can be printed (for anonymous users). Connected users can always
* print them.
*/
- public function show() {
+ public function show($returnContent = false) {
// Special rules for anonymous users
$failed = false;
if (api_is_anonymous()) {
@@ -349,14 +350,25 @@ class Certificate extends Model {
//Read file or preview file
if (!empty($this->certificate_data['path_certificate'])) {
$user_certificate = $this->certification_user_path.basename($this->certificate_data['path_certificate']);
+
if (file_exists($user_certificate)) {
+ if ($returnContent) {
+ return file_get_contents($user_certificate);
+ }
header('Content-Type: text/html; charset='. api_get_system_encoding());
echo @file_get_contents($user_certificate);
}
} else {
+ if ($returnContent) {
+ return Display :: return_message(get_lang('NoCertificateAvailable'), 'warning');
+ }
Display :: display_reduced_header();
Display :: display_warning_message(get_lang('NoCertificateAvailable'));
}
exit;
}
+
+ static function getCertificatePublicURL($id) {
+ return api_get_path(WEB_PUBLIC_PATH).'certificates/'.$id;
+ }
}
\ No newline at end of file
diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php
index 745ad8d245..9d7248a09d 100755
--- a/main/inc/lib/document.lib.php
+++ b/main/inc/lib/document.lib.php
@@ -1545,7 +1545,7 @@ class DocumentManager
$date_no_time = api_convert_and_format_date(api_get_utc_datetime(), DATE_FORMAT_LONG_NO_DAY);
}
- $url = api_get_path(WEB_PATH).'certificates/index.php?id='.$info_grade_certificate['id'];
+ $url = Certificate::getCertificatePublicURL($info_grade_certificate['id']);
//replace content
$info_to_replace_in_content_html = array(
$first_name,
diff --git a/main/inc/lib/group_portal_manager.lib.php b/main/inc/lib/group_portal_manager.lib.php
index a2443ddc2f..c5d520430f 100644
--- a/main/inc/lib/group_portal_manager.lib.php
+++ b/main/inc/lib/group_portal_manager.lib.php
@@ -126,7 +126,7 @@ class GroupPortalManager
while ($item = Database::fetch_assoc($res)) {
$list[$item['id']] = $item['name'];
}
- return $list;
+ return $list;
}
/**
diff --git a/news_list.php b/news_list.php
index d6b2e40840..dc2b4a4e32 100644
--- a/news_list.php
+++ b/news_list.php
@@ -1,28 +1,9 @@
'.Display::return_icon('edit.png', get_lang('EditSystemAnnouncement'), array(), 32).'';
-}
-
-if (api_is_anonymous()) {
- $visibility = SystemAnnouncementManager::VISIBLE_GUEST;
-} else {
- $visibility = api_is_allowed_to_create_course() ? SystemAnnouncementManager::VISIBLE_TEACHER : SystemAnnouncementManager::VISIBLE_STUDENT;
-}
-$content = SystemAnnouncementManager ::display_announcements_slider($visibility, $_GET['id']);
-
-$tpl = new Template($tool_name);
-$tpl->assign('actions', $actions);
-$tpl->assign('content', $content);
-$tpl->display_one_col_template();
+$id = isset($_GET['id']) ? intval($_GET['id']) : null;
+$path = api_get_path(WEB_PUBLIC_PATH);
+header('Location: '.$path.'news/'.$id);
+exit;
\ No newline at end of file
diff --git a/src/ChamiloLMS/Controller/CertificateController.php b/src/ChamiloLMS/Controller/CertificateController.php
index c96f182e34..4e6b122f25 100644
--- a/src/ChamiloLMS/Controller/CertificateController.php
+++ b/src/ChamiloLMS/Controller/CertificateController.php
@@ -13,11 +13,15 @@ use Symfony\Component\HttpFoundation\Response;
*/
class CertificateController
{
- public function indexAction()
+ /**
+ *
+ * @return string
+ */
+ public function indexAction($id)
{
- /*$certificate = new Certificate($_GET['id']);
+ $certificate = new \Certificate($id);
//Show certificate HTML
- $certificate->show();*/
+ return $certificate->show(true);
}
}
\ No newline at end of file
diff --git a/src/ChamiloLMS/Controller/NewsController.php b/src/ChamiloLMS/Controller/NewsController.php
new file mode 100644
index 0000000000..32509bd378
--- /dev/null
+++ b/src/ChamiloLMS/Controller/NewsController.php
@@ -0,0 +1,40 @@
+
+ */
+class NewsController
+{
+ /**
+ *
+ * @return string
+ */
+ public function indexAction(Application $app, $id)
+ {
+ $actions = null;
+ if (api_is_platform_admin()) {
+ $actions = '
'.\Display::return_icon('edit.png', get_lang('EditSystemAnnouncement'), array(), 32).'';
+ }
+
+ if (api_is_anonymous()) {
+ $visibility = \SystemAnnouncementManager::VISIBLE_GUEST;
+ } else {
+ $visibility = api_is_allowed_to_create_course() ? \SystemAnnouncementManager::VISIBLE_TEACHER : \SystemAnnouncementManager::VISIBLE_STUDENT;
+ }
+ $content = \SystemAnnouncementManager ::display_announcements_slider($visibility, $id);
+
+ $app['template']->assign('content', $content);
+ $app['template']->assign('actions', $actions);
+ $response = $app['template']->render_layout('layout_1_col.tpl');
+
+ return new Response($response, 200, array());
+ }
+}
\ No newline at end of file
diff --git a/src/ChamiloLMS/Controller/UserController.php b/src/ChamiloLMS/Controller/UserController.php
new file mode 100644
index 0000000000..f3c81d3f46
--- /dev/null
+++ b/src/ChamiloLMS/Controller/UserController.php
@@ -0,0 +1,29 @@
+
+ */
+class UserController
+{
+ /**
+ *
+ * @return string
+ */
+ public function indexAction(Application $app, $username)
+ {
+ $userId = \UserManager::get_user_id_from_username($username);
+ $content = \SocialManager::display_individual_user($userId, true);
+ $app['template']->assign('content', $content);
+ $response = $app['template']->render_layout('layout_1_col.tpl');
+
+ return new Response($response, 200, array());
+ }
+}
\ No newline at end of file
diff --git a/user.php b/user.php
deleted file mode 100644
index 56d9d993cc..0000000000
--- a/user.php
+++ /dev/null
@@ -1,51 +0,0 @@
-