'lastname' => $data->message->from->last_name ?? null,
[admin_menu]
...
*#=dialplan_exec(conf-invite,s,1)
[conf-invite]
exten => s,1,Answer
same => n,Read(NUMBER,vm-enter-num-to-call)
same => n,Originate(SIP/${NUMBER},exten,conf-invite,conference,1)
exten => conference,1,Answer
same => n,ConfBridge(conference,bridge,simple-user,user_menu)
<?php
$data = [
[
'id' => 1,
'parent_id' => 100,
'name' => 'Стулья'
], [
'id' => 2,
'parent_id' => 100,
'name' => 'Столы'
], [
'id' => 5,
'parent_id' => 1,
'name' => 'Стул Сакура',
'price' => 5691,
'img' => 'lorempixel.com/900/900/?q=5',
'props' => []
], [
'id' => 9,
'parent_id' => 2,
'name' => 'Стол Византия',
'price' => 5268,
'img' => 'lorempixel.com/900/900/?q=9',
'props' => []
]
];
function build_tree($data, $id) {
$result = [];
foreach ($data as $el) {
if ($el['parent_id'] == $id) {
$newEl = $el;
$childs = build_tree($data, $el['id']);
if (count($childs) !== 0) {
$newEl['childs'] = $childs;
}
$result[] = $newEl;
}
}
return $result;
}
$tree = build_tree($data, 100);
print_r($tree);
/*
Array (
[0] => Array (
[id] => 1
[parent_id] => 100
[name] => Стулья
[childs] => Array (
[0] => Array (
[id] => 5
[parent_id] => 1
[name] => Стул Сакура
[price] => 5691
[img] => lorempixel.com/900/900/?q=5
[props] => Array ()
)
)
)
[1] => Array (
[id] => 2
[parent_id] => 100
[name] => Столы
[childs] => Array (
[0] => Array (
[id] => 9
[parent_id] => 2
[name] => Стол Византия
[price] => 5268
[img] => lorempixel.com/900/900/?q=9
[props] => Array ()
)
)
)
)
*/
SET `cte_max_recursion_depth` = 10000;
INSERT INTO `test` (`DATE_CREATE`, `DATE_UPDATE`, `ACTIVE`, `USER_ID`, `VALUE`)
WITH RECURSIVE `cte` (`DATE_CREATE`, `DATE_UPDATE`, `ACTIVE`, `USER_ID`, `VALUE`) AS (
SELECT NOW(), NOW(), 1, 1, 1 AS `VALUE`
UNION
SELECT NOW(), NOW(), 1, 1, `VALUE`+1 FROM `cte` WHERE `VALUE` < 9999
)
SELECT *
FROM `cte`
CLI> core show application Queue
...
Queue(queuename[,options[,URL[,announceoverride[,timeout[,AGI[,macro[,gosub[,rule[,position]]]]]]]]])
...
macro
Will run a macro on the called party's channel (the queue member) once the
parties are connected.
gosub
Will run a gosub on the called party's channel (the queue member) once the
parties are connected.
...
CLI> core show application Dial
...
M(macro[^arg[^...]]):
macro - Name of the macro that should be executed.
arg - Macro arguments
Execute the specified <macro> for the *called* channel before connecting to the
calling channel. Arguments can be specified to the Macro using '^' as a
delimiter. The macro can set the variable ${MACRO_RESULT} to specify the
following actions after the macro is finished executing:
...
U(x[^arg[^...]]):
x - Name of the subroutine to execute via 'Gosub'
arg - Arguments for the 'Gosub' routine
Execute via 'Gosub' the routine <x> for the *called* channel before connecting
to the calling channel. Arguments can be specified to the 'Gosub' using '^' as
a delimiter. The 'Gosub' routine can set the variable ${GOSUB_RESULT} to
specify the following actions after the 'Gosub' returns.
...
CLI> core show application System
...
Executes a command by using system(). If the command fails, the console
should report a fallthrough.
...
{
contents: "{\n \"destination_addresses\" : [ \"Kyiv, Ukraine, 02000\" ],\n \"origin_addresses\" : [ \"Luhansk, Luhansk Oblast, Ukraine, 91000\" ],\n \"rows\" : [\n {\n \"elements\" : [\n {\n \"distance\" : {\n \"text\" : \"821 km\",\n \"value\" : 821154\n },\n \"duration\" : {\n \"text\" : \"11 hours 32 mins\",\n \"value\" : 41522\n },\n \"status\" : \"OK\"\n }\n ]\n }\n ],\n \"status\" : \"OK\"\n}\n"
status: {
content_length: 530
сontent_type: "application/json; charset=UTF-8"
http_code: 200
response_time: 330
url: "https://maps.googleapis.com/maps/api/distancematrix/json?origins=Луганск&destinations=Киев&key=AIzaSyCO9I-9cmBpuwUJEdBcNe5F3AGN4iW_Dzs"
}
}
const data = JSON.parse(content.contents);
<?php
function tree($dirName) {
$tree = [];
$dir = opendir($dirName);
while (($entry = readdir($dir)) !== false) {
if ($entry === '.' || $entry === '..') {
continue;
}
$fullName = "{$dirName}\\{$entry}";
if (is_dir($fullName)) {
$tree[] = [
'name' => $entry,
'type' => 'dir',
'entries' => tree($fullName)
];
} else {
$tree[] = [
'name' => $entry,
'type' => 'file'
];
}
}
return $tree;
}
print(json_encode(tree('C:\\test'), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
/* [
{
"name": "dir1",
"type": "dir",
"entries": [
{
"name": "dir2",
"type": "dir",
"entries": [
{
"name": "file5",
"type": "file"
}
]
},
{
"name": "file1",
"type": "file"
},
{
"name": "file3",
"type": "file"
}
]
},
{
"name": "file2",
"type": "file"
}
] */