Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
pull/2487/head
Scrutinizer Auto-Fixer 9 years ago
parent 5828b19067
commit 1711b421c8
  1. 2
      custompages/language.inc.php
  2. 2
      main/auth/ldap/login.php
  3. 2
      main/document/document_slideshow.inc.php
  4. 6
      main/inc/lib/event_email_template.class.php
  5. 4
      main/inc/lib/gradebook.lib.php
  6. 10
      main/lp/scormItem.class.php
  7. 2
      main/lp/scormMetadata.class.php
  8. 2
      main/lp/scormOrganization.class.php
  9. 2
      main/lp/scormResource.class.php
  10. 6
      plugin/add_cas_logout_button/index.php
  11. 4
      plugin/add_cas_logout_button/plugin.php
  12. 6
      plugin/add_shibboleth_login_button/index.php
  13. 2
      plugin/customfooter/index.php
  14. 2
      plugin/show_user_info/lang/spanish.php
  15. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php
  16. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Project.php
  17. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectCommentStudent.php
  18. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectStudent.php
  19. 14
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Wiki.php
  20. 12
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Announcement.php
  21. 20
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseCopyLearnpath.php
  22. 2
      src/Chamilo/ThemeBundle/Controller/BreadcrumbController.php
  23. 2
      src/Chamilo/ThemeBundle/Controller/DefaultController.php
  24. 4
      src/Chamilo/ThemeBundle/Event/SidebarMenuEvent.php
  25. 4
      src/Chamilo/ThemeBundle/Event/TaskListEvent.php
  26. 18
      src/Chamilo/ThemeBundle/Event/ThemeEvents.php
  27. 6
      src/Chamilo/ThemeBundle/EventListener/NavbarMessageListDemoListener.php
  28. 2
      src/Chamilo/ThemeBundle/EventListener/NavbarNotificationListDemoListener.php
  29. 2
      src/Chamilo/ThemeBundle/EventListener/NavbarTaskListDemoListener.php
  30. 6
      src/Chamilo/ThemeBundle/EventListener/SidebarSetupMenuDemoListener.php
  31. 2
      src/Chamilo/ThemeBundle/Form/FormDemoModelType.php
  32. 4
      src/Chamilo/ThemeBundle/Model/MessageModel.php
  33. 4
      src/Chamilo/ThemeBundle/Model/UserModel.php
  34. 12
      src/Chamilo/ThemeBundle/Theme/ThemeManager.php
  35. 4
      user.php

