本文整理汇总了PHP中ilObject::_getObjectsByType方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObject::_getObjectsByType方法的具体用法?PHP ilObject::_getObjectsByType怎么用?PHP ilObject::_getObjectsByType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObject
的用法示例。
在下文中一共展示了ilObject::_getObjectsByType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gatherCourseLPData
function gatherCourseLPData()
{
global $tree, $ilDB;
// process all courses
$all_courses = array_keys(ilObject::_getObjectsByType("crs"));
if ($all_courses) {
// gather objects in trash
$trashed_objects = $tree->getSavedNodeObjIds($all_courses);
include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
include_once "Modules/Course/classes/class.ilCourseParticipants.php";
include_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
foreach ($all_courses as $crs_id) {
// trashed objects will not change
if (!in_array($crs_id, $trashed_objects)) {
// only if LP is active
$mode = ilLPObjSettings::_lookupMode($crs_id);
if ($mode == LP_MODE_DEACTIVATED || $mode == LP_MODE_UNDEFINED) {
continue;
}
// only save once per day
$ilDB->manipulate("DELETE FROM obj_lp_stat WHERE" . " obj_id = " . $ilDB->quote($crs_id, "integer") . " AND fulldate = " . $ilDB->quote(date("Ymd", $this->date), "integer"));
$members = new ilCourseParticipants($crs_id);
$members = $members->getMembers();
$in_progress = count(ilLPStatusWrapper::_lookupInProgressForObject($crs_id, $members));
$completed = count(ilLPStatusWrapper::_lookupCompletedForObject($crs_id, $members));
$failed = count(ilLPStatusWrapper::_lookupFailedForObject($crs_id, $members));
// calculate with other values - there is not direct method
$not_attempted = count($members) - $in_progress - $completed - $failed;
$set = array("type" => array("text", "crs"), "obj_id" => array("integer", $crs_id), "yyyy" => array("integer", date("Y", $this->date)), "mm" => array("integer", date("m", $this->date)), "dd" => array("integer", date("d", $this->date)), "fulldate" => array("integer", date("Ymd", $this->date)), "mem_cnt" => array("integer", count($members)), "in_progress" => array("integer", $in_progress), "completed" => array("integer", $completed), "failed" => array("integer", $failed), "not_attempted" => array("integer", $not_attempted));
$ilDB->insert("obj_lp_stat", $set);
}
}
}
}
示例2: refreshAll
/**
* Refresh all installed languages
*/
static function refreshAll()
{
global $ilPluginAdmin;
$languages = ilObject::_getObjectsByType("lng");
foreach ($languages as $lang) {
$langObj = new ilObjLanguage($lang["obj_id"], false);
if ($langObj->isInstalled() == true) {
if ($langObj->check()) {
$langObj->flush('keep_local');
$langObj->insert();
$langObj->setTitle($langObj->getKey());
$langObj->setDescription($langObj->getStatus());
$langObj->update();
$langObj->optimizeData();
if ($langObj->isLocal() == true) {
if ($langObj->check('local')) {
$langObj->insert('local');
$langObj->setTitle($langObj->getKey());
$langObj->setDescription($langObj->getStatus());
$langObj->update();
$langObj->optimizeData();
}
}
}
}
unset($langObj);
}
// refresh languages of activated plugins
include_once "./Services/Component/classes/class.ilPluginSlot.php";
$slots = ilPluginSlot::getAllSlots();
foreach ($slots as $slot) {
$act_plugins = $ilPluginAdmin->getActivePluginsForSlot($slot["component_type"], $slot["component_name"], $slot["slot_id"]);
foreach ($act_plugins as $plugin) {
include_once "./Services/Component/classes/class.ilPlugin.php";
$pl = ilPlugin::getPluginObject($slot["component_type"], $slot["component_name"], $slot["slot_id"], $plugin);
if (is_object($pl)) {
$pl->updateLanguages();
}
}
}
}
示例3: initFilter
/**
*
*/
public function initFilter()
{
/**
* @var $tpl ilTemplate
*/
global $tpl;
include_once 'Services/Form/classes/class.ilTextInputGUI.php';
$ul = new ilTextInputGUI($this->lng->txt('login') . '/' . $this->lng->txt('email') . '/' . $this->lng->txt('name'), 'query');
$ul->setDataSource($this->ctrl->getLinkTarget($this->getParentObject(), 'addUserAutoComplete', '', true));
$ul->setSize(20);
$ul->setSubmitFormOnEnter(true);
$this->addFilterItem($ul);
$ul->readFromSession();
$this->filter['query'] = $ul->getValue();
include_once 'Services/Form/classes/class.ilSelectInputGUI.php';
$options = array();
$languages = ilObject::_getObjectsByType('lng');
foreach ($languages as $lng) {
$options[$lng['title']] = $this->lng->txt('meta_l_' . $lng['title']);
}
asort($options);
$options = array('' => $this->lng->txt('any_language')) + $options;
$si = new ilSelectInputGUI($this->lng->txt('language'), 'lng');
$si->setOptions($options);
$this->addFilterItem($si);
$si->readFromSession();
$this->filter['lng'] = $si->getValue();
include_once 'Services/Form/classes/class.ilDateDurationInputGUI.php';
$tpl->addJavaScript('./Services/Form/js/date_duration.js');
$duration = new ilDateDurationInputGUI($this->lng->txt('tos_period'), 'period');
$duration->setStartText($this->lng->txt('tos_period_from'));
$duration->setEndText($this->lng->txt('tos_period_until'));
$duration->setStart(new ilDateTime(strtotime('-1 year', time()), IL_CAL_UNIX));
$duration->setEnd(new ilDateTime(time(), IL_CAL_UNIX));
$duration->setShowTime(true);
$this->addFilterItem($duration, true);
$duration->readFromSession();
$this->optional_filter['period'] = $duration->getValue();
}
示例4:
static final function _getObjectsByType($a_obj_type = "", $a_owner = "")
{
return parent::_getObjectsByType($a_obj_type, $a_owner);
}
示例5: getLanguages
/**
* gather all information about available languages
*
* This function builds an array with the following structure:
* $languages[lang_key][long][installed][update][info]
*
* lang_key: string international language key (2 digits, i.e. de,en,dk...)
* long: string full language name in the chosen user language
* installed: boolean is the language installed (true) or not (false)?
* update: int contains the timestamp of last db-modification
* info: string optional information. valid is: 'notfound','new'
*
* @return array $languages status information about available languages
*/
function getLanguages()
{
global $lng;
$lng->loadLanguageModule("meta");
// set path to directory where lang-files reside
$d = dir($this->lang_path);
$tmpPath = getcwd();
chdir($this->lang_path);
// get available lang-files
while ($entry = $d->read()) {
if (is_file($entry) && ereg("(^ilias_.{2}\\.lang\$)", $entry)) {
$lang_key = substr($entry, 6, 2);
$languages[$lang_key] = "";
// long names will be set in class Out
}
}
// ensure that arrays are initiated when no lang file was found
if (!array($languages)) {
$language = array();
$tmp_array = array();
}
$tmp_array = array_keys($languages);
$lang_keys = array();
// now get languages from database
if ($lang_db = ilObject::_getObjectsByType("lng")) {
foreach ($lang_db as $lang) {
// set values
$lang_key = $lang["title"];
$languages[$lang_key] = $lang;
$lang_keys[] = $lang_key;
// determine default language and language of current user
if ($lang_key == $this->lang_user) {
$languages[$lang_key]["status"] = "in_use";
}
if ($lang_key == $this->lang_default) {
$languages[$lang_key]["status"] = "system_language";
}
// check if files are missing
if (count($tmp_array) > 0 && !in_array($lang_key, $tmp_array)) {
$languages[$lang_key]["info"] = "file_not_found";
}
}
}
// compute new languages
foreach ($languages as $lang_key => $lang_data) {
if (!in_array($lang_key, $lang_keys)) {
$languages[$lang_key]["info"] = "new_language";
//$languages[$lang_key]["desc"] = "not_installed";
}
}
chdir($tmpPath);
// Insert languages with files new found into table language
$languages = $this->addNewLanguages($languages);
// Remove from array & db languages which are not installed and no lang-files
$languages = $this->removeLanguages($languages);
// setting language's full names
foreach ($languages as $lang_key => $lang_data) {
$languages[$lang_key]["name"] = $lng->txt("meta_l_" . $lang_key);
}
$this->languages = $languages;
return $this->languages;
}
示例6: getInstalledLanguages
function getInstalledLanguages()
{
include_once "./Services/Object/classes/class.ilObject.php";
$langlist = ilObject::_getObjectsByType("lng");
foreach ($langlist as $lang) {
if (substr($lang["desc"], 0, 9) == "installed") {
$languages[] = $lang["title"];
}
}
return $languages ? $languages : array();
}
示例7: getAvailablePortfolioTemplates
public static function getAvailablePortfolioTemplates($a_permission = "read")
{
global $ilUser, $ilAccess;
$res = array();
foreach (ilObject::_getObjectsByType("prtt") as $obj) {
$has_permission = false;
if ($obj["owner"] == $ilUser->getId() && false) {
$has_permission = true;
} else {
foreach (ilObject::_getAllReferences($obj["obj_id"]) as $ref_id) {
if ($ilAccess->checkAccess($a_permission, "", $ref_id)) {
$has_permission = true;
break;
}
}
}
if ($has_permission) {
$res[$obj["obj_id"]] = $obj["title"];
}
}
asort($res);
return $res;
}
示例8: _hasLearningProgressOtherUsers
static function _hasLearningProgressOtherUsers()
{
global $rbacsystem;
$obj_id = array_pop(array_keys(ilObject::_getObjectsByType("trac")));
$ref_id = array_pop(ilObject::_getAllReferences($obj_id));
return $rbacsystem->checkAccess("lp_other_users", $ref_id);
}
示例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);
}