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


PHP cm_info::get_url方法代码示例

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


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

示例1: navigation_add_activity

 /**
  * Adds a course module to the navigation node
  *
  * This is basically copied from function global_navigation::load_section_activities()
  * because it is not accessible from outside.
  *
  * @param navigation_node $node
  * @param cm_info $cm
  * @return null|navigation_node
  */
 protected function navigation_add_activity(navigation_node $node, $cm)
 {
     if (!$cm->uservisible) {
         return null;
     }
     $action = $cm->get_url();
     if (!$action) {
         // Do not add to navigation activity without url (i.e. labels).
         return null;
     }
     $activityname = format_string($cm->name, true, array('context' => context_module::instance($cm->id)));
     if ($cm->icon) {
         $icon = new pix_icon($cm->icon, $cm->modfullname, $cm->iconcomponent);
     } else {
         $icon = new pix_icon('icon', $cm->modfullname, $cm->modname);
     }
     $activitynode = $node->add($activityname, $action, navigation_node::TYPE_ACTIVITY, null, $cm->id, $icon);
     if (global_navigation::module_extends_navigation($cm->modname)) {
         $activitynode->nodetype = navigation_node::NODETYPE_BRANCH;
     } else {
         $activitynode->nodetype = navigation_node::NODETYPE_LEAF;
     }
     return $activitynode;
 }
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:34,代码来源:lib.php

示例2: send_response

 /**
  * Send the details of the newly created activity back to the client browser
  *
  * @param cm_info $mod details of the mod just created
  */
 protected function send_response($mod)
 {
     global $OUTPUT;
     $resp = new stdClass();
     $resp->error = self::ERROR_OK;
     $resp->icon = $mod->get_icon_url()->out();
     $resp->name = $mod->name;
     $resp->link = $mod->get_url()->out();
     $resp->elementid = 'module-' . $mod->id;
     $resp->commands = make_editing_buttons($mod, true, true, 0, $mod->sectionnum);
     $resp->onclick = $mod->get_on_click();
     // if using groupings, then display grouping name
     if (!empty($mod->groupingid) && has_capability('moodle/course:managegroups', $this->context)) {
         $groupings = groups_get_all_groupings($this->course->id);
         $resp->groupingname = format_string($groupings[$mod->groupingid]->name);
     }
     echo $OUTPUT->header();
     echo json_encode($resp);
     die;
 }
开发者ID:vinoth4891,项目名称:clinique,代码行数:25,代码来源:dnduploadlib.php

示例3: send_response

 /**
  * Send the details of the newly created activity back to the client browser
  *
  * @param cm_info $mod details of the mod just created
  */
 protected function send_response($mod)
 {
     global $OUTPUT, $PAGE;
     $courserenderer = $PAGE->get_renderer('core', 'course');
     $resp = new stdClass();
     $resp->error = self::ERROR_OK;
     $resp->icon = $mod->get_icon_url()->out();
     $resp->name = $mod->name;
     if ($mod->has_view()) {
         $resp->link = $mod->get_url()->out();
     } else {
         $resp->link = null;
     }
     $resp->content = $mod->get_content();
     $resp->elementid = 'module-' . $mod->id;
     $actions = course_get_cm_edit_actions($mod, 0, $mod->sectionnum);
     $resp->commands = ' ' . $courserenderer->course_section_cm_edit_actions($actions);
     $resp->onclick = $mod->get_on_click();
     $resp->visible = $mod->visible;
     // if using groupings, then display grouping name
     if (!empty($mod->groupingid) && has_capability('moodle/course:managegroups', $this->context)) {
         $groupings = groups_get_all_groupings($this->course->id);
         $resp->groupingname = format_string($groupings[$mod->groupingid]->name);
     }
     echo $OUTPUT->header();
     echo json_encode($resp);
     die;
 }
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:33,代码来源:dnduploadlib.php

