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


PHP lti_split_custom_parameters函数代码示例

本文整理汇总了PHP中lti_split_custom_parameters函数的典型用法代码示例。如果您正苦于以下问题:PHP lti_split_custom_parameters函数的具体用法?PHP lti_split_custom_parameters怎么用?PHP lti_split_custom_parameters使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_split_custom_parameters

 public function test_split_custom_parameters()
 {
     $this->assertEquals(lti_split_custom_parameters("x=1\ny=2"), array('custom_x' => '1', 'custom_y' => '2'));
     $this->assertEquals(lti_split_custom_parameters('x=1;y=2'), array('custom_x' => '1', 'custom_y' => '2'));
     $this->assertEquals(lti_split_custom_parameters('Review:Chapter=1.2.56'), array('custom_review_chapter' => '1.2.56'));
     $this->assertEquals(lti_split_custom_parameters('Complex!@#$^*(){}[]KEY=Complex!@#$^*(){}[]Value'), array('custom_complex____________key' => 'Complex!@#$^*(){}[]Value'));
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:7,代码来源:locallib_test.php

示例2: test_split_custom_parameters

 public function test_split_custom_parameters()
 {
     $tool = new stdClass();
     $tool->enabledcapability = '';
     $this->assertEquals(lti_split_custom_parameters(null, $tool, array(), "x=1\ny=2", false), array('custom_x' => '1', 'custom_y' => '2'));
     // Removed repeat of previous test with a semicolon separator.
     $this->assertEquals(lti_split_custom_parameters(null, $tool, array(), 'Review:Chapter=1.2.56', false), array('custom_review_chapter' => '1.2.56'));
     $this->assertEquals(lti_split_custom_parameters(null, $tool, array(), 'Complex!@#$^*(){}[]KEY=Complex!@#$^*;(){}[]½Value', false), array('custom_complex____________key' => 'Complex!@#$^*;(){}[]½Value'));
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:9,代码来源:locallib_test.php

示例3: test_split_custom_parameters

 public function test_split_custom_parameters()
 {
     $this->resetAfterTest();
     $tool = new stdClass();
     $tool->enabledcapability = '';
     $tool->parameter = '';
     $this->assertEquals(lti_split_custom_parameters(null, $tool, array(), "x=1\ny=2", false), array('custom_x' => '1', 'custom_y' => '2'));
     // Removed repeat of previous test with a semicolon separator.
     $this->assertEquals(lti_split_custom_parameters(null, $tool, array(), 'Review:Chapter=1.2.56', false), array('custom_review_chapter' => '1.2.56'));
     $this->assertEquals(lti_split_custom_parameters(null, $tool, array(), 'Complex!@#$^*(){}[]KEY=Complex!@#$^*;(){}[]½Value', false), array('custom_complex____________key' => 'Complex!@#$^*;(){}[]½Value'));
     // Test custom parameter that returns $USER property.
     $user = $this->getDataGenerator()->create_user(array('middlename' => 'SOMETHING'));
     $this->setUser($user);
     $this->assertEquals(array('custom_x' => '1', 'custom_y' => 'SOMETHING'), lti_split_custom_parameters(null, $tool, array(), "x=1\ny=\$Person.name.middle", false));
 }
开发者ID:aleph-n,项目名称:lms.aaenl,代码行数:15,代码来源:locallib_test.php

示例4: lti_build_request

/**
 * This function builds the request that must be sent to the tool producer
 *
 * @param object    $instance       Basic LTI instance object
 * @param object    $typeconfig     Basic LTI tool configuration
 * @param object    $course         Course object
 *
 * @return array    $request        Request details
 */
function lti_build_request($instance, $typeconfig, $course) {
    global $USER, $CFG;

    if (empty($instance->cmid)) {
        $instance->cmid = 0;
    }

    $role = lti_get_ims_role($USER, $instance->cmid, $instance->course);

    $locale = $course->lang;
    if ( strlen($locale) < 1 ) {
         $locale = $CFG->lang;
    }

    $requestparams = array(
        'resource_link_id' => $instance->id,
        'resource_link_title' => $instance->name,
        'resource_link_description' => $instance->intro,
        'user_id' => $USER->id,
        'roles' => $role,
        'context_id' => $course->id,
        'context_label' => $course->shortname,
        'context_title' => $course->fullname,
        'launch_presentation_locale' => $locale,
    );

    $placementsecret = $instance->servicesalt;

    if ( isset($placementsecret) ) {
        $sourcedid = json_encode(lti_build_sourcedid($instance->id, $USER->id, null, $placementsecret));
    }

    if ( isset($placementsecret) &&
         ( $typeconfig['acceptgrades'] == LTI_SETTING_ALWAYS ||
         ( $typeconfig['acceptgrades'] == LTI_SETTING_DELEGATE && $instance->instructorchoiceacceptgrades == LTI_SETTING_ALWAYS ) ) ) {
        $requestparams['lis_result_sourcedid'] = $sourcedid;

        //Add outcome service URL
        $serviceurl = new moodle_url('/mod/lti/service.php');
        $serviceurl = $serviceurl->out();

        if ($typeconfig['forcessl'] == '1') {
            $serviceurl = lti_ensure_url_is_https($serviceurl);
        }

        $requestparams['lis_outcome_service_url'] = $serviceurl;
    }

    // Send user's name and email data if appropriate
    if ( $typeconfig['sendname'] == LTI_SETTING_ALWAYS ||
         ( $typeconfig['sendname'] == LTI_SETTING_DELEGATE && $instance->instructorchoicesendname == LTI_SETTING_ALWAYS ) ) {
        $requestparams['lis_person_name_given'] =  $USER->firstname;
        $requestparams['lis_person_name_family'] =  $USER->lastname;
        $requestparams['lis_person_name_full'] =  $USER->firstname." ".$USER->lastname;
    }

    if ( $typeconfig['sendemailaddr'] == LTI_SETTING_ALWAYS ||
         ( $typeconfig['sendemailaddr'] == LTI_SETTING_DELEGATE && $instance->instructorchoicesendemailaddr == LTI_SETTING_ALWAYS ) ) {
        $requestparams['lis_person_contact_email_primary'] = $USER->email;
    }

    // Concatenate the custom parameters from the administrator and the instructor
    // Instructor parameters are only taken into consideration if the administrator
    // has giver permission
    $customstr = $typeconfig['customparameters'];
    $instructorcustomstr = $instance->instructorcustomparameters;
    $custom = array();
    $instructorcustom = array();
    if ($customstr) {
        $custom = lti_split_custom_parameters($customstr);
    }
    if (!isset($typeconfig['allowinstructorcustom']) || $typeconfig['allowinstructorcustom'] == LTI_SETTING_NEVER) {
        $requestparams = array_merge($custom, $requestparams);
    } else {
        if ($instructorcustomstr) {
            $instructorcustom = lti_split_custom_parameters($instructorcustomstr);
        }
        foreach ($instructorcustom as $key => $val) {
            // Ignore the instructor's parameter
            if (!array_key_exists($key, $custom)) {
                $custom[$key] = $val;
            }
        }
        $requestparams = array_merge($custom, $requestparams);
    }

    // Make sure we let the tool know what LMS they are being called from
    $requestparams["ext_lms"] = "moodle-2";
    $requestparams['tool_consumer_info_product_family_code'] = 'moodle';
    $requestparams['tool_consumer_info_version'] = strval($CFG->version);

//.........这里部分代码省略.........
开发者ID:numbas,项目名称:moodle,代码行数:101,代码来源:locallib.php

示例5: lti_build_custom_parameters

/**
 * This function builds the custom parameters
 *
 * @param object    $toolproxy      Tool proxy instance object
 * @param object    $tool           Tool instance object
 * @param object    $instance       Tool placement instance object
 * @param array     $params         LTI launch parameters
 * @param string    $customstr      Custom parameters defined for tool
 * @param string    $instructorcustomstr      Custom parameters defined for this placement
 * @param boolean   $islti2         True if an LTI 2 tool is being launched
 *
 * @return array                    Custom parameters
 */
function lti_build_custom_parameters($toolproxy, $tool, $instance, $params, $customstr, $instructorcustomstr, $islti2)
{
    // Concatenate the custom parameters from the administrator and the instructor
    // Instructor parameters are only taken into consideration if the administrator
    // has given permission.
    $custom = array();
    if ($customstr) {
        $custom = lti_split_custom_parameters($toolproxy, $tool, $params, $customstr, $islti2);
    }
    if (!isset($typeconfig['allowinstructorcustom']) || $typeconfig['allowinstructorcustom'] != LTI_SETTING_NEVER) {
        if ($instructorcustomstr) {
            $custom = array_merge(lti_split_custom_parameters($toolproxy, $tool, $params, $instructorcustomstr, $islti2), $custom);
        }
    }
    if ($islti2) {
        $custom = array_merge(lti_split_custom_parameters($toolproxy, $tool, $params, $tool->parameter, true), $custom);
        $settings = lti_get_tool_settings($tool->toolproxyid);
        $custom = array_merge($custom, lti_get_custom_parameters($toolproxy, $tool, $params, $settings));
        $settings = lti_get_tool_settings($tool->toolproxyid, $instance->course);
        $custom = array_merge($custom, lti_get_custom_parameters($toolproxy, $tool, $params, $settings));
        $settings = lti_get_tool_settings($tool->toolproxyid, $instance->course, $instance->id);
        $custom = array_merge($custom, lti_get_custom_parameters($toolproxy, $tool, $params, $settings));
    }
    return $custom;
}
开发者ID:reconnectmedia,项目名称:moodle,代码行数:38,代码来源:locallib.php


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