if (!$lp_found) {
            //check if the learnpath ID was defined, otherwise send back to list
            if ($debug > 0) error_log('New LP - No learnpath given for add audio', 0);
            require 'lp_list.php';
        } else {
            $_SESSION['refresh'] = 1;

            if (isset($_REQUEST['id'])) {
                $lp_item_obj = new learnpathItem($_REQUEST['id']);

                // Remove audio
                if (isset($_GET['delete_file']) && $_GET['delete_file'] == 1) {
                    $lp_item_obj->remove_audio();

                    $url = api_get_self().'?action=add_audio&lp_id='.intval($_SESSION['oLP']->lp_id).'&id='.$lp_item_obj->get_id().'&'.api_get_cidreq();
                    header('Location: '.$url);
                    exit;
                }

                // Upload audio
                if (isset($_FILES['file']) && !empty($_FILES['file'])) {
                    // Updating the lp.modified_on
                    $_SESSION['oLP']->set_modified_on();
                    $lp_item_obj->add_audio();
                }

                //Add audio file from documents
                if (isset($_REQUEST['document_id']) && !empty($_REQUEST['document_id'])) {
                    $_SESSION['oLP']->set_modified_on();
                    $lp_item_obj->add_audio_from_documents($_REQUEST['document_id']);
Example #2
0
     error_log('New LP - add audio action triggered', 0);
 }
 if (!$lp_found) {
     //check if the learnpath ID was defined, otherwise send back to list
     if ($debug > 0) {
         error_log('New LP - No learnpath given for add audio', 0);
     }
     require 'lp_list.php';
 } else {
     Session::write('refresh', 1);
     if (isset($_REQUEST['id'])) {
         $lp_item_obj = new learnpathItem($_REQUEST['id']);
         // Remove audio
         if (isset($_GET['delete_file']) && $_GET['delete_file'] == 1) {
             $lp_item_obj->remove_audio();
             $url = api_get_self() . '?action=add_audio&lp_id=' . intval($learnPath->lp_id) . '&id=' . $lp_item_obj->get_id() . '&' . api_get_cidreq();
             header('Location: ' . $url);
             exit;
         }
         // Upload audio
         if (isset($_FILES['file']) && !empty($_FILES['file'])) {
             // Updating the lp.modified_on
             $learnPath->set_modified_on();
             $lp_item_obj->add_audio();
         }
         //Add audio file from documents
         if (isset($_REQUEST['document_id']) && !empty($_REQUEST['document_id'])) {
             $learnPath->set_modified_on();
             $lp_item_obj->add_audio_from_documents($_REQUEST['document_id']);
         }
         $learnPath->updateCurrentLpFromSession();