function organization(&$treeView) { //getTitleArea('organizations'); // contruct and initialize TreeView to manage organization /*$orgDb = new OrgDirDb(); if( !checkPerm('lesson') ) { $treeView->tdb->setFilterVisibility( TRUE ); $treeView->tdb->setFilterAccess( Docebo::user()-> ); } $treeView = new Org_TreeView($orgDb, $_SESSION['idCourse']); $treeView->parsePositionData($_POST, $_POST, $_POST);*/ // manage items addition if (isset($_GET['replay'])) { $treeView->op = 'playitem'; } else { if (isset($_GET['itemdone'])) { $treeView->op = 'itemdone'; } else { if (isset($_POST['_orgrules_save']) || isset($_POST['_repoproperties_save'])) { $treeView->tdb->modifyItem($_POST, false, true); $treeView->op = ''; } else { if (isset($_POST['_orgrules_cancel']) || isset($_POST['_repoproperties_cancel'])) { $treeView->op = ''; } else { if (Get::req('op', DOTY_STRING, '') == 'org_select_sco' || Get::req('op', DOTY_STRING, '') == 'org_categorize_sco') { $treeView->op = Get::req('op', DOTY_STRING, ''); require_once dirname(__FILE__) . '/orgcategorize.php'; } } } } } //echo $treeView->op; switch ($treeView->op) { case 'newfolder': case 'renamefolder': case 'movefolder': case 'deletefolder': organization_opfolder($treeView, $treeView->op); break; case 'import': organization_import($treeView); break; case 'org_categorize': case 'org_opcategorize': // organization_rules( $treeView, $treeView->opContextId ); require_once dirname(__FILE__) . '/orgcategorize.php'; organization_categorize($treeView, $treeView->opContextId); break; case 'org_select_sco': organization_select_sco(); break; case 'org_categorize_sco': organization_categorize_sco(); break; case 'org_properties': case 'org_opproperties': // organization_rules( $treeView, $treeView->opContextId ); require_once dirname(__FILE__) . '/orgprop.php'; organization_property($treeView, $treeView->opContextId); break; case 'org_opaccess': case 'org_access': require_once dirname(__FILE__) . '/orgprop.php'; organization_access($treeView, $treeView->opContextId); break; case 'save': $treeView->tdb->modifyItem($_POST, false, true); organization_display($treeView); break; /*case 'playitem': organization_play( $treeView, $treeView->_getOpPlayEnd() ); break;*/ /*case 'playitem': organization_play( $treeView, $treeView->_getOpPlayEnd() ); break;*/ case 'treeview_error': organization_showerror($treeView); break; case 'itemdone': organization_itemdone($treeView, (int) $_GET[$treeView->_getOpPlayEnd()], (int) getLogUserId()); //refresh the tree // no break, we would display after LO completition //refresh the tree // no break, we would display after LO completition default: organization_display($treeView); break; } }
function organization_categorize_switch_subcat(&$treeView, $idItem) { require_once _lms_ . '/lib/lib.kbres.php'; $kbres = new KbRes(); $folder = $treeView->tdb->getFolderById($idItem); $data = $folder->otherValues; $type = $data[REPOFIELDOBJECTTYPE]; $r_data = $kbres->getResourceFromItem($data[REPOFIELDIDRESOURCE], $type, 'course_lo'); $cat_sub_items = Get::pReq('subcategorize_switch', DOTY_INT); $res_id = (int) $r_data['res_id']; $r_env_parent_id = (int) $r_data['r_env_parent_id']; $kbres->saveResourceSubCategorizePref($res_id, $cat_sub_items); if ($cat_sub_items == 1) { organization_jump_select_sco($treeView, $idItem, $folder, $data, $type); die; } else { organization_categorize($treeView, $idItem); } }