本文整理汇总了PHP中kEntitlementUtils::isEntitledForEditEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP kEntitlementUtils::isEntitledForEditEntry方法的具体用法?PHP kEntitlementUtils::isEntitledForEditEntry怎么用?PHP kEntitlementUtils::isEntitledForEditEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kEntitlementUtils
的用法示例。
在下文中一共展示了kEntitlementUtils::isEntitledForEditEntry方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doFromObject
public function doFromObject($dbObject, KalturaDetachedResponseProfile $responseProfile = null)
{
parent::doFromObject($dbObject, $responseProfile);
$dbEntry = entryPeer::retrieveByPK($dbObject->getEntryId());
if (!kEntitlementUtils::isEntitledForEditEntry($dbEntry)) {
/**
* @var kQuiz $kQuiz
*/
$kQuiz = QuizPlugin::validateAndGetQuiz($dbEntry);
$dbUserEntry = UserEntryPeer::retrieveByPK($this->quizUserEntryId);
if ($dbUserEntry && $dbUserEntry->getStatus() == QuizPlugin::getCoreValue('UserEntryStatus', QuizUserEntryStatus::QUIZ_SUBMITTED)) {
if (!$kQuiz->getShowCorrectAfterSubmission()) {
$this->isCorrect = KalturaNullableBoolean::NULL_VALUE;
$this->correctAnswerKeys = null;
$this->explanation = null;
}
} else {
if (!$kQuiz->getShowResultOnAnswer()) {
$this->isCorrect = KalturaNullableBoolean::NULL_VALUE;
}
if (!$kQuiz->getShowCorrectKeyOnAnswer()) {
$this->correctAnswerKeys = null;
$this->explanation = null;
}
}
}
}
示例2: validateForInsert
public function validateForInsert($propertiesToSkip = array())
{
parent::validateForInsert($propertiesToSkip);
$dbEntry = entryPeer::retrieveByPK($this->entryId);
QuizPlugin::validateAndGetQuiz($dbEntry);
if (!kEntitlementUtils::isEntitledForEditEntry($dbEntry)) {
throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID);
}
}
示例3: validateAndUpdateQuizData
/**
* if user is entitled for this action will update quizData on entry
* @param entry $dbEntry
* @param KalturaQuiz $quiz
* @param int $currentVersion
* @param kQuiz|null $newQuiz
* @return KalturaQuiz
* @throws KalturaAPIException
*/
private function validateAndUpdateQuizData(entry $dbEntry, KalturaQuiz $quiz, $currentVersion = 0, kQuiz $newQuiz = null)
{
if (!kEntitlementUtils::isEntitledForEditEntry($dbEntry)) {
KalturaLog::debug('Update quiz allowed only with admin KS or entry owner or co-editor');
throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID);
}
$quizData = $quiz->toObject($newQuiz);
$quizData->setVersion($currentVersion + 1);
QuizPlugin::setQuizData($dbEntry, $quizData);
$dbEntry->setIsTrimDisabled(true);
$dbEntry->save();
$quiz->fromObject($quizData);
return $quiz;
}