本文整理汇总了PHP中ilCourseParticipants类的典型用法代码示例。如果您正苦于以下问题:PHP ilCourseParticipants类的具体用法?PHP ilCourseParticipants怎么用?PHP ilCourseParticipants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ilCourseParticipants类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
}
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:65,代码来源:class.ilCourseAppEventListener.php
示例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;
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:20,代码来源:class.ilParticipants.php
示例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;
}
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:24,代码来源:class.ilCourseXMLParser.php
示例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);
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:21,代码来源:ilMembershipTest.php
示例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');
}
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:26,代码来源:class.ilParticipants.php
示例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;
}
}
}
}
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:49,代码来源:class.ilCourseAppEventListener.php
示例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);
}
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:43,代码来源:class.ilCourseEditParticipantsTableGUI.php
示例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);
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:27,代码来源:class.ilCourseVerificationTableGUI.php
示例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;
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:23,代码来源:class.ilForumNotification.php
示例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();
}
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:21,代码来源:class.ilLPStatusEvent.php
示例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);
}
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:30,代码来源:class.ilCourseObjectiveResult.php
示例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;
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:72,代码来源:class.ilECSCmsCourseMemberCommandQueueHandler.php
示例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);
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:36,代码来源:class.ilWorkspaceAccessGUI.php
示例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;
}
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:40,代码来源:class.ilCourseParticipantsGroupsTableGUI.php
示例16: assignUsersAsCourseMembers
/**
* Assign users as course members
*
*/
function assignUsersAsCourseMembers($a_user_login_base = "learner", $a_start = 1, $a_end = 100)
{
global $ilDB;
$this->log("Assigning Course Members");
$set = $ilDB->query("SELECT usr_id, login FROM usr_data WHERE " . " login LIKE " . $ilDB->quote($a_user_login_base . "%", "text"));
$user_ids = array();
while ($rec = $ilDB->fetchAssoc($set)) {
$rest = substr($rec["login"], strlen($a_user_login_base));
if (is_numeric($rest) && ((int) $rest >= $a_start && (int) $rest <= $a_end)) {
$user_ids[] = $rec["usr_id"];
}
}
$cnt = 1;
$crs_ref_ids = ilUtil::_getObjectsByOperations("crs", "read", 0, $limit = 1000000);
include_once "./Modules/Course/classes/class.ilCourseParticipants.php";
foreach ($crs_ref_ids as $r) {
$crs_id = ilObject::_lookupObjId($r);
$mem_obj = ilCourseParticipants::_getInstanceByObjId($crs_id);
foreach ($user_ids as $u) {
$this->log("{$cnt}: add user {$u} as member to course " . $crs_id);
$mem_obj->add($u, 1);
$cnt++;
}
}
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:29,代码来源:class.ilDataLoader.php
示例17: confirmedUnsubscribe
public function confirmedUnsubscribe()
{
global $ilCtrl, $ilAccess, $ilUser;
if (!sizeof($_POST["ref_id"])) {
$ilCtrl->redirect($this, "manage");
}
foreach ($_POST["ref_id"] as $ref_id) {
if ($ilAccess->checkAccess("leave", "", $ref_id)) {
switch (ilObject::_lookupType($ref_id, true)) {
case "crs":
// see ilObjCourseGUI:performUnsubscribeObject()
include_once "Modules/Course/classes/class.ilCourseParticipants.php";
$members = new ilCourseParticipants(ilObject::_lookupObjId($ref_id));
$members->delete($ilUser->getId());
$members->sendUnsubscribeNotificationToAdmins($ilUser->getId());
$members->sendNotification($members->NOTIFY_UNSUBSCRIBE, $ilUser->getId());
break;
case "grp":
// see ilObjGroupGUI:performUnsubscribeObject()
include_once "Modules/Group/classes/class.ilGroupParticipants.php";
$members = new ilGroupParticipants(ilObject::_lookupObjId($ref_id));
$members->delete($ilUser->getId());
include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
$members->sendNotification(ilGroupMembershipMailNotification::TYPE_UNSUBSCRIBE_MEMBER, $ilUser->getId());
$members->sendNotification(ilGroupMembershipMailNotification::TYPE_NOTIFICATION_UNSUBSCRIBE, $ilUser->getId());
break;
default:
// do nothing
continue;
}
include_once './Modules/Forum/classes/class.ilForumNotification.php';
ilForumNotification::checkForumsExistsDelete($ref_id, $ilUser->getId());
}
}
ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
$ilCtrl->redirectByClass("ilpersonaldesktopgui", "show");
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:37,代码来源:class.ilPDSelectedItemsBlockGUI.php
示例18: createCourseStatus
/**
* Get course status body
* @param int $a_usr_id
* @return string
*/
protected function createCourseStatus($a_usr_id)
{
$part = ilCourseParticipants::_getInstanceByObjId($this->getObjId());
$body = $this->getLanguageText('crs_new_status') . "\n";
$body .= $this->getLanguageText('role') . ': ';
if ($part->isAdmin($a_usr_id)) {
$body .= $this->getLanguageText('crs_admin') . "\n";
} elseif ($part->isTutor($a_usr_id)) {
$body .= $this->getLanguageText('crs_tutor') . "\n";
} else {
$body .= $this->getLanguageText('crs_member') . "\n";
}
if ($part->isAdmin($a_usr_id) or $part->isTutor($a_usr_id)) {
$body .= $this->getLanguageText('crs_status') . ': ';
if ($part->isNotificationEnabled($a_usr_id)) {
$body .= $this->getLanguageText('crs_notify') . "\n";
} else {
$body .= $this->getLanguageText('crs_no_notify') . "\n";
}
} else {
$body .= $this->getLanguageText('crs_access') . ': ';
if ($part->isBlocked($a_usr_id)) {
$body .= $this->getLanguageText('crs_blocked') . "\n";
} else {
$body .= $this->getLanguageText('crs_unblocked') . "\n";
}
}
$body .= $this->getLanguageText('crs_passed') . ': ';
if ($part->hasPassed($a_usr_id)) {
$body .= $this->getLanguageText('yes');
} else {
$body .= $this->getLanguageText('no');
}
return $body;
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:40,代码来源:class.ilCourseMembershipMailNotification.php
示例19: showMembers
/**
* Show course members
*/
public function showMembers()
{
global $lng, $ilUser, $ilObjDataCache;
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
if ($_GET["search_crs"] != "") {
$_POST["search_crs"] = explode(",", $_GET["search_crs"]);
$_GET["search_crs"] = "";
} else {
if ($_SESSION["search_crs"] != "") {
$_POST["search_crs"] = explode(",", $_SESSION["search_crs"]);
$_SESSION["search_crs"] = "";
}
}
if (!is_array($_POST["search_crs"]) || count($_POST["search_crs"]) == 0) {
ilUtil::sendInfo($lng->txt("mail_select_course"));
$this->showMyCourses();
} else {
foreach ($_POST['search_crs'] as $crs_id) {
$oTmpCrs = ilObjectFactory::getInstanceByObjId($crs_id);
if ($oTmpCrs->getShowMembers() == $oTmpCrs->SHOW_MEMBERS_DISABLED) {
unset($_POST['search_crs']);
ilUtil::sendInfo($lng->txt('mail_crs_list_members_not_available_for_at_least_one_crs'));
return $this->showMyCourses();
}
unset($oTmpCrs);
}
$this->tpl->setTitle($this->lng->txt("mail_addressbook"));
$this->ctrl->setParameter($this, "view", "crs_members");
if ($_GET["ref"] != "") {
$this->ctrl->setParameter($this, "ref", $_GET["ref"]);
}
if (is_array($_POST["search_crs"])) {
$this->ctrl->setParameter($this, "search_crs", implode(",", $_POST["search_crs"]));
}
$this->tpl->setVariable("ACTION", $this->ctrl->getFormAction($this));
$this->ctrl->clearParameters($this);
$lng->loadLanguageModule('crs');
include_once 'Services/Contact/classes/class.ilMailSearchCoursesMembersTableGUI.php';
$context = $_GET["ref"] ? $_GET["ref"] : "mail";
$table = new ilMailSearchCoursesMembersTableGUI($this, 'crs', $context);
$table->setId('show_crs_mmbrs_tbl');
$tableData = array();
$searchTpl = new ilTemplate('tpl.mail_search_template.html', true, true, 'Services/Contact');
foreach ($_POST["search_crs"] as $crs_id) {
$members_obj = ilCourseParticipants::_getinstanceByObjId($crs_id);
$tmp_members = $members_obj->getParticipants();
$course_members = ilUtil::_sortIds($tmp_members, 'usr_data', 'lastname', 'usr_id');
foreach ($course_members as $member) {
$tmp_usr = new ilObjUser($member);
if ($tmp_usr->checkTimeLimit() == false || $tmp_usr->getActive() == false) {
unset($tmp_usr);
continue;
}
unset($tmp_usr);
$name = ilObjUser::_lookupName($member);
$login = ilObjUser::_lookupLogin($member);
$fullname = "";
if (in_array(ilObjUser::_lookupPref($member, 'public_profile'), array("g", 'y'))) {
$fullname = $name['lastname'] . ', ' . $name['firstname'];
}
$rowData = array('members_id' => $member, 'members_login' => $login, 'members_name' => $fullname, 'members_crs_grp' => $ilObjDataCache->lookupTitle($crs_id), 'members_in_addressbook' => $this->abook->checkEntryByLogin($login) ? $lng->txt("yes") : $lng->txt("no"), 'search_crs' => $crs_id);
$tableData[] = $rowData;
}
}
$table->setData($tableData);
if (count($tableData)) {
$searchTpl->setVariable("TXT_MARKED_ENTRIES", $lng->txt("marked_entries"));
}
$searchTpl->setVariable('TABLE', $table->getHtml());
$this->tpl->setContent($searchTpl->get());
if ($_GET["ref"] != "wsp") {
$this->tpl->show();
}
}
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:78,代码来源:class.ilMailSearchCoursesGUI.php
示例20: _checkAccess
/**
* checks wether a user may invoke a command or not
* (this method is called by ilAccessHandler::checkAccess)
*
* @param string $a_cmd command (not permission!)
* @param string $a_permission permission
* @param int $a_ref_id reference id
* @param int $a_obj_id object id
* @param int $a_user_id user id (if not provided, current user is taken)
*
* @return boolean true, if everything is ok
*/
function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
{
global $ilUser, $lng, $rbacsystem, $ilAccess, $ilias;
if ($a_user_id == "") {
$a_user_id = $ilUser->getId();
}
if ($ilUser->getId() == $a_user_id) {
$participants = ilCourseParticipant::_getInstanceByObjId($a_obj_id, $a_user_id);
} else {
$participants = ilCourseParticipants::_getInstanceByObjId($a_obj_id);
}
switch ($a_cmd) {
case "view":
if ($participants->isBlocked($a_user_id) and $participants->isAssigned($a_user_id)) {
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("crs_status_blocked"));
|
请发表评论