function format_book_data($books, $type, $main_id, $is_moderator = false) { $type_list = $type . '_list'; $module = 'books'; $main_module = c2cTools::Letter2Module(substr($type, 1, 1)); $strict = 1; $html = '<div class="association_content_inside_field">'; foreach ($books as $book) { $doc_id = $book['id']; $idstring = $type . '_' . $doc_id; $class = 'linked_elt'; $html .= '<div class="' . $class . '" id="' . $idstring . '">' . '<div class="assoc_img picto_' . $module . '" title="' . ucfirst(__($module)) . '"></div>'; $name = ucfirst($book['name']); $url = "@document_by_id_lang_slug?module={$module}&id={$doc_id}" . '&lang=' . $book['culture'] . '&slug=' . make_slug($book['name']); $html .= link_to($name, $url); if (isset($book['author']) && trim($book['author']) != '') { $html .= ' - ' . $book['author']; } if (isset($book['publication_date']) && trim($book['publication_date']) != '') { $html .= ' - ' . $book['publication_date']; } if ($is_moderator && $main_id && !c2cTools::mobileVersion()) { $html .= c2c_link_to_delete_element($type, $doc_id, $main_id, false, $strict); } $html .= '</div>'; } $html .= '</div>'; return $html; }