__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/**
* Functionality for the navigation tree
*/
declare(strict_types=1);
namespace PhpMyAdmin\Navigation\Nodes;
use function __;
use function strlen;
use function substr;
/**
* Represents a columns node in the navigation tree
*/
class NodeColumn extends Node
{
/**
* Initialises the class
*
* @param array $item array to identify the column node
* @param int $type Type of node, may be one of CONTAINER or OBJECT
* @param bool $isGroup Whether this object has been created
* while grouping nodes
*/
public function __construct($item, $type = Node::OBJECT, $isGroup = false)
{
$this->displayName = $this->getDisplayName($item);
parent::__construct($item['name'], $type, $isGroup);
$this->icon = ['image' => $this->getColumnIcon($item['key']), 'title' => __('Column')];
$this->links = [
'text' => [
'route' => '/table/structure/change',
'params' => ['change_column' => 1, 'db' => null, 'table' => null, 'field' => null],
],
'icon' => [
'route' => '/table/structure/change',
'params' => ['change_column' => 1, 'db' => null, 'table' => null, 'field' => null],
],
'title' => __('Structure'),
];
$this->urlParamName = 'field';
}
/**
* Get customized Icon for columns in navigation tree
*
* @param string $key The key type - (primary, foreign etc.)
*
* @return string Icon name for required key.
*/
private function getColumnIcon($key)
{
switch ($key) {
case 'PRI':
$retval = 'b_primary';
break;
case 'UNI':
$retval = 'bd_primary';
break;
default:
$retval = 'pause';
break;
}
return $retval;
}
/**
* Get displayable name for navigation tree (key_type, data_type, default)
*
* @param array<string, mixed> $item Item is array containing required info
*
* @return string Display name for navigation tree
*/
private function getDisplayName($item)
{
$retval = $item['name'];
$flag = 0;
foreach ($item as $key => $value) {
if (empty($value) || $key === 'name') {
continue;
}
$flag == 0 ? $retval .= ' (' : $retval .= ', ';
$flag = 1;
$retval .= $this->getTruncateValue($key, $value);
}
return $retval . ')';
}
/**
* Get truncated value for display in node column view
*
* @param string $key key to identify default,datatype etc
* @param string $value value corresponding to key
*
* @return string truncated value
*/
public function getTruncateValue($key, $value)
{
$retval = '';
switch ($key) {
case 'default':
strlen($value) > 6 ?
$retval .= substr($value, 0, 6) . '...' :
$retval = $value;
break;
default:
$retval = $value;
break;
}
return $retval;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Node.php | File | 26.53 KB | 0644 |
|
| NodeColumn.php | File | 3.22 KB | 0644 |
|
| NodeColumnContainer.php | File | 1.45 KB | 0644 |
|
| NodeDatabase.php | File | 23.17 KB | 0644 |
|
| NodeDatabaseChild.php | File | 1.56 KB | 0644 |
|
| NodeDatabaseChildContainer.php | File | 1.05 KB | 0644 |
|
| NodeDatabaseContainer.php | File | 1.21 KB | 0644 |
|
| NodeEvent.php | File | 1.38 KB | 0644 |
|
| NodeEventContainer.php | File | 1.25 KB | 0644 |
|
| NodeFunction.php | File | 1.46 KB | 0644 |
|
| NodeFunctionContainer.php | File | 1.47 KB | 0644 |
|
| NodeIndex.php | File | 1.07 KB | 0644 |
|
| NodeIndexContainer.php | File | 1.43 KB | 0644 |
|
| NodeProcedure.php | File | 1.47 KB | 0644 |
|
| NodeProcedureContainer.php | File | 1.33 KB | 0644 |
|
| NodeTable.php | File | 11.37 KB | 0644 |
|
| NodeTableContainer.php | File | 1.32 KB | 0644 |
|
| NodeTrigger.php | File | 1.19 KB | 0644 |
|
| NodeTriggerContainer.php | File | 1.29 KB | 0644 |
|
| NodeView.php | File | 1.24 KB | 0644 |
|
| NodeViewContainer.php | File | 1.3 KB | 0644 |
|