本文整理汇总了PHP中ilRTE::_getMediaObjects方法的典型用法代码示例。如果您正苦于以下问题:PHP ilRTE::_getMediaObjects方法的具体用法?PHP ilRTE::_getMediaObjects怎么用?PHP ilRTE::_getMediaObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilRTE
的用法示例。
在下文中一共展示了ilRTE::_getMediaObjects方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveStatutoryRegulationsObject
public function saveStatutoryRegulationsObject()
{
require_once 'Services/RTE/classes/class.ilRTE.php';
if (isset($_POST['statutory_regulations']) && $_POST['statutory_regulations'] != NULL) {
$this->genSetData->set('statutory_regulations', ilRTE::_replaceMediaObjectImageSrc($_POST['statutory_regulations'], 0), 'regulations');
// copy temporary media objects (frm~)
include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
$mediaObjects = ilRTE::_getMediaObjects($_POST['statutory_regulations'], 0);
$myMediaObjects = ilObjMediaObject::_getMobsOfObject('pays~:html', ilObject::_lookupObjId($this->ref_id));
foreach ($mediaObjects as $mob) {
foreach ($myMediaObjects as $myMob) {
if ($mob == $myMob) {
// change usage
ilObjMediaObject::_removeUsage($mob, 'pays~:html', ilObject::_lookupObjId($this->ref_id));
break;
}
}
ilObjMediaObject::_saveUsage($mob, 'pays~:html', ilObject::_lookupObjId($this->ref_id));
}
} else {
$this->genSetData->set('statutory_regulations', NULL, 'regulations');
}
// remove usage of deleted media objects
include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
$oldMediaObjects = ilObjMediaObject::_getMobsOfObject('pays~:html', ilObject::_lookupObjId($this->ref_id));
$curMediaObjects = ilRTE::_getMediaObjects($_POST['statutory_regulations'], 0);
foreach ($oldMediaObjects as $oldMob) {
$found = false;
foreach ($curMediaObjects as $curMob) {
if ($oldMob == $curMob) {
$found = true;
break;
}
}
if (!$found) {
if (ilObjMediaObject::_exists($oldMob)) {
ilObjMediaObject::_removeUsage($oldMob, 'pays~:html', ilObject::_lookupObjId($this->ref_id));
$mob_obj = new ilObjMediaObject($oldMob);
$mob_obj->delete();
}
}
}
$this->genSetData->set('show_sr_shoppingcart', isset($_POST['show_sr_shoppingcart']) ? 1 : 0, 'regulations');
$this->genSetData->set('attach_sr_invoice', isset($_POST['attach_sr_invoice']) ? 1 : 0, 'regulations');
$this->StatutoryRegulationsObject();
ilUtil::sendSuccess($this->lng->txt('pays_updated_general_settings'));
return true;
}
示例2: updateAssignmentTextObject
function updateAssignmentTextObject($a_return = false)
{
global $ilCtrl, $ilUser;
$times_up = $this->ass->getDeadline() && $this->ass->getDeadline() - time() < 0;
if (!$this->ass || $this->ass->getType() != ilExAssignment::TYPE_TEXT || $times_up) {
if ($times_up) {
ilUtil::sendFailure($this->lng->txt("exercise_time_over"), true);
}
$ilCtrl->redirect($this, "showOverview");
}
$this->checkPermission("read");
$form = $this->initAssignmentTextForm($this->ass);
// we are not using a purifier, so we have to set the valid RTE tags
// :TODO:
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
$rte = $form->getItemByPostVar("atxt");
$rte->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("exc_ass"));
if ($form->checkInput()) {
$text = trim($form->getInput("atxt"));
$existing = (bool) ilExAssignment::getDeliveredFiles($this->ass->getExerciseId(), $this->ass->getId(), $ilUser->getId());
$returned_id = $this->object->updateTextSubmission($this->ass->getExerciseId(), $this->ass->getId(), $ilUser->getId(), ilRTE::_replaceMediaObjectImageSrc($text, 0));
// no empty text
if ($returned_id) {
if (!$existing) {
// #14332 - new text
$this->sendNotifications($this->ass->getId());
$this->object->handleSubmission($this->ass->getId());
}
// mob usage
include_once "Services/MediaObjects/classes/class.ilObjMediaObject.php";
$mobs = ilRTE::_getMediaObjects($text, 0);
foreach ($mobs as $mob) {
if (ilObjMediaObject::_exists($mob)) {
ilObjMediaObject::_removeUsage($mob, 'exca~:html', $ilUser->getId());
ilObjMediaObject::_saveUsage($mob, 'exca:html', $returned_id);
}
}
}
ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
if ($a_return) {
$ilCtrl->redirect($this, "showOverview");
} else {
$ilCtrl->redirect($this, "editAssignmentText");
}
}
$form->setValuesByPost();
$this->editAssignmentTextObject($form);
}
示例3: addThreadObject
public function addThreadObject($a_prevent_redirect = false)
{
/**
* @var $ilUser ilObjUser
* @var $ilAccess ilAccessHandler
* @var $lng ilLanguage
*/
global $ilUser, $ilAccess, $lng;
$frm = $this->object->Forum;
$frm->setForumId($this->object->getId());
$frm->setForumRefId($this->object->getRefId());
if (!$ilAccess->checkAccess('add_thread', '', $this->object->getRefId())) {
$this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
}
$frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
$topicData = $frm->getOneTopic();
$this->initTopicCreateForm();
if ($this->create_topic_form_gui->checkInput()) {
require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
if ($ilUser->isAnonymous() && !$ilUser->isCaptchaVerified() && ilCaptchaUtil::isActiveForForum()) {
$ilUser->setCaptchaVerified(true);
}
if ($this->objProperties->isAnonymized()) {
if (!strlen($this->create_topic_form_gui->getInput('alias'))) {
$user_alias = $this->lng->txt('forums_anonymous');
} else {
$user_alias = $this->create_topic_form_gui->getInput('alias');
}
} else {
$user_alias = $ilUser->getLogin();
}
$status = 1;
if ($this->objProperties->isPostActivationEnabled() && !$this->is_moderator || $this->objCurrentPost->isAnyParentDeactivated()) {
$status = 0;
}
// build new thread
$newPost = $frm->generateThread($topicData['top_pk'], $ilUser->getId(), $this->objProperties->isAnonymized() ? 0 : $ilUser->getId(), $this->handleFormInput($this->create_topic_form_gui->getInput('subject'), false), ilRTE::_replaceMediaObjectImageSrc($this->create_topic_form_gui->getInput('message'), 0), $this->create_topic_form_gui->getItemByPostVar('notify') ? (int) $this->create_topic_form_gui->getInput('notify') : 0, $this->create_topic_form_gui->getItemByPostVar('notify_posts') ? (int) $this->create_topic_form_gui->getInput('notify_posts') : 0, $user_alias, '', $status);
$file = $_FILES['userfile'];
// file upload
if (is_array($file) && !empty($file)) {
$tmp_file_obj = new ilFileDataForum($this->object->getId(), $newPost);
$tmp_file_obj->storeUploadedFile($file);
}
// Visit-Counter
$frm->setDbTable('frm_data');
$frm->setMDB2WhereCondition('top_pk = %s ', array('integer'), array($topicData['top_pk']));
$frm->updateVisits($topicData['top_pk']);
$frm->setMDB2WhereCondition('thr_top_fk = %s AND thr_subject = %s AND thr_num_posts = 1 ', array('integer', 'text'), array($topicData['top_pk'], $this->create_topic_form_gui->getInput('subject')));
// copy temporary media objects (frm~)
include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
$mediaObjects = ilRTE::_getMediaObjects($this->create_topic_form_gui->getInput('message'), 0);
foreach ($mediaObjects as $mob) {
if (ilObjMediaObject::_exists($mob)) {
ilObjMediaObject::_removeUsage($mob, 'frm~:html', $ilUser->getId());
ilObjMediaObject::_saveUsage($mob, 'frm:html', $newPost);
}
}
if ($this->ilias->getSetting('forum_notification') == 1) {
// send notification about new topic
$objPost = new ilForumPost((int) $newPost, $this->is_moderator);
$post_data = array();
$post_data = $objPost->getDataAsArray();
$titles = $this->getTitlesByRefId(array($this->object->getRefId()));
$post_data["top_name"] = $titles[0];
$post_data["ref_id"] = $this->object->getRefId();
$frm->sendForumNotifications($post_data);
}
if (!$a_prevent_redirect) {
ilUtil::sendSuccess($this->lng->txt('forums_thread_new_entry'), true);
$this->ctrl->redirect($this);
} else {
return $newPost;
}
} else {
$this->create_topic_form_gui->setValuesByPost();
if (!$this->objProperties->isAnonymized()) {
$this->create_topic_form_gui->getItemByPostVar('alias')->setValue($ilUser->getLogin());
}
return $this->tpl->setContent($this->create_topic_form_gui->getHTML());
}
}