Skip to content

Commit

Permalink
[Session] fix: objects picto
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-theo committed Aug 25, 2022
1 parent 747e18a commit f32ea59
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 31 deletions.
41 changes: 10 additions & 31 deletions class/session.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,18 +326,24 @@ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss

$result = '';

$picto = '';
switch ($this->type) {
case 'trainingsession':
$picto = '<i class"fas fa-people-arrows"></i>';
$picto = '<i class="fas fa-people-arrows"></i>';
break;
case 'meeting':
$picto = '<i class"fas fa-comments"></i>';
$picto = '<i class="fas fa-comments"></i>';
break;
case 'audit':
$picto = '<i class"fas fa-list-check"></i>';
$picto = '<i class="fas fa-tasks"></i>';
break;
}

$label = $picto .' <u>'.$langs->trans("Session").'</u>';
if (isset($this->status)) {
$label .= ' '.$this->getLibStatut(5);
}

$label .= '<br>';
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;

Expand Down Expand Up @@ -380,34 +386,7 @@ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss

$result .= $linkstart;

if (empty($this->showphoto_on_popup)) {
if ($withpicto) {
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
}
} else {
if ($withpicto) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';

list($class, $module) = explode('@', $this->picto);
$upload_dir = $conf->$module->multidir_output[$conf->entity]."/$class/".dol_sanitizeFileName($this->ref);
$filearray = dol_dir_list($upload_dir, "files");
$filename = $filearray[0]['name'];
if (!empty($filename)) {
$pospoint = strpos($filearray[0]['name'], '.');

$pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint);
if (empty($conf->global->{strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS'})) {
$result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$module.'" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div></div>';
} else {
$result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div>';
}

$result .= '</div>';
} else {
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
}
}
}
if ($withpicto) $result .= $picto . ' ';

if ($withpicto != 2) {
$result .= $this->ref;
Expand Down
Binary file modified img/object_audit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/object_meeting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/object_trainingsession.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f32ea59

Please sign in to comment.