本文整理汇总了PHP中assQuestion::lookupParentObjId方法的典型用法代码示例。如果您正苦于以下问题:PHP assQuestion::lookupParentObjId方法的具体用法?PHP assQuestion::lookupParentObjId怎么用?PHP assQuestion::lookupParentObjId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assQuestion
的用法示例。
在下文中一共展示了assQuestion::lookupParentObjId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copyAndLinkToQuestionpoolObject
public function copyAndLinkToQuestionpoolObject()
{
global $lng;
require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
// #13761; All methods use for this request should be revised, thx japo ;-)
if ('copyAndLinkToQuestionpool' == $this->ctrl->getCmd() && (!isset($_REQUEST['q_id']) || !is_array($_REQUEST['q_id']))) {
ilUtil::sendFailure($this->lng->txt('tst_no_question_selected_for_moving_to_qpl'), true);
$this->ctrl->redirect($this, 'questions');
}
if (isset($_REQUEST['q_id']) && is_array($_REQUEST['q_id'])) {
foreach ($_REQUEST['q_id'] as $q_id) {
if (!assQuestion::originalQuestionExists($q_id)) {
continue;
}
$type = ilObject::_lookupType(assQuestion::lookupParentObjId(assQuestion::_getOriginalId($q_id)));
if ($type !== 'tst') {
ilUtil::sendFailure($lng->txt('tst_link_only_unassigned'), true);
$this->ctrl->redirect($this, 'questions');
return;
}
}
}
$this->createQuestionpoolTargetObject('copyAndLinkQuestionsToPool');
}
示例2: syncImages
/**
* Sync images of a MC question on synchronisation with the original question
*/
protected function syncImages()
{
global $ilLog;
$imagepath = $this->getImagePath();
$question_id = $this->getOriginalId();
$originalObjId = parent::lookupParentObjId($this->getOriginalId());
$imagepath_original = $this->getImagePath($question_id, $originalObjId);
ilUtil::delDir($imagepath_original);
foreach ($this->answers as $answer) {
$filename = $answer->getImage();
if (strlen($filename)) {
if (@file_exists($imagepath . $filename)) {
if (!file_exists($imagepath)) {
ilUtil::makeDirParents($imagepath);
}
if (!file_exists($imagepath_original)) {
ilUtil::makeDirParents($imagepath_original);
}
if (!@copy($imagepath . $filename, $imagepath_original . $filename)) {
$ilLog->write("image could not be duplicated!!!!", $ilLog->ERROR);
$ilLog->write("object: " . print_r($this, TRUE), $ilLog->ERROR);
}
}
if (@file_exists($imagepath . $this->getThumbPrefix() . $filename)) {
if (!@copy($imagepath . $this->getThumbPrefix() . $filename, $imagepath_original . $this->getThumbPrefix() . $filename)) {
$ilLog->write("image thumbnail could not be duplicated!!!!", $ilLog->ERROR);
$ilLog->write("object: " . print_r($this, TRUE), $ilLog->ERROR);
}
}
}
}
}
示例3: isSyncOriginalPossibleAndAllowed
private function isSyncOriginalPossibleAndAllowed($questionId)
{
$questionData = $this->questionList->getDataArrayForQuestionId($questionId);
if (!$questionData['original_id']) {
return false;
}
require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
$parentObjId = assQuestion::lookupParentObjId($questionData['original_id']);
if (!$this->doesObjectTypeMatch($parentObjId)) {
return false;
}
foreach (ilObject::_getAllReferences($parentObjId) as $parentRefId) {
if ($this->access->checkAccess('write', '', $parentRefId)) {
return true;
}
}
return false;
}
示例4: copyAndLinkToQuestionpoolObject
public function copyAndLinkToQuestionpoolObject()
{
global $lng;
require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
foreach ($_REQUEST['q_id'] as $q_id) {
if (!assQuestion::originalQuestionExists($q_id)) {
continue;
}
$type = ilObject::_lookupType(assQuestion::lookupParentObjId(assQuestion::_getOriginalId($q_id)));
if ($type !== 'tst') {
ilUtil::sendFailure($lng->txt('tst_link_only_unassigned'), true);
$this->backObject();
return;
}
}
$this->createQuestionpoolTargetObject('copyAndLinkQuestionsToPool');
}