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


PHP elispm::lib方法代码示例

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


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

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

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

/**
 * Install function for this plugin
 *
 * @return  boolean  true  Returns true to satisfy install procedure
 */
function xmldb_elisprogram_usetclassify_install()
{
    global $CFG, $DB;
    require_once elispm::lib('setup.php');
    require_once elis::lib('data/customfield.class.php');
    require_once elispm::file('plugins/usetclassify/usersetclassification.class.php');
    // Migrate component.
    $oldcmp = 'pmplugins_userset_classification';
    $newcmp = 'elisprogram_usetclassify';
    $upgradestepfuncname = 'elisprogram_usetclassify_pre26upgradesteps';
    $tablechanges = array('crlm_cluster_classification' => 'elisprogram_usetclassify');
    $migrator = new \local_eliscore\install\migration\migrator($oldcmp, $newcmp, $upgradestepfuncname, $tablechanges);
    if ($migrator->old_component_installed() === true) {
        $migrator->migrate();
    }
    $field = new field();
    $field->shortname = USERSET_CLASSIFICATION_FIELD;
    $field->name = get_string('classification_field_name', 'elisprogram_usetclassify');
    $field->datatype = 'char';
    $category = new field_category();
    $category->name = get_string('classification_category_name', 'elisprogram_usetclassify');
    $field = field::ensure_field_exists_for_context_level($field, CONTEXT_ELIS_USERSET, $category);
    // make sure we're set as owner
    if (!isset($field->owners['userset_classifications'])) {
        $owner = new field_owner();
        $owner->fieldid = $field->id;
        $owner->plugin = 'userset_classifications';
        $owner->save();
    }
    // 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 = 'moodle/user:update';
        $owner->param_control = 'menu';
        $owner->param_options_source = 'userset_classifications';
        $owner->param_help_file = 'elisprogram_usetclassify/cluster_classification';
        $owner->save();
    }
    // make sure we have a default value set
    if (!field_data::get_for_context_and_field(NULL, $field)) {
        field_data::set_for_context_and_field(NULL, $field, 'regular');
    }
    $regclassify = $DB->get_record(usersetclassification::TABLE, array('shortname' => 'regular'));
    if (empty($regclassify)) {
        $default = new usersetclassification();
        $default->shortname = 'regular';
        $default->name = get_string('cluster', 'local_elisprogram');
        $default->param_autoenrol_curricula = 1;
        $default->param_autoenrol_tracks = 1;
        $default->save();
    }
    return true;
}
开发者ID:jamesmcq,项目名称:elis,代码行数:61,代码来源:install.php

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

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

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

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

示例8: assign_track_enrol_permissions

 /**
  * Set up permissions that allow the current user to enrol users in tracks
  */
 protected function assign_track_enrol_permissions()
 {
     global $CFG, $USER, $DB;
     require_once elispm::lib('data/user.class.php');
     // Set up a test role that allows users to enrol users in tracks.
     $roleid = create_role('trackenrol', 'trackenrol', 'trackenrol');
     $syscontext = context_system::instance();
     assign_capability('local/elisprogram:track_enrol', CAP_ALLOW, $roleid, $syscontext->id);
     // Set up our current user.
     $activeuser = new user(array('idnumber' => 'activeuser', 'username' => 'activeuser', 'firstname' => 'Activeuser', 'lastname' => 'Activeuser', 'email' => 'active@user.com', 'country' => 'CA'));
     $activeuser->save();
     $USER = $DB->get_record('user', array('username' => 'activeuser'));
     // Assign the role to the current user.
     role_assign($roleid, $USER->id, $syscontext->id);
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:18,代码来源:usertrackgetavailableusers_test.php

示例9: test_user_sync_on_pm_user_create

 /**
  * Validate that appropriate fields are synched over to Moodle when PM user is enrolled in a class instance during an import.
  */
 public function test_user_sync_on_pm_user_create()
 {
     global $CFG, $DB;
     require_once $CFG->dirroot . '/course/lib.php';
     require_once $CFG->dirroot . '/local/elisprogram/lib/setup.php';
     require_once elispm::lib('data/classmoodlecourse.class.php');
     require_once elispm::lib('data/course.class.php');
     require_once elispm::lib('data/pmclass.class.php');
     require_once elispm::lib('data/user.class.php');
     // Configure the elis enrolment plugin.
     $roleid = $DB->get_field('role', 'id', array(), IGNORE_MULTIPLE);
     set_config('roleid', $roleid, 'enrol_elis');
     $user = new user(array('idnumber' => 'testuseridnumber', 'username' => 'testuserusername', 'firstname' => 'testuserfirstname', 'lastname' => 'testuserlastname', 'email' => 'test@useremail.com', 'country' => 'CA'));
     $user->save();
     $course = new course(array('name' => 'testcoursename', 'idnumber' => 'testcourseidnumber', 'syllabus' => ''));
     $course->save();
     $class = new pmclass(array('courseid' => $course->id, 'idnumber' => 'testclassidnumber'));
     $class->save();
     $category = new stdClass();
     $category->name = 'testcategoryname';
     $category->id = $DB->insert_record('course_categories', $category);
     // Create the associated context.
     context_coursecat::instance($category->id);
     $mdlcourse = new stdClass();
     $mdlcourse->category = $category->id;
     $mdlcourse->fullname = 'testcoursefullname';
     $mdlcourse = create_course($mdlcourse);
     // Associate class instance to Moodle course.
     $classmoodlecourse = new classmoodlecourse(array('classid' => $class->id, 'moodlecourseid' => $mdlcourse->id));
     $classmoodlecourse->save();
     // Run the enrolment create action.
     $record = new stdClass();
     $record->context = 'class_testclassidnumber';
     $record->user_username = 'testuserusername';
     $importplugin = rlip_dataplugin_factory::factory('dhimport_version1elis');
     $importplugin->fslogger = new silent_fslogger(null);
     $importplugin->class_enrolment_create($record, 'bogus', 'testclassidnumber');
     // Validate the enrolment.
     $enrolid = $DB->get_field('enrol', 'id', array('enrol' => 'elis', 'courseid' => $mdlcourse->id));
     $this->assertNotEquals(false, $enrolid);
     $mdluserid = $DB->get_field('user', 'id', array('username' => 'testuserusername'));
     $this->assertNotEquals(false, $mdluserid);
     $this->assertTrue($DB->record_exists('user_enrolments', array('enrolid' => $enrolid, 'userid' => $mdluserid)));
     // Validate the role assignment.
     $mdlcoursecontext = context_course::instance($mdlcourse->id);
     $this->assertTrue($DB->record_exists('role_assignments', array('roleid' => $roleid, 'contextid' => $mdlcoursecontext->id, 'userid' => $mdluserid)));
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:50,代码来源:elis_enrolment_sync_test.php

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

示例11: test_usercountexcludesinactivewhenexcludinginactive

 /**
  * Validate that the enrolment count excludes inactive users when the site is not configured to show inactive users
  */
 public function test_usercountexcludesinactivewhenexcludinginactive()
 {
     require_once elispm::lib('lib.php');
     // Set up all the data needed for the listing.
     $this->load_csv_data();
     // Disable showing of inactive users.
     pm_set_config('legacy_show_inactive_users', 0);
     elis::$config = new elis_config();
     // Obtain the listing.
     $listing = track_assignment_get_listing(1);
     // Validate the number of rows.
     $count = 0;
     foreach ($listing as $entity) {
         $count++;
         // Validate the aggregated count in the first row.
         $this->assertEquals(1, $entity->enrolments);
     }
     unset($listing);
     $this->assertEquals(1, $count);
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:23,代码来源:trackassignmentgetlisting_test.php

示例12: xmldb_elisprogram_archive_install

/**
 * Install function for this plugin
 *
 * @return  boolean  true  Returns true to satisfy install procedure
 */
function xmldb_elisprogram_archive_install()
{
    global $CFG;
    require_once elispm::lib('setup.php');
    require_once elis::lib('data/customfield.class.php');
    // Migrate component.
    $oldcmp = 'pmplugins_archive';
    $newcmp = 'elisprogram_archive';
    $upgradestepfuncname = 'elisprogram_archive_pre26upgradesteps';
    $migrator = new \local_eliscore\install\migration\migrator($oldcmp, $newcmp, $upgradestepfuncname);
    if ($migrator->old_component_installed() === true) {
        $migrator->migrate();
    }
    // Archive field
    $field = new field();
    $field->shortname = ARCHIVE_FIELD;
    $field->name = get_string('archive_field_name', 'elisprogram_archive');
    $field->datatype = 'bool';
    $category = new field_category();
    $category->name = get_string('archive_category_name', 'elisprogram_archive');
    $field = field::ensure_field_exists_for_context_level($field, CONTEXT_ELIS_PROGRAM, $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_required = 0;
        $owner->param_view_capability = '';
        $owner->param_edit_capability = '';
        $owner->param_control = 'checkbox';
        $owner->param_options_source = '';
        $owner->param_help_file = 'elisprogram_archive/archive_program';
        $owner->save();
    }
    $owner_options = array('required' => 0, 'edit_capability' => '', 'view_capability' => '', 'control' => 'checkbox', 'columns' => 30, 'rows' => 10, 'maxlength' => 2048, 'help_file' => 'elisprogram_archive/archive_program');
    field_owner::ensure_field_owner_exists($field, 'manual', $owner_options);
    return true;
}
开发者ID:jamesmcq,项目名称:elis,代码行数:43,代码来源:install.php

示例13: test_enrolled_course_user_syncstoclass

 /**
  * Validate that the sync from course role assignment to class instance enrolment works
  */
 public function test_enrolled_course_user_syncstoclass()
 {
     global $CFG, $DB;
     require_once elispm::lib('lib.php');
     // Set up import data.
     $this->load_csv_data();
     // Make sure the context is set up.
     $crsctx = context_course::instance(100);
     // Set up our test role.
     $roleid = create_role('gradedrole', 'gradedrole', 'gradedrole');
     set_config('gradebookroles', $roleid);
     // Create role assignments.
     role_assign($roleid, 100, $crsctx->id);
     // Attempt the sync.
     $sync = new \local_elisprogram\moodle\synchronize();
     $sync->synchronize_moodle_class_grades();
     // Make sure the student record was created.
     $student = student::find();
     $this->assertTrue($student->valid());
     // Make sure the student has the right class id.
     $student = $student->current();
     $this->assertEquals(100, $student->classid);
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:26,代码来源:autoclassenrolment_test.php

示例14: test_enrolment_with_invalid_classid

 /**
  * Test enrolment functions using an invalid class ID.
  */
 public function test_enrolment_with_invalid_classid()
 {
     global $CFG, $DB;
     require_once $CFG->dirroot . '/local/elisprogram/lib/setup.php';
     require_once elispm::lib('lib.php');
     $this->load_csv_data();
     $enrolment = new stdClass();
     $enrolment->classid = 1000;
     // Invalid class ID.
     $enrolment->userid = 103;
     $enrolment->enrolmenttime = time();
     $enrolment->completetime = 0;
     $enrolment->endtime = 0;
     $enrolment->completestatusid = 0;
     $enrolment->grade = 0;
     $enrolment->credits = 0.0;
     $enrolment->locked = 0;
     // Directly insert the record to bypass 'student' class validation on the classid.
     $this->assertGreaterThan(0, $DB->insert_record(student::TABLE, $enrolment));
     // Attempt to update status before the required learning objective is satisfied.
     // ELIS-4955 -- This should ignore the bad data and proceed without error.
     pm_update_enrolment_status();
     // Validate that the enrolment is still in progress.
     $sturecord = new student(100);
     $this->assertEquals(STUSTATUS_NOTCOMPLETE, $sturecord->completestatusid);
     $this->assertEquals(0, $sturecord->locked);
     // Satisfy the required learning objective.
     $graderecord = new student_grade(1);
     $graderecord->grade = 80;
     $graderecord->save();
     // Attempt to update status now that the required learning objective is satisfied.
     pm_update_enrolment_status();
     // Validate that the enrolment is passed.
     $sturecord = new student(100);
     $this->assertEquals(STUSTATUS_PASSED, $sturecord->completestatusid);
     $this->assertEquals(1, $sturecord->locked);
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:40,代码来源:autoclasscompletion_test.php

示例15: pm_issue_course_certificates

/**
 * This function looks for course descriptions that issue certificates and students who have met the criteria to receive a
 * certificate
 * @return bool This function will always return true as to not interfere with the rest of the cron process.
 */
function pm_issue_course_certificates()
{
    require_once elispm::lib('certificate.php');
    require_once elispm::lib('data/certificateissued.class.php');
    global $DB;
    $status = true;
    $certuser = null;
    $certusers = array();
    // Find all courses having certificate settings and are enabled.
    $params = array('entity_type' => CERTIFICATE_ENTITY_TYPE_COURSE, 'disable' => 0);
    $certcourses = $DB->get_recordset('local_elisprogram_certcfg', $params, '', 'id, entity_id');
    if (empty($certcourses)) {
        return $status;
    }
    foreach ($certcourses as $certcoursesetting) {
        /* Find all users who completed classes and have not already recieved
         * certificates for those classes
         */
        $subselect = "SELECT * ";
        $subfrom = "FROM {local_elisprogram_certissued} certissued ";
        $subwhere = "WHERE certissued.cert_setting_id = :certsettingid AND " . "certissued.cm_userid = clsenrol.userid AND clsenrol.completetime = certissued.timeissued ";
        $params = array('completestatus' => STUSTATUS_PASSED, 'locked' => 1, 'courseid' => $certcoursesetting->entity_id, 'certsettingid' => $certcoursesetting->id);
        $select = "SELECT clsenrol.userid, clsenrol.completetime ";
        $from = "FROM {local_elisprogram_cls} cmclass " . "INNER JOIN {local_elisprogram_cls_enrol} clsenrol ON clsenrol.classid = cmclass.id ";
        $where = "WHERE clsenrol.completestatusid = :completestatus AND clsenrol.locked = :locked AND " . "cmclass.courseid = :courseid AND " . "NOT EXISTS ({$subselect} {$subfrom} {$subwhere}) ORDER BY clsenrol.userid ";
        $certusers = $DB->get_recordset_sql($select . $from . $where, $params);
        $certissueddata = new certificateissued(0);
        $result = pm_issue_user_certificate($certcoursesetting->id, $certusers, $certissueddata);
        $certusers->close();
    }
    return $status;
}
开发者ID:jamesmcq,项目名称:elis,代码行数:37,代码来源:lib.php


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