Add a new object relational model class and make the dialplan edit use for add and edit.

This commit is contained in:
Mark Crane
2014-01-19 13:09:17 +00:00
parent 1316745483
commit be442661c9
3 changed files with 861 additions and 182 deletions
+41 -1
View File
@@ -81,7 +81,6 @@
$dialplan_order = 0;
}
//dialplan class
require_once "app/dialplan/resources/classes/dialplan.php";
$dialplan = new dialplan;
$dialplan->domain_uuid = $domain_uuid;
$dialplan->dialplan_order = $dialplan_order;
@@ -93,4 +92,45 @@
$dialplan->import();
}
//add the global dialplan to inbound routes
if ($domains_processed == 1) {
$sql = "select count(*) as num_rows from v_dialplans ";
$sql .= "where dialplan_uuid = 'd4e06654-e394-444a-b3af-4c3d54aebbec' ";
$prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == 0) {
//create the dialplan array
$array["app_uuid"] = "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4";
$array["dialplan_context"] = "public";
$array["dialplan_name"] = "global";
$array["dialplan_continue"] = "true";
$array["dialplan_order"] = "0";
$array["dialplan_enabled"] = "true";
$y = 0;
$array["dialplan_details"][$y]["dialplan_detail_uuid"] = "5e1062d8-6842-4890-a78a-388e8dd5bbaf";
$array["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$array["dialplan_details"][$y]["dialplan_detail_type"] = "context";
$array["dialplan_details"][$y]["dialplan_detail_data"] = "public";
$array["dialplan_details"][$y]["dialplan_detail_order"] = "10";
$y++;
$array["dialplan_details"][$y]["dialplan_detail_uuid"] = "bdafd4aa-6633-48fc-970e-bc2778f3f022";
$array["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$array["dialplan_details"][$y]["dialplan_detail_type"] = "lua";
$array["dialplan_details"][$y]["dialplan_detail_data"] = "app.lua dialplan";
$array["dialplan_details"][$y]["dialplan_detail_order"] = "20";
//save the dialplan with a specific uuid
$orm = new orm;
$orm->domain_uuid = $domain_uuid;
$orm->uuid('d4e06654-e394-444a-b3af-4c3d54aebbec');
$orm->name('dialplans');
$orm->save($array);
//$message = $orm->message;
unset($array);
}
}
}
?>