本文整理汇总了PHP中ilCourseParticipants类的典型用法代码示例。如果您正苦于以下问题:PHP ilCourseParticipants类的具体用法?PHP ilCourseParticipants怎么用?PHP ilCourseParticipants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ilCourseParticipants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleEvent
/**
* Handle an event in a listener.
*
* @param string $a_component component, e.g. "Modules/Forum" or "Services/User"
* @param string $a_event event e.g. "createUser", "updateUser", "deleteUser", ...
* @param array $a_parameter parameter array (assoc), array("name" => ..., "phone_office" => ...)
*/
static function handleEvent($a_component, $a_event, $a_parameter)
{
global $ilUser;
if ($a_component == "Services/Tracking" && $a_event == "updateStatus") {
// #13905
include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
if (!ilObjUserTracking::_enabledLearningProgress()) {
return;
}
$obj_id = $a_parameter["obj_id"];
$user_id = $a_parameter["usr_id"];
$status = $a_parameter["status"];
if ($obj_id && $user_id) {
if (ilObject::_lookupType($obj_id) != "crs") {
return;
}
// determine couse setting only once
if (!isset(self::$course_mode[$obj_id])) {
include_once "./Modules/Course/classes/class.ilObjCourse.php";
$crs = new ilObjCourse($obj_id, false);
if ($crs->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
include_once './Services/Object/classes/class.ilObjectLP.php';
$olp = ilObjectLP::getInstance($obj_id);
$mode = $olp->getCurrentMode();
} else {
$mode = false;
}
self::$course_mode[$obj_id] = $mode;
}
$is_completed = $status == ilLPStatus::LP_STATUS_COMPLETED_NUM;
// we are NOT using the members object because of performance issues
switch (self::$course_mode[$obj_id]) {
case ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR:
// #11600
include_once "Modules/Course/classes/class.ilCourseParticipants.php";
ilCourseParticipants::_updatePassed($obj_id, $user_id, $is_completed, true);
break;
case ilLPObjSettings::LP_MODE_COLLECTION:
case ilLPObjSettings::LP_MODE_OBJECTIVES:
// overwrites course passed status if it was set automatically (full sync)
// or toggle manually set passed status to completed (1-way-sync)
$do_update = $is_completed;
include_once "Modules/Course/classes/class.ilCourseParticipants.php";
if (!$do_update) {
$part = new ilCourseParticipants($obj_id);
$passed = $part->getPassedInfo($user_id);
if (!is_array($passed) || $passed["user_id"] == -1) {
$do_update = true;
}
}
if ($do_update) {
ilCourseParticipants::_updatePassed($obj_id, $user_id, $is_completed);
}
break;
}
}
}
}
示例2: getInstanceByObjId
/**
* Get instance by obj type
*
* @param int $a_obj_id
* @return ilParticipants
*/
public static function getInstanceByObjId($a_obj_id)
{
$type = ilObject::_lookupType($a_obj_id);
switch ($type) {
case 'crs':
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
return ilCourseParticipants::_getInstanceByObjId($a_obj_id);
case 'grp':
include_once './Modules/Group/classes/class.ilGroupParticipants.php';
return ilGroupParticipants::_getInstanceByObjId($a_obj_id);
}
// @todo proper error handling
return null;
}
示例3: ilCourseXMLParser
/**
* Constructor
*
* @param object $a_content_object must be of type ilObjContentObject
* ilObjTest or ilObjQuestionPool
* @param string $a_xml_file xml file
* @param string $a_subdir subdirectory in import directory
* @access public
*/
function ilCourseXMLParser($a_course_obj, $a_xml_file = '')
{
global $lng, $ilLog;
parent::ilMDSaxParser($a_xml_file);
$this->sax_controller = new ilSaxController();
$this->log =& $ilLog;
$this->course_obj = $a_course_obj;
$this->course_members = ilCourseParticipants::_getInstanceByObjId($this->course_obj->getId());
$this->course_waiting_list = new ilCourseWaitingList($this->course_obj->getId());
// flip the array so we can use array_key_exists
$this->course_members_array = array_flip($this->course_members->getParticipants());
$this->md_obj = new ilMD($this->course_obj->getId(), 0, 'crs');
$this->setMDObject($this->md_obj);
$this->lng =& $lng;
}
示例4: testSubscription
/**
*
* @param
* @return
*/
public function testSubscription()
{
include_once './Services/Membership/classes/class.ilParticipants.php';
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
$part = ilCourseParticipants::_getInstanceByObjId(999999);
$part->addSubscriber(111111);
$part->updateSubscriptionTime(111111, time());
$part->updateSubject(111111, 'hallo');
$is = $part->isSubscriber(111111);
$this->assertEquals($is, true);
$is = ilParticipants::_isSubscriber(999999, 111111);
$this->assertEquals($is, true);
$part->deleteSubscriber(111111);
$is = $part->isSubscriber(111111);
$this->assertEquals($is, false);
}
示例5: getInstanceByObjId
/**
* @param int $a_obj_id
* @return ilParticipants|mixed|null|object
*/
public static function getInstanceByObjId($a_obj_id)
{
$type = ilObject::_lookupType($a_obj_id);
switch ($type) {
case 'crs':
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
return ilCourseParticipants::_getInstanceByObjId($a_obj_id);
case 'grp':
include_once './Modules/Group/classes/class.ilGroupParticipants.php';
return ilGroupParticipants::_getInstanceByObjId($a_obj_id);
case 'sess':
include_once './Modules/Session/classes/class.ilSessionParticipants.php';
return ilSessionParticipants::_getInstanceByObjId($a_obj_id);
default:
include_once 'class.ilAdobeConnectParticipantsNullObject.php';
return new ilAdobeConnectParticipantsNullObject();
}
}
开发者ID:KamuiXenom,项目名称:ILIAS_AdobeConnectPlugin,代码行数:22,代码来源:class.ilAdobeConnectContainerParticipants.php
示例6: getInstanceByObjId
/**
* Get instance by obj type
*
* @param int $a_obj_id
* @return ilParticipants
* @throws InvalidArgumentException
*/
public static function getInstanceByObjId($a_obj_id)
{
$type = ilObject::_lookupType($a_obj_id);
switch ($type) {
case 'crs':
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
return ilCourseParticipants::_getInstanceByObjId($a_obj_id);
case 'grp':
include_once './Modules/Group/classes/class.ilGroupParticipants.php';
return ilGroupParticipants::_getInstanceByObjId($a_obj_id);
case 'sess':
include_once './Modules/Session/classes/class.ilSessionParticipants.php';
return ilSessionParticipants::_getInstanceByObjId($a_obj_id);
default:
$GLOBALS['ilLog']->logStack();
$GLOBALS['ilLog']->write(__METHOD__ . ': Invalid obj_id given: ' . $a_obj_id);
throw new InvalidArgumentException('Invalid obj id given');
}
}
示例7: handleEvent
/**
* Handle an event in a listener.
*
* @param string $a_component component, e.g. "Modules/Forum" or "Services/User"
* @param string $a_event event e.g. "createUser", "updateUser", "deleteUser", ...
* @param array $a_parameter parameter array (assoc), array("name" => ..., "phone_office" => ...)
*/
static function handleEvent($a_component, $a_event, $a_parameter)
{
global $ilUser;
if ($a_component == "Services/Tracking" && $a_event == "updateStatus") {
$obj_id = $a_parameter["obj_id"];
$user_id = $a_parameter["usr_id"];
$status = $a_parameter["status"];
if ($obj_id && $user_id) {
if (ilObject::_lookupType($obj_id) != "crs") {
return;
}
// determine couse setting only once
if (!isset(self::$course_mode[$obj_id])) {
include_once "./Modules/Course/classes/class.ilObjCourse.php";
$crs = new ilObjCourse($obj_id, false);
if ($crs->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
include_once './Services/Tracking/classes/class.ilLPObjSettings.php';
$lp_settings = new ilLPObjSettings($obj_id);
$mode = $lp_settings->getMode();
} else {
$mode = false;
}
self::$course_mode[$obj_id] = $mode;
}
$is_completed = $status == LP_STATUS_COMPLETED_NUM;
// we are NOT using the members object because of performance issues
switch (self::$course_mode[$obj_id]) {
case LP_MODE_MANUAL_BY_TUTOR:
include_once "Modules/Course/classes/class.ilCourseParticipants.php";
ilCourseParticipants::_updatePassed($obj_id, $user_id, $is_completed, $ilUser->getId());
break;
case LP_MODE_COLLECTION:
case LP_MODE_OBJECTIVES:
if ($is_completed) {
include_once "Modules/Course/classes/class.ilCourseParticipants.php";
ilCourseParticipants::_updatePassed($obj_id, $user_id, $is_completed, -1);
}
break;
}
}
}
}
示例8: __construct
/**
* Constructor
*
* @access public
* @param object parent gui object
* @return void
*/
public function __construct($a_parent_obj)
{
global $lng, $ilCtrl;
$this->lng = $lng;
$this->lng->loadLanguageModule('crs');
$this->ctrl = $ilCtrl;
$this->container = $a_parent_obj;
include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
$this->privacy = ilPrivacySettings::_getInstance();
$this->participants = ilCourseParticipants::_getInstanceByObjId($a_parent_obj->object->getId());
parent::__construct($a_parent_obj, 'editMembers');
$this->setFormName('participants');
$this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
$this->addColumn($this->lng->txt('lastname'), 'lastname', '20%');
$this->addColumn($this->lng->txt('login'), 'login', '25%');
if ($this->privacy->enabledCourseAccessTimes()) {
$this->addColumn($this->lng->txt('last_access'), 'access_time');
}
$this->addColumn($this->lng->txt('crs_passed'), 'passed');
$this->addColumn($this->lng->txt('crs_blocked'), 'blocked');
$this->addColumn($this->lng->txt('crs_notification'), 'notification');
$this->addColumn($this->lng->txt('objs_role'), 'roles');
$this->addCommandButton('updateMembers', $this->lng->txt('save'));
$this->addCommandButton('members', $this->lng->txt('cancel'));
$this->setRowTemplate("tpl.edit_participants_row.html", "Modules/Course");
$this->disable('sort');
$this->enable('header');
$this->enable('numinfo');
$this->disable('select_all');
// Performance improvement: We read the local course roles
// only once, instead of reading them for each row in method fillRow().
$this->localCourseRoles = array();
foreach ($this->container->object->getLocalCourseRoles(false) as $title => $role_id) {
$this->localCourseRoles[ilObjRole::_getTranslation($title)] = array('role_id' => $role_id, 'title' => $title);
}
}
示例9: getItems
/**
* Get all completed tests
*/
protected function getItems()
{
global $ilUser;
$data = array();
include_once "Modules/Course/classes/class.ilObjCourse.php";
include_once "./Modules/Course/classes/class.ilCourseParticipants.php";
$obj_ids = ilCourseParticipants::_getMembershipByType($ilUser->getId(), "crs");
if ($obj_ids) {
include_once "./Services/Certificate/classes/class.ilCertificate.php";
include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php";
ilCourseCertificateAdapter::_preloadListData($ilUser->getId(), $obj_ids);
foreach ($obj_ids as $crs_id) {
// #11210 - only available certificates!
if (ilCourseCertificateAdapter::_hasUserCertificate($ilUser->getId(), $crs_id)) {
$crs = new ilObjCourse($crs_id, false);
$adapter = new ilCourseCertificateAdapter($crs);
if (ilCertificate::_isComplete($adapter)) {
$data[] = array("id" => $crs_id, "title" => ilObject::_lookupTitle($crs_id), "passed" => true);
}
}
}
}
$this->setData($data);
}
示例10: checkParentNodeTree
public static function checkParentNodeTree($ref_id)
{
global $tree;
$parent_ref_id = $tree->getParentId($ref_id);
$parent_obj = ilObjectFactory::getInstanceByRefId($parent_ref_id);
if ($parent_obj->getType() == 'crs') {
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$oParticipants = ilCourseParticipants::_getInstanceByObjId($parent_obj->getId());
} else {
if ($parent_obj->getType() == 'grp') {
include_once 'Modules/Group/classes/class.ilGroupParticipants.php';
$oParticipants = ilGroupParticipants::_getInstanceByObjId($parent_obj->getId());
}
}
$result = array();
if ($parent_obj->getType() == 'crs' || $parent_obj->getType() == 'grp') {
$moderator_ids = self::_getModerators($ref_id);
$admin_ids = $oParticipants->getAdmins();
$tutor_ids = $oParticipants->getTutors();
$result = array_unique(array_merge($moderator_ids, $admin_ids, $tutor_ids));
}
return $result;
}
示例11: getMembers
/**
* Get members for object
* @param int $a_obj_id
* @param bool $a_is_crs_id
* @return array
*/
protected static function getMembers($a_obj_id, $a_is_crs_id = false)
{
// find course in path
if (!$a_is_crs_id) {
$references = ilObject::_getAllReferences($a_obj_id);
$ref_id = end($references);
$course_ref_id = $tree->checkForParentType($ref_id, 'crs');
$course_obj_id = ilObject::_lookupObjId($course_ref_id);
} else {
$course_obj_id = $a_obj_id;
}
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$member_obj = ilCourseParticipants::_getInstanceByObjId($course_obj_id);
return $member_obj->getMembers();
}
示例12: __updatePassed
function __updatePassed($a_user_id, $objective_ids)
{
global $ilDB;
$passed = array();
$query = "SELECT COUNT(t1.crs_id) num,t1.crs_id FROM crs_objectives t1 " . "JOIN crs_objectives t2 WHERE t1.crs_id = t2.crs_id and " . $ilDB->in('t1.objective_id', $objective_ids, false, 'integer') . " " . "GROUP BY t1.crs_id";
$res = $ilDB->query($query);
$crs_ids = array();
while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
$query = "SELECT COUNT(cs.objective_id) num_passed FROM crs_objective_status cs " . "JOIN crs_objectives co ON cs.objective_id = co.objective_id " . "WHERE crs_id = " . $ilDB->quote($row->crs_id, 'integer') . " " . "AND user_id = " . $ilDB->quote($a_user_id, 'integer') . " ";
$user_res = $ilDB->query($query);
while ($user_row = $user_res->fetchRow(DB_FETCHMODE_OBJECT)) {
if ($user_row->num_passed == $row->num) {
$passed[] = $row->crs_id;
}
}
$crs_ids[$row->crs_id] = $row->crs_id;
}
if (count($passed)) {
foreach ($passed as $crs_id) {
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$members = ilCourseParticipants::_getInstanceByObjId($crs_id);
$members->updatePassed($a_user_id, true);
}
}
// update tracking status
foreach ($crs_ids as $cid) {
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilLPStatusWrapper::_updateStatus($cid, $a_user_id);
}
}
示例13: refreshAssignmentStatus
/**
* Refresh status of course member assignments
* @param object $course_member
* @param int $obj_id
*/
protected function refreshAssignmentStatus($course_member, $obj_id, $sub_id, $assigned)
{
include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseMemberAssignment.php';
$type = ilObject::_lookupType($obj_id);
if ($type == 'crs') {
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
$part = ilCourseParticipants::_getInstanceByObjId($obj_id);
} else {
include_once './Modules/Group/classes/class.ilGroupParticipants.php';
$part = ilGroupParticipants::_getInstanceByObjId($obj_id);
}
$course_id = (int) $course_member->lectureID;
$usr_ids = ilECSCourseMemberAssignment::lookupUserIds($course_id, $sub_id, $obj_id);
// Delete remote deleted
foreach ((array) $usr_ids as $usr_id) {
if (!isset($assigned[$usr_id])) {
$ass = ilECSCourseMemberAssignment::lookupAssignment($course_id, $sub_id, $obj_id, $usr_id);
if ($ass instanceof ilECSCourseMemberAssignment) {
$acc = ilObjUser::_checkExternalAuthAccount(ilECSSetting::lookupAuthMode(), (string) $usr_id);
if ($il_usr_id = ilObjUser::_lookupId($acc)) {
// this removes also admin, tutor roles
$part->delete($il_usr_id);
$GLOBALS['ilLog']->write(__METHOD__ . ': Deassigning user ' . $usr_id . ' ' . 'from course ' . ilObject::_lookupTitle($obj_id));
} else {
$GLOBALS['ilLog']->write(__METHOD__ . ': Deassigning unknown ILIAS user ' . $usr_id . ' ' . 'from course ' . ilObject::_lookupTitle($obj_id));
}
$ass->delete();
}
}
}
// Assign new participants
foreach ((array) $assigned as $person_id => $person) {
$role = $this->lookupRole($person['role']);
$role_info = ilECSMappingUtils::getRoleMappingInfo($role);
$acc = ilObjUser::_checkExternalAuthAccount(ilECSSetting::lookupAuthMode(), (string) $person_id);
$GLOBALS['ilLog']->write(__METHOD__ . ': Handling user ' . (string) $person_id);
if (in_array($person_id, $usr_ids)) {
if ($il_usr_id = ilObjUser::_lookupId($acc)) {
$GLOBALS['ilLog']->write(__METHOD__ . ': ' . print_r($role, true));
$part->updateRoleAssignments($il_usr_id, array($role));
// Nothing to do, user is member or is locally deleted
}
} else {
if ($il_usr_id = ilObjUser::_lookupId($acc)) {
if ($role) {
// Add user
$GLOBALS['ilLog']->write(__METHOD__ . ': Assigning new user ' . $person_id . ' ' . 'to ' . ilObject::_lookupTitle($obj_id));
$part->add($il_usr_id, $role);
}
} else {
if ($role_info['create']) {
$this->createMember($person_id);
$GLOBALS['ilLog']->write(__METHOD__ . ': Added new user ' . $person_id);
}
}
$assignment = new ilECSCourseMemberAssignment();
$assignment->setServer($this->getServer()->getServerId());
$assignment->setMid($this->mid);
$assignment->setCmsId($course_id);
$assignment->setCmsSubId($sub_id);
$assignment->setObjId($obj_id);
$assignment->setUid($person_id);
$assignment->save();
}
}
return true;
}
示例14: share
protected function share()
{
global $ilToolbar, $tpl, $ilUser, $ilSetting;
$options = array();
$options["user"] = $this->lng->txt("wsp_set_permission_single_user");
include_once 'Modules/Group/classes/class.ilGroupParticipants.php';
$grp_ids = ilGroupParticipants::_getMembershipByType($ilUser->getId(), 'grp');
if (sizeof($grp_ids)) {
$options["group"] = $this->lng->txt("wsp_set_permission_group");
}
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$crs_ids = ilCourseParticipants::_getMembershipByType($ilUser->getId(), 'crs');
if (sizeof($crs_ids)) {
$options["course"] = $this->lng->txt("wsp_set_permission_course");
}
if (!$this->getAccessHandler()->hasRegisteredPermission($this->node_id)) {
$options["registered"] = $this->lng->txt("wsp_set_permission_registered");
}
if ($ilSetting->get("enable_global_profiles")) {
if (!$this->getAccessHandler()->hasGlobalPasswordPermission($this->node_id)) {
$options["password"] = $this->lng->txt("wsp_set_permission_all_password");
}
if (!$this->getAccessHandler()->hasGlobalPermission($this->node_id)) {
$options["all"] = $this->lng->txt("wsp_set_permission_all");
}
}
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$actions = new ilSelectInputGUI("", "action");
$actions->setOptions($options);
$ilToolbar->addInputItem($actions);
$ilToolbar->setFormAction($this->ctrl->getFormAction($this));
$ilToolbar->addFormButton($this->lng->txt("add"), "addpermissionhandler");
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessTableGUI.php";
$table = new ilWorkspaceAccessTableGUI($this, "share", $this->node_id, $this->getAccessHandler());
$tpl->setContent($table->getHTML() . $this->footer);
}
示例15: getItems
/**
* Build item rows for given object and filter(s)
*/
function getItems()
{
if ($this->groups) {
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
$part = ilCourseParticipants::_getInstanceByObjId($this->obj_id);
$members = $part->getMembers();
if (count($members)) {
include_once './Services/User/classes/class.ilUserUtil.php';
$usr_data = array();
foreach ($members as $usr_id) {
$name = ilObjUser::_lookupName($usr_id);
// #9984
$user_groups = array("members" => array(), "admins" => array());
$user_groups_number = 0;
foreach (array_keys($this->participants) as $group_id) {
if (in_array($usr_id, $this->participants[$group_id]["members"])) {
$user_groups["members"][$group_id] = $this->groups[$group_id];
$user_groups_number++;
} else {
if (in_array($usr_id, $this->participants[$group_id]["admins"])) {
$user_groups["admins"][$group_id] = $this->groups[$group_id];
$user_groups_number++;
}
}
}
if ((!$this->filter["name"] || stristr(implode("", $name), $this->filter["name"])) && (!$this->filter["group"] || array_key_exists($this->filter["group"], $user_groups["members"]) || array_key_exists($this->filter["group"], $user_groups["admins"]))) {
$usr_data[] = array("usr_id" => $usr_id, "name" => $name["lastname"] . ", " . $name["firstname"], "groups" => $user_groups, "groups_number" => $user_groups_number, "login" => $name["login"]);
}
}
// ???
$usr_data = array_slice($usr_data, (int) $this->getOffset(), (int) $this->getLimit());
$this->setMaxCount(sizeof($members));
$this->setData($usr_data);
}
return $titles;
}
}