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


PHP elispm类代码示例

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


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

示例1: test_classmoodlecourse_preventsduplicates

 /**
  * Test validation of duplicates
  * @expectedException data_object_validation_exception
  */
 public function test_classmoodlecourse_preventsduplicates()
 {
     $dataset = $this->createCsvDataSet(array(classmoodlecourse::TABLE => elispm::file('tests/fixtures/class_moodle_course.csv')));
     $this->loadDataSet($dataset);
     $classmoodlecourse = new classmoodlecourse(array('classid' => 100, 'moodlecourseid' => 100));
     $classmoodlecourse->save();
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:11,代码来源:classmoodlecourse_test.php

示例2: test_associate_moodle_course_during_course_update

 /**
  * Validate that course description-moodle template course associations
  * can be created during a course description update action
  */
 public function test_associate_moodle_course_during_course_update()
 {
     global $CFG, $DB;
     require_once $CFG->dirroot . '/course/lib.php';
     require_once $CFG->dirroot . '/local/elisprogram/lib/setup.php';
     require_once elispm::lib('data/course.class.php');
     require_once elispm::lib('data/coursetemplate.class.php');
     $coursecategory = new stdClass();
     $coursecategory->name = 'testcoursecategoryname';
     $coursecategory->id = $DB->insert_record('course_categories', $coursecategory);
     $templatecourse = new stdClass();
     $templatecourse->category = $coursecategory->id;
     $templatecourse->shortname = 'testcourseshortname';
     $templatecourse->fullname = 'testcoursefullname';
     $templatecourse = create_course($templatecourse);
     // Create the course description.
     $pmcourse = new course(array('name' => 'testcoursename', 'idnumber' => 'testcourseidnumber', 'syllabus' => ''));
     $pmcourse->save();
     // Run the course description update action.
     $record = new stdClass();
     $record->name = 'testcoursename';
     $record->idnumber = 'testcourseidnumber';
     $record->link = $templatecourse->shortname;
     $importplugin = rlip_dataplugin_factory::factory('dhimport_version1elis');
     $importplugin->fslogger = new silent_fslogger(null);
     $importplugin->course_update($record, 'bogus');
     // Validation.
     $this->assertTrue($DB->record_exists(coursetemplate::TABLE, array('courseid' => $pmcourse->id, 'location' => $templatecourse->id, 'templateclass' => 'moodlecourseurl')));
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:33,代码来源:course_associate_moodle_course_test.php

示例3: xmldb_elisprogram_usetdisppriority_install

/**
 * Install function for this plugin
 *
 * @return  boolean  true  Returns true to satisfy install procedure
 */
function xmldb_elisprogram_usetdisppriority_install()
{
    global $CFG;
    require_once elispm::lib('setup.php');
    // Migrate component.
    $oldcmp = 'pmplugins_userset_display_priority';
    $newcmp = 'elisprogram_usetdisppriority';
    $upgradestepfuncname = 'elisprogram_usetdisppriority_pre26upgradesteps';
    $migrator = new \local_eliscore\install\migration\migrator($oldcmp, $newcmp, $upgradestepfuncname);
    if ($migrator->old_component_installed() === true) {
        $migrator->migrate();
    }
    $field = new field();
    $field->shortname = USERSET_DISPLAY_PRIORITY_FIELD;
    $field->name = get_string('display_priority_field_name', 'elisprogram_usetdisppriority');
    $field->datatype = 'int';
    $category = new field_category();
    $category->name = get_string('display_settings_category_name', 'elisprogram_usetdisppriority');
    $field = field::ensure_field_exists_for_context_level($field, CONTEXT_ELIS_USERSET, $category);
    // make sure 'manual' is an owner
    if (!isset($field->owners['manual'])) {
        $owner = new field_owner();
        $owner->fieldid = $field->id;
        $owner->plugin = 'manual';
        $owner->param_view_capability = '';
        $owner->param_edit_capability = '';
        $owner->param_control = 'text';
        $owner->param_options_source = 'userset_display_priority';
        $owner->param_help_file = 'elisprogram_usetdisppriority/display_priority';
        $owner->save();
    }
    return true;
}
开发者ID:jamesmcq,项目名称:elis,代码行数:38,代码来源:install.php

示例4: test_make_filter_options_custom

 /**
  * Test make_filter_options_custom function
  */
 public function test_make_filter_options_custom()
 {
     global $DB;
     // Fixture.
     $datagenerator = new elis_program_datagenerator($DB);
     $pgm = $datagenerator->create_program();
     $course = $datagenerator->create_course();
     $pmclass = $datagenerator->create_pmclass(array('courseid' => $course->id));
     $dataset = $this->createCsvDataSet(array('local_elisprogram_env' => elispm::file('tests/fixtures/environment.csv')));
     $this->loadDataSet($dataset);
     // Tests.
     $choicestests = array('curriculum' => array('name' => array($pgm->id => $pgm->name)), 'course' => array('name' => array($course->id => $course->name)), 'class' => array('idnumber' => array($pmclass->id => $pmclass->idnumber), 'environmentid' => array(1 => 'Testing')));
     foreach ($choicestests as $group => $names) {
         foreach ($names as $name => $expectedchoices) {
             $curclassopts = array('choices' => array(), 'wrapper' => array($group => ''));
             $filter = new generalized_filter_curriculumclass('filt-curriculumclass', 'Null', $curclassopts);
             $options = $filter->make_filter_options_custom(array(), $group, $name);
             $this->assertInternalType('array', $options);
             $this->assertArrayHasKey('choices', $options);
             $this->assertInternalType('array', $options['choices']);
             $this->assertEquals($expectedchoices, $options['choices']);
             unset($filter);
         }
     }
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:28,代码来源:filtercurriculumclass_test.php

示例5: load_csv_data

 /**
  * Load iniital data from CSVs.
  */
 protected function load_csv_data()
 {
     $dataset = $this->createCsvDataSet(array('user' => elispm::file('tests/fixtures/mdluser.csv'), 'user_info_field' => elispm::file('tests/fixtures/user_info_field.csv'), 'user_info_data' => elispm::file('tests/fixtures/user_info_data.csv'), user::TABLE => elispm::file('tests/fixtures/pmuser.csv'), usermoodle::TABLE => elispm::file('tests/fixtures/usermoodle.csv'), field::TABLE => elispm::file('tests/fixtures/user_field.csv'), field_owner::TABLE => elispm::file('tests/fixtures/user_field_owner.csv'), curriculum::TABLE => elispm::file('tests/fixtures/curriculum.csv'), track::TABLE => elispm::file('tests/fixtures/track.csv'), course::TABLE => elispm::file('tests/fixtures/pmcourse.csv'), pmclass::TABLE => elispm::file('tests/fixtures/pmclass.csv'), userset::TABLE => elispm::file('tests/fixtures/userset.csv')));
     $dataset = new PHPUnit_Extensions_Database_DataSet_ReplacementDataSet($dataset);
     $dataset->addSubStrReplacement('\\n', "\n");
     $this->loadDataSet($dataset);
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:10,代码来源:roleassignments_test.php

示例6: fixture_moodleenrol

 /**
  * Set up all data needed for testing.
  * @param array $userids List of moodle user ids to test with.
  * @param array $itemgrades List of grade item grades to test with.
  */
 public function fixture_moodleenrol($userids, $itemgrades)
 {
     global $DB;
     // Import CSV data.
     $dataset = $this->createCsvDataSet(array(course::TABLE => elispm::file('tests/fixtures/pmcourse.csv'), pmclass::TABLE => elispm::file('tests/fixtures/pmclass.csv'), 'user' => elispm::file('tests/fixtures/mdluser.csv'), user::TABLE => elispm::file('tests/fixtures/pmuser.csv'), usermoodle::TABLE => elispm::file('tests/fixtures/user_moodle.csv'), coursecompletion::TABLE => elispm::file('tests/fixtures/course_completion.csv')));
     $this->loadDataSet($dataset);
     // Create course.
     $course = $this->getDataGenerator()->create_course();
     // Link with ELIS class.
     $DB->insert_record(classmoodlecourse::TABLE, (object) array('classid' => 100, 'moodlecourseid' => $course->id));
     // Create grade items.
     $items = array(array('courseid' => $course->id, 'idnumber' => 'required', 'itemtype' => 'manual'), array('courseid' => $course->id, 'idnumber' => 'notrequired', 'itemtype' => 'manual'), array('courseid' => $course->id, 'idnumber' => 'course', 'itemtype' => 'course'));
     foreach ($items as $item) {
         $DB->insert_record('grade_items', (object) $item);
     }
     // Set up our test role.
     $roleid = create_role('gradedrole', 'gradedrole', 'gradedrole');
     set_config('gradebookroles', $roleid);
     // Create all of our test enrolments.
     foreach ($userids as $userid) {
         $this->getDataGenerator()->enrol_user($userid, $course->id, $roleid);
     }
     // Assign item grades.
     foreach ($itemgrades as $itemgrade) {
         $DB->insert_record('grade_grades', (object) $itemgrade);
     }
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:32,代码来源:pmupdatestudentprogress_test.php

示例7: test_get_corequisites

 /**
  * Test get_corequisites function.
  */
 public function test_get_corequisites()
 {
     $dataset = $this->createCsvDataSet(array(curriculumcourse::TABLE => elispm::file('tests/fixtures/curriculum_course.csv'), coursecorequisite::TABLE => elispm::file('tests/fixtures/pmcourse_corequisite.csv')));
     $this->loadDataSet($dataset);
     $curriculumcourse = new curriculumcourse();
     $curriculumcourse->id = 2;
     $coreqs = $curriculumcourse->get_corequisites();
     $this->assertEquals(array(100), $coreqs);
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:12,代码来源:curriculumcourse_test.php

示例8: xmldb_elisprogram_preposttest_install

/**
 * Install function for this plugin
 *
 * @return  boolean  true  Returns true to satisfy install procedure
 */
function xmldb_elisprogram_preposttest_install()
{
    global $CFG;
    require_once elispm::lib('setup.php');
    require_once elis::lib('data/customfield.class.php');
    // Migrate component.
    $oldcmp = 'pmplugins_pre_post_test';
    $newcmp = 'elisprogram_preposttest';
    $upgradestepfuncname = 'elisprogram_preposttest_pre26upgradesteps';
    $migrator = new \local_eliscore\install\migration\migrator($oldcmp, $newcmp, $upgradestepfuncname);
    if ($migrator->old_component_installed() === true) {
        $migrator->migrate();
    }
    // Pre-test field
    $field = new field();
    $field->shortname = PRE_TEST_FIELD;
    $field->name = get_string('pre_test_field_name', 'elisprogram_preposttest');
    $field->datatype = 'char';
    $category = new field_category();
    $category->name = get_string('pre_post_test_category_name', 'elisprogram_preposttest');
    $field = field::ensure_field_exists_for_context_level($field, CONTEXT_ELIS_COURSE, $category);
    // make sure 'manual' is an owner
    if (!isset($field->owners['manual'])) {
        $owner = new field_owner();
        $owner->fieldid = $field->id;
        $owner->plugin = 'manual';
        $owner->param_view_capability = '';
        $owner->param_edit_capability = '';
        $owner->param_control = 'menu';
        $owner->param_options_source = 'learning_objectives';
        $owner->param_help_file = 'elisprogram_preposttest/pre_test';
        $owner->save();
    }
    // Post-test field
    $field = new field();
    $field->shortname = POST_TEST_FIELD;
    $field->name = get_string('post_test_field_name', 'elisprogram_preposttest');
    $field->datatype = 'char';
    $category = new field_category();
    $category->name = get_string('pre_post_test_category_name', 'elisprogram_preposttest');
    $field = field::ensure_field_exists_for_context_level($field, CONTEXT_ELIS_COURSE, $category);
    // make sure 'manual' is an owner
    if (!isset($field->owners['manual'])) {
        $owner = new field_owner();
        $owner->fieldid = $field->id;
        $owner->plugin = 'manual';
        $owner->param_view_capability = '';
        $owner->param_edit_capability = '';
        $owner->param_control = 'menu';
        $owner->param_options_source = 'learning_objectives';
        $owner->param_help_file = 'elisprogram_preposttest/post_test';
        $owner->save();
    }
    return true;
}
开发者ID:jamesmcq,项目名称:elis,代码行数:60,代码来源:install.php

示例9: require_elis_dependencies

 /**
  * Require ELIS dependencies if ELIS is installed, otherwise return false.
  * @return bool Whether ELIS dependencies were successfully required.
  */
 public static function require_elis_dependencies()
 {
     global $CFG;
     if (file_exists($CFG->dirroot . '/local/elisprogram/lib/setup.php')) {
         require_once $CFG->dirroot . '/local/elisprogram/lib/setup.php';
         require_once elispm::lib('data/userset.class.php');
         return true;
     } else {
         return false;
     }
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:15,代码来源:userset_update.class.php

示例10: require_elis_dependencies

 /**
  * Require ELIS dependencies if ELIS is installed, otherwise return false.
  * @return bool Whether ELIS dependencies were successfully required.
  */
 public static function require_elis_dependencies()
 {
     global $CFG;
     if (file_exists($CFG->dirroot . '/local/elisprogram/lib/setup.php')) {
         require_once $CFG->dirroot . '/local/elisprogram/lib/setup.php';
         require_once elispm::lib('data/user.class.php');
         require_once dirname(__FILE__) . '/../../importplugins/version1elis/version1elis.class.php';
         return true;
     } else {
         return false;
     }
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:16,代码来源:user_delete.class.php

示例11: get_options

 function get_options($dataobject)
 {
     global $DB;
     require_once elispm::file('plugins/usetclassify/usersetclassification.class.php');
     $result = array();
     $recs = $DB->get_recordset(usersetclassification::TABLE, null, 'name ASC', 'shortname, name');
     foreach ($recs as $rec) {
         $result[$rec->shortname] = $rec->name;
     }
     unset($recs);
     return $result;
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:12,代码来源:userset_classifications.php

示例12: init

 /**
  * Perform initialization that should
  * be done at the beginning of the export
  *
  * @param int $targetstarttime The timestamp representing the theoretical
  *                             time when this task was meant to be run
  * @param int $lastruntime     The last time the export was run
  *                             (required for incremental scheduled export)
  */
 public function init($targetstarttime = 0, $lastruntime = 0)
 {
     global $CFG, $DB;
     require_once $CFG->dirroot . '/local/elisprogram/lib/setup.php';
     require_once elispm::lib('data/user.class.php');
     require_once elispm::lib('data/student.class.php');
     require_once elispm::lib('data/pmclass.class.php');
     require_once elispm::lib('data/course.class.php');
     require_once elispm::lib('data/classmoodlecourse.class.php');
     // Columns that are always displayed.
     $columns = array(get_string('header_firstname', 'dhexport_version1'), get_string('header_lastname', 'dhexport_version1'), get_string('header_username', 'dhexport_version1'), get_string('header_useridnumber', 'dhexport_version1'), get_string('header_courseidnumber', 'dhexport_version1'), get_string('header_startdate', 'dhexport_version1'), get_string('header_enddate', 'dhexport_version1'), get_string('header_status', 'dhexport_version1elis'), get_string('header_grade', 'dhexport_version1'), get_string('header_letter', 'dhexport_version1'));
     // Query parameters.
     $params = array();
     // Track extra SQL and parameters needed for custom fields.
     $extra_joins = implode(" \n ", rlipexport_version1elis_extrafields::get_extra_joins());
     $extra_select = implode(', ', rlipexport_version1elis_extrafields::get_extra_select());
     if (!empty($extra_select)) {
         $extra_select = ', ' . $extra_select;
     }
     // Get columns.
     $columns = array_merge($columns, rlipexport_version1elis_extrafields::get_extra_columns());
     // Add passed as completion status requirement.
     $params[] = student::STUSTATUS_PASSED;
     // Sql time condition.
     $time_condition = '';
     // Determine if we're in incremental or non-incremental mode.
     $nonincremental = get_config('dhexport_version1elis', 'nonincremental');
     if (empty($nonincremental)) {
         if ($this->manual) {
             // Manual export incremental mode.
             // Get string delta.
             $incrementaldelta = get_config('dhexport_version1elis', 'incrementaldelta');
             // Convert to number of seconds.
             $numsecs = rlip_time_string_to_offset($incrementaldelta);
             // Add to query parameters.
             $params[] = time() - $numsecs;
             // Add query fragment.
             $time_condition = 'AND stu.completetime >= ?';
         } else {
             // Scheduled export incremental mode.
             // Set up the query fragment and parameters.
             $params[] = $lastruntime;
             $time_condition = 'AND stu.completetime >= ?';
         }
     }
     // Initialize our recordset to the core data.
     $sql = "SELECT u.id AS userid,\n                       u.firstname,\n                       u.lastname,\n                       u.username,\n                       u.idnumber,\n                       crs.idnumber AS crsidnumber,\n                       stu.enrolmenttime,\n                       stu.completetime,\n                       stu.grade,\n                       mdlcrs.id AS mdlcrsid\n                       {$extra_select}\n                FROM {" . user::TABLE . "} u\n                JOIN {" . student::TABLE . "} stu\n                  ON u.id = stu.userid\n                JOIN {" . pmclass::TABLE . "} cls\n                  ON stu.classid = cls.id\n                JOIN {" . course::TABLE . "} crs\n                  ON cls.courseid = crs.id\n                LEFT JOIN {" . classmoodlecourse::TABLE . "} clsmdl\n                  ON cls.id = clsmdl.classid\n                LEFT JOIN {course} mdlcrs\n                  ON clsmdl.moodlecourseid = mdlcrs.id\n                {$extra_joins}\n                WHERE stu.completestatusid = ?\n                {$time_condition}\n                ORDER BY u.idnumber ASC,\n                         crs.idnumber ASC,\n                         stu.completetime ASC,\n                         stu.grade DESC,\n                         cls.idnumber ASC,\n                         u.username ASC";
     $this->recordset = $DB->get_recordset_sql($sql, $params);
     // Write out header.
     $this->fileplugin->write($columns);
     // Load string to prevent calling get_string for every record.
     $this->completestatusstring = get_string('completestatusstring', 'dhexport_version1elis');
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:62,代码来源:version1elis.class.php

示例13: test_get_userset_subsets

 /**
  * Tests deepsight_datatable_usersetuser_base::get_userset_subsets
  * @dataProvider dataprovider_get_userset_subsets
  * @param int $parentuserset The ID of a userset to pass to the function as the parent userset ID.
  * @param bool $includeparent Whether to include the parent ID in the return array.
  * @param array $expectedresults The expected return value.
  */
 public function test_get_userset_subsets($parentuserset, $includeparent, $expectedresults)
 {
     $dataset = $this->createCsvDataSet(array(user::TABLE => elispm::file('tests/fixtures/deepsight_user.csv'), userset::TABLE => elispm::file('tests/fixtures/deepsight_usersetwithsubsets.csv')));
     $this->loadDataSet($dataset);
     accesslib_clear_all_caches(true);
     // Set up contexts.
     for ($i = 1; $i <= 6; $i++) {
         $ctx = \local_elisprogram\context\userset::instance($i);
     }
     accesslib_clear_all_caches(true);
     $actualresults = deepsight_datatable_standard::get_userset_subsets($parentuserset, $includeparent);
     $this->assertEquals($expectedresults, array_keys($actualresults));
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:20,代码来源:deepsight_datatable_test.php

示例14: test_format_course_listing

 /**
  * Test format_course_listing function.
  */
 public function test_format_course_listing()
 {
     // Fixture.
     $dataset = $this->createCsvDataSet(array(curriculumcourse::TABLE => elispm::file('tests/fixtures/curriculum_course.csv')));
     $this->loadDataSet($dataset);
     // Test.
     $courses = array(1 => null, 100 => null);
     $pmclass = new pmclass();
     $listing = $pmclass->format_course_listing($courses);
     // Verify.
     $expected = array(1 => array(1 => 1, 100 => 2));
     $this->assertEquals($expected, $listing);
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:16,代码来源:pmclass_test.php

示例15: load_csv_data

 /**
  * Load initial data from CSVs.
  */
 protected function load_csv_data()
 {
     $dataset = $this->createCsvDataSet(array('user' => elispm::file('tests/fixtures/mdluser.csv'), 'user_info_field' => elispm::file('tests/fixtures/user_info_field.csv'), 'user_info_data' => elispm::file('tests/fixtures/user_info_data.csv'), user::TABLE => elispm::file('tests/fixtures/pmuser.csv'), usermoodle::TABLE => elispm::file('tests/fixtures/usermoodle.csv'), field::TABLE => elispm::file('tests/fixtures/user_field.csv'), field_owner::TABLE => elispm::file('tests/fixtures/user_field_owner.csv')));
     $dataset = new PHPUnit_Extensions_Database_DataSet_ReplacementDataSet($dataset);
     $dataset->addSubStrReplacement('\\n', "\n");
     $this->loadDataSet($dataset);
     // Load field data next (we need the user context ID and context level).
     $usercontext = \local_elisprogram\context\user::instance(103);
     $dataset = $this->createCsvDataSet(array(field_contextlevel::TABLE => elispm::file('tests/fixtures/user_field_contextlevel.csv'), field_category_contextlevel::TABLE => elispm::file('tests/fixtures/user_field_category_contextlevel.csv'), field_data_int::TABLE => elispm::file('tests/fixtures/user_field_data_int.csv'), field_data_char::TABLE => elispm::file('tests/fixtures/user_field_data_char.csv'), field_data_text::TABLE => elispm::file('tests/fixtures/user_field_data_text.csv')));
     $dataset = new PHPUnit_Extensions_Database_DataSet_ReplacementDataSet($dataset);
     $dataset->addFullReplacement('##USERCTXID##', $usercontext->id);
     $dataset->addFullReplacement('##USERCTXLVL##', CONTEXT_ELIS_USER);
     $this->loadDataSet($dataset);
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:17,代码来源:customuserfields_test.php


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