chamilo/chamilo-lms

View on GitHub
public/main/social/promoted_messages.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

/* For licensing terms, see /license.txt */

use Chamilo\CoreBundle\Component\Utils\ActionIcon;

$cidReset = true;

require_once __DIR__.'/../inc/global.inc.php';

api_protect_admin_script();

if ('true' !== api_get_setting('allow_social_tool')) {
    api_not_allowed(true);
}

$logInfo = [
    'tool' => 'Messages',
    'action' => 'promoted_messages_list',
];
Event::registerLog($logInfo);

$this_section = SECTION_SOCIAL;
$interbreadcrumb[] = [
    'url' => api_get_path(WEB_CODE_PATH).'social/home.php',
    'name' => get_lang('Social network'),
];

$interbreadcrumb[] = [
    'url' => api_get_path(WEB_CODE_PATH).'social/promoted_messages.php',
    'name' => get_lang('PromotedMessages'),
];
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('List')];
//$menu = SocialManager::show_social_menu('messages');

// Right content
$social_right_content = '';
$keyword = '';
$actionsLeft = '<a href="'.api_get_path(WEB_CODE_PATH).'social/new_promoted_message.php">'.
    Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Compose message')).'</a>';

$form = MessageManager::getSearchForm(api_get_self());
if ($form->validate()) {
    $values = $form->getSubmitValues();
    $keyword = $values['keyword'];
}
$actionsRight = $form->returnForm();
$social_right_content .= Display::toolbarAction('toolbar', [$actionsLeft, $actionsRight]);
//$social_right_content .= MessageManager::getPromotedMessagesGrid($keyword);

$tpl = new Template(null);
// Block Social Avatar
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');

$tpl->assign('social_menu_block', '');
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('social/inbox.tpl');
$tpl->display($social_layout);