Skip to content

Commit 58e5f75

Browse files
committed
Updates
1 parent 8e3e921 commit 58e5f75

File tree

4 files changed

+116
-17
lines changed

4 files changed

+116
-17
lines changed

pages/user-view.php

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,38 @@
132132
*/
133133
function displayUser($user){
134134
Page::theme('Greeny By Ibrahim Ali');
135-
Page::document()->getChildByID('main-content-area')->addChild(HTMLNode::createTextNode($user));
135+
Page::document()->getChildByID('main-content-area')->addChild(createUserInfoView($user));
136136
Page::render();
137137
}
138+
/**
139+
*
140+
* @param User $user
141+
* @return \HTMLNode
142+
*/
143+
function createUserInfoView($user){
144+
$node = new HTMLNode();
145+
$node->setClassName('pa-row');
146+
$infoNode = new HTMLNode('table');
147+
$infoNode->setClassName('pa-'.Page::dir().'-col-6');
148+
$infoNode->addChild(createUserInfoTableRow('User ID:', $user->getID()));
149+
$infoNode->addChild(createUserInfoTableRow('Username:', $user->getUserName()));
150+
$infoNode->addChild(createUserInfoTableRow('Display Name:', $user->getDisplayName()));
151+
$infoNode->addChild(createUserInfoTableRow('Email Address:', $user->getEmail()));
152+
$infoNode->addChild(createUserInfoTableRow('Registration Date:', $user->getRegDate()));
153+
$infoNode->addChild(createUserInfoTableRow('Last Login:', $user->getLastLogin()));
154+
$infoNode->addChild(createUserInfoTableRow('Last Password Reset Date:', $user->getLastPasswordResetDate()));
155+
$infoNode->addChild(createUserInfoTableRow('Password Reset Count:', $user->getResetCount()));
156+
$node->addChild($infoNode);
157+
return $node;
158+
}
159+
160+
function createUserInfoTableRow($label,$content){
161+
$row = new HTMLNode('tr');
162+
$td1 = new HTMLNode('td');
163+
$td1->addChild(HTMLNode::createTextNode('<b>'.$label.'</b>'));
164+
$row->addChild($td1);
165+
$td2 = new HTMLNode('td');
166+
$td2->addChild(HTMLNode::createTextNode($content));
167+
$row->addChild($td2);
168+
return $row;
169+
}

