Ejemplo n.º 1
0
 function delcoursepathelem()
 {
     checkPerm('mod');
     $id_course = importVar('id_course', true, 0);
     $id_path = importVar('id_path', true, 0);
     $id_slot = importVar('id_slot', true, 0);
     if (isset($_POST['confirm'])) {
         require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
         $cpath_man = new CoursePath_Manager();
         $re = $cpath_man->delFromSlot($id_path, $id_slot, $id_course);
         if ($re) {
             // update users course subscription
             require_once $GLOBALS['where_lms'] . '/lib/lib.subscribe.php';
             $subs_man = new CourseSubscribe_Management();
             $users = $cpath_man->getSubscribed($id_path);
             if (!empty($users)) {
                 $re &= $subs_man->unsubscribeUsers($users, $id_course);
             }
         }
         Util::jump_to('index.php?modname=coursepath&op=pathelem&id_path=' . $id_path . '&result=' . ($re ? 'ok' : 'err'));
     } else {
         require_once _base_ . '/lib/lib.form.php';
         require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
         $arr_course = array($id_course => $id_course);
         $course_info =& getCoursesInfo($arr_course);
         $lang =& DoceboLanguage::createInstance('coursepath', 'lms');
         $query_pathlist = "\r\n\t\tSELECT path_name\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_coursepath\r\n\t\tWHERE id_path = '" . (int) $id_path . "'\r\n\t\tORDER BY path_name";
         list($path_name) = sql_fetch_row(sql_query($query_pathlist));
         $title_area = array('index.php?modname=coursepath&op=pathlist' => $lang->def('_COURSEPATH'), 'index.php?modname=coursepath&op=pathelem&id_path=' . $id_path => $path_name, $lang->def('_DEL'));
         $GLOBALS['page']->add(getTitleArea($title_area, 'coursepath') . '<div class="std_block">' . Form::openForm('deletepath', 'index.php?modname=coursepath&amp;op=delcoursepath') . Form::getHidden('id_path', 'id_path', $id_path) . Form::getHidden('id_course', 'id_course', $id_course) . Form::getHidden('id_slot', 'id_slot', $id_slot) . getDeleteUi($lang->def('_AREE_YOU_SURE_TO_REMOVE_COURSE_FROM_PATH'), '<span class="text_bold">' . $lang->def('_COURSE_NAME') . ' : </span>' . $course_info[$id_course]['name'] . '<br />' . '<span class="text_bold">' . $lang->def('_DESCRIPTION') . ' : </span>' . $course_info[$id_course]['description'], false, 'confirm', 'undoelem') . Form::closeForm() . '</div>', 'content');
     }
 }