Пример #1
0
 function modslot()
 {
     checkPerm('mod');
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
     $out =& $GLOBALS['page'];
     $lang =& DoceboLanguage::createInstance('coursepath', 'lms');
     $id_slot = importVar('id_slot');
     $id_path = importVar('id_path');
     $cpath_man = new CoursePath_Manager();
     $path = $cpath_man->getCoursepathInfo($id_path);
     if (isset($_POST['save'])) {
         if ($id_slot == false) {
             $re = $cpath_man->createSlot($id_path, $_POST['min_selection'], $_POST['max_selection']);
         } else {
             $re = $cpath_man->saveSlot($id_slot, $_POST['min_selection'], $_POST['max_selection']);
         }
         Util::jump_to('index.php?modname=coursepath&op=pathelem&id_path=' . $id_path);
     }
     if ($id_slot == false) {
         $min_selection = 1;
         $max_selection = 1;
     } else {
         $slot = $cpath_man->getSlotInfo($id_slot);
         $min_selection = $slot[CP_SLOT_MIN];
         $max_selection = $slot[CP_SLOT_MAX];
     }
     $title_area = array('index.php?modname=coursepath&op=pathlist' => $lang->def('_COURSEPATH'));
     $title_area['index.php?modname=coursepath&op=pathelem&id_path=' . $id_path] = $path['path_name'];
     $title_area[] = $lang->def('_MANAGE_SLOT');
     $out->add(getTitleArea($title_area, 'coursepath') . '<div class="std_block">' . Form::openForm('mancoursepath', 'index.php?modname=coursepath&amp;op=modslot') . Form::openElementSpace() . Form::getHidden('id_path', 'id_path', $id_path) . Form::getHidden('id_slot', 'id_slot', $id_slot) . Form::getTextfield($lang->def('_MIN_SELECTION'), 'min_selection', 'min_selection', 3, $min_selection) . Form::getTextfield($lang->def('_MAX_SELECTION'), 'max_selection', 'max_selection', 3, $max_selection) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }