本文整理汇总了PHP中ilObject::_lookupOwner方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObject::_lookupOwner方法的具体用法?PHP ilObject::_lookupOwner怎么用?PHP ilObject::_lookupOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObject
的用法示例。
在下文中一共展示了ilObject::_lookupOwner方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addCrsGrpMembers
/**
* @param integer $ref_id ref_id of ilias ac-object
* @param integer $sco_id
* @param array $member_ids
*/
public function addCrsGrpMembers($ref_id, $sco_id, $member_ids = null)
{
$oParticipants = $this->getParticipantsObject();
if (count($oParticipants->getParticipants()) == 0) {
return;
}
$role_map = ilAdobeConnectServer::getRoleMap();
/** @var $oParticipants ilGroupParticipants | ilCourseParticipants */
$admins = $oParticipants->getAdmins();
$tutors = $oParticipants->getTutors();
$members = $oParticipants->getMembers();
if (is_array($member_ids) && count($member_ids) > 0) {
$all_participants = $member_ids;
$admins = array_uintersect($member_ids, $admins, 'strcmp');
$tutors = array_uintersect($member_ids, $tutors, 'strcmp');
$members = array_uintersect($member_ids, $members, 'strcmp');
} else {
$all_participants = array_unique(array_merge($admins, $tutors, $members));
}
$this->pluginObj->includeClass('class.ilAdobeConnectRoles.php');
$xavcRoles = new ilAdobeConnectRoles($ref_id);
if (ilAdobeConnectServer::getSetting('user_assignment_mode') != ilAdobeConnectServer::ASSIGN_USER_SWITCH) {
foreach ($all_participants as $user_id) {
$this->pluginObj->includeClass('class.ilAdobeConnectUserUtil.php');
//check if there is an adobe connect account at the ac-server
$ilAdobeConnectUser = new ilAdobeConnectUserUtil($user_id);
$ilAdobeConnectUser->ensureAccountExistance();
// add to desktop
if (ilAdobeConnectServer::getSetting('add_to_desktop') == 1) {
ilObjUser::_addDesktopItem($user_id, $ref_id, 'xavc');
}
}
}
// receive breeze session
$session = $this->xmlApi->getBreezeSession();
$this->pluginObj->includeClass('class.ilXAVCMembers.php');
if ($session != NULL && $this->xmlApi->login($this->adminLogin, $this->adminPass, $session)) {
foreach ($admins as $user_id) {
if ($user_id == $this->getOwner()) {
continue;
}
$xavcRoles->addAdministratorRole($user_id);
$is_member = ilXAVCMembers::_isMember($user_id, $ref_id);
// local member table
$xavcMemberObj = new ilXAVCMembers($ref_id, $user_id);
$status = $role_map[$oParticipants->getType() . '_admin'];
$xavcMemberObj->setStatus($status);
$xavcMemberObj->setScoId($sco_id);
if ($is_member) {
$xavcMemberObj->updateXAVCMember();
} else {
$xavcMemberObj->insertXAVCMember();
}
$this->xmlApi->updateMeetingParticipant($sco_id, ilXAVCMembers::_lookupXAVCLogin($user_id), $session, $status);
}
foreach ($tutors as $user_id) {
if ($user_id == $this->getOwner()) {
continue;
}
$xavcRoles->addAdministratorRole($user_id);
$is_member = ilXAVCMembers::_isMember($user_id, $ref_id);
// local member table
$xavcMemberObj = new ilXAVCMembers($ref_id, $user_id);
$status = $role_map[$oParticipants->getType() . '_tutor'];
$xavcMemberObj->setStatus($status);
$xavcMemberObj->setScoId($sco_id);
if ($is_member) {
$xavcMemberObj->updateXAVCMember();
} else {
$xavcMemberObj->insertXAVCMember();
}
$this->xmlApi->updateMeetingParticipant($sco_id, ilXAVCMembers::_lookupXAVCLogin($user_id), $session, $status);
}
foreach ($members as $user_id) {
if ($user_id == $this->getOwner()) {
continue;
}
$xavcRoles->addMemberRole($user_id);
$is_member = ilXAVCMembers::_isMember($user_id, $ref_id);
// local member table
$xavcMemberObj = new ilXAVCMembers($ref_id, $user_id);
$status = $role_map[$oParticipants->getType() . '_member'];
$xavcMemberObj->setStatus($status);
$xavcMemberObj->setScoId($sco_id);
if ($is_member) {
$xavcMemberObj->updateXAVCMember();
} else {
$xavcMemberObj->insertXAVCMember();
}
$this->xmlApi->updateMeetingParticipant($sco_id, ilXAVCMembers::_lookupXAVCLogin($user_id), $session, $status);
}
$owner_id = ilObject::_lookupOwner($oParticipants->getObjId());
$xavcRoles->addAdministratorRole($owner_id);
$is_member = ilXAVCMembers::_isMember($owner_id, $ref_id);
// local member table
//.........这里部分代码省略.........
示例2: randomSelectQuestions
/**
* Returns a random selection of questions
*
* @param integer $nr_of_questions Number of questions to return
* @param integer $questionpool ID of questionpool to choose the questions from (0 = all available questionpools)
* @param boolean $user_obj_id Use the object id instead of the reference id when set to true
* @param array $qpls An array of questionpool id's if the random questions should only be chose from the contained questionpools
* @return array A random selection of questions
* @access public
*
* @deprecated --> old school random test
*/
function randomSelectQuestions($nr_of_questions, $questionpool, $use_obj_id = 0, $qpls = "", $pass = NULL)
{
global $rbacsystem;
global $ilDB;
// retrieve object id instead of ref id if necessary
if ($questionpool != 0 && !$use_obj_id) {
$questionpool = ilObject::_lookupObjId($questionpool);
}
// get original ids of all existing questions in the test
$result = $ilDB->queryF("SELECT qpl_questions.original_id FROM qpl_questions, tst_test_question WHERE qpl_questions.question_id = tst_test_question.question_fi AND qpl_questions.tstamp > 0 AND tst_test_question.test_fi = %s", array("integer"), array($this->getTestId()));
$original_ids = array();
$paramtypes = array();
$paramvalues = array();
while ($row = $ilDB->fetchAssoc($result)) {
array_push($original_ids, $row['original_id']);
}
$available = "";
// get a list of all available questionpools
if ($questionpool == 0 && !is_array($qpls)) {
include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
$available_pools = array_keys(ilObjQuestionPool::_getAvailableQuestionpools($use_object_id = TRUE, $equal_points = FALSE, $could_be_offline = FALSE, $showPath = FALSE, $with_questioncount = FALSE, "read", ilObject::_lookupOwner($this->getId())));
if (count($available_pools)) {
$available = " AND " . $ilDB->in('obj_fi', $available_pools, false, 'integer');
} else {
return array();
}
}
$constraint_qpls = "";
$result_array = array();
if ($questionpool == 0) {
if (is_array($qpls)) {
if (count($qpls) > 0) {
$constraint_qpls = " AND " . $ilDB->in('obj_fi', $qpls, false, 'integer');
}
}
}
$original_clause = "";
if (count($original_ids)) {
$original_clause = " AND " . $ilDB->in('question_id', $original_ids, true, 'integer');
}
if ($questionpool == 0) {
$result = $ilDB->queryF("SELECT question_id FROM qpl_questions WHERE original_id IS NULL {$available} {$constraint_qpls} AND owner > %s AND complete = %s {$original_clause}", array('integer', 'text'), array(0, "1"));
} else {
$result = $ilDB->queryF("SELECT question_id FROM qpl_questions WHERE original_id IS NULL AND obj_fi = %s AND owner > %s AND complete = %s {$original_clause}", array('integer', 'integer', 'text'), array($questionpool, 0, "1"));
}
$found_ids = array();
while ($row = $ilDB->fetchAssoc($result)) {
array_push($found_ids, $row['question_id']);
}
$nr_of_questions = $nr_of_questions > count($found_ids) ? count($found_ids) : $nr_of_questions;
if ($nr_of_questions == 0) {
return array();
}
$rand_keys = array_rand($found_ids, $nr_of_questions);
$result = array();
if (is_array($rand_keys)) {
foreach ($rand_keys as $key) {
$result[$found_ids[$key]] = $found_ids[$key];
}
} else {
$result[$found_ids[$rand_keys]] = $found_ids[$rand_keys];
}
return $result;
}
示例3: getExportMeta
/**
* Build export meta data
*
* @return array
*/
protected function getExportMeta()
{
global $lng, $ilObjDataCache, $ilUser, $ilClientIniFile;
/* see spec
Name of installation
Name of the course
Permalink to course
Owner of course object
Date of report generation
Reporting period
Name of person who generated the report.
*/
ilDatePresentation::setUseRelativeDates(false);
include_once './Services/Link/classes/class.ilLink.php';
$data = array();
$data[$lng->txt("trac_name_of_installation")] = $ilClientIniFile->readVariable('client', 'name');
if ($this->obj_id) {
$data[$lng->txt("trac_object_name")] = $ilObjDataCache->lookupTitle($this->obj_id);
if ($this->ref_id) {
$data[$lng->txt("trac_object_link")] = ilLink::_getLink($this->ref_id, ilObject::_lookupType($this->obj_id));
}
$data[$lng->txt("trac_object_owner")] = ilObjUser::_lookupFullname(ilObject::_lookupOwner($this->obj_id));
}
$data[$lng->txt("trac_report_date")] = ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX), IL_CAL_DATETIME);
$data[$lng->txt("trac_report_owner")] = $ilUser->getFullName();
return $data;
}
示例4:
final function _lookupOwner($a_id)
{
return parent::_lookupOwner($a_id);
}
示例5: join
public function join()
{
/**
* @var $ilCtrl ilCtrl
*/
global $ilCtrl;
$user_id = $this->user->getId();
$this->pluginObj->includeClass('class.ilAdobeConnectRoles.php');
$this->pluginObj->includeClass('class.ilXAVCMembers.php');
$this->pluginObj->includeClass('class.ilAdobeConnectUserUtil.php');
$this->pluginObj->includeClass('class.ilAdobeConnectServer.php');
$xavcRoles = new ilAdobeConnectRoles($this->object->getRefId());
$current_users = $xavcRoles->getUsers();
if (in_array($user_id, $current_users)) {
ilUtil::sendInfo($this->txt('already_member'));
}
if (!$user_id) {
ilUtil::sendFailure($this->txt('user_not_known'));
return $this->editParticipants();
}
$xavcRoles->addMemberRole($user_id);
//check if there is an adobe connect account at the ac-server
$ilAdobeConnectUser = new ilAdobeConnectUserUtil($user_id);
$ilAdobeConnectUser->ensureAccountExistance();
$role_map = ilAdobeConnectServer::getRoleMap();
$status = false;
$oParticipants = null;
$type = '';
$owner = 0;
if (count($this->object->getParticipantsObject()->getParticipants()) > 0) {
$user_is_admin = $this->object->getParticipantsObject()->isAdmin($user_id);
$user_is_tutor = $this->object->getParticipantsObject()->isTutor($user_id);
$owner = ilObject::_lookupOwner($this->object->getParticipantsObject()->getObjId());
if ($owner == $this->user->getId()) {
$status = $role_map[$this->object->getParticipantsObject()->getType() . '_owner'];
} else {
if ($user_is_admin) {
$status = $role_map[$this->object->getParticipantsObject()->getType() . '_admin'];
} else {
if ($user_is_tutor) {
$status = $role_map[$this->object->getParticipantsObject()->getType() . '_tutor'];
} else {
$status = $role_map[$this->object->getParticipantsObject()->getType() . '_member'];
}
}
}
}
if (!$status) {
if ($owner == $this->user->getId()) {
$status = 'host';
} else {
$status = 'view';
}
}
$is_member = ilXAVCMembers::_isMember($user_id, $this->object->getRefId());
// local member table
$xavcMemberObj = new ilXAVCMembers($this->object->getRefId(), $user_id);
$xavcMemberObj->setStatus($status);
$xavcMemberObj->setScoId($this->object->getScoId());
if ($is_member) {
$xavcMemberObj->updateXAVCMember();
} else {
$xavcMemberObj->insertXAVCMember();
}
$this->object->updateParticipant(ilXAVCMembers::_lookupXAVCLogin($user_id), $status);
if (ilAdobeConnectServer::getSetting('add_to_desktop') == 1) {
ilObjUser::_addDesktopItem($user_id, $this->object->getRefId(), 'xavc');
}
$ilCtrl->setParameter($this, 'cmd', 'showContent');
$ilCtrl->redirect($this, "showContent");
}
示例6: addCrsGrpMembers
/**
* @param integer $ref_id ref_id of ilias ac-object
* @param integer $sco_id
* @param array $member_ids
*/
public function addCrsGrpMembers($ref_id, $sco_id, $member_ids = null)
{
global $tree;
$parent_crs_ref = $tree->checkForParentType($ref_id, 'crs');
$parent_grp_ref = $tree->checkForParentType($ref_id, 'grp');
$type = null;
$obj_id = 0;
if ($parent_crs_ref && empty($parent_grp_ref)) {
$obj_id = ilObject::_lookupObjectId($parent_crs_ref);
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$oParticipants = ilCourseParticipants::_getInstanceByObjId($obj_id);
$type = 'crs';
} else {
if ($parent_grp_ref) {
$obj_id = ilObject::_lookupObjectId($parent_grp_ref);
include_once 'Modules/Group/classes/class.ilGroupParticipants.php';
$oParticipants = ilGroupParticipants::_getInstanceByObjId($obj_id);
$type = 'grp';
}
}
if ($type == 'crs' || $type == 'grp') {
$role_map = ilAdobeConnectServer::getRoleMap();
$owner_id = ilObject::_lookupOwner(ilObject::_lookupObjectId($ref_id));
/** @var $oParticipants ilGroupParticipants | ilCourseParticipants */
$admins = $oParticipants->getAdmins();
$tutors = $oParticipants->getTutors();
$members = $oParticipants->getMembers();
if (is_array($member_ids) && count($member_ids) > 0) {
$all_participants = $member_ids;
$admins = array_uintersect($member_ids, $admins, 'strcmp');
$tutors = array_uintersect($member_ids, $tutors, 'strcmp');
$members = array_uintersect($member_ids, $members, 'strcmp');
} else {
$all_participants = array_unique(array_merge($admins, $tutors, $members));
}
$this->pluginObj->includeClass('class.ilAdobeConnectRoles.php');
$xavcRoles = new ilAdobeConnectRoles($ref_id);
if (ilAdobeConnectServer::getSetting('user_assignment_mode') != ilAdobeConnectServer::ASSIGN_USER_SWITCH) {
foreach ($all_participants as $user_id) {
$this->pluginObj->includeClass('class.ilAdobeConnectUserUtil.php');
//check if there is an adobe connect account at the ac-server
$ilAdobeConnectUser = new ilAdobeConnectUserUtil($user_id);
$ilAdobeConnectUser->ensureAccountExistance();
// add to desktop
if (ilAdobeConnectServer::getSetting('add_to_desktop') == 1) {
ilObjUser::_addDesktopItem($user_id, $ref_id, 'xavc');
}
}
}
// receive breeze session
$session = self::getSession();
$this->pluginObj->includeClass('class.ilXAVCMembers.php');
if ($session != NULL && $this->xmlApi->login($this->adminLogin, $this->adminPass, $session)) {
foreach ($admins as $user_id) {
$xavcRoles->addAdministratorRole($user_id);
$is_member = ilXAVCMembers::_isMember($user_id, $ref_id);
// local member table
$xavcMemberObj = new ilXAVCMembers($ref_id, $user_id);
$status = $role_map[$type . '_admin'];
$xavcMemberObj->setStatus($status);
$xavcMemberObj->setScoId($sco_id);
if ($is_member) {
$xavcMemberObj->updateXAVCMember();
} else {
$xavcMemberObj->insertXAVCMember();
}
$xavc_login = ilXAVCMembers::_lookupXAVCLogin($user_id);
if (!empty($xavc_login)) {
$this->xmlApi->updateMeetingParticipant($sco_id, $xavc_login, $session, $status);
}
}
foreach ($tutors as $user_id) {
if (($xavc_login = ilXAVCMembers::_lookupXAVCLogin($user_id)) != $this->adminLogin && $user_id != $owner_id) {
$xavcRoles->addAdministratorRole($user_id);
$is_member = ilXAVCMembers::_isMember($user_id, $ref_id);
// local member table
$xavcMemberObj = new ilXAVCMembers($ref_id, $user_id);
$status = $role_map[$type . '_tutor'];
$xavcMemberObj->setStatus($status);
$xavcMemberObj->setScoId($sco_id);
if ($is_member) {
$xavcMemberObj->updateXAVCMember();
} else {
$xavcMemberObj->insertXAVCMember();
}
if (!empty($xavc_login)) {
$this->xmlApi->updateMeetingParticipant($sco_id, $xavc_login, $session, $status);
}
}
}
foreach ($members as $user_id) {
if (($xavc_login = ilXAVCMembers::_lookupXAVCLogin($user_id)) != $this->adminLogin && $user_id != $owner_id) {
$xavcRoles->addMemberRole($user_id);
$is_member = ilXAVCMembers::_isMember($user_id, $ref_id);
// local member table
//.........这里部分代码省略.........
示例7: showTargets
//.........这里部分代码省略.........
}
// for references, get original title
// (link will lead to orignal, which basically is wrong though)
if ($a_obj_type == "crsr" || $a_obj_type == "catr") {
include_once "Services/ContainerReference/classes/class.ilContainerReference.php";
$tgt_obj_id = ilContainerReference::_lookupTargetId($a_rep_obj_id);
$title = ilObject::_lookupTitle($tgt_obj_id);
} else {
$title = ilObject::_lookupTitle($a_rep_obj_id);
}
$this->item_list_gui[$type]->initItem($vis_ref_id, $a_rep_obj_id, $title);
$link = $this->item_list_gui[$type]->getCommandLink("infoScreen");
// workaround, because # anchor can't be passed through frameset
$link = ilUtil::appendUrlParameterString($link, "anchor=note_" . $a_note_id);
$link = $this->item_list_gui[$type]->appendRepositoryFrameParameter($link) . "#note_" . $a_note_id;
} else {
$title = ilObject::_lookupTitle($a_rep_obj_id);
$link = "goto.php?target=pg_" . $a_obj_id . "_" . $vis_ref_id;
}
}
}
$par_id = $tree->getParentId($vis_ref_id);
// sub object link
if ($sub_link != "") {
if ($this->export_html || $this->print) {
$tpl->setCurrentBlock("exp_target_sub_object");
} else {
$tpl->setCurrentBlock("target_sub_object");
$tpl->setVariable("LINK_SUB_TARGET", $sub_link);
}
$tpl->setVariable("TXT_SUB_TARGET", $sub_title);
$tpl->setVariable("IMG_SUB_TARGET", $sub_icon);
$tpl->parseCurrentBlock();
}
// container and object link
if ($this->export_html || $this->print) {
$tpl->setCurrentBlock("exp_target_object");
} else {
$tpl->setCurrentBlock("target_object");
$tpl->setVariable("LINK_TARGET", $link);
}
$tpl->setVariable("TXT_CONTAINER", ilObject::_lookupTitle(ilObject::_lookupObjId($par_id)));
$tpl->setVariable("IMG_CONTAINER", ilObject::_getIcon(ilObject::_lookupObjId($par_id), "tiny"));
$tpl->setVariable("TXT_TARGET", $title);
$tpl->setVariable("IMG_TARGET", ilObject::_getIcon($a_rep_obj_id, "tiny"));
$tpl->parseCurrentBlock();
}
$tpl->touchBlock("target_objects");
}
} else {
// we only need 1 instance
if (!$this->wsp_tree) {
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
$this->wsp_tree = new ilWorkspaceTree($ilUser->getId());
$this->wsp_access_handler = new ilWorkspaceAccessHandler($this->wsp_tree);
}
$node_id = $this->wsp_tree->lookupNodeId($a_rep_obj_id);
if ($this->wsp_access_handler->checkAccess("visible", "", $node_id)) {
$path = $this->wsp_tree->getPathFull($node_id);
if ($path) {
$item = array_pop($path);
$parent = array_pop($path);
if (!$parent["title"]) {
$parent["title"] = $this->lng->txt("wsp_personal_workspace");
}
// sub-objects
$additional = null;
if ($a_obj_id) {
$sub_title = $this->getSubObjectTitle($a_rep_obj_id, $a_obj_id);
if ($sub_title) {
$item["title"] .= " (" . $sub_title . ")";
$additional = "_" . $a_obj_id;
}
}
$link = ilWorkspaceAccessHandler::getGotoLink($node_id, $a_rep_obj_id, $additional);
} else {
$owner = ilObject::_lookupOwner($a_rep_obj_id);
$parent["title"] = $this->lng->txt("wsp_tab_shared") . " (" . ilObject::_lookupOwnerName($owner) . ")";
$item["title"] = ilObject::_lookupTitle($a_rep_obj_id);
$link = "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace&dsh=" . $owner;
}
// container and object link
if ($this->export_html || $this->print) {
$tpl->setCurrentBlock("exp_target_object");
} else {
$tpl->setCurrentBlock("target_object");
$tpl->setVariable("LINK_TARGET", $link);
}
// :TODO: no images in template ?
$tpl->setVariable("TXT_CONTAINER", $parent["title"]);
$tpl->setVariable("IMG_CONTAINER", ilObject::_getIcon($parent["obj_id"], "tiny"));
$tpl->setVariable("TXT_TARGET", $item["title"]);
$tpl->setVariable("IMG_TARGET", ilObject::_getIcon($a_rep_obj_id, "tiny"));
$tpl->parseCurrentBlock();
}
}
}
}
}
示例8: renderList
/**
* Build posting month list
*
* @param array $items
* @param string $a_cmd
* @param bool $a_link_template
* @param bool $a_show_inactive
* @param string $a_export_directory
* @return string
*/
function renderList(array $items, $a_cmd = "preview", $a_link_template = null, $a_show_inactive = false, $a_export_directory = null)
{
global $lng, $ilCtrl;
include_once "Services/Calendar/classes/class.ilCalendarUtil.php";
$wtpl = new ilTemplate("tpl.blog_list.html", true, true, "Modules/Blog");
// quick editing in portfolio
if ($_REQUEST["prt_id"] && stristr($a_cmd, "embedded")) {
global $ilUser;
if (ilObject::_lookupOwner($_REQUEST["prt_id"]) == $ilUser->getId()) {
// see ilPortfolioPageTableGUI::fillRow()
$ilCtrl->setParameterByClass("ilportfoliopagegui", "ppage", (int) $_REQUEST["user_page"]);
$link = $ilCtrl->getLinkTargetByClass(array("ilportfoliopagegui", "ilobjbloggui"), "render");
$ilCtrl->setParameterByClass("ilportfoliopagegui", "ppage", "");
$wtpl->setCurrentBlock("prtf_edit_bl");
$wtpl->setVariable("PRTF_BLOG_URL", $link);
$wtpl->setVariable("PRTF_BLOG_TITLE", sprintf($lng->txt("prtf_edit_embedded_blog"), $this->object->getTitle()));
$wtpl->parseCurrentBlock();
}
}
$can_approve = $this->object->hasApproval() && $this->checkPermissionBool("write");
$can_deactivate = $this->checkPermissionBool("write");
include_once "./Modules/Blog/classes/class.ilBlogPostingGUI.php";
$last_month = null;
foreach ($items as $item) {
// only published items
$is_active = ilBlogPosting::_lookupActive($item["id"], "blp");
if (!$is_active && !$a_show_inactive) {
continue;
}
if (!$this->keyword && !$this->author) {
$month = substr($item["created"]->get(IL_CAL_DATE), 0, 7);
}
if (!$last_month || $last_month != $month) {
if ($last_month) {
$wtpl->setCurrentBlock("month_bl");
$wtpl->parseCurrentBlock();
}
// title according to current "filter"/navigation
if ($this->keyword) {
$title = $lng->txt("blog_keyword") . ": " . $this->keyword;
} else {
if ($this->author) {
include_once "Services/User/classes/class.ilUserUtil.php";
$title = $lng->txt("blog_author") . ": " . ilUserUtil::getNamePresentation($this->author);
} else {
include_once "Services/Calendar/classes/class.ilCalendarUtil.php";
$title = ilCalendarUtil::_numericMonthToString((int) substr($month, 5)) . " " . substr($month, 0, 4);
$last_month = $month;
}
}
$wtpl->setVariable("TXT_CURRENT_MONTH", $title);
}
if (!$a_link_template) {
$ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", $this->month);
$ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $item["id"]);
$preview = $ilCtrl->getLinkTargetByClass("ilblogpostinggui", $a_cmd);
} else {
$preview = $this->buildExportLink($a_link_template, "posting", $item["id"]);
}
// actions
$item_contribute = $this->mayContribute($item["id"], $item["author"]);
if (($item_contribute || $can_approve || $can_deactivate) && !$a_link_template && $a_cmd == "preview") {
include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
$alist = new ilAdvancedSelectionListGUI();
$alist->setId($item["id"]);
$alist->setListTitle($lng->txt("actions"));
if ($is_active && $this->object->hasApproval() && !$item["approved"]) {
if ($can_approve) {
$ilCtrl->setParameter($this, "apid", $item["id"]);
$alist->addItem($lng->txt("blog_approve"), "approve", $ilCtrl->getLinkTarget($this, "approve"));
$ilCtrl->setParameter($this, "apid", "");
}
$wtpl->setVariable("APPROVAL", $lng->txt("blog_needs_approval"));
}
if ($item_contribute) {
$alist->addItem($lng->txt("edit_content"), "edit", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "edit"));
// #11858
if ($is_active) {
$alist->addItem($lng->txt("blog_toggle_draft"), "deactivate", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "deactivatePageToList"));
} else {
$alist->addItem($lng->txt("blog_toggle_final"), "activate", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "activatePageToList"));
}
$alist->addItem($lng->txt("rename"), "rename", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "edittitle"));
if ($this->object->hasKeywords()) {
$alist->addItem($lng->txt("blog_edit_keywords"), "keywords", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "editKeywords"));
}
$alist->addItem($lng->txt("blog_edit_date"), "editdate", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "editdate"));
$alist->addItem($lng->txt("delete"), "delete", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "deleteBlogPostingConfirmationScreen"));
} else {
if ($can_deactivate) {
//.........这里部分代码省略.........
示例9: testSetGetLookup
public function testSetGetLookup()
{
global $ilUser;
$obj = new ilObject();
$obj->setType("");
// otherwise type check will fail
$obj->setTitle("TestObject");
$obj->setDescription("TestDescription");
$obj->setImportId("imp_44");
$obj->create();
$obj->createReference();
$id = $obj->getId();
$ref_id = $obj->getRefId();
$obj = new ilObject($id, false);
if ($obj->getType() == "") {
$value .= "sg1-";
}
if ($obj->getTitle() == "TestObject") {
$value .= "sg2-";
}
if ($obj->getDescription() == "TestDescription") {
$value .= "sg3-";
}
if ($obj->getImportId() == "imp_44") {
$value .= "sg4-";
}
if ($obj->getOwner() == $ilUser->getId()) {
$value .= "sg5-";
}
$obj = new ilObject($ref_id);
if ($obj->getTitle() == "TestObject") {
$value .= "sg6-";
}
if ($obj->getCreateDate() == ($lu = $obj->getLastUpdateDate())) {
$value .= "sg7-";
}
$obj->setTitle("TestObject2");
sleep(2);
// we want a different date here...
$obj->update();
$obj = new ilObject($ref_id);
if ($lu != ($lu2 = $obj->getLastUpdateDate())) {
$value .= "up1-";
}
if ($obj->getTitle() == "TestObject2") {
$value .= "up2-";
}
if ($id == ilObject::_lookupObjIdByImportId("imp_44")) {
$value .= "lu1-";
}
if ($ilUser->getFullname() == ilObject::_lookupOwnerName(ilObject::_lookupOwner($id))) {
$value .= "lu2-";
}
if (ilObject::_lookupTitle($id) == "TestObject2") {
$value .= "lu3-";
}
if (ilObject::_lookupDescription($id) == "TestDescription") {
$value .= "lu4-";
}
if (ilObject::_lookupLastUpdate($id) == $lu2) {
$value .= "lu5-";
}
if (ilObject::_lookupObjId($ref_id) == $id) {
$value .= "lu6-";
}
if (ilObject::_lookupType($id) == "") {
$value .= "lu7-";
}
if (ilObject::_lookupObjectId($ref_id) == $id) {
$value .= "lu8-";
}
$ar = ilObject::_getAllReferences($id);
if (is_array($ar) && count($ar) == 1 && $ar[$ref_id] == $ref_id) {
$value .= "lu9-";
}
$ids = ilObject::_getIdsForTitle("TestObject2");
foreach ($ids as $i) {
if ($i == $id) {
$value .= "lu10-";
}
}
$obs = ilObject::_getObjectsByType("usr");
foreach ($obs as $ob) {
if ($ob["obj_id"] == $ilUser->getId()) {
$value .= "lu11-";
}
}
$d1 = ilObject::_lookupDeletedDate($ref_id);
ilObject::_setDeletedDate($ref_id);
$d2 = ilObject::_lookupDeletedDate($ref_id);
ilObject::_resetDeletedDate($ref_id);
$d3 = ilObject::_lookupDeletedDate($ref_id);
if ($d1 != $d2 && $d1 == $d3 && $d3 == null) {
$value .= "dd1-";
}
$obj->delete();
$this->assertEquals("sg1-sg2-sg3-sg4-sg5-sg6-sg7-up1-up2-" . "lu1-lu2-lu3-lu4-lu5-lu6-lu7-lu8-lu9-lu10-lu11-dd1-", $value);
}