publish/Page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ public function getTheme() {
750750
* the function will return it. If not, the function will return NULL.
751751
* @since 1.9
752752
*/
753-
public function dir($new=null) {
753+
public static function dir($new=null) {
754754
$page = Page::get();
755755
$lNew = strtolower($new);
756756
if($lNew == 'ltr' || $lNew == 'rtl'){

publish/themes/greeny/css/Grid.css

Lines changed: 70 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,47 @@ THE SOFTWARE.
4040
box-sizing: border-box;
4141
}
4242

43-
.pa-container, .pa-row{
43+
.pa-container,
44+
.pa-row,
45+
.pa-row-nm,
46+
.pa-row-np,
47+
.pa-row-nm-np,
48+
.pa-row-np-nm{
4449
float: left;
4550
}
4651
.pa-container{
47-
padding: 1%;
4852
width: 100%;
4953
margin: 0;
5054
}
55+
.pa-row-nm, .pa-row-np{
56+
width: 100%;
57+
}
58+
.pa-row-np{
59+
margin: 0.5%;
60+
width: 99%
61+
}
62+
.pa-row-nm-np,.pa-row-np-nm{
63+
width: 100%;
64+
}
5165
.pa-row{
5266
padding: 0.5%;
5367
margin: 0.5%;
5468
width: 99%;
5569
}
70+
[class*='-np']{
71+
padding: 0 !important;
72+
}
73+
[class*='-nm']{
74+
margin: 0 !important;
75+
}
5676
.pa-container > .pa-row{
5777
margin-bottom: 0;
5878
margin-top: 0;
5979
}
6080
[class*="-col-"] {
6181
padding: 0.5%;
6282
margin: 0.5%;
83+
float: left;
6384
}
6485

6586
[class*="pa-ltr-"]{
@@ -71,15 +92,50 @@ THE SOFTWARE.
7192
direction: rtl;
7293
}
7394

74-
[class*="-col-one"]{width: 7.333333333%}
75-
[class*="-col-two"]{width: 15.66666667%}
76-
[class*="-col-three"]{width: 24%}
77-
[class*="-col-four"]{width: 32.33333333%}
78-
[class*="-col-five"]{width: 40.66666667%}
79-
[class*="-col-six"]{width: 49%}
80-
[class*="-col-seven"]{width: 57.33333333%}
81-
[class*="-col-eight"]{width: 65.66666666%}
82-
[class*="-col-nine"]{width: 74%}
83-
[class*="-col-ten"]{width: 82.33333333%}
84-
[class*="-col-eleven"]{width: 90.66666666%}
85-
[class*="-col-twelve"]{width: 99%}
95+
[class*="-col-1"]{width: 7.333333333%}
96+
[class*="-col-1-nm"]{width: 8.333333333%}
97+
[class*="-col-1-nm-np"],[class*="-col-1-np-nm"]{width: 8.333333333%}
98+
99+
[class*="-col-2"]{width: 15.66666667%}
100+
[class*="-col-2-nm"]{width: 16.66666667%}
101+
[class*="-col-2-np-nm"],[class*="-col-2-nm-np"]{width: 16.66666667%}
102+
103+
[class*="-col-3"]{width: 24%}
104+
[class*="-col-3-nm"]{width: 25%}
105+
[class*="-col-3-nm-np"],[class*="-col-3-np-nm"]{width: 25%}
106+
107+
[class*="-col-4"]{width: 32.33333333%}
108+
[class*="-col-4-nm"]{width: 33.33333333%}
109+
[class*="-col-4-nm-np"],[class*="-col-4-np-nm"]{width: 33.33333333%}
110+
111+
[class*="-col-5"]{width: 40.66666667%}
112+
[class*="-col-5-nm"]{width: 41.66666667%}
113+
[class*="-col-5-nm-np"],[class*="-col-5-np-nm"]{width: 41.66666667%}
114+
115+
[class*="-col-6"]{width: 49%}
116+
[class*="-col-6-nm"]{width: 50%}
117+
[class*="-col-6-nm-np"],[class*="-col-6-np-nm"]{width: 50%}
118+
119+
[class*="-col-7"]{width: 57.33333333%}
120+
[class*="-col-7-nm"]{width: 58.33333333%}
121+
[class*="-col-7-nm-np"],[class*="-col-7-np-nm"]{width: 58.33333333%}
122+
123+
[class*="-col-8"]{width: 65.66666666%}
124+
[class*="-col-8-nm"]{width: 66.66666666%}
125+
[class*="-col-8-nm-np"],[class*="-col-8-np-nm"]{width: 66.66666666%}
126+
127+
[class*="-col-9"]{width: 74%}
128+
[class*="-col-9-nm"]{width: 75%}
129+
[class*="-col-9-nm-np"],[class*="-col-9-np-nm"]{width: 75%}
130+
131+
[class*="-col-10"]{width: 82.33333333%}
132+
[class*="-col-10-nm"]{width: 83.33333333%}
133+
[class*="-col-10-nm-np"],[class*="-col-10-np-nm"]{width: 83.33333333%}
134+
135+
[class*="-col-11"]{width: 90.66666666%}
136+
[class*="-col-11-nm"]{width: 91.66666666%}
137+
[class*="-col-11-nm-np"],[class*="-col-11-np-nm"]{width: 91.66666666%}
138+
139+
[class*="-col-12"]{width: 99%}
140+
[class*="-col-12-nm"]{width: 100%}
141+
[class*="-col-12-nm-np"],[class*="-col-12-np-nm"]{width: 100%}

tests/xhrTest.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,15 @@ xhr.onreadystatechange = function(){
5353
}
5454
}
5555
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
56-
xhr.send('')
56+
xhr.send('')
57+
58+
+-------------
59+
var xhr = new XMLHttpRequest();
60+
xhr.open('post','http://localhost/generic-php/AccessAPIs/update-user-privileges')
61+
xhr.onreadystatechange = function(){
62+
if(this.readyState === 4){
63+
console.log(this.responseText);
64+
}
65+
}
66+
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
67+
xhr.send('user-id=1&privileges-string=LOGIN-1;')

0 commit comments

Comments
 (0)