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


PHP elispm::file方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: setUp

 /**
  * This method is called before the first test of this test class is run.
  */
 public function setUp()
 {
     global $DB, $USER;
     parent::setUp();
     // Create data we need for many test cases.
     set_config('defaultenrol', 1, 'enrol_guest');
     set_config('status', ENROL_INSTANCE_DISABLED, 'enrol_guest');
     set_config('enrol_plugins_enabled', 'manual,guest');
     // Load initial data from CSVs.
     $dataset = $this->createCsvDataSet(array('course' => elispm::file('tests/fixtures/autocreatemoodlecourse_course.csv'), pmclass::TABLE => elispm::file('tests/fixtures/autocreatemoodlecourse_class.csv'), course::TABLE => elispm::file('tests/fixtures/autocreatemoodlecourse_coursedescription.csv'), coursetemplate::TABLE => elispm::file('tests/fixtures/autocreatemoodlecourse_coursetemplate.csv')));
     $this->loadDataSet($dataset);
     // Set current user as admin.
     $this->setAdminUser();
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:17,代码来源:autocreatemoodlecourse_test.php

示例11: load_csv_data

 /**
  * Load CSV data for use in this test class.
  * @param boolean $createnonrequiredlos set to true to create non-required learning objective records
  * @param $createrequiredlos set to true to create required learning objective records
  */
 public function load_csv_data($createnonrequiredlos = false, $createrequiredlos = false)
 {
     // NOTE: for now, can only use one of two parameters.
     $csvs = array(course::TABLE => elispm::file('tests/fixtures/pmcoursewithgrade.csv'), pmclass::TABLE => elispm::file('tests/fixtures/pmclass.csv'), user::TABLE => elispm::file('tests/fixtures/pmuser.csv'), usermoodle::TABLE => elispm::file('tests/fixtures/usermoodle.csv'), 'user' => elispm::file('tests/fixtures/mdluser.csv'));
     if ($createnonrequiredlos) {
         // Want a non-required learning objective.
         $csvs[coursecompletion::TABLE] = elispm::file('tests/fixtures/course_completion_nonrequired.csv');
     } else {
         if ($createrequiredlos) {
             // Want a required learning objective.
             $csvs[coursecompletion::TABLE] = elispm::file('tests/fixtures/course_completion_required.csv');
         }
     }
     $dataset = $this->createCsvDataSet($csvs);
     $this->loadDataSet($dataset);
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:21,代码来源:pmclassupdateenrolmentstatus_test.php

示例12: init_required_data

 /**
  * Set up necessary data
  *
  * @param int $numfields The number of custom fields used in auto-association
  */
 private function init_required_data($numfields = 1)
 {
     global $CFG, $DB;
     require_once $CFG->dirroot . '/local/elisprogram/lib/setup.php';
     require_once elis::file('eliscore/fields/moodleprofile/custom_fields.php');
     require_once elis::lib('data/customfield.class.php');
     require_once elispm::file('accesslib.php');
     require_once elispm::lib('data/userset.class.php');
     require_once $CFG->dirroot . '/user/profile/definelib.php';
     require_once $CFG->dirroot . '/user/profile/field/checkbox/define.class.php';
     // Set up the category only once.
     $fieldcategory = new field_category(array('name' => 'testcategoryname'));
     $fieldcategory->save();
     // Ste up the target userset only once.
     $userset = new userset(array('name' => 'testusersetname'));
     $userset->save();
     for ($i = 1; $i <= $numfields; $i++) {
         // Custom field.
         $field = new field(array('categoryid' => $fieldcategory->id, 'shortname' => 'testfieldshortname' . $i, 'name' => 'testfieldname' . $i, 'datatype' => 'bool'));
         $field->save();
         // Ensure manual field owner exists for syncing.
         field_owner::ensure_field_owner_exists($field, 'manual');
         $ownerid = $DB->get_field(field_owner::TABLE, 'id', array('fieldid' => $field->id, 'plugin' => 'manual'));
         $owner = new field_owner($ownerid);
         $owner->param_control = 'checkbox';
         $owner->save();
         // Ensure moodle profile field owner exists.
         field_owner::ensure_field_owner_exists($field, 'moodle_profile');
         $DB->execute("UPDATE {" . field_owner::TABLE . "} SET exclude = ?", array(pm_moodle_profile::sync_to_moodle));
         // Field context level assocation.
         $fieldcontextlevel = new field_contextlevel(array('fieldid' => $field->id, 'contextlevel' => CONTEXT_ELIS_USER));
         $fieldcontextlevel->save();
         // The associated Moodle user profile field.
         $profiledefinecheckbox = new profile_define_checkbox();
         $data = new stdClass();
         $data->datatype = 'checkbox';
         $data->categoryid = 99999;
         $data->shortname = 'testfieldshortname' . $i;
         $data->name = 'testfieldname' . $i;
         $profiledefinecheckbox->define_save($data);
         $mfield = $DB->get_record('user_info_field', array('shortname' => 'testfieldshortname' . $i));
         // The "cluster-profile" association.
         $usersetprofile = new userset_profile(array('clusterid' => $userset->id, 'fieldid' => $mfield->id, 'value' => 1));
         $usersetprofile->save();
     }
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:51,代码来源:elis_cluster_profile_import_test.php

示例13: display_default

 function display_default()
 {
     require_once elispm::file('form/configcrsdefaultform.class.php');
     $configform = new configcrsdefaultform('index.php?s=dftcrs&section=admn', $this);
     $configform->set_data(elis::$config->local_elisprogram);
     if ($configdata = $configform->get_data()) {
         $this->_config_set_value($configdata, 'crsdftname', 0);
         $this->_config_set_value($configdata, 'crsdftcode', 0);
         $this->_config_set_value($configdata, 'crsdftidnumber');
         $this->_config_set_value($configdata, 'crsdftsyllabus', 0);
         $this->_config_set_value($configdata, 'crsdftlengthdescription', 0);
         $this->_config_set_value($configdata, 'crsdftlength', 0);
         $this->_config_set_value($configdata, 'crsdftcredits', 0);
         $this->_config_set_value($configdata, 'crsdftcompletion_grade', 0);
         $this->_config_set_value($configdata, 'crsdftenvironmentid', 0);
         $this->_config_set_value($configdata, 'crsdftcost', 0);
         $this->_config_set_value($configdata, 'crsdftversion', 0);
     }
     $configform->display();
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:20,代码来源:configcrsdefaultpage.class.php

示例14: display_default

 function display_default()
 {
     require_once elispm::file('form/configclsdefaultform.class.php');
     $configform = new configclsdefaultform('index.php?s=dftcls&section=admn', $this);
     $configform->set_data(elis::$config->local_elisprogram);
     if ($configdata = $configform->get_data()) {
         if (isset($configdata->clsdftstarttime)) {
             $configdata->clsdftstarttime = $configdata->clsdftstarttime % DAYSECS;
         }
         if (isset($configdata->clsdftendtime)) {
             $configdata->clsdftendtime = $configdata->clsdftendtime % DAYSECS;
         }
         $this->_config_set_value($configdata, 'clsdftidnumber', 0);
         $this->_config_set_value($configdata, 'clsdftstartdate', 0);
         $this->_config_set_value($configdata, 'clsdftenddate', 0);
         $this->_config_set_value($configdata, 'clsdftstarttime');
         $this->_config_set_value($configdata, 'clsdftendtime', 0);
         $this->_config_set_value($configdata, 'clsdftmaxstudents', 0);
         $this->_config_set_value($configdata, 'clsdftenvironmentid', 0);
     }
     $configform->display();
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:22,代码来源:configclsdefaultpage.class.php

示例15: test_checkforcompletednagsdate

 /**
  * Test check_for_completed_nags function with completion time in the past.
  */
 public function test_checkforcompletednagsdate()
 {
     global $DB;
     $dataset = $this->createCsvDataSet(array(user::TABLE => elispm::file('tests/fixtures/pmuser.csv'), curriculum::TABLE => elispm::file('tests/fixtures/curriculum.csv'), curriculumstudent::TABLE => elispm::file('tests/fixtures/curriculum_student.csv'), course::TABLE => elispm::file('tests/fixtures/pmcourse.csv'), curriculumcourse::TABLE => elispm::file('tests/fixtures/curriculum_course.csv'), pmclass::TABLE => elispm::file('tests/fixtures/pmclass.csv'), student::TABLE => elispm::file('tests/fixtures/student.csv')));
     $this->loadDataSet($dataset);
     // Set the course to be required in the program.
     $sql = "UPDATE {" . curriculumcourse::TABLE . "} SET required = 1 WHERE curriculumid = 1 AND courseid = 100";
     $DB->execute($sql);
     // Set the completion time to a month ago and status to completed on the class enrolment.
     $completetime = time() - 2592000;
     $sql = 'UPDATE {' . student::TABLE . '} SET completetime = ' . $completetime . ', completestatusid = 2 WHERE userid = 103 AND classid = 100';
     $DB->execute($sql);
     // Execute check_for_completed_nags.
     $curriculum = new curriculum(1);
     $curriculum->load();
     $result = $curriculum->check_for_completed_nags();
     // Verify completion time in program assignment table.
     $recordset = curriculumstudent::get_curricula(103);
     foreach ($recordset as $record) {
         $this->assertEquals(1, $record->curid);
         $this->assertEquals($completetime, $record->timecompleted);
     }
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:26,代码来源:curriculumstudent_test.php


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