本文整理汇总了PHP中ilCourseParticipants::_getInstanceByObjId方法的典型用法代码示例。如果您正苦于以下问题:PHP ilCourseParticipants::_getInstanceByObjId方法的具体用法?PHP ilCourseParticipants::_getInstanceByObjId怎么用?PHP ilCourseParticipants::_getInstanceByObjId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilCourseParticipants
的用法示例。
在下文中一共展示了ilCourseParticipants::_getInstanceByObjId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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);
}
示例4: 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
示例5: 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');
}
}
示例6: __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);
}
}
示例7: __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);
}
}
示例8: 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;
}
}
示例9: 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;
}
示例10: assignCourses
protected function assignCourses()
{
if (count($this->getAssignedCourses()) == 0) {
return false;
}
foreach ($this->getAssignedCourses() as $crs_obj_id) {
if (ilObject2::_lookupType($crs_obj_id) != 'crs') {
continue;
}
$part = ilCourseParticipants::_getInstanceByObjId($crs_obj_id);
$usr_id = $this->getUsrObject()->getId();
$part->add($usr_id, ilCourseConstants::CRS_MEMBER);
$all_refs = ilObject2::_getAllReferences($crs_obj_id);
$first = array_shift(array_values($all_refs));
ilObjUser::_dropDesktopItem($usr_id, $first, 'crs');
}
}
示例11: purchase
public function purchase($tid)
{
global $lng;
$this->getDebtor();
$this->deb->createInvoice();
$products = array();
foreach ($this->sc as $i) {
$pod = ilPaymentObject::_getObjectData($i['pobject_id']);
$bo = new ilPaymentBookings($this->ilUser->getId());
$ilias_tid = $this->ilUser->getId() . "_" . $tid;
// psc_id, pobject_id, obj_id, typ, betrag_string
$bo->setTransaction($ilias_tid);
$bo->setPobjectId(isset($i['pobject_id']) ? $i['pobject_id'] : 0);
$bo->setCustomerId($this->ilUser->getId());
$bo->setVendorId($pod['vendor_id']);
$bo->setPayMethod($this->paytype);
$bo->setOrderDate(time());
// $bo->setDuration($i['dauer']); // duration
// $bo->setPrice( $i['betrag'] ); // amount
//$bo->setPrice( ilPaymentPrices::_getPriceString( $i['price_id'] ));
$bo->setDuration($i['duration']);
$bo->setPrice($i['price_string']);
$bo->setDiscount(0);
$bo->setVoucher('');
$bo->setVatRate($i['vat_rate']);
$bo->setVatUnit($i['vat_unit']);
$bo->setTransactionExtern($tid);
// $product_name = $i['buchungstext'];
//$duration = $i['dauer'];
//$amount = $i['betrag'];
$product_name = $i['object_title'];
$duration = $i['duration'];
$amount = $i['price'];
// -> ? $i['price_string']
include_once './Services/Payment/classes/class.ilPayMethods.php';
$save_adr = (int) ilPaymethods::_EnabledSaveUserAddress($this->paytype) ? 1 : 0;
//if($save_adr == 1)
//{
$bo->setStreet($this->ilUser->getStreet(), '');
$bo->setPoBox('');
//$this->ilUser->);
$bo->setZipcode($this->ilUser->getZipcode());
$bo->setCity($this->ilUser->getCity());
$bo->setCountry($this->ilUser->getCountry());
//}
$bo->setPayed(1);
$bo->setAccess(1);
$bo->setAccessExtension($this->sc['extension']);
$boid = $bo->add();
//$bo->update();
if ($i['typ'] == 'crs') {
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
$this->deb->createInvoiceLine(0, $product_name . " (" . $duration . ")", 1, $amount);
$products[] = $product_name;
$obj_id = ilObject::_lookupObjId($pod["ref_id"]);
$cp = ilCourseParticipants::_getInstanceByObjId($obj_id);
$cp->add($this->ilUser->getId(), IL_CRS_MEMBER);
$cp->sendNotification($cp->NOTIFY_ACCEPT_SUBSCRIBER, $this->ilUser->getId());
}
}
$inv = $this->deb->bookInvoice();
$invoice_number = $this->deb->getInvoiceNumber();
$attach = $this->deb->getInvoicePDF($inv);
$this->deb->saveInvoice($attach, false);
$lng->loadLanguageModule('payment');
$this->deb->sendInvoice($lng->txt('pay_order_paid_subject'), $this->ilUser->getFullName() . ",\n" . str_replace('%products%', implode(", ", $products), $lng->txt('pay_order_paid_body')), $this->ilUser->getEmail(), $attach, $lng->txt('pays_invoice') . "-" . $invoice_number);
$this->cart->emptyShoppingCart();
}
示例12: getMembers
/**
* Get members for object
* @param int $a_obj_id
* @return array
*/
protected static function getMembers($a_obj_id)
{
global $ilObjDataCache, $tree;
switch ($ilObjDataCache->lookupType($a_obj_id)) {
case 'crs':
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$member_obj = ilCourseParticipants::_getInstanceByObjId($a_obj_id);
return $member_obj->getMembers();
case 'grp':
include_once 'Modules/Group/classes/class.ilGroupParticipants.php';
$member_obj = ilGroupParticipants::_getInstanceByObjId($a_obj_id);
return $member_obj->getMembers();
case 'fold':
$folder_ref_ids = ilObject::_getAllReferences($a_obj_id);
$folder_ref_id = current($folder_ref_ids);
if ($crs_id = $tree->checkForParentType($folder_ref_id, 'crs')) {
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$member_obj = ilCourseParticipants::_getInstanceByObjId(ilObject::_lookupObjId($crs_id));
return $member_obj->getMembers();
}
break;
}
return array();
}
示例13: 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;
}
示例14: _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"));
return false;
}
break;
case 'leave':
// Regular member
if ($a_permission == 'leave') {
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
if (!$participants->isAssigned($a_user_id)) {
return false;
}
}
// Waiting list
if ($a_permission == 'join') {
include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
if (!ilCourseWaitingList::_isOnList($a_user_id, $a_obj_id)) {
return false;
}
return true;
}
break;
}
switch ($a_permission) {
case 'visible':
$visible = null;
$active = self::_isActivated($a_obj_id, $visible);
$tutor = $rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id);
if (!$active) {
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
}
if (!$tutor and !$active && !$visible) {
return false;
}
break;
case 'read':
$tutor = $rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id);
if ($tutor) {
return true;
}
$active = self::_isActivated($a_obj_id);
if (!$active) {
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
return false;
}
if ($participants->isBlocked($a_user_id) and $participants->isAssigned($a_user_id)) {
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("crs_status_blocked"));
return false;
}
break;
case 'join':
if (!self::_registrationEnabled($a_obj_id)) {
return false;
}
include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
if (ilCourseWaitingList::_isOnList($a_user_id, $a_obj_id)) {
return false;
}
if ($participants->isAssigned($a_user_id)) {
return false;
}
break;
}
return true;
}
示例15: getMembers
public function getMembers($a_search = true)
{
include_once "Modules/Course/classes/class.ilCourseParticipants.php";
$member_obj = ilCourseParticipants::_getInstanceByObjId($this->obj_id);
return $member_obj->getMembers();
}