本文整理汇总了PHP中orm::save方法的典型用法代码示例。如果您正苦于以下问题:PHP orm::save方法的具体用法?PHP orm::save怎么用?PHP orm::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类orm
的用法示例。
在下文中一共展示了orm::save方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dialplan
//.........这里部分代码省略.........
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "answer";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "fax_uuid=" . $this->fax_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "api_hangup_hook=lua app/fax/resources/scripts/hangup_rx.lua";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
foreach ($_SESSION['fax']['variable'] as $data) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
if (substr($data, 0, 8) == "inbound:") {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = substr($data, 8, strlen($data));
} elseif (substr($data, 0, 9) == "outbound:") {
} else {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $data;
}
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
if (strlen($_SESSION['fax']['last_fax']['text']) > 0) {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "last_fax=" . $_SESSION['fax']['last_fax']['text'];
} else {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "last_fax=\${caller_id_number}-\${strftime(%Y-%m-%d-%H-%M-%S)}";
}
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "playback";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "silence_stream://2000";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "rxfax";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $_SESSION['switch']['storage']['dir'] . '/fax/' . $_SESSION['domain_name'] . '/' . $this->fax_extension . '/inbox/' . $this->forward_prefix . '${last_fax}.tif';
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "hangup";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
//add the dialplan permission
$p = new permissions();
$p->add("dialplan_add", 'temp');
$p->add("dialplan_detail_add", 'temp');
$p->add("dialplan_edit", 'temp');
$p->add("dialplan_detail_edit", 'temp');
//save the dialplan
$orm = new orm();
$orm->name('dialplans');
$orm->save($dialplan);
$dialplan_response = $orm->message;
$this->dialplan_uuid = $dialplan_response['uuid'];
//if new dialplan uuid then update the call center queue
$sql = "update v_fax ";
$sql .= "set dialplan_uuid = '" . $this->dialplan_uuid . "' ";
$sql .= "where fax_uuid = '" . $this->fax_uuid . "' ";
$sql .= "and domain_uuid = '" . $this->domain_uuid . "' ";
$this->db->exec($sql);
unset($sql);
//remove the temporary permission
$p->delete("dialplan_add", 'temp');
$p->delete("dialplan_detail_add", 'temp');
$p->delete("dialplan_edit", 'temp');
$p->delete("dialplan_detail_edit", 'temp');
//synchronize the xml config
save_dialplan_xml();
//clear the cache
$cache = new cache();
$cache->delete("dialplan:" . $_SESSION['context']);
//return the dialplan_uuid
return $dialplan_response;
}
示例2: foreach
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'backup';
$array[$x]['default_setting_subcategory'] = 'path';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = $_SESSION['switch']['db']['dir'];
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$sql = "select * from v_default_settings ";
$sql .= "where default_setting_category = 'backup' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$x = 0;
foreach ($array as $row) {
$found = false;
foreach ($default_settings as $field) {
if ($row['default_setting_subcategory'] == $field['default_setting_subcategory']) {
$found = true;
$break;
}
}
if (!$found) {
$orm = new orm();
$orm->name('default_settings');
$orm->save($array[$x]);
$message = $orm->message;
}
$x++;
}
}
示例3: foreach
//iterate and add each, if necessary
foreach ($array as $index => $default_settings) {
//add default settings
$sql = "select count(*) as num_rows from v_default_settings ";
$sql .= "where default_setting_category = '" . $default_settings['default_setting_category'] . "' ";
$sql .= "and default_setting_subcategory = '" . $default_settings['default_setting_subcategory'] . "' ";
$sql .= "and default_setting_name = '" . $default_settings['default_setting_name'] . "' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
unset($prep_statement);
if ($row['num_rows'] == 0) {
$orm = new orm();
$orm->name('default_settings');
$orm->save($array[$index]);
$message = $orm->message;
//print_r($message);
}
unset($row);
}
}
//create phrases folder and add include line in xml for each language found
if (strlen($_SESSION['switch']['phrases']['dir']) > 0) {
if (is_readable($_SESSION['switch']['phrases']['dir'])) {
$conf_lang_folders = glob($_SESSION['switch']['phrases']['dir'] . "/*");
foreach ($conf_lang_folders as $conf_lang_folder) {
//create phrases folder, if necessary
if (!file_exists($conf_lang_folder . "/phrases/")) {
mkdir($conf_lang_folder . "/phrases/", 0777);
}
示例4: strtolower
$device_profiles[0]["device_profile_name"] = $device_profiles[0]["device_profile_name"] . "-" . strtolower($text['button-copy']);
$device_profiles[0]["device_profile_description"] = $text['button-copy'] . " " . $device_profiles[0]["device_profile_description"];
//prepare the device_keys array
$x = 0;
foreach ($device_keys as $row) {
unset($device_keys[$x]["device_profile_uuid"]);
unset($device_keys[$x]["device_key_uuid"]);
$x++;
}
//prepare the device_settings array
//$x = 0;
//foreach ($device_settings as $row) {
// unset($device_settings[$x]["device_uuid"]);
// unset($device_settings[$x]["device_setting_uuid"]);
// $x++;
//}
//create the device array
$device_profile = $device_profiles[0];
$device_profile["device_keys"] = $device_keys;
//$device["device_settings"] = $device_settings;
//copy the device
if ($save) {
$orm = new orm();
$orm->name('device_profiles');
$orm->save($device_profile);
$response = $orm->message;
$_SESSION["message"] = $text['message-copy'];
}
//redirect
header("Location: device_profiles.php");
return;
示例5: unset
unset($_POST["ring_group_destinations"][$x]);
}
//unset ring_group_destination_uuid if the field has no value
if (strlen($row["ring_group_destination_uuid"]) == 0) {
unset($_POST["ring_group_destinations"][$x]["ring_group_destination_uuid"]);
}
//increment the row
$x++;
}
//save to the data
$orm = new orm();
$orm->name('ring_groups');
if (strlen($ring_group_uuid) > 0) {
$orm->uuid($ring_group_uuid);
}
$orm->save($_POST);
$message = $orm->message;
if (strlen($ring_group_uuid) == 0) {
$ring_group_uuid = $message['uuid'];
$_GET["id"] = $ring_group_uuid;
}
}
//delete the dialplan details
$sql = "delete from v_dialplan_details ";
$sql .= "where domain_uuid = '" . $_SESSION['domain_uuid'] . "' ";
$sql .= "and dialplan_uuid = '" . $dialplan_uuid . "' ";
$db->exec(check_sql($sql));
unset($sql);
//delete from the dialplan
$sql = "delete from v_dialplans ";
$sql .= "where domain_uuid = '" . $_SESSION['domain_uuid'] . "' ";
示例6: unset
//prepare the device_keys array
$x = 0;
foreach ($device_keys as $row) {
unset($device_keys[$x]["device_uuid"]);
unset($device_keys[$x]["device_key_uuid"]);
$x++;
}
//prepare the device_settings array
$x = 0;
foreach ($device_settings as $row) {
unset($device_settings[$x]["device_uuid"]);
unset($device_settings[$x]["device_setting_uuid"]);
$x++;
}
//create the device array
$device = $devices[0];
$device["device_mac_address"] = $mac_address_new;
$device["device_lines"] = $device_lines;
$device["device_keys"] = $device_keys;
$device["device_settings"] = $device_settings;
//copy the device
if ($save) {
$orm = new orm();
$orm->name('devices');
$orm->save($device);
$response = $orm->message;
$_SESSION["message"] = $text['message-copy'];
}
//redirect
header("Location: devices.php");
return;
示例7: uuid
$sql .= "('" . uuid() . "', 'Thai', 'th'), ";
$sql .= "('" . uuid() . "', 'Tibetan', 'bo'), ";
$sql .= "('" . uuid() . "', 'Tsonga', 'ts'), ";
$sql .= "('" . uuid() . "', 'Turkish', 'tr'), ";
$sql .= "('" . uuid() . "', 'Turkmen', 'tk'), ";
$sql .= "('" . uuid() . "', 'Ukrainian', 'uk'), ";
$sql .= "('" . uuid() . "', 'Urdu', 'ur'), ";
$sql .= "('" . uuid() . "', 'Uzbek - Cyrillic, Latin', 'uz-uz'), ";
$sql .= "('" . uuid() . "', 'Vietnamese', 'vi'), ";
$sql .= "('" . uuid() . "', 'Welsh', 'cy'), ";
$sql .= "('" . uuid() . "', 'Xhosa', 'xh'), ";
$sql .= "('" . uuid() . "', 'Yiddish', 'yi') ";
$db->exec(check_sql($sql));
unset($sql);
}
unset($prep_statement, $row);
}
//set the sip_profiles directory for older installs
if (isset($_SESSION['switch']['gateways']['dir'])) {
$orm = new orm();
$orm->name('default_settings');
$orm->uuid($_SESSION['switch']['gateways']['uuid']);
$array['default_setting_category'] = 'switch';
$array['default_setting_subcategory'] = 'sip_profiles';
$array['default_setting_name'] = 'dir';
//$array['default_setting_value'] = '';
//$array['default_setting_enabled'] = 'true';
$orm->save($array);
unset($array);
}
}
示例8: unset
break;
}
}
}
//get default settings
$sql = "select * from v_default_settings ";
$sql .= "where default_setting_category = 'theme' ";
$sql .= "and default_setting_subcategory = 'background_image' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset($prep_statement);
//add theme default settings
foreach ($array as $row) {
$found = false;
foreach ($default_settings as $field) {
if ($field["default_setting_value"] == $row["default_setting_value"]) {
$found = true;
}
}
if (!$found) {
$orm = new orm();
$orm->name('default_settings');
$orm->save($row);
$message = $orm->message;
//print_r($message);
}
}
//unset the array variable
unset($array);
}
示例9: dialplan
//.........这里部分代码省略.........
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "\${caller_id_name}";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^([^#]+#)(.*)\$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "never";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "caller_id_name=\$2";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^" . $this->destination_number . "\$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "answer";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "hangup_after_bridge=true";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
if (strlen($this->queue_cid_prefix) > 0) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "effective_caller_id_name=" . $this->queue_cid_prefix . "#\${caller_id_name}";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "callcenter";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $this->queue_name . '@' . $_SESSION["domain_name"];
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
if (strlen($this->queue_timeout_action) > 0) {
$action_array = explode(":", $this->queue_timeout_action);
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $action_array[0];
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = substr($this->queue_timeout_action, strlen($action_array[0]) + 1, strlen($this->queue_timeout_action));
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "hangup";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
//add the dialplan permission
$p = new permissions();
$p->add("dialplan_add", 'temp');
$p->add("dialplan_detail_add", 'temp');
$p->add("dialplan_edit", 'temp');
$p->add("dialplan_detail_edit", 'temp');
//save the dialplan
$orm = new orm();
$orm->name('dialplans');
$orm->save($dialplan);
$dialplan_response = $orm->message;
$this->dialplan_uuid = $dialplan_response['uuid'];
//if new dialplan uuid then update the call center queue
$sql = "update v_call_center_queues ";
$sql .= "set dialplan_uuid = '" . $this->dialplan_uuid . "' ";
$sql .= "where call_center_queue_uuid = '" . $this->call_center_queue_uuid . "' ";
$sql .= "and domain_uuid = '" . $this->domain_uuid . "' ";
$this->db->exec($sql);
unset($sql);
//remove the temporary permission
$p->delete("dialplan_add", 'temp');
$p->delete("dialplan_detail_add", 'temp');
$p->delete("dialplan_edit", 'temp');
$p->delete("dialplan_detail_edit", 'temp');
//synchronize the xml config
save_dialplan_xml();
//clear the cache
$cache = new cache();
$cache->delete("dialplan:" . $_SESSION['context']);
//return the dialplan_uuid
return $dialplan_response;
}
示例10: dialplan
//.........这里部分代码省略.........
$details[$x]['dialplan_detail_data'] = 'ringback=${hold_music}';
} else {
$details[$x]['dialplan_detail_data'] = 'ringback=' . $field['ivr_menu_ringback'];
}
$details[$x]['dialplan_detail_order'] = '025';
$x++;
$details[$x]['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$details[$x]['dialplan_detail_type'] = 'set';
if ($field['ivr_menu_ringback'] == "music" || $field['ivr_menu_ringback'] == "") {
$details[$x]['dialplan_detail_data'] = 'transfer_ringback=${hold_music}';
} else {
$details[$x]['dialplan_detail_data'] = 'transfer_ringback=' . $field['ivr_menu_ringback'];
}
$details[$x]['dialplan_detail_order'] = '030';
$x++;
$details[$x]['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$details[$x]['dialplan_detail_type'] = 'set';
$details[$x]['dialplan_detail_data'] = 'ivr_menu_uuid=' . $this->ivr_menu_uuid;
$details[$x]['dialplan_detail_order'] = '035';
$x++;
$details[$x]['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
if ($_SESSION['ivr menu']['application']['text'] == "lua") {
$details[$x]['dialplan_detail_type'] = 'lua';
$details[$x]['dialplan_detail_data'] = 'ivr_menu.lua';
} else {
$details[$x]['dialplan_detail_type'] = 'ivr';
$details[$x]['dialplan_detail_data'] = $this->ivr_menu_uuid;
}
$details[$x]['dialplan_detail_order'] = '040';
if (strlen($field['ivr_menu_exit_app']) > 0) {
$x++;
$details[$x]['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$details[$x]['dialplan_detail_type'] = $field['ivr_menu_exit_app'];
$details[$x]['dialplan_detail_data'] = $field['ivr_menu_exit_data'];
$details[$x]['dialplan_detail_order'] = '045';
$x++;
}
//build the array
$array['domain_uuid'] = $field['domain_uuid'];
$array['dialplan_uuid'] = $field['dialplan_uuid'];
$array['dialplan_name'] = $field['ivr_menu_name'];
$array['dialplan_order'] = '333';
$array['dialplan_context'] = $_SESSION['context'];
$array['dialplan_enabled'] = $field['ivr_menu_enabled'];
$array['dialplan_description'] = $field['ivr_menu_description'];
$array['app_uuid'] = $this->app_uuid;
$x = 0;
foreach ($details as $row) {
//find the matching uuid
/*
foreach ($dialplan_details as $database) {
if ($database['dialplan_detail_tag'] == $row['dialplan_detail_tag']
&& $database['dialplan_detail_type'] == $row['dialplan_detail_type']
&& $database['dialplan_detail_data'] == $row['dialplan_detail_data']) {
$array['dialplan_details'][$x]['dialplan_detail_uuid'] = $database['dialplan_detail_uuid'];
}
}
*/
//add to the array
$array['dialplan_details'][$x]['domain_uuid'] = $field['domain_uuid'];
$array['dialplan_details'][$x]['dialplan_uuid'] = $field['dialplan_uuid'];
$array['dialplan_details'][$x]['dialplan_detail_tag'] = $row['dialplan_detail_tag'];
$array['dialplan_details'][$x]['dialplan_detail_type'] = $row['dialplan_detail_type'];
$array['dialplan_details'][$x]['dialplan_detail_data'] = $row['dialplan_detail_data'];
$array['dialplan_details'][$x]['dialplan_detail_order'] = $row['dialplan_detail_order'];
//increment the row
$x++;
}
//debug
//echo "<pre>\n";
//print_r($dialplan_details);
//print_r($array);
//echo "</pre>\n";
//exit;
//save the dialplan
$orm = new orm();
$orm->name('dialplans');
$orm->save($array);
$response = $orm->message;
if (strlen($response['uuid']) > 0) {
$this->dialplan_uuid = $response['uuid'];
}
//debug
//echo "<pre>\n";
//print_r($response);
//echo "</pre>\n";
//exit;
//synchronize the xml config
save_dialplan_xml();
//delete the dialplan context from memcache
//$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//if ($fp) {
// $switch_cmd .= "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
// $switch_result = event_socket_request($fp, 'api '.$switch_cmd);
//}
}
示例11: settings
//.........这里部分代码省略.........
$x++;
$array[$x]['default_setting_category'] = 'switch';
$array[$x]['default_setting_subcategory'] = 'mod';
$array[$x]['default_setting_name'] = 'dir';
$array[$x]['default_setting_value'] = $vars['mod_dir'];
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'switch';
$array[$x]['default_setting_subcategory'] = 'phrases';
$array[$x]['default_setting_name'] = 'dir';
$array[$x]['default_setting_value'] = $vars['conf_dir'] . '/lang';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'switch';
$array[$x]['default_setting_subcategory'] = 'recordings';
$array[$x]['default_setting_name'] = 'dir';
$array[$x]['default_setting_value'] = $vars['recordings_dir'];
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'switch';
$array[$x]['default_setting_subcategory'] = 'scripts';
$array[$x]['default_setting_name'] = 'dir';
$array[$x]['default_setting_value'] = $vars['script_dir'];
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'switch';
$array[$x]['default_setting_subcategory'] = 'sip_profiles';
$array[$x]['default_setting_name'] = 'dir';
$array[$x]['default_setting_value'] = $vars['conf_dir'] . '/sip_profiles';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'switch';
$array[$x]['default_setting_subcategory'] = 'sounds';
$array[$x]['default_setting_name'] = 'dir';
$array[$x]['default_setting_value'] = $vars['sounds_dir'];
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'switch';
$array[$x]['default_setting_subcategory'] = 'storage';
$array[$x]['default_setting_name'] = 'dir';
$array[$x]['default_setting_value'] = $vars['storage_dir'];
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'switch';
$array[$x]['default_setting_subcategory'] = 'voicemail';
$array[$x]['default_setting_name'] = 'dir';
$array[$x]['default_setting_value'] = $vars['storage_dir'] . '/voicemail';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$x++;
//get an array of the default settings
$sql = "select * from v_default_settings ";
$sql .= "where default_setting_category = 'switch' ";
$prep_statement = $this->db->prepare($sql);
$prep_statement->execute();
$default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset($prep_statement, $sql);
//find the missing default settings
$x = 0;
foreach ($array as $setting) {
$found = false;
$missing[$x] = $setting;
foreach ($default_settings as $row) {
if (trim($row['default_setting_subcategory']) == trim($setting['default_setting_subcategory'])) {
$found = true;
//remove items from the array that were found
unset($missing[$x]);
}
}
$x++;
}
//add the missing default settings
foreach ($missing as $row) {
//add the default settings
$orm = new orm();
$orm->name('default_settings');
$orm->save($row);
$message = $orm->message;
unset($orm);
//print_r($message);
}
unset($missing);
//set the default settings
foreach ($array as $row) {
if (!isset($_SESSION['switch'][$row['default_setting_subcategory']])) {
if ($row['default_setting_enabled'] != "false") {
$_SESSION['switch'][$row['default_setting_subcategory']] = $row['default_setting_value'];
}
}
}
//unset the array variable
unset($array);
}