PMA\libraries\Util::getTitleForTarget PHP Method

getTitleForTarget() public static method

Get the action word corresponding to a script name in order to display it as a title in navigation panel
public static getTitleForTarget ( string $target ) : string
$target string a valid value for $cfg['NavigationTreeDefaultTabTable'], $cfg['NavigationTreeDefaultTabTable2'], $cfg['DefaultTabTable'] or $cfg['DefaultTabDatabase']
return string Title for the $cfg value
    public static function getTitleForTarget($target)
    {
        $mapping = array('structure' => __('Structure'), 'sql' => __('SQL'), 'search' => __('Search'), 'insert' => __('Insert'), 'browse' => __('Browse'), 'operations' => __('Operations'), 'tbl_structure.php' => __('Structure'), 'tbl_sql.php' => __('SQL'), 'tbl_select.php' => __('Search'), 'tbl_change.php' => __('Insert'), 'sql.php' => __('Browse'), 'db_structure.php' => __('Structure'), 'db_sql.php' => __('SQL'), 'db_search.php' => __('Search'), 'db_operations.php' => __('Operations'));
        return isset($mapping[$target]) ? $mapping[$target] : false;
    }

Usage Example

コード例 #1
0
 /**
  * Initialises the class
  *
  * @param string $name     An identifier for the new node
  * @param int    $type     Type of node, may be one of CONTAINER or OBJECT
  * @param bool   $is_group Whether this object has been created
  *                         while grouping nodes
  */
 public function __construct($name, $type = Node::OBJECT, $is_group = false)
 {
     parent::__construct($name, $type, $is_group);
     $this->icon = array();
     $this->_addIcon(Util::getScriptNameForOption($GLOBALS['cfg']['NavigationTreeDefaultTabTable'], 'table'));
     $this->_addIcon(Util::getScriptNameForOption($GLOBALS['cfg']['NavigationTreeDefaultTabTable2'], 'table'));
     $title = Util::getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']);
     $this->title = $title;
     $script_name = Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabTable'], 'table');
     $this->links = array('text' => $script_name . '?server=' . $GLOBALS['server'] . '&db=%2$s&table=%1$s' . '&pos=0&token=' . $_SESSION[' PMA_token '], 'icon' => array(Util::getScriptNameForOption($GLOBALS['cfg']['NavigationTreeDefaultTabTable'], 'table') . '?server=' . $GLOBALS['server'] . '&db=%2$s&table=%1$s&token=' . $_SESSION[' PMA_token '], Util::getScriptNameForOption($GLOBALS['cfg']['NavigationTreeDefaultTabTable2'], 'table') . '?server=' . $GLOBALS['server'] . '&db=%2$s&table=%1$s&token=' . $_SESSION[' PMA_token ']), 'title' => $this->title);
     $this->classes = 'table';
 }
All Usage Examples Of PMA\libraries\Util::getTitleForTarget
Util