本文整理汇总了PHP中CCourse::IsCertificatesExists方法的典型用法代码示例。如果您正苦于以下问题:PHP CCourse::IsCertificatesExists方法的具体用法?PHP CCourse::IsCertificatesExists怎么用?PHP CCourse::IsCertificatesExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCourse
的用法示例。
在下文中一共展示了CCourse::IsCertificatesExists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ProcessActionsOnList
public function ProcessActionsOnList()
{
if (isset($_POST['action']) && strlen($_POST['action']) !== 0) {
$action = $_POST['action'];
} elseif (isset($_GET['action']) && strlen($_GET['action']) !== 0) {
$action = $_GET['action'];
} elseif (isset($_POST['action_button']) && strlen($_POST['action_button']) !== 0) {
$action = $_POST['action_button'];
} elseif (isset($_GET['action_button']) && strlen($_GET['action_button']) !== 0) {
$action = $_GET['action_button'];
} else {
return $this;
}
// nothing to do
$arID = $this->oList->GroupAction();
if ($arID === false) {
return $this;
}
// no items selected
if (check_bitrix_sessid() !== true) {
throw new CLearnRenderAdminUnilessonListException('', CLearnRenderAdminUnilessonListException::C_ACCESS_DENIED);
}
if ($_POST['action_target'] === 'selected') {
$arID = array();
$rsData = $this->fetchDataFromDb();
while ($arRes = $rsData->Fetch()) {
$arID[] = $arRes['LESSON_ID'];
}
}
foreach ($arID as $lessonId) {
// If not int or string can't be strictly casted to int
if (!(is_numeric($lessonId) && is_int($lessonId + 0))) {
continue;
}
$lessonId += 0;
$wasError = false;
$preventSelectionOnError = false;
try {
switch ($action) {
case 'unlink':
// !!! In case of unlinking in $lessonId not Lesson's id, but it's full path
$oPath = new CLearnPath();
$oPath->ImportUrlencoded($lessonId);
$arPath = $oPath->GetPathAsArray();
if (count($arPath) < 2) {
throw new CLearnRenderAdminUnilessonListException('', CLearnRenderAdminUnilessonListException::C_LOGIC);
}
$childLessonId = $oPath->GetBottom();
$parentLessonId = $oPath->GetBottom();
if ($parentLessonId === false || $childLessonId === false) {
// something goes wrong
throw new CLearnRenderAdminUnilessonListException('', CLearnRenderAdminUnilessonListException::C_LOGIC);
}
$this->EnsureLessonUnlinkAccess($parentLessonId, $childLessonId);
// throws an exception on error
CLearnLesson::RelationRemove($parentLessonId, $childLessonId);
break;
case 'disband':
@set_time_limit(0);
$courseId = CLearnLesson::GetLinkedCourse($lessonId);
if ($courseId !== false && CCourse::IsCertificatesExists($courseId)) {
throw new Exception(GetMessage(LEARNING_COURSE_UNREMOVABLE_CAUSE_OF_CERTIFICATES));
}
$this->EnsureLessonDisbandAccess($lessonId);
CLearnLesson::Delete($lessonId);
break;
case 'delete':
case 'recursive_delete':
$preventSelectionOnError = true;
// prevent switch table to "selection mode" when cannot delete item in list
@set_time_limit(0);
$courseId = CLearnLesson::GetLinkedCourse($lessonId);
if ($courseId !== false && CCourse::IsCertificatesExists($courseId)) {
throw new Exception(GetMessage(LEARNING_COURSE_UNREMOVABLE_CAUSE_OF_CERTIFICATES));
}
try {
// firstly, simulate to check permissions
CLearnLesson::DeleteRecursiveLikeHardlinks(array('lesson_id' => $lessonId, 'simulate' => true));
// If all is OK, try to really remove it
CLearnLesson::DeleteRecursiveLikeHardlinks($lessonId);
} catch (LearnException $e) {
if ($e->GetCode() === LearnException::EXC_ERR_ALL_ACCESS_DENIED) {
throw new CLearnRenderAdminUnilessonListException('', CLearnRenderAdminUnilessonListException::C_ACCESS_DENIED);
} else {
// bubble exception
throw new LearnException($e->GetMessage(), $e->GetCode());
}
}
break;
case 'activate':
case 'deactivate':
if (strtolower($action) === 'deactivate') {
$this->EnsureLessonDeactivateAccess($lessonId);
$arFields = array('ACTIVE' => 'N');
} elseif (strtolower($action) === 'activate') {
$this->EnsureLessonActivateAccess($lessonId);
$arFields = array('ACTIVE' => 'Y');
} else {
throw new CLearnRenderAdminUnilessonListException('WTFAYD,#Pro#?!', CLearnRenderAdminUnilessonListException::C_ACCESS_DENIED);
}
//.........这里部分代码省略.........