Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
ec8de608
Commit
ec8de608
authored
Jun 09, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:yiisoft/yii2
parents
f2d477dc
864bf936
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
20 deletions
+22
-20
Nav.php
framework/yii/bootstrap/Nav.php
+15
-9
Schema.php
framework/yii/db/pgsql/Schema.php
+7
-11
No files found.
framework/yii/bootstrap/Nav.php
View file @
ec8de608
...
@@ -27,13 +27,19 @@ use yii\helpers\Html;
...
@@ -27,13 +27,19 @@ use yii\helpers\Html;
* ),
* ),
* array(
* array(
* 'label' => 'Dropdown',
* 'label' => 'Dropdown',
* '
dropdown
' => array(
* '
items
' => array(
* array(
* array(
* 'label' => 'DropdownA',
* 'label' => '
Level 1 -
DropdownA',
* 'url' => '#',
* 'url' => '#',
* 'items' => array(
* array(
* 'label' => 'Level 2 -DropdownA',
* 'url' => '#',
* ),
* ),
* ),
* ),
* array(
* array(
* 'label' => 'DropdownB',
* 'label' => '
Level 1 -
DropdownB',
* 'url' => '#',
* 'url' => '#',
* ),
* ),
* ),
* ),
...
@@ -114,7 +120,7 @@ class Nav extends Widget
...
@@ -114,7 +120,7 @@ class Nav extends Widget
}
}
$label
=
$this
->
encodeLabels
?
Html
::
encode
(
$item
[
'label'
])
:
$item
[
'label'
];
$label
=
$this
->
encodeLabels
?
Html
::
encode
(
$item
[
'label'
])
:
$item
[
'label'
];
$options
=
ArrayHelper
::
getValue
(
$item
,
'options'
,
array
());
$options
=
ArrayHelper
::
getValue
(
$item
,
'options'
,
array
());
$
dropdown
=
ArrayHelper
::
getValue
(
$item
,
'dropdown
'
);
$
items
=
ArrayHelper
::
getValue
(
$item
,
'items
'
);
$url
=
Html
::
url
(
ArrayHelper
::
getValue
(
$item
,
'url'
,
'#'
));
$url
=
Html
::
url
(
ArrayHelper
::
getValue
(
$item
,
'url'
,
'#'
));
$linkOptions
=
ArrayHelper
::
getValue
(
$item
,
'linkOptions'
,
array
());
$linkOptions
=
ArrayHelper
::
getValue
(
$item
,
'linkOptions'
,
array
());
...
@@ -122,19 +128,19 @@ class Nav extends Widget
...
@@ -122,19 +128,19 @@ class Nav extends Widget
$this
->
addCssClass
(
$options
,
'active'
);
$this
->
addCssClass
(
$options
,
'active'
);
}
}
if
(
$
dropdown
!==
null
)
{
if
(
$
items
!==
null
)
{
$linkOptions
[
'data-toggle'
]
=
'dropdown'
;
$linkOptions
[
'data-toggle'
]
=
'dropdown'
;
$this
->
addCssClass
(
$options
,
'dropdown'
);
$this
->
addCssClass
(
$options
,
'dropdown'
);
$this
->
addCssClass
(
$urlOptions
,
'dropdown-toggle'
);
$this
->
addCssClass
(
$urlOptions
,
'dropdown-toggle'
);
$label
.=
' '
.
Html
::
tag
(
'b'
,
''
,
array
(
'class'
=>
'caret'
));
$label
.=
' '
.
Html
::
tag
(
'b'
,
''
,
array
(
'class'
=>
'caret'
));
if
(
is_array
(
$
dropdown
))
{
if
(
is_array
(
$
items
))
{
$
dropdown
=
Dropdown
::
widget
(
array
(
$
items
=
Dropdown
::
widget
(
array
(
'items'
=>
$
dropdown
,
'items'
=>
$
items
,
'clientOptions'
=>
false
,
'clientOptions'
=>
false
,
));
));
}
}
}
}
return
Html
::
tag
(
'li'
,
Html
::
a
(
$label
,
$url
,
$linkOptions
)
.
$
dropdown
,
$options
);
return
Html
::
tag
(
'li'
,
Html
::
a
(
$label
,
$url
,
$linkOptions
)
.
$
items
,
$options
);
}
}
}
}
framework/yii/db/pgsql/Schema.php
View file @
ec8de608
...
@@ -73,7 +73,7 @@ class Schema extends \yii\db\Schema
...
@@ -73,7 +73,7 @@ class Schema extends \yii\db\Schema
);
);
/**
/**
* Creates a query builder for the
My
SQL database.
* Creates a query builder for the
Postgre
SQL database.
* @return QueryBuilder query builder instance
* @return QueryBuilder query builder instance
*/
*/
public
function
createQueryBuilder
()
public
function
createQueryBuilder
()
...
@@ -143,14 +143,9 @@ class Schema extends \yii\db\Schema
...
@@ -143,14 +143,9 @@ class Schema extends \yii\db\Schema
$sql
=
<<<SQL
$sql
=
<<<SQL
select
select
ct.conname as containst,
c.relname as table_name,
ns.nspname as table_schema,
current_database() as table_catalog,
(select string_agg(attname,',') attname from pg_attribute where attrelid=ct.conrelid and attnum = any(ct.conkey)) as columns,
(select string_agg(attname,',') attname from pg_attribute where attrelid=ct.conrelid and attnum = any(ct.conkey)) as columns,
fc.relname as foreign_table_name,
fc.relname as foreign_table_name,
fns.nspname as foreign_table_schema,
fns.nspname as foreign_table_schema,
current_database() as foreign_table_catalog,
(select string_agg(attname,',') attname from pg_attribute where attrelid=ct.confrelid and attnum = any(ct.confkey)) as foreign_columns
(select string_agg(attname,',') attname from pg_attribute where attrelid=ct.confrelid and attnum = any(ct.confkey)) as foreign_columns
from
from
pg_constraint ct
pg_constraint ct
...
@@ -169,7 +164,12 @@ SQL;
...
@@ -169,7 +164,12 @@ SQL;
foreach
(
$constraints
as
$constraint
)
{
foreach
(
$constraints
as
$constraint
)
{
$columns
=
explode
(
','
,
$constraint
[
'columns'
]);
$columns
=
explode
(
','
,
$constraint
[
'columns'
]);
$fcolumns
=
explode
(
','
,
$constraint
[
'foreign_columns'
]);
$fcolumns
=
explode
(
','
,
$constraint
[
'foreign_columns'
]);
$citem
=
array
(
$constraint
[
'foreign_table_name'
]);
if
(
$constraint
[
'foreign_table_schema'
]
!==
$this
->
defaultSchema
)
{
$foreignTable
=
$constraint
[
'foreign_table_schema'
]
.
'.'
.
$constraint
[
'foreign_table_name'
];
}
else
{
$foreignTable
=
$constraint
[
'foreign_table_name'
];
}
$citem
=
array
(
$foreignTable
);
foreach
(
$columns
as
$idx
=>
$column
)
{
foreach
(
$columns
as
$idx
=>
$column
)
{
$citem
[]
=
array
(
$fcolumns
[
$idx
]
=>
$column
);
$citem
[]
=
array
(
$fcolumns
[
$idx
]
=>
$column
);
}
}
...
@@ -243,10 +243,6 @@ ORDER BY
...
@@ -243,10 +243,6 @@ ORDER BY
SQL;
SQL;
$columns
=
$this
->
db
->
createCommand
(
$sql
)
->
queryAll
();
$columns
=
$this
->
db
->
createCommand
(
$sql
)
->
queryAll
();
if
(
empty
(
$columns
))
{
return
false
;
}
foreach
(
$columns
as
$column
)
{
foreach
(
$columns
as
$column
)
{
$column
=
$this
->
loadColumnSchema
(
$column
);
$column
=
$this
->
loadColumnSchema
(
$column
);
$table
->
columns
[
$column
->
name
]
=
$column
;
$table
->
columns
[
$column
->
name
]
=
$column
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment