当前位置: 首页>>代码示例>>PHP>>正文


PHP learnpath::get_preview_image_path方法代码示例

本文整理汇总了PHP中learnpath::get_preview_image_path方法的典型用法代码示例。如果您正苦于以下问题:PHP learnpath::get_preview_image_path方法的具体用法?PHP learnpath::get_preview_image_path怎么用?PHP learnpath::get_preview_image_path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在learnpath的用法示例。


在下文中一共展示了learnpath::get_preview_image_path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_tools_category

 /**
  * Gets the tools of a certain category. Returns an array expected
  * by show_tools_category()
  * @param string $course_tool_category	contains the category of tools to
  * display: "toolauthoring", "toolinteraction", "tooladmin", "tooladminplatform", "toolplugin"
  * @return array
  */
 public static function get_tools_category($course_tool_category)
 {
     $course_tool_table = Database::get_course_table(TABLE_TOOL_LIST);
     $is_platform_admin = api_is_platform_admin();
     $all_tools_list = array();
     // Condition for the session
     $session_id = api_get_session_id();
     $course_id = api_get_course_int_id();
     $condition_session = api_get_session_condition($session_id, true, true, 't.session_id');
     switch ($course_tool_category) {
         case TOOL_STUDENT_VIEW:
             $conditions = ' WHERE visibility = 1 AND (category = "authoring" OR category = "interaction" OR category = "plugin") ';
             if ((api_is_coach() || api_is_course_tutor()) && $_SESSION['studentview'] != 'studentview') {
                 $conditions = ' WHERE (visibility = 1 AND (category = "authoring" OR category = "interaction" OR category = "plugin") OR (name = "' . TOOL_TRACKING . '") )   ';
             }
             $sql = "SELECT *\n                        FROM {$course_tool_table} t\n                        {$conditions} AND\n                        c_id = {$course_id} {$condition_session}\n                        ORDER BY id";
             $result = Database::query($sql);
             break;
         case TOOL_AUTHORING:
             $sql = "SELECT * FROM {$course_tool_table} t\n                        WHERE category = 'authoring' AND c_id = {$course_id} {$condition_session}\n                        ORDER BY id";
             $result = Database::query($sql);
             break;
         case TOOL_INTERACTION:
             $sql = "SELECT * FROM {$course_tool_table} t\n                        WHERE category = 'interaction' AND c_id = {$course_id} {$condition_session}\n                        ORDER BY id";
             $result = Database::query($sql);
             break;
         case TOOL_ADMIN_VISIBLE:
             $sql = "SELECT * FROM {$course_tool_table} t\n                        WHERE category = 'admin' AND visibility ='1' AND c_id = {$course_id} {$condition_session}\n                        ORDER BY id";
             $result = Database::query($sql);
             break;
         case TOOL_ADMIN_PLATFORM:
             $sql = "SELECT * FROM {$course_tool_table} t\n                        WHERE category = 'admin' AND c_id = {$course_id} {$condition_session}\n                        ORDER BY id";
             $result = Database::query($sql);
             break;
         case TOOL_DRH:
             $sql = "SELECT * FROM {$course_tool_table} t\n                        WHERE name IN ('tracking') AND c_id = {$course_id} {$condition_session}\n                        ORDER BY id";
             $result = Database::query($sql);
             break;
         case TOOL_COURSE_PLUGIN:
             //Other queries recover id, name, link, image, visibility, admin, address, added_tool, target, category and session_id
             // but plugins are not present in the tool table, only globally and inside the course_settings table once configured
             $sql = "SELECT * FROM {$course_tool_table} t\n                        WHERE category = 'plugin' AND c_id = {$course_id} {$condition_session}\n                        ORDER BY id";
             $result = Database::query($sql);
             break;
     }
     //Get the list of hidden tools - this might imply performance slowdowns
     // if the course homepage is loaded many times, so the list of hidden
     // tools might benefit from a shared memory storage later on
     $list = api_get_settings('Tools', 'list', api_get_current_access_url_id());
     $hide_list = array();
     $check = false;
     foreach ($list as $line) {
         // Admin can see all tools even if the course_hide_tools configuration is set
         if ($is_platform_admin) {
             continue;
         }
         if ($line['variable'] == 'course_hide_tools' and $line['selected_value'] == 'true') {
             $hide_list[] = $line['subkey'];
             $check = true;
         }
     }
     while ($temp_row = Database::fetch_assoc($result)) {
         $add = false;
         if ($check) {
             if (!in_array($temp_row['name'], $hide_list)) {
                 $add = true;
             }
         } else {
             $add = true;
         }
         if ($temp_row['image'] == 'scormbuilder.gif') {
             $lp_id = self::get_published_lp_id_from_link($temp_row['link']);
             $lp = new learnpath(api_get_course_id(), $lp_id, api_get_user_id());
             $path = $lp->get_preview_image_path(ICON_SIZE_BIG);
             $add = $lp->is_lp_visible_for_student($lp_id, api_get_user_id(), api_get_course_id(), api_get_session_id());
             if ($path) {
                 $temp_row['custom_image'] = $path;
             }
         }
         if ($add) {
             $all_tools_list[] = $temp_row;
         }
     }
     // Grabbing all the links that have the property on_homepage set to 1
     $course_link_table = Database::get_course_table(TABLE_LINK);
     $course_item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
     $condition_session = api_get_session_condition($session_id, true, true, 'tip.session_id');
     switch ($course_tool_category) {
         case TOOL_AUTHORING:
             $sql_links = "SELECT tl.*, tip.visibility\n                    FROM {$course_link_table} tl\n                    LEFT JOIN {$course_item_property_table} tip\n                    ON tip.tool='link' AND tip.ref=tl.id\n                    WHERE\n                        tl.c_id = {$course_id} AND\n                        tip.c_id = {$course_id} AND\n                        tl.on_homepage='1' {$condition_session}";
             break;
         case TOOL_INTERACTION:
             $sql_links = null;
//.........这里部分代码省略.........
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:101,代码来源:course_home.lib.php

示例2: show_tools_category


//.........这里部分代码省略.........
                 $icon = Display::return_icon($image, null, array('class' => 'tool-icon', 'id' => 'toolimage_' . $tool['id']), ICON_SIZE_BIG, false);
             }
             $userInfo = api_get_user_info();
             $userStatus = isset($userInfo['status']) ? $userInfo['status'] : null;
             // Validation when belongs to a session
             $session_img = api_get_session_image($tool['session_id'], $userStatus);
             $item['url_params'] = $tool_link_params;
             $item['icon'] = Display::url($icon, $tool_link_params['href'], $tool_link_params);
             $item['tool'] = $tool;
             $item['name'] = $tool_name;
             $tool_link_params['id'] = 'is' . $tool_link_params['id'];
             $item['link'] = Display::url($tool_name . $session_img, $tool_link_params['href'], $tool_link_params);
             $items[] = $item;
         }
         // end of foreach
     }
     $i = 0;
     $html = '';
     $counter = 0;
     if (!empty($items)) {
         foreach ($items as $item) {
             switch ($theme) {
                 case 'activity_big':
                     $data = '';
                     if ($counter == 0) {
                         $html .= $rowDiv;
                     }
                     $html .= '<div class="col-xs-4 col-md-4 course-tool">';
                     $image = substr($item['tool']['image'], 0, strpos($item['tool']['image'], '.')) . '.png';
                     if (!empty($item['tool']['custom_icon'])) {
                         $original_image = Display::img($item['tool']['image'], null, array('id' => 'toolimage_' . $item['tool']['id']));
                     } else {
                         $original_image = Display::return_icon($image, null, array('id' => 'toolimage_' . $item['tool']['id']), ICON_SIZE_BIG, false);
                     }
                     switch ($image) {
                         case 'scormbuilder.png':
                             if (api_is_allowed_to_edit(null, true)) {
                                 $item['url_params']['href'] .= '&isStudentView=true';
                             }
                             $image = $original_image;
                             $lp_id = self::get_published_lp_id_from_link($item['link']);
                             if ($lp_id) {
                                 $lp = new learnpath(api_get_course_id(), $lp_id, api_get_user_id());
                                 $path = $lp->get_preview_image_path(64);
                                 if ($path) {
                                     $image = '<img src="' . $path . '">';
                                 }
                             }
                             break;
                         default:
                             $image = $original_image;
                     }
                     $data .= Display::url($image, $item['url_params']['href'], $item['url_params']);
                     $html .= Display::div($data, array('class' => 'big_icon'));
                     //box-image reflection
                     $html .= Display::div('<h4>' . $item['visibility'] . $item['extra'] . $item['link'] . '</h4>', array('class' => 'content'));
                     $html .= '</div>';
                     if ($counter == 2) {
                         $html .= '</div>';
                         $counter = -1;
                     }
                     $counter++;
                     break;
                 case 'activity':
                     if ($counter == 0) {
                         $html .= $rowDiv;
                     }
                     $html .= '<div class="col-md-6 course-tool">';
                     $content = $item['extra'];
                     $content .= $item['visibility'];
                     $content .= $item['icon'];
                     $content .= $item['link'];
                     $html .= Display::div($content, array('class' => 'activity_content'));
                     $html .= '</div>';
                     if ($counter == 1) {
                         $html .= '</div>';
                         $counter = -1;
                     }
                     $counter++;
                     break;
                 case 'vertical_activity':
                     if ($i == 0) {
                         $html .= '<ul>';
                     }
                     $html .= '<li class="course-tool">';
                     $html .= $item['extra'];
                     $html .= $item['visibility'];
                     $html .= $item['icon'];
                     $html .= $item['link'];
                     $html .= '</li>';
                     if ($i == count($items) - 1) {
                         $html .= '</ul>';
                     }
                     break;
             }
             $i++;
         }
     }
     return array('content' => $html, 'tool_list' => $items);
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:101,代码来源:course_home.lib.php


注:本文中的learnpath::get_preview_image_path方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。