Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1083827
TYPProfileDetail.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Subscribers
None
TYPProfileDetail.php
View Options
<?php
namespace
Drupal\typ_profile\Plugin\Block
;
/**
* @file
* Contains \Drupal\search\Plugin\Block\SearchBlock.
*/
use
Drupal\Core\Block\BlockBase
;
use
Drupal\Core\Url
;
use
Drupal\typ_legacy\Service\TYPLegacyLandingPageService
;
use
Drupal\typ_search\Service\TYPSearchService
;
use
Drupal\typ_legacy\Serivee
;
use
Drupal\Core\Access\AccessResult
;
/**
* Provides a 'Search form' block.
*
* @Block(
* id = "typ_profile_detail_more",
* admin_label = @Translation("Profile Detail more"),
* category = @Translation("TYP")
* )
*/
class
TYPProfileDetail
extends
BlockBase
{
public
function
getCacheMaxAge
()
{
return
0
;
// NOCACHE!
}
static
$data
;
static
$result
;
static
$datashow
;
public
function
blockAccess
(
\Drupal\Core\Session\AccountInterface
$account
)
{
$url
=
\Drupal
::
request
()->
getRequestUri
();
$s
=
explode
(
"/"
,
$url
);
$bid
=
end
(
$s
);
$data
=
self
::
$data
=
\Drupal
::
service
(
"typ.search"
)->
getProfile
(
$bid
,
AUTO
);
$temp
=
array
();
if
(!
empty
(
$data
[
'paymentmethod'
])){
$temp
[
'paymentmethod'
]
=
$data
[
'paymentmethod'
];
}
if
(!
empty
(
$data
[
'atmosphere'
])){
$temp
[
'atmosphere'
]
=
$data
[
'atmosphere'
];
}
if
(!
empty
(
$data
[
'standard'
])){
$temp
[
'standard'
]
=
$data
[
'standard'
];
}
if
(!
empty
(
$data
[
'amentity'
])){
$temp
[
'amentity'
]
=
$data
[
'amentity'
];
}
if
(!
empty
(
$data
[
'rating'
])){
$temp
[
'rating'
]
=
$data
[
'rating'
];
}
if
(!
empty
(
$data
[
'duration'
])){
$temp
[
'duration'
]
=
$data
[
'duration'
];
}
if
(!
empty
(
$data
[
'landmark'
])){
$temp
[
'landmark'
]
=
$data
[
'landmark'
];
}
self
::
$datashow
=
$temp
;
if
(
$data
[
'customertype'
]
!=
'FL'
&&
!
empty
(
$temp
)){
return
AccessResult
::
allowed
();
}
else
{
return
AccessResult
::
forbidden
();
}
}
public
function
build
(){
$result
=
self
::
$datashow
;
$html
=
''
;
$star
=
'<span class="glyphicon glyphicon-star" aria-hidden="true"></span> '
;
$star_empty
=
'<span class="glyphicon glyphicon-star-empty" aria-hidden="true"></span> '
;
if
(!
empty
(
$result
[
'landmark'
])){
$html
.=
'<p class="orange_font">'
.
t
(
'Landmark'
)
.
':</p>
<p class="gray_font">'
.
$result
[
'landmark'
]
.
'</p>'
;
}
if
(!
empty
(
$result
[
'paymentmethod'
]))
{
$html
.=
'<p class="orange_font">'
.
t
(
'Payment'
)
.
':</p>
<p class="gray_font">'
.
$result
[
'paymentmethod'
]
.
'</p>'
;
}
if
(!
empty
(
$result
[
'rating'
]))
{
$num
=
intval
(
substr
(
$result
[
'rating'
],
0
,
1
));
$rateing
=
''
;
for
(
$i
=
1
;
$i
<=
5
;
$i
++){
if
(
$i
<=
$num
){
$rateing
.=
$star
;
}
else
{
$rateing
.=
$star_empty
;
}
}
$html
.=
'<p class="orange_font">'
.
t
(
'Rating'
)
.
': '
.
$rateing
.
'</p>'
;
}
if
(!
empty
(
$result
[
'standard'
])){
$html
.=
'<p class="orange_font">'
.
t
(
'Standard'
).
':</p>
<p class="gray_font">'
.
$result
[
'standard'
].
'</p>'
;
}
if
(!
empty
(
$result
[
'atmosphere'
])){
$html
.=
'<p class="orange_font">'
.
t
(
'Atmosphere'
).
':</p>
<p class="gray_font">'
.
$result
[
'atmosphere'
].
'</p>'
;
}
if
(
empty
(
$result
[
'duration'
])){
if
(!
empty
(
$result
[
'amentity'
]))
{
$result
[
'duration'
]
=
$result
[
'amentity'
];
}
}
if
(!
empty
(
$result
[
'duration'
])){
$html
.=
'<p class="orange_font">'
.
t
(
'Facilities'
).
':</p>
<p class="gray_font">'
.
$result
[
'duration'
].
'</p>'
;
}
$data
=
'<div class="col-xs-12 col-md-12 col-lg-12 text-left profile_share_title">
'
.
t
(
'More details'
).
'
</div>
<div class="col-xs-12 col-md-12 col-lg-12 form-inline text-left profile_share" style="padding:10px 10px 10px 6px;">
<div class="col-xs-12 col-md-12 col-lg-12">'
.
$html
.
'</div>
</div>'
;
if
(
empty
(
$result
)
||
is_null
(
$result
)){
$data
=
''
;
}
// echo "<PRE>";var_export($result);exit;
$build
=
array
();
$build
[]
=
array
(
'#markup'
=>
$data
,
);
$build
[
'#attached'
][
'library'
]
=
array
(
'typ_profile/profile_share'
);
return
$build
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Dec 25, 10:46 AM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
193032
Attached To
rPF typ_profile
Event Timeline
Log In to Comment