Ejemplo n.º 1
0
 function savecatalogue()
 {
     checkPerm('mod');
     if (isset($_POST['id_cat'])) {
         // Update entry
         $query_catalogue = "\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_catalogue\r\n\t\tSET name = '" . $_POST['name'] . "',\r\n\t\t\tdescription = '" . $_POST['description'] . "'\r\n\t\tWHERE idCatalogue = '" . (int) $_POST['id_cat'] . "'";
         $re = sql_query($query_catalogue);
     } else {
         // Create a new entry
         $query_catalogue = "\r\n\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_catalogue\r\n\t\t( name, description ) VALUES\r\n\t\t( '" . $_POST['name'] . "', '" . $_POST['description'] . "' )";
         $re = sql_query($query_catalogue);
         if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
             list($id_cat) = sql_fetch_row(sql_query("SELECT LAST_INSERT_ID()"));
             require_once _base_ . '/lib/lib.preference.php';
             $adminManager = new AdminPreference();
             $adminManager->addAdminCatalogue($id_cat, Docebo::user()->getIdSt());
         }
     }
     Util::jump_to('index.php?modname=catalogue&op=catlist&result=' . ($re ? 'ok' : 'err'));
 }