Fix php warning + format code

pull/2487/head
jmontoyaa 9 years ago
parent 2482839268
commit edc64d6f20
  1. 19
      main/inc/lib/usergroup.lib.php

@ -1214,10 +1214,8 @@ class UserGroup extends Model
public function delete($id) public function delete($id)
{ {
if ($this->useMultipleUrl) { if ($this->useMultipleUrl) {
if ($result) {
$this->unsubscribeToUrl($id, api_get_current_access_url_id()); $this->unsubscribeToUrl($id, api_get_current_access_url_id());
} }
}
$sql = "DELETE FROM $this->usergroup_rel_user_table $sql = "DELETE FROM $this->usergroup_rel_user_table
WHERE usergroup_id = $id"; WHERE usergroup_id = $id";
@ -1342,15 +1340,13 @@ class UserGroup extends Model
//Name //Name
$form->addElement('text', 'name', get_lang('Name'), array('maxlength'=>255)); $form->addElement('text', 'name', get_lang('Name'), array('maxlength'=>255));
$form->applyFilter('name', 'html_filter');
$form->applyFilter('name', 'trim'); $form->applyFilter('name', 'trim');
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('name', '', 'maxlength', 255); $form->addRule('name', '', 'maxlength', 255);
// Description // Description
$form->addElement('textarea', 'description', get_lang('Description'), array('cols' => 58)); $form->addTextarea('description', get_lang('Description'), array('cols' => 58));
$form->applyFilter('description', 'html_filter');
$form->applyFilter('description', 'trim'); $form->applyFilter('description', 'trim');
if ($this->showGroupTypeSetting) { if ($this->showGroupTypeSetting) {
@ -1364,7 +1360,6 @@ class UserGroup extends Model
// url // url
$form->addElement('text', 'url', get_lang('Url')); $form->addElement('text', 'url', get_lang('Url'));
$form->applyFilter('url', 'html_filter');
$form->applyFilter('url', 'trim'); $form->applyFilter('url', 'trim');
// Picture // Picture
@ -1387,7 +1382,6 @@ class UserGroup extends Model
$form->addElement('select', 'visibility', get_lang('GroupPermissions'), $this->getGroupStatusList()); $form->addElement('select', 'visibility', get_lang('GroupPermissions'), $this->getGroupStatusList());
$form->setRequiredNote('<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>'); $form->setRequiredNote('<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>');
$form->addElement('checkbox', 'allow_members_leave_group', '', get_lang('AllowMemberLeaveGroup')); $form->addElement('checkbox', 'allow_members_leave_group', '', get_lang('AllowMemberLeaveGroup'));
// Setting the form elements // Setting the form elements
@ -1417,16 +1411,16 @@ class UserGroup extends Model
} }
switch ($size_picture) { switch ($size_picture) {
case GROUP_IMAGE_SIZE_ORIGINAL : case GROUP_IMAGE_SIZE_ORIGINAL:
$size_picture = ''; $size_picture = '';
break; break;
case GROUP_IMAGE_SIZE_BIG : case GROUP_IMAGE_SIZE_BIG:
$size_picture = 'big_'; $size_picture = 'big_';
break; break;
case GROUP_IMAGE_SIZE_MEDIUM : case GROUP_IMAGE_SIZE_MEDIUM:
$size_picture = 'medium_'; $size_picture = 'medium_';
break; break;
case GROUP_IMAGE_SIZE_SMALL : case GROUP_IMAGE_SIZE_SMALL:
$size_picture = 'small_'; $size_picture = 'small_';
break; break;
default: default:
@ -1450,9 +1444,10 @@ class UserGroup extends Model
if (file_exists($file) && !is_dir($file)) { if (file_exists($file) && !is_dir($file)) {
$picture['file'] = $image_array['dir'].$picture_file; $picture['file'] = $image_array['dir'].$picture_file;
} else { } else {
$picture['file'] = Display::returnIconPath('group_na.png',64); $picture['file'] = Display::returnIconPath('group_na.png', 64);
} }
} }
return $picture; return $picture;
} }

Loading…
Cancel
Save