-
Notifications
You must be signed in to change notification settings - Fork 1
/
store_bundle.php
executable file
·36 lines (31 loc) · 1.18 KB
/
store_bundle.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
* store the bundle and its description in table dasis_bundles
*
* @package DASIS -> Semantic Web
* @author Andre Scherl
* @version 1.0 - 15.11.2010
*
* Copyright (C) 2012, Andre Scherl
* You should have received a copy of the GNU General Public License
* along with DASIS. If not, see <http://www.gnu.org/licenses/>.
*/
require_once("../../config.php");
$bundle = new object();
$bundle->id = optional_param("bundleId", 0, PARAM_INT);
$bundle->name = optional_param("name_of_bundle", "", PARAM_TEXT);
$bundle->description = optional_param("description_of_bundle", "", PARAM_TEXT);
$connection = new object();
$connection->course_id = optional_param("courseid", 0, PARAM_INT);
// if bundle doesn't exists, store it
if(!$DB->record_exists("dasis_bundles", array("id" => $bundle->id))) {
$bundle->id = $DB->insert_record("dasis_bundles", $bundle);
// first connected course is the current one
$connection->bundle_id = $bundle->id;
$DB->insert_record("dasis_bundle_connections", $connection);
}else{
$DB->update_record("dasis_bundles", $bundle);
}
$array = explode("&bundle", $_POST["currenturl"]);
redirect($array[0]."&bundleId=".$bundle->id);
?>