@ -28,7 +28,7 @@ function get_preferred_language($available_langs) {
} }
krsort($langs, SORT_NUMERIC); krsort($langs, SORT_NUMERIC);
// Choosing the best match // Choosing the best match
foreach($langs as $weight => $codes) { foreach ($langs as $weight => $codes) {
foreach ($codes as $code) { foreach ($codes as $code) {
if (in_array($code, $available_langs)) { if (in_array($code, $available_langs)) {
return $code; return $code;

@ -31,7 +31,7 @@ if ($loginLdapSucces) {
$loginFailed = false; $loginFailed = false;
$uidReset = true; $uidReset = true;
$_user['user_id'] = $uData['user_id']; $_user['user_id'] = $uData['user_id'];
Session::write('_uid',$_uid); Session::write('_uid', $_uid);
// Jand: copied from event_login in events.lib.php to enable login statistics: // Jand: copied from event_login in events.lib.php to enable login statistics:
Event::event_login($uData['user_id']); Event::event_login($uData['user_id']);
} else { } else {

@ -71,7 +71,7 @@ $_SESSION['image_files_only'] = $image_files_only;
function sort_files($table) function sort_files($table)
{ {
$tablename_direction = isset($_GET['tablename_direction']) ? Security::remove_XSS($_GET['tablename_direction']) : 'ASC'; $tablename_direction = isset($_GET['tablename_direction']) ? Security::remove_XSS($_GET['tablename_direction']) : 'ASC';
$accepted_extensions = array('.jpg', '.jpeg', '.gif', '.png', '.bmp','.svg'); $accepted_extensions = array('.jpg', '.jpeg', '.gif', '.png', '.bmp', '.svg');
$temp = array(); $temp = array();
foreach ($table as & $file_array) { foreach ($table as & $file_array) {

@ -20,7 +20,7 @@ class EventEmailTemplate extends Model
*/ */
public function __construct() public function __construct()
{ {
$this->table = Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE); $this->table = Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE);
} }
/** /**
@ -44,7 +44,7 @@ class EventEmailTemplate extends Model
// action links // action links
$content = Display::actions(array( $content = Display::actions(array(
array( array(
'url' => 'event_type.php' , 'url' => 'event_type.php',
'content' => Display::return_icon( 'content' => Display::return_icon(
'new_document.png', 'new_document.png',
get_lang('Add'), get_lang('Add'),
@ -132,7 +132,7 @@ class EventEmailTemplate extends Model
public function get_count() public function get_count()
{ {
$row = Database::select('count(*) as count', $this->table, array(),'first'); $row = Database::select('count(*) as count', $this->table, array(), 'first');
return $row['count']; return $row['count'];
} }

@ -57,7 +57,7 @@ class Gradebook extends Model
} }
$c_id = $c_id ? intval($c_id) : api_get_course_int_id(); $c_id = $c_id ? intval($c_id) : api_get_course_int_id();
$table = Database::get_course_table(TABLE_TOOL_LIST); $table = Database::get_course_table(TABLE_TOOL_LIST);
$sql = "SELECT * from $table $sql = "SELECT * from $table
WHERE c_id = $c_id and name='$name' WHERE c_id = $c_id and name='$name'
LIMIT 1"; LIMIT 1";
@ -194,7 +194,7 @@ class Gradebook extends Model
$selected_skills = self::get_skills_by_gradebook($gradebook_id); $selected_skills = self::get_skills_by_gradebook($gradebook_id);
$clean_selected_skills = array(); $clean_selected_skills = array();
if (!empty($selected_skills)) { if (!empty($selected_skills)) {
foreach($selected_skills as $skill) { foreach ($selected_skills as $skill) {
$clean_selected_skills[] = $skill['id']; $clean_selected_skills[] = $skill['id'];
} }
} }

@ -100,7 +100,7 @@ class scormItem extends learnpathItem
} }
break; break;
case 'item': case 'item':
$oItem = new scormItem('manifest',$child); $oItem = new scormItem('manifest', $child);
if ($oItem->identifier != '') { if ($oItem->identifier != '') {
$this->sub_items[$oItem->identifier] = $oItem; $this->sub_items[$oItem->identifier] = $oItem;
} }
@ -119,7 +119,7 @@ class scormItem extends learnpathItem
$attributes = $element->attributes; $attributes = $element->attributes;
//$keep_href = ''; //$keep_href = '';
foreach ($attributes as $attrib) { foreach ($attributes as $attrib) {
switch($attrib->name){ switch ($attrib->name) {
case 'identifier': case 'identifier':
$this->identifier = $attrib->value; $this->identifier = $attrib->value;
break; break;
@ -172,8 +172,8 @@ class scormItem extends learnpathItem
); );
$abs_order++; $abs_order++;
$i = 1; $i = 1;
foreach($this->sub_items as $id => $dummy) { foreach ($this->sub_items as $id => $dummy) {
$oSubitem =& $this->sub_items[$id]; $oSubitem = & $this->sub_items[$id];
$oSubitem->get_flat_list($list, $abs_order, $i, $level + 1); $oSubitem->get_flat_list($list, $abs_order, $i, $level + 1);
$i++; $i++;
} }
@ -188,7 +188,7 @@ class scormItem extends learnpathItem
parent::save($from_outside, $prereqs_complete); parent::save($from_outside, $prereqs_complete);
// Under certain conditions, the scorm_contact should not be set, because no scorm signal was sent. // Under certain conditions, the scorm_contact should not be set, because no scorm signal was sent.
$this->scorm_contact = true; $this->scorm_contact = true;
if (!$this->scorm_contact){ if (!$this->scorm_contact) {
//error_log('New LP - was expecting SCORM message but none received', 0); //error_log('New LP - was expecting SCORM message but none received', 0);
} }
} }

@ -88,7 +88,7 @@ class scormMetadata
//$keep_href = ''; //$keep_href = '';
if (is_array($attributes)) { if (is_array($attributes)) {
foreach ($attributes as $attrib) { foreach ($attributes as $attrib) {
if (trim($attrib->value) != ''){ if (trim($attrib->value) != '') {
$this->attribs[$attrib->name] = $attrib->value; $this->attribs[$attrib->name] = $attrib->value;
} }
} }

@ -98,7 +98,7 @@ class scormOrganization
foreach ($this->items as $id => $dummy) { foreach ($this->items as $id => $dummy) {
$abs_order = 0; $abs_order = 0;
// Passes the array as a pointer so it is modified in $list directly. // Passes the array as a pointer so it is modified in $list directly.
$this->items[$id]->get_flat_list($list,$abs_order, $i, 0); $this->items[$id]->get_flat_list($list, $abs_order, $i, 0);
$i++; $i++;
} }

@ -69,7 +69,7 @@ class scormResource
} }
} }
//$keep_href = ''; //$keep_href = '';
if ($element->hasAttributes()){ //in some cases we get here with an empty attributes array if ($element->hasAttributes()) { //in some cases we get here with an empty attributes array
// TODO: Find when and why we get such a case (empty array). // TODO: Find when and why we get such a case (empty array).
$attributes = $element->attributes; $attributes = $element->attributes;
foreach ($attributes as $attrib) { foreach ($attributes as $attrib) {

@ -1,20 +1,20 @@
<?php <?php
// Show the CAS button to logout to your CAS session // Show the CAS button to logout to your CAS session
global $_user; global $_user;
$_template['show_message'] = false; $_template['show_message'] = false;
if (!api_is_anonymous() && if (!api_is_anonymous() &&
api_get_setting('cas_activate') == 'true' && api_get_setting('cas_activate') == 'true' &&
$_user['auth_source'] == CAS_AUTH_SOURCE $_user['auth_source'] == CAS_AUTH_SOURCE
) { ) {
$_template['show_message'] = true; $_template['show_message'] = true;
// the default title // the default title
$logout_label = "Deconnexion de CAS"; $logout_label = "Deconnexion de CAS";
if (!empty($plugin_info['settings']['add_cas_logout_button_cas_logout_label'])) { if (!empty($plugin_info['settings']['add_cas_logout_button_cas_logout_label'])) {
$logout_label = api_htmlentities($plugin_info['settings']['add_cas_logout_button_cas_logout_label']); $logout_label = api_htmlentities($plugin_info['settings']['add_cas_logout_button_cas_logout_label']);
} }
// the comm // the comm
$logout_comment = api_htmlentities($plugin_info['settings']['add_cas_logout_button_cas_logout_comment']);; $logout_comment = api_htmlentities($plugin_info['settings']['add_cas_logout_button_cas_logout_comment']); ;
// URL of the image // URL of the image
$logout_image_url = $plugin_info['settings']['add_cas_logout_button_cas_logout_image_url']; $logout_image_url = $plugin_info['settings']['add_cas_logout_button_cas_logout_image_url'];

@ -10,7 +10,7 @@
*/ */
//the plugin title //the plugin title
$plugin_info['title'] = 'Add a button to logout from CAS'; $plugin_info['title'] = 'Add a button to logout from CAS';
//the comments that go with the plugin //the comments that go with the plugin
$plugin_info['comment'] = "If CAS is activated, this plugin add a text and a button on the user page to logout from a CAS session. Configure plugin to add title, comment and logo."; $plugin_info['comment'] = "If CAS is activated, this plugin add a text and a button on the user page to logout from a CAS session. Configure plugin to add title, comment and logo.";
@ -36,4 +36,4 @@ $form->setDefaults($defaults);
$plugin_info['settings_form'] = $form; $plugin_info['settings_form'] = $form;
// Set the templates that are going to be used // Set the templates that are going to be used
$plugin_info['templates'] = array('template.tpl'); $plugin_info['templates'] = array('template.tpl');

@ -1,17 +1,17 @@
<?php <?php
// Show the Shibboleth button to login using SHIBBOLETH // Show the Shibboleth button to login using SHIBBOLETH
$_template['show_message'] = false; $_template['show_message'] = false;
if (api_is_anonymous()) { if (api_is_anonymous()) {
$_template['show_message'] = true; $_template['show_message'] = true;
// the default title // the default title
$button_label = "Connexion via Shibboleth"; $button_label = "Connexion via Shibboleth";
if (!empty($plugin_info['settings']['add_shibboleth_login_button_shibboleth_button_label'])) { if (!empty($plugin_info['settings']['add_shibboleth_login_button_shibboleth_button_label'])) {
$button_label = api_htmlentities($plugin_info['settings']['add_shibboleth_login_button_shibboleth_button_label']); $button_label = api_htmlentities($plugin_info['settings']['add_shibboleth_login_button_shibboleth_button_label']);
} }
// the comm // the comm
$comm_label = api_htmlentities($plugin_info['settings']['add_shibboleth_login_button_shibboleth_button_comment']);; $comm_label = api_htmlentities($plugin_info['settings']['add_shibboleth_login_button_shibboleth_button_comment']); ;
// URL of the image // URL of the image
$url_label = $plugin_info['settings']['add_shibboleth_login_button_shibboleth_image_url']; $url_label = $plugin_info['settings']['add_shibboleth_login_button_shibboleth_image_url'];

@ -4,7 +4,7 @@
*/ */
if (isset($plugin_info['current_region'])) { if (isset($plugin_info['current_region'])) {
switch($plugin_info['current_region']) { switch ($plugin_info['current_region']) {
case 'footer_left': case 'footer_left':
echo $plugin_info['settings']['customfooter_footer_left']; echo $plugin_info['settings']['customfooter_footer_left'];
break; break;

@ -1,3 +1,3 @@
<?php <?php
$strings['WelcomeToChamiloUserX'] = "Bienvenido a Chamilo %s!"; $strings['WelcomeToChamiloUserX'] = "Bienvenido a Chamilo %s!";

@ -109,7 +109,7 @@ class Documents extends Basic
], ],
['BulletedList', 'NumberedList', 'HorizontalRule'], ['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyBlock'], ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
[ 'Styles', ['Styles',
'Format', 'Format',
'Font', 'Font',
'FontSize', 'FontSize',

@ -90,7 +90,7 @@ class Project extends Basic
return [ return [
$this->getNewPageBlock(), $this->getNewPageBlock(),
['Undo', 'Redo'], ['Undo', 'Redo'],
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'], ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
['BulletedList', 'NumberedList', 'HorizontalRule'], ['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyBlock'], ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor', 'BGColor', 'Source'], ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor', 'BGColor', 'Source'],

@ -89,7 +89,7 @@ class ProjectCommentStudent extends Basic
return [ return [
$this->getNewPageBlock(), $this->getNewPageBlock(),
['Undo', 'Redo'], ['Undo', 'Redo'],
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'], ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
['BulletedList', 'NumberedList', 'HorizontalRule'], ['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyBlock'], ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor'], ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor'],

@ -90,7 +90,7 @@ class ProjectStudent extends Basic
return [ return [
$this->getNewPageBlock(), $this->getNewPageBlock(),
['Undo', 'Redo'], ['Undo', 'Redo'],
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'], ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
['BulletedList', 'NumberedList', 'HorizontalRule'], ['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyBlock'], ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor'], ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor'],

@ -56,11 +56,11 @@ class Wiki extends Basic
'-', '-',
'Find' 'Find'
], ],
['Wikilink','Link','Unlink','Anchor'], ['Wikilink', 'Link', 'Unlink', 'Anchor'],
['Image','Video','Flash','Oembed','Youtube','Audio','Asciimath'], ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio', 'Asciimath'],
['Table','HorizontalRule','Smiley','SpecialChar','leaflet'], ['Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'leaflet'],
['Format','Font','FontSize'], ['Format', 'Font', 'FontSize'],
['Bold','Italic','Underline'], ['Bold', 'Italic', 'Underline'],
[ [
'Subscript', 'Subscript',
'Superscript', 'Superscript',
@ -94,10 +94,10 @@ class Wiki extends Basic
return [ return [
$this->getNewPageBlock(), $this->getNewPageBlock(),
['Undo', 'Redo'], ['Undo', 'Redo'],
['Wikilink', 'Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'], ['Wikilink', 'Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
['BulletedList', 'NumberedList', 'HorizontalRule'], ['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['Styles','Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'], ['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''], api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''],
['Toolbarswitch'] ['Toolbarswitch']
]; ];

@ -59,13 +59,13 @@ class Announcement extends Resource
$size, $size,
$comment $comment
) { ) {
parent::__construct($id,RESOURCE_ANNOUNCEMENT); parent::__construct($id, RESOURCE_ANNOUNCEMENT);
$this->content = $content; $this->content = $content;
$this->title = $title; $this->title = $title;
$this->date = $date; $this->date = $date;
$this->display_order = $display_order; $this->display_order = $display_order;
$this->email_sent = $email_sent; $this->email_sent = $email_sent;
$this->attachment_path = $path; $this->attachment_path = $path;
$this->attachment_filename = $filename; $this->attachment_filename = $filename;

@ -155,18 +155,18 @@ class CourseCopyLearnpath extends Resource
$this->js_lib = $js_lib; $this->js_lib = $js_lib;
$this->content_license = $content_license; $this->content_license = $content_license;
$this->debug = $debug; $this->debug = $debug;
$this->visibility=$visibility; $this->visibility = $visibility;
$this->use_max_score=$use_max_score; $this->use_max_score = $use_max_score;
$this->autolaunch=$autolaunch; $this->autolaunch = $autolaunch;
$this->created_on=$created_on; $this->created_on = $created_on;
$this->modified_on=$modified_on; $this->modified_on = $modified_on;
$this->publicated_on=$publicated_on; $this->publicated_on = $publicated_on;
$this->expired_on=$expired_on; $this->expired_on = $expired_on;
$this->session_id=$session_id; $this->session_id = $session_id;
$this->author= $author; $this->author = $author;
$this->preview_image= $preview_image; $this->preview_image = $preview_image;
$this->items = $items; $this->items = $items;
} }

@ -58,7 +58,7 @@ class BreadcrumbController extends Controller {
$list = array(); $list = array();
if ($active) { if ($active) {
$list[] = $active; $list[] = $active;
while(null !== ($item = $active->getActiveChild())) { while (null !== ($item = $active->getActiveChild())) {
$list[] = $item; $list[] = $item;
$active = $item; $active = $item;
} }

@ -43,7 +43,7 @@ class DefaultController extends Controller
} }
public function formAction() { public function formAction() {
$form =$this->createForm( new FormDemoModelType()); $form = $this->createForm(new FormDemoModelType());
return $this->render('ChamiloThemeBundle:Default:form.html.twig', array( return $this->render('ChamiloThemeBundle:Default:form.html.twig', array(
'form' => $form->createView() 'form' => $form->createView()
)); ));

@ -74,9 +74,9 @@ class SidebarMenuEvent extends ThemeEvent
*/ */
public function getActive() { public function getActive() {
foreach($this->getItems() as $item) { foreach ($this->getItems() as $item) {
/** @var $item MenuItemInterface */ /** @var $item MenuItemInterface */
if($item->isActive()) return $item; if ($item->isActive()) return $item;
} }
return null; return null;
} }

@ -30,8 +30,8 @@ class TaskListEvent extends ThemeEvent {
* *
* @return $this * @return $this
*/ */
public function addTask(TaskInterface $taskInterface){ public function addTask(TaskInterface $taskInterface) {
$this->tasks[] = $taskInterface; $this->tasks[] = $taskInterface;
return $this; return $this;
} }

@ -19,40 +19,40 @@ class ThemeEvents
/** /**
* Used to receive notification data * Used to receive notification data
*/ */
const THEME_NOTIFICATIONS = 'theme.notifications'; const THEME_NOTIFICATIONS = 'theme.notifications';
/** /**
* Used to receive message data * Used to receive message data
*/ */
const THEME_MESSAGES = 'theme.messages'; const THEME_MESSAGES = 'theme.messages';
/** /**
* Used to receive task data * Used to receive task data
*/ */
const THEME_TASKS = 'theme.tasks'; const THEME_TASKS = 'theme.tasks';
/** /**
* *
*/ */
const THEME_NAVBAR_USER = 'theme.navbar_user'; const THEME_NAVBAR_USER = 'theme.navbar_user';
/** /**
* used to receive breadcrumb data * used to receive breadcrumb data
*/ */
const THEME_BREADCRUMB = 'theme.breadcrumb'; const THEME_BREADCRUMB = 'theme.breadcrumb';
/** /**
* used to receive the current user for the sidebar * used to receive the current user for the sidebar
*/ */
const THEME_SIDEBAR_USER = 'theme.sidebar_user'; const THEME_SIDEBAR_USER = 'theme.sidebar_user';
/** /**
* Used for searching * Used for searching
* @unused * @unused
*/ */
const THEME_SIDEBAR_SEARCH = 'theme.sidebar_search'; const THEME_SIDEBAR_SEARCH = 'theme.sidebar_search';
/** /**
* Used to receive the sidebar menu data * Used to receive the sidebar menu data
*/ */
const THEME_SIDEBAR_SETUP_MENU = 'theme.sidebar_setup_menu'; const THEME_SIDEBAR_SETUP_MENU = 'theme.sidebar_setup_menu';
/** /**
* Used to receive the sidebar menu data * Used to receive the sidebar menu data
*/ */
const THEME_SIDEBAR_SETUP_MENU_KNP = 'theme.sidebar_setup_menu_knp'; const THEME_SIDEBAR_SETUP_MENU_KNP = 'theme.sidebar_setup_menu_knp';
/** /**
* *
*/ */

@ -16,15 +16,15 @@ class NavbarMessageListDemoListener {
public function onListMessages(MessageListEvent $event) { public function onListMessages(MessageListEvent $event) {
foreach($this->getMessages() as $msg) { foreach ($this->getMessages() as $msg) {
$event->addMessage($msg); $event->addMessage($msg);
} }
} }
protected function getMessages() { protected function getMessages() {
return array( return array(
new MessageModel(new UserModel('Karl kettenkit'),'Dude! do something!', new \DateTime('-3 days')), new MessageModel(new UserModel('Karl kettenkit'), 'Dude! do something!', new \DateTime('-3 days')),
new MessageModel(new UserModel('Jack Trockendoc'),'This is some subject', new \DateTime('-10 month')), new MessageModel(new UserModel('Jack Trockendoc'), 'This is some subject', new \DateTime('-10 month')),
); );
} }

@ -16,7 +16,7 @@ class NavbarNotificationListDemoListener {
public function onListNotifications(NotificationListEvent $event) { public function onListNotifications(NotificationListEvent $event) {
foreach($this->getNotifications() as $notify){ foreach ($this->getNotifications() as $notify) {
$event->addNotification($notify); $event->addNotification($notify);
} }

@ -17,7 +17,7 @@ class NavbarTaskListDemoListener
public function onListTasks(TaskListEvent $event) public function onListTasks(TaskListEvent $event)
{ {
foreach($this->getTasks() as $task) { foreach ($this->getTasks() as $task) {
$event->addTask($task); $event->addTask($task);
} }

@ -45,12 +45,12 @@ class SidebarSetupMenuDemoListener
protected function activateByRoute($route, $items) { protected function activateByRoute($route, $items) {
foreach($items as $item) { /** @var $item MenuItemModel */ foreach ($items as $item) { /** @var $item MenuItemModel */
if($item->hasChildren()) { if ($item->hasChildren()) {
$this->activateByRoute($route, $item->getChildren()); $this->activateByRoute($route, $item->getChildren());
} }
else { else {
if($item->getRoute() == $route) { if ($item->getRoute() == $route) {
$item->setIsActive(true); $item->setIsActive(true);
} }
} }

@ -34,7 +34,7 @@ class FormDemoModelType extends AbstractType
->add('someChoices', 'choice', array('choices' => $choices, 'expanded' => true, 'multiple' => true)) ->add('someChoices', 'choice', array('choices' => $choices, 'expanded' => true, 'multiple' => true))
->add('username') ->add('username')
->add('email') ->add('email')
->add('termsAccepted','checkbox') ->add('termsAccepted', 'checkbox')
->add('message', 'textarea') ->add('message', 'textarea')
->add('price') ->add('price')
->add('date', 'date', array('widget' => 'single_text')) ->add('date', 'date', array('widget' => 'single_text'))

@ -51,11 +51,11 @@ class MessageModel implements MessageInterface
* @param null $sentAt * @param null $sentAt
* @param UserInterface $to * @param UserInterface $to
*/ */
function __construct(UserInterface $from = null, $subject= '', $sentAt = null, UserInterface $to = null) function __construct(UserInterface $from = null, $subject = '', $sentAt = null, UserInterface $to = null)
{ {
$this->to = $to; $this->to = $to;
$this->subject = $subject; $this->subject = $subject;
$this->sentAt = $sentAt ? : new \DateTime(); $this->sentAt = $sentAt ?: new \DateTime();
$this->from = $from; $this->from = $from;
} }

@ -31,11 +31,11 @@ class UserModel implements UserInterface
*/ */
protected $isOnline = false; protected $isOnline = false;
function __construct($username='', $avatar = '', $memberSince = null, $isOnline = true) function __construct($username = '', $avatar = '', $memberSince = null, $isOnline = true)
{ {
$this->avatar = $avatar; $this->avatar = $avatar;
$this->isOnline = $isOnline; $this->isOnline = $isOnline;
$this->memberSince = $memberSince ?:new \DateTime(); $this->memberSince = $memberSince ?: new \DateTime();
$this->username = $username; $this->username = $username;
} }

@ -36,7 +36,7 @@ class ThemeManager
function __construct($container, $resolverClass = null) function __construct($container, $resolverClass = null)
{ {
$this->container = $container; $this->container = $container;
$this->resolverClass = $resolverClass?: 'Chamilo\ThemeBundle\Util\DependencyResolver'; $this->resolverClass = $resolverClass ?: 'Chamilo\ThemeBundle\Util\DependencyResolver';
} }
public function registerScript($id, $src, $deps = array(), $location = "bottom") public function registerScript($id, $src, $deps = array(), $location = "bottom")
@ -54,7 +54,7 @@ class ThemeManager
public function registerStyle($id, $src, $deps = array()) public function registerStyle($id, $src, $deps = array())
{ {
if(!isset($this->stylesheets[$id])) { if (!isset($this->stylesheets[$id])) {
$this->stylesheets[$id] = array( $this->stylesheets[$id] = array(
'src' => $src, 'src' => $src,
'deps' => $deps, 'deps' => $deps,
@ -66,14 +66,14 @@ class ThemeManager
{ {
$unsorted = array(); $srcList = array(); $assetList = array(); $unsorted = array(); $srcList = array(); $assetList = array();
foreach($this->javascripts as $id => $scriptDefinition) { foreach ($this->javascripts as $id => $scriptDefinition) {
if($scriptDefinition['location'] == $location) { if ($scriptDefinition['location'] == $location) {
$unsorted[$id] = $scriptDefinition; $unsorted[$id] = $scriptDefinition;
} }
} }
$queue = $this->getResolver()->register($unsorted)->resolveAll(); $queue = $this->getResolver()->register($unsorted)->resolveAll();
foreach($queue as $def) { foreach ($queue as $def) {
$srcList[] = $def['src']; $srcList[] = $def['src'];
} }
return $srcList; return $srcList;
@ -83,7 +83,7 @@ class ThemeManager
{ {
$srcList = array(); $srcList = array();
$queue = $this->getResolver()->register($this->stylesheets)->resolveAll(); $queue = $this->getResolver()->register($this->stylesheets)->resolveAll();
foreach($queue as $def) { foreach ($queue as $def) {
$srcList[] = $def['src']; $srcList[] = $def['src'];
} }
return $srcList; return $srcList;

@ -32,8 +32,8 @@ if (empty($array_keys)) {
exit; exit;
} }
$username = substr($array_keys[0],0,20); // max len of an username $username = substr($array_keys[0], 0, 20); // max len of an username
$friend_id = UserManager::get_user_id_from_username($username); $friend_id = UserManager::get_user_id_from_username($username);
if (!$friend_id) { if (!$friend_id) {
// we cant find your friend // we cant find your friend

Loading…
Cancel
Save