本文整理汇总了PHP中Role::hasRole方法的典型用法代码示例。如果您正苦于以下问题:PHP Role::hasRole方法的具体用法?PHP Role::hasRole怎么用?PHP Role::hasRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Role
的用法示例。
在下文中一共展示了Role::hasRole方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: moveStock
public static function moveStock($prod_id, $jumlah, $minus = 1, $note = "", $po_id = 0)
{
$prod = new ProdModel();
$prod->getByID($prod_id);
//isi log
$ps = new ProdStok();
$ps->stok_date = leap_mysqldate();
$ps->stok_prev = $prod->prod_stock;
$ps->stok_po_id = $po_id;
$ps->stok_prod_id = $prod->prod_id;
$ps->stok_userid = Account::getMyID();
if ($minus) {
//kurangi stok
$prod->prod_stock -= $jumlah;
} else {
//kurangi stok
$prod->prod_stock += $jumlah;
}
$prod->load = 1;
$prod->save();
if (Role::hasRole('admin')) {
$ps->stock_admin = 1;
}
$ps->stock_note = $note;
$ps->stok_actual = $prod->prod_stock;
if ($ps->stok_prev > $ps->stok_actual) {
$ps->stok_debit_credit = 1;
} else {
$ps->stok_debit_credit = 0;
}
return $ps->save();
}
示例2: printMenuMobile
//.........这里部分代码省略.........
echo $text;
?>
</a>
</li>
<?php
} else {
?>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><?php
echo $text;
?>
<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="<?php
echo _SPPATH;
?>
tools?mode=email">TBS Email</a></li>
<li><a href="<?php
echo _SPPATH;
?>
tools?mode=wikipedia">TBS Wikipedia</a></li>
<li><a href="<?php
echo _SPPATH;
?>
km">TBS Knowledge</a></li>
<li><a href="<?php
echo _SPPATH;
?>
webapps">TBS Apps</a></li>
</ul>
</li>
<?php
}
?>
<?php
}
if (Auth::isLogged()) {
?>
<hr>
<?php
/* <li>
<a class="admin-button-mobile" href="<?= _SPPATH; ?>order"><?= Lang::t('cart'); ?></a>
</li>
<li>
<a class="admin-button-mobile" href="<?= _SPPATH; ?>myorder"><?= Lang::t('order history'); ?></a>
</li>*/
?>
<li>
<a class="admin-button-mobile" href="<?php
echo _SPPATH;
?>
p/user/<?php
echo Account::getMyID();
?>
"><?php
echo Lang::t('profil');
?>
</a>
</li>
<li>
<a class="admin-button-mobile" href="<?php
echo _SPPATH;
?>
logout"><?php
echo Lang::t('keluar');
?>
</a>
</li>
<?php
} else {
?>
<hr>
<li>
<a class="admin-button-mobile" href="<?php
echo _SPPATH;
?>
register"><?php
echo Lang::t('masuk');
?>
</a>
</li>
<?php
}
//echo Role::hasRole("admin");
if (Role::hasRole("admin")) {
?>
<hr>
<li>
<a class="admin-button-mobile" href="<?php
echo _SPPATH;
?>
EfiHome/home"><?php
echo Lang::t('Admin');
?>
</a>
</li>
<?php
}
}
示例3:
?>
myprofile">
<i class="glyphicon glyphicon-user"></i>
</a>
<a title="<?php
echo PortalHierarchy::getMyOrganizationName();
?>
Page" style="margin-left:5px;color:white; margin-top: 3px;" href="<?php
echo _SPPATH;
?>
mydepartment">
<i class="glyphicon glyphicon-tree-deciduous"></i>
</a>
<?php
if (Role::hasRole("admin")) {
?>
<a title="Administrator Site" style="color:white; margin-top: 3px; " href="<?php
echo _SPPATH;
?>
EfiHome/home">
<i class="glyphicon glyphicon-tasks"></i>
</a>
<?php
}
?>
<a title="Log Out" style="color:white; margin-top: 3px;" href="<?php
echo _SPPATH;
?>
示例4: printTreeRecursive
function printTreeRecursive($startNode, $anak2)
{
if (count($anak2[$startNode]) > 0) {
?>
<ul <?php
if ($startNode === 0) {
?>
class="nav navbar-nav navbar-right"<?php
} else {
?>
class="dropdown-menu"<?php
}
?>
>
<?php
foreach ($anak2[$startNode] as $n => $o) {
//drop down
if (count($anak2[$o->menu_id]) > 0) {
?>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<?php
echo $o->menu_name;
?>
<span class="caret"></span></a>
<?php
$this->printTreeRecursive($o->menu_id, $anak2);
?>
</li>
<?php
} else {
if ($o->menu_submenu_titletext != "" && $o->menu_submenu_titletext != $this->active_submenu_title) {
$this->active_submenu_title = $o->menu_submenu_titletext;
?>
<li role="separator" class="divider"></li>
<li class="dropdown-header"><?php
echo Lang::t($o->menu_submenu_titletext);
?>
</li>
<?php
}
if (strpos($URL, "http://")) {
$URL = $o->menu_link;
} else {
$URL = _LANGPATH . $o->menu_link;
}
?>
<li>
<a href="<?php
echo $URL;
?>
"><?php
echo $o->menu_name;
?>
</a></li>
<?php
}
}
?>
<?php
if ($startNode === 0) {
?>
<li>
<div style="padding-top: 7px;">
<?php
Lang::picker();
?>
</div>
</li>
<?php
if (Auth::isLogged() && Role::hasRole('admin')) {
?>
<li>
<?php
global $backEndClass;
?>
<a href="<?php
echo _LANGPATH . $backEndClass;
?>
/home">BE</a>
</li>
<?php
}
}
?>
</ul>
<?php
}
}
示例5: printMenuMobile
public static function printMenuMobile()
{
?>
<style>
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus{
color:#fff;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a{
color:#fff;
}
</style>
<?php
$menu = self::$menus;
//pr($menu);
$menu2 = array_reverse($menu);
foreach ($menu as $text => $m) {
if ($m != "tools") {
?>
<li>
<a href="<?php
echo _SPPATH . $m;
?>
"><?php
echo $text;
?>
</a>
</li>
<?php
} else {
?>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><?php
echo $text;
?>
<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="<?php
echo _SPPATH;
?>
tools?mode=email">TBS Email</a></li>
<li><a href="<?php
echo _SPPATH;
?>
tools?mode=wikipedia">TBS Wikipedia</a></li>
<li><a href="<?php
echo _SPPATH;
?>
km">TBS Knowledge</a></li>
<li><a href="<?php
echo _SPPATH;
?>
webapps">TBS Apps</a></li>
</ul>
</li>
<?php
}
?>
<?php
}
?>
<?php
if (Role::hasRole("admin")) {
?>
<li>
<a class="admin-button-mobile" href="<?php
echo _SPPATH;
?>
EfiHome/home"><?php
echo Lang::t('Admin');
?>
</a>
</li>
<?php
}
}
示例6: my
public function my()
{
$cartModel = new CartModel();
$id = Account::getMyID();
if (Role::hasRole('admin')) {
if ($_GET['id'] != "") {
$id = addslashes($_GET['id']);
}
}
if ($id < 1) {
die('Err');
}
//paymentstatus != deleted
$arr = $cartModel->getWhere("userid = '{$id}' AND payment_status != 4 ORDER BY po_date DESC");
// pr($arr);
?>
<h1 class="beli" style="padding-bottom: 30px;">Order History</h1>
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>Tanggal</th>
<th>Value</th>
<th>Action</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<?php
foreach ($arr as $cartModel) {
?>
<tr>
<td><?php
echo indonesian_date($cartModel->po_date);
?>
</td>
<td style="text-align: right;">Rp.<?php
echo rupiah($cartModel->total_cost);
?>
</td>
<td>
<a target="blank" href="<?php
echo _SPPATH;
?>
cartorder/details?po=<?php
echo $cartModel->po_id;
?>
">lihat details</a><br>
<a target="blank" href="<?php
echo _SPPATH;
?>
ordersuccesspage?po=<?php
echo $cartModel->po_id;
?>
">cara pembayaran</a>
</td>
<td><?php
echo $this->arrStatus[$cartModel->payment_status];
?>
</td>
<td>
<?php
if ($cartModel->payment_status == 0) {
?>
<button onclick="if(confirm('Delete PO Anda ?'))document.location='<?php
echo _SPPATH;
?>
CartOrder/deleteOrder?po=<?php
echo $cartModel->po_id;
?>
';">Delete Order</button>
<?php
}
?>
</td>
</tr>
<?php
}
?>
</table>
</div>
<?php
}