当前位置: 首页>>代码示例>>PHP>>正文


PHP learnpath::delete方法代码示例

本文整理汇总了PHP中learnpath::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP learnpath::delete方法的具体用法?PHP learnpath::delete怎么用?PHP learnpath::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在learnpath的用法示例。


在下文中一共展示了learnpath::delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: WSDeleteLp

/**
 * @param array $params
 * @return int|string
 */
function WSDeleteLp($params)
{
    global $debug;
    if (!WSHelperVerifyKey($params)) {
        return return_error(WS_ERROR_SECRET_KEY);
    }
    require_once api_get_path(SYS_CODE_PATH) . 'newscorm/learnpathList.class.php';
    require_once api_get_path(SYS_CODE_PATH) . 'newscorm/learnpath.class.php';
    require_once api_get_path(SYS_CODE_PATH) . 'newscorm/learnpathItem.class.php';
    $courseIdName = $params['course_id_name'];
    $courseIdValue = $params['course_id_value'];
    $lpId = $params['lp_id'];
    $sessionIdName = isset($params['session_id_name']) ? $params['session_id_name'] : null;
    $sessionIdValue = isset($params['session_id_value']) ? $params['session_id_value'] : null;
    $courseInfo = CourseManager::getCourseInfoFromOriginalId($courseIdValue, $courseIdName);
    if (empty($courseInfo)) {
        if ($debug) {
            error_log("Course not found: {$courseIdName} : {$courseIdValue}");
        }
        return 'Course not found';
    }
    $courseId = $courseInfo['real_id'];
    $courseCode = $courseInfo['code'];
    $sessionId = 0;
    /*
    if (!empty($sessionIdName) && !empty($sessionIdValue)) {
        $sessionId = SessionManager::get_session_id_from_original_id(
            $sessionIdValue,
            $sessionIdName
        );
    
        if (empty($sessionId)) {
    
            if ($debug) error_log('Session not found');
            return 'Session not found';
        }
    }
    */
    $lp = new learnpath($courseCode, $lpId, null);
    if ($lp) {
        if ($debug) {
            error_log("LP deleted {$lpId}");
        }
        $course_dir = $courseInfo['directory'] . '/document';
        $sys_course_path = api_get_path(SYS_COURSE_PATH);
        $base_work_dir = $sys_course_path . $course_dir;
        $items = $lp->get_flat_ordered_items_list($lpId, 0, $courseId);
        if (!empty($items)) {
            /** @var $item learnpathItem */
            foreach ($items as $itemId) {
                $item = new learnpathItem($itemId, null, $courseId);
                if ($item) {
                    $documentId = $item->get_path();
                    if ($debug) {
                        error_log("lp item id found #{$itemId}");
                    }
                    $documentInfo = DocumentManager::get_document_data_by_id($documentId, $courseInfo['code'], false, $sessionId);
                    if (!empty($documentInfo)) {
                        if ($debug) {
                            error_log("Document id deleted #{$documentId}");
                        }
                        DocumentManager::delete_document($courseInfo, null, $base_work_dir, $sessionId, $documentId);
                    } else {
                        if ($debug) {
                            error_log("No document found for id #{$documentId}");
                        }
                    }
                } else {
                    if ($debug) {
                        error_log("Document not found #{$itemId}");
                    }
                }
            }
        }
        $lp->delete($courseInfo, $lpId, 'remove');
        return 1;
    }
    return 0;
}
开发者ID:daffef,项目名称:chamilo-lms,代码行数:83,代码来源:lp.php

示例2:

         exit;
     }
     break;
 case 'delete':
     if (!$is_allowed_to_edit) {
         api_not_allowed(true);
     }
     if ($debug > 0) {
         error_log('New LP - delete action triggered', 0);
     }
     if (!$lp_found) {
         error_log('New LP - No learnpath given for delete', 0);
         require 'lp_list.php';
     } else {
         Session::write('refresh', 1);
         $learnPath->delete(null, $_GET['lp_id'], 'remove');
         Session::erase('oLP');
         require 'lp_list.php';
     }
     break;
 case 'toggle_visible':
     // Change lp visibility (inside lp tool).
     if (!$is_allowed_to_edit) {
         api_not_allowed(true);
     }
     if ($debug > 0) {
         error_log('New LP - visibility action triggered', 0);
     }
     if (!$lp_found) {
         error_log('New LP - No learnpath given for visibility', 0);
         require 'lp_list.php';
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:lp_controller.php


注:本文中的learnpath::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。