本文整理汇总了PHP中mimeinfo_from_icon函数的典型用法代码示例。如果您正苦于以下问题:PHP mimeinfo_from_icon函数的具体用法?PHP mimeinfo_from_icon怎么用?PHP mimeinfo_from_icon使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mimeinfo_from_icon函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_section
//.........这里部分代码省略.........
if (!empty($CFG->enableavailability)) {
$accessiblebutdim = $accessiblebutdim || $mod->availablefrom > time() || $mod->availableuntil && $mod->availableuntil < time() || count($mod->conditionsgrade) > 0 || count($mod->conditionscompletion) > 0;
}
}
$liclasses = array();
$liclasses[] = 'activity';
$liclasses[] = $mod->modname;
$liclasses[] = 'modtype_' . $mod->modname;
$extraclasses = $mod->get_extra_classes();
if ($extraclasses) {
$liclasses = array_merge($liclasses, explode(' ', $extraclasses));
}
echo html_writer::start_tag('li', array('class' => join(' ', $liclasses), 'id' => 'module-' . $modnumber));
if ($ismoving) {
echo '<a title="' . $strmovefull . '"' . ' href="' . $CFG->wwwroot . '/course/mod.php?moveto=' . $mod->id . '&sesskey=' . sesskey() . '">' . '<img class="movetarget" src="' . $OUTPUT->pix_url('movehere') . '" ' . ' alt="' . $strmovehere . '" /></a><br />
';
}
$classes = array('mod-indent');
if (!empty($mod->indent)) {
$classes[] = 'mod-indent-' . $mod->indent;
if ($mod->indent > 15) {
$classes[] = 'mod-indent-huge';
}
}
echo html_writer::start_tag('div', array('class' => join(' ', $classes)));
// Get data about this course-module
list($content, $instancename) = get_print_section_cm_text($modinfo->cms[$modnumber], $course);
//Accessibility: for files get description via icon, this is very ugly hack!
$altname = '';
$altname = $mod->modfullname;
if (!empty($customicon)) {
$archetype = plugin_supports('mod', $mod->modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
if ($archetype == MOD_ARCHETYPE_RESOURCE) {
$mimetype = mimeinfo_from_icon('type', $customicon);
$altname = get_mimetype_description($mimetype);
}
}
// Avoid unnecessary duplication: if e.g. a forum name already
// includes the word forum (or Forum, etc) then it is unhelpful
// to include that in the accessible description that is added.
if (false !== strpos(textlib::strtolower($instancename), textlib::strtolower($altname))) {
$altname = '';
}
// File type after name, for alphabetic lists (screen reader).
if ($altname) {
$altname = get_accesshide(' ' . $altname);
}
// We may be displaying this just in order to show information
// about visibility, without the actual link
$contentpart = '';
if ($mod->uservisible) {
// Nope - in this case the link is fully working for user
$linkclasses = '';
$textclasses = '';
if ($accessiblebutdim) {
$linkclasses .= ' dimmed';
$textclasses .= ' dimmed_text';
$accesstext = '<span class="accesshide">' . get_string('hiddenfromstudents') . ': </span>';
} else {
$accesstext = '';
}
if ($linkclasses) {
$linkcss = 'class="' . trim($linkclasses) . '" ';
} else {
$linkcss = '';
}
示例2: print_section_newsroom
//.........这里部分代码省略.........
$extra = '';
if (!empty($modinfo->cms[$modnumber]->extra)) {
$extra = $modinfo->cms[$modnumber]->extra;
}
if ($mod->modname == "label") {
echo "<span class=\"";
if (!$mod->visible) {
echo 'dimmed_text';
} else {
echo 'label';
}
echo '">';
echo format_text($extra, FORMAT_HTML, $labelformatoptions);
echo "</span>";
if (!empty($CFG->enablegroupings) && !empty($mod->groupingid) && has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
if (!isset($groupings)) {
$groupings = groups_get_all_groupings($course->id);
}
echo " <span class=\"groupinglabel\">(" . format_string($groupings[$mod->groupingid]->name) . ')</span>';
}
} else {
// Normal activity
$instancename = format_string($modinfo->cms[$modnumber]->name, true, $course->id);
if (!empty($modinfo->cms[$modnumber]->icon)) {
$icon = "{$CFG->pixpath}/" . $modinfo->cms[$modnumber]->icon;
} else {
$icon = "{$CFG->modpixpath}/{$mod->modname}/icon.gif";
}
//Accessibility: for files get description via icon.
$altname = '';
if ('resource' == $mod->modname) {
if (!empty($modinfo->cms[$modnumber]->icon)) {
$possaltname = $modinfo->cms[$modnumber]->icon;
$mimetype = mimeinfo_from_icon('type', $possaltname);
$altname = get_mimetype_description($mimetype);
} else {
$altname = $mod->modfullname;
}
} else {
$altname = $mod->modfullname;
}
// Avoid unnecessary duplication.
if (false !== stripos($instancename, $altname)) {
$altname = '';
}
// File type after name, for alphabetic lists (screen reader).
if ($altname) {
$altname = get_accesshide(' ' . $altname);
}
$linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
echo '<a ' . $linkcss . ' ' . $extra . ' href="' . $CFG->wwwroot . '/mod/' . $mod->modname . '/view.php?id=' . $mod->id . '">' . '<img src="' . $icon . '" class="activityicon" alt="" /> <span>' . $instancename . $altname . '</span></a>';
//echo " $mod->modname ";
// Special NEWSPAPER magic ... show summry from resource and blog's 200 chars from each post OUBlog (nadavkav)
if ($mod->modname == 'resource') {
$article = get_record('resource', 'id', $mod->instance);
//print_r($article );
echo "{$article->summary}";
}
if ($mod->modname == 'oublog') {
require_once $CFG->dirroot . '/mod/oublog/locallib.php';
$oublog = get_record('oublog', 'id', $mod->instance);
if (!($oublogcm = get_coursemodule_from_instance('oublog', $oublog->id))) {
//error("Course module ID was incorrect");
}
$oublogcontext = get_context_instance(CONTEXT_MODULE, $oublogcm->id);
//oublog_check_view_permissions($oublog, $oublogcontext, $oublogcm);
示例3: ss_print_section
//.........这里部分代码省略.........
echo format_text($extra, FORMAT_HTML, $labelformatoptions);
echo "</div>";
if (!empty($mod->groupingid) && has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
if (!isset($groupings)) {
$groupings = groups_get_all_groupings($course->id);
}
echo " <span class=\"groupinglabel\">(".format_string($groupings[$mod->groupingid]->name).')</span>';
}
} else { // Normal activity
$instancename = format_string($modinfo->cms[$modnumber]->name, true, $course->id);
# echo format_string($modinfo->cms[$modnumber]->intro, true, $course->id);
# echo format_string($modinfo->cms[$modnumber]->name, true, $course->id);
# print_r($modinfo->cms[$modnumber]);
$customicon = $modinfo->cms[$modnumber]->icon;
if (!empty($customicon)) {
if (substr($customicon, 0, 4) === 'mod/') {
list($modname, $iconname) = explode('/', substr($customicon, 4), 2);
$icon = $OUTPUT->pix_url($iconname, $modname);
} else {
$icon = $OUTPUT->pix_url($customicon);
}
} else {
$icon = $OUTPUT->pix_url('icon', $mod->modname);
}
//Accessibility: for files get description via icon, this is very ugly hack!
$altname = '';
$altname = $mod->modfullname;
if (!empty($customicon)) {
$archetype = plugin_supports('mod', $mod->modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
if ($archetype == MOD_ARCHETYPE_RESOURCE) {
$mimetype = mimeinfo_from_icon('type', $customicon);
$altname = get_mimetype_description($mimetype);
}
}
// Avoid unnecessary duplication.
if (false !== stripos($instancename, $altname)) {
$altname = '';
}
// File type after name, for alphabetic lists (screen reader).
if ($altname) {
$altname = get_accesshide(' '.$altname);
}
// We may be displaying this just in order to show information
// about visibility, without the actual link
if ($mod->uservisible) {
// Display normal module link
if (!$accessiblebutdim) {
$linkcss = '';
$accesstext ='';
} else {
$linkcss = ' class="dimmed" ';
$accesstext = '<span class="accesshide">'.
get_string('hiddenfromstudents').': </span>';
}
echo '<a '.$linkcss.' '.$extra.
' href="'.$CFG->wwwroot.'/mod/'.$mod->modname.'/view.php?id='.$mod->id.'">'.
'<img src="'.$icon.'" class="activityicon" alt="'.get_string('modulename',$mod->modname).'" /> '.
$accesstext.'<span class="instancename">'.$instancename.$altname.'</span></a>';
if (!empty($mod->groupingid) && has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
if (!isset($groupings)) {
示例4: print_topicstree_section
//.........这里部分代码省略.........
if (!empty($mod->closelevel)) {
for ($n = 0; $n < $mod->closelevel; $n++) {
echo '</ul></li>' . "\n";
}
}
if (!empty($mod->islast)) {
$lastcss = 'last ';
}
echo '<li class="activity treeactivity ' . $lastcss . $mod->modname . '" id="module-' . $modnumber . '">';
// Unique ID
/// Add spacer for activities without collapse/expand button
if (empty($mod->openlevel)) {
echo $spacer;
}
$extra = '';
if (!empty($modinfo->cms[$modnumber]->extra)) {
$extra = $modinfo->cms[$modnumber]->extra;
}
if ($mod->modname == "label") {
if (!$mod->visible) {
echo "<span class=\"dimmed_text\">";
}
echo format_text($extra, FORMAT_HTML, $labelformatoptions);
if (!$mod->visible) {
echo "</span>";
}
if (!empty($CFG->enablegroupings) && !empty($mod->groupingid) && has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
if (!isset($groupings)) {
$groupings = groups_get_all_groupings($course->id);
}
echo " <span class=\"groupinglabel\">(" . format_string($groupings[$mod->groupingid]->name) . ')</span>';
}
} else {
// Normal activity
$instancename = format_string($modinfo->cms[$modnumber]->name, true, $course->id);
if (!empty($modinfo->cms[$modnumber]->icon)) {
$icon = "{$CFG->pixpath}/" . $modinfo->cms[$modnumber]->icon;
} else {
$icon = "{$CFG->modpixpath}/{$mod->modname}/icon.gif";
}
//Accessibility: for files get description via icon.
$altname = '';
if ('resource' == $mod->modname) {
if (!empty($modinfo->cms[$modnumber]->icon)) {
$possaltname = $modinfo->cms[$modnumber]->icon;
$mimetype = mimeinfo_from_icon('type', $possaltname);
$altname = get_mimetype_description($mimetype);
} else {
$altname = $mod->modfullname;
}
} else {
$altname = $mod->modfullname;
}
// Avoid unnecessary duplication.
if (false !== stripos($instancename, $altname)) {
$altname = '';
}
// File type after name, for alphabetic lists (screen reader).
if ($altname) {
$altname = get_accesshide(' ' . $altname);
}
$linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
echo '<a ' . $linkcss . ' ' . $extra . ' href="' . $CFG->wwwroot . '/mod/' . $mod->modname . '/view.php?id=' . $mod->id . '">' . '<img src="' . $icon . '" class="activityicon" alt="" /> <span>' . $instancename . $altname . '</span></a>';
if (!empty($CFG->enablegroupings) && !empty($mod->groupingid) && has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
if (!isset($groupings)) {
$groupings = groups_get_all_groupings($course->id);
}
echo " <span class=\"groupinglabel\">(" . format_string($groupings[$mod->groupingid]->name) . ')</span>';
}
}
if ($usetracking && $mod->modname == 'forum') {
if ($unread = forum_tp_count_forum_unread_posts($mod, $course)) {
echo '<span class="unread"> <a href="' . $CFG->wwwroot . '/mod/forum/view.php?id=' . $mod->id . '">';
if ($unread == 1) {
echo $strunreadpostsone;
} else {
print_string('unreadpostsnumber', 'forum', $unread);
}
echo '</a></span>';
}
}
/// Open new level if necessary, else print end of li
if (isset($mod->openlevel)) {
echo '<ul class="treelevel-' . ($mod->openlevel + 1) . '">' . "\n";
} else {
echo "</li>\n";
}
}
/// End modules iterator
/// Close remaining levels if necessary
if (!empty($mod->indent)) {
for ($n = 0; $n < $mod->indent; $n++) {
echo '</ul></li>' . "\n";
}
}
}
if (!empty($section->sequence)) {
echo "</ul><!--class='section'-->\n\n";
}
}
示例5: mimetypes
public static function mimetypes()
{
return array_merge(mimeinfo_from_icon('type', 'video.gif', true), mimeinfo_from_icon('type', 'avi.gif', true));
}
示例6: mimetypes
public static function mimetypes()
{
return mimeinfo_from_icon('type', 'powerpoint', true);
}
示例7: print_section_dblistview
//.........这里部分代码省略.........
$extra = '';
if (!empty($modinfo->cms[$modnumber]->extra)) {
$extra = $modinfo->cms[$modnumber]->extra;
}
if ($mod->modname == "label") {
echo "<span class=\"";
if (!$mod->visible) {
echo 'dimmed_text';
} else {
echo 'label';
}
echo '">';
echo format_text($extra, FORMAT_HTML, $labelformatoptions);
echo "</span>";
if (!empty($CFG->enablegroupings) && !empty($mod->groupingid) && has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
if (!isset($groupings)) {
$groupings = groups_get_all_groupings($course->id);
}
echo " <span class=\"groupinglabel\">(" . format_string($groupings[$mod->groupingid]->name) . ')</span>';
}
} else {
// Normal activity
$instancename = format_string($modinfo->cms[$modnumber]->name, true, $course->id);
if (!empty($modinfo->cms[$modnumber]->icon)) {
$icon = "{$CFG->pixpath}/" . $modinfo->cms[$modnumber]->icon;
} else {
$icon = "{$CFG->modpixpath}/{$mod->modname}/icon.gif";
}
//Accessibility: for files get description via icon.
$altname = '';
if ('resource' == $mod->modname) {
if (!empty($modinfo->cms[$modnumber]->icon)) {
$possaltname = $modinfo->cms[$modnumber]->icon;
$mimetype = mimeinfo_from_icon('type', $possaltname);
$altname = get_mimetype_description($mimetype);
} else {
$altname = $mod->modfullname;
}
} else {
$altname = $mod->modfullname;
}
// Avoid unnecessary duplication.
if (false !== stripos($instancename, $altname)) {
$altname = '';
}
// File type after name, for alphabetic lists (screen reader).
if ($altname) {
$altname = get_accesshide(' ' . $altname);
}
$linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
if ($mod->modname != 'data') {
echo '<a ' . $linkcss . ' ' . $extra . ' href="' . $CFG->wwwroot . '/mod/' . $mod->modname . '/view.php?id=' . $mod->id . '">' . '<img src="' . $icon . '" class="activityicon" alt="" /> <span>' . $instancename . $altname . '</span></a>';
}
//echo " $mod->modname ";
// Special DBLISTVIEW magic ... show summry from resource and blog's 200 chars from each post OUBlog (nadavkav)
if ($mod->modname == 'resource') {
$article = get_record('resource', 'id', $mod->instance);
//print_r($article );
echo "{$article->summary}";
}
if ($mod->modname == 'data') {
require_once $CFG->dirroot . '/mod/data/lib.php';
if (!($data = get_record('data', 'id', $mod->instance))) {
//error('Course module is incorrect');
}
$sort = 0;