示例4: course_section_cm_name

 /**
  * Renders html to display a name with the link to the course module on a course page
  *
  * If module is unavailable for user but still needs to be displayed
  * in the list, just the name is returned without a link
  *
  * Note, that for course modules that never have separate pages (i.e. labels)
  * this function return an empty string
  *
  * @param cm_info $mod
  * @param array $displayoptions
  * @return string
  */
 public function course_section_cm_name(cm_info $mod, $displayoptions = array())
 {
     global $CFG;
     $output = '';
     if (!$mod->uservisible && (empty($mod->showavailability) || empty($mod->availableinfo))) {
         // nothing to be displayed to the user
         return $output;
     }
     $url = $mod->get_url();
     if (!$url) {
         return $output;
     }
     //Accessibility: for files get description via icon, this is very ugly hack!
     $instancename = $mod->get_formatted_name();
     $altname = $mod->modfullname;
     // 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(core_text::strtolower($instancename), core_text::strtolower($altname))) {
         $altname = '';
     }
     // File type after name, for alphabetic lists (screen reader).
     if ($altname) {
         $altname = get_accesshide(' ' . $altname);
     }
     // For items which are hidden but available to current user
     // ($mod->uservisible), we show those as dimmed only if the user has
     // viewhiddenactivities, so that teachers see 'items which might not
     // be available to some students' dimmed but students do not see 'item
     // which is actually available to current student' dimmed.
     $linkclasses = '';
     $accesstext = '';
     $textclasses = '';
     if ($mod->uservisible) {
         $conditionalhidden = $this->is_cm_conditionally_hidden($mod);
         $accessiblebutdim = (!$mod->visible || $conditionalhidden) && has_capability('moodle/course:viewhiddenactivities', context_course::instance($mod->course));
         if ($accessiblebutdim) {
             $linkclasses .= ' dimmed';
             $textclasses .= ' dimmed_text';
             if ($conditionalhidden) {
                 $linkclasses .= ' conditionalhidden';
                 $textclasses .= ' conditionalhidden';
             }
             // Show accessibility note only if user can access the module himself.
             $accesstext = get_accesshide(get_string('hiddenfromstudents') . ':' . $mod->modfullname);
         }
     } else {
         $linkclasses .= ' dimmed';
         $textclasses .= ' dimmed_text';
     }
     // Get on-click attribute value if specified and decode the onclick - it
     // has already been encoded for display (puke).
     $onclick = htmlspecialchars_decode($mod->get_on_click(), ENT_QUOTES);
     $groupinglabel = '';
     if (!empty($mod->groupingid) && has_capability('moodle/course:managegroups', context_course::instance($mod->course))) {
         $groupings = groups_get_all_groupings($mod->course);
         $groupinglabel = html_writer::tag('span', '(' . format_string($groupings[$mod->groupingid]->name) . ')', array('class' => 'groupinglabel ' . $textclasses));
     }
     // Display link itself.
     $activitylink = html_writer::empty_tag('img', array('src' => $mod->get_icon_url(), 'class' => 'iconlarge activityicon', 'alt' => ' ', 'role' => 'presentation')) . $accesstext . html_writer::tag('span', $instancename . $altname, array('class' => 'instancename'));
     if ($mod->uservisible) {
         $output .= html_writer::link($url, $activitylink, array('class' => $linkclasses, 'onclick' => $onclick)) . $groupinglabel;
     } else {
         // We may be displaying this just in order to show information
         // about visibility, without the actual link ($mod->uservisible)
         $output .= html_writer::tag('div', $activitylink, array('class' => $textclasses)) . $groupinglabel;
     }
     return $output;
 }
开发者ID:helenagarcia90,项目名称:moodle,代码行数:82,代码来源:renderer.php

示例5: send_response

 /**
  * Send the details of the newly created activity back to the client browser
  *
  * @param cm_info $mod details of the mod just created
  */
 protected function send_response($mod)
 {
     global $OUTPUT;
     $resp = new stdClass();
     $resp->error = self::ERROR_OK;
     $resp->icon = $mod->get_icon_url()->out();
     $resp->name = $mod->name;
     $resp->link = $mod->get_url()->out();
     $resp->elementid = 'module-' . $mod->id;
     $resp->commands = make_editing_buttons($mod, true, true, 0, $mod->sectionnum);
     $resp->onclick = $mod->get_on_click();
     echo $OUTPUT->header();
     echo json_encode($resp);
     die;
 }
开发者ID:nicusX,项目名称:moodle,代码行数:20,代码来源:dnduploadlib.php


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