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


PHP assign_plugin::get_subtype方法代码示例

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


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

示例1: format_plugin_summary_with_link

 /**
  * Write the plugin summary with an optional link to view the full feedback/submission.
  *
  * @param assign_plugin $plugin Submission plugin or feedback plugin
  * @param stdClass $item Submission or grade
  * @param string $returnaction The return action to pass to the
  *                             view_submission page (the current page)
  * @param string $returnparams The return params to pass to the view_submission
  *                             page (the current page)
  * @return string The summary with an optional link
  */
 private function format_plugin_summary_with_link(assign_plugin $plugin, stdClass $item, $returnaction, $returnparams)
 {
     $link = '';
     $showviewlink = false;
     $summary = $plugin->view_summary($item, $showviewlink);
     $separator = '';
     if ($showviewlink) {
         $viewstr = get_string('view' . substr($plugin->get_subtype(), strlen('assign')), 'assign');
         $icon = $this->output->pix_icon('t/preview', $viewstr);
         $urlparams = array('id' => $this->assignment->get_course_module()->id, 'sid' => $item->id, 'gid' => $item->id, 'plugin' => $plugin->get_type(), 'action' => 'viewplugin' . $plugin->get_subtype(), 'returnaction' => $returnaction, 'returnparams' => http_build_query($returnparams));
         $url = new moodle_url('/mod/assign/view.php', $urlparams);
         $link = $this->output->action_link($url, $icon);
         $separator = $this->output->spacer(array(), true);
     }
     return $link . $separator . $summary;
 }
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:27,代码来源:gradingtable.php

示例2: add_plugin_settings

    /**
     * Add one plugins settings to edit plugin form
     *
     * @param assign_plugin $plugin The plugin to add the settings from
     * @param MoodleQuickForm $mform The form to add the configuration settings to. This form is modified directly (not returned)
     * @return void
     */
    private function add_plugin_settings(assign_plugin $plugin, MoodleQuickForm $mform) {
        global $CFG;
        if ($plugin->is_visible()) {
            // enabled
            //tied disableIf rule to this select element
            $mform->addElement('selectyesno', $plugin->get_subtype() . '_' . $plugin->get_type() . '_enabled', $plugin->get_name());
            $mform->addHelpButton($plugin->get_subtype() . '_' . $plugin->get_type() . '_enabled', 'enabled', $plugin->get_subtype() . '_' . $plugin->get_type());


            $default = get_config($plugin->get_subtype() . '_' . $plugin->get_type(), 'default');
            if ($plugin->get_config('enabled') !== false) {
                $default = $plugin->is_enabled();
            }
            $mform->setDefault($plugin->get_subtype() . '_' . $plugin->get_type() . '_enabled', $default);

            $plugin->get_settings($mform);

        }

    }
开发者ID:netspotau,项目名称:moodle-mod_assign,代码行数:27,代码来源:locallib.php

示例3: download_rewrite_pluginfile_urls

 /**
  * Rewrite plugin file urls so they resolve correctly in an exported zip.
  *
  * @param string $text - The replacement text
  * @param stdClass $user - The user record
  * @param assign_plugin $plugin - The assignment plugin
  */
 public function download_rewrite_pluginfile_urls($text, $user, $plugin)
 {
     $groupmode = groups_get_activity_groupmode($this->get_course_module());
     $groupname = '';
     if ($groupmode) {
         $groupid = groups_get_activity_group($this->get_course_module(), true);
         $groupname = groups_get_group_name($groupid) . '-';
     }
     if ($this->is_blind_marking()) {
         $prefix = $groupname . get_string('participant', 'assign');
         $prefix = str_replace('_', ' ', $prefix);
         $prefix = clean_filename($prefix . '_' . $this->get_uniqueid_for_user($user->id) . '_');
     } else {
         $prefix = $groupname . fullname($user);
         $prefix = str_replace('_', ' ', $prefix);
         $prefix = clean_filename($prefix . '_' . $this->get_uniqueid_for_user($user->id) . '_');
     }
     $subtype = $plugin->get_subtype();
     $type = $plugin->get_type();
     $prefix = $prefix . $subtype . '_' . $type . '_';
     $result = str_replace('@@PLUGINFILE@@/', $prefix, $text);
     return $result;
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:30,代码来源:locallib.php

示例4: is_file_modified

    /**
     * Does this file exist in any of the current files supported by this plugin for this user?
     *
     * @param assign $assignment - The assignment instance
     * @param stdClass $user The user matching this uploaded file
     * @param assign_plugin $plugin The matching plugin from the filename
     * @param string $filename The parsed filename from the zip
     * @param stored_file $fileinfo The info about the extracted file from the zip
     * @return bool - True if the file has been modified or is new
     */
    public function is_file_modified($assignment, $user, $plugin, $filename, $fileinfo) {
        $sg = null;

        if ($plugin->get_subtype() == 'assignsubmission') {
            $sg = $assignment->get_user_submission($user->id, false);
        } else if ($plugin->get_subtype() == 'assignfeedback') {
            $sg = $assignment->get_user_grade($user->id, false);
        } else {
            return false;
        }

        if (!$sg) {
            return true;
        }
        foreach ($plugin->get_files($sg, $user) as $pluginfilename => $file) {
            if ($pluginfilename == $filename) {
                // Extract the file and compare hashes.
                $contenthash = '';
                if (is_array($file)) {
                    $content = reset($file);
                    $contenthash = sha1($content);
                } else {
                    $contenthash = $file->get_contenthash();
                }
                if ($contenthash != $fileinfo->get_contenthash()) {
                    return true;
                } else {
                    return false;
                }
            }
        }
        return true;
    }
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:43,代码来源:importziplib.php


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