PHP Method User::getAdmin, codiad Code Examples

This page contains top rated real world PHP examples of method User::getAdmin from package codiad extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: page.class.php Project: Keshaun1222/IRIN
0
 /**
  * @param User $user
  * @return Page[]
  */
 public static function getPages(User $user)
 {
     global $mysqli;
     $pages = array();
     $query = $mysqli->query("SELECT * FROM pages ORDER BY id");
     while ($result = $query->fetch_array()) {
         if ($result['clearance'] > 0 && $user->getClearance() && $user->getClearance()->getClearance() >= $result['clearance'] || ($result['admin'] > 0 && $result['team'] != 0 && ($user->getAdmin() && $user->getAdmin()->getAdminLevel() >= $result['admin'] && in_array(new Division($result['team']), $user->getAdmin()->getTeams()) || $user->getAdmin() && $user->getAdmin()->getAdminLevel() > $result['admin'] + 1) || $user->getAdmin() && $user->getAdmin()->getAdminLevel() > 3) || $user->getAdmin() && $user->getAdmin()->getAdminLevel() >= $result['admin'] && $result['team'] == 0 || $result['clearance'] == 0 && $result['admin'] == 0) {
             $pages[] = new self($result['name'], $result['desc'], $result['title'], $result['page']);
         }
     }
     return $pages;
 }
Example #2
Show file File: codegen.class.php Project: Keshaun1222/IRIN
0
 public static function generateCode(User $user)
 {
     $rand = rand(100, 999);
     $date = date('mdy');
     $name = strtoupper($user->getName()[0] . $user->getName()[1]);
     $abbrev = '';
     foreach (explode(' ', $user->getAdmin()->getAdminRank()) as $word) {
         $abbrev .= strtoupper($word[0]);
     }
     return $date . $name . $abbrev . $rand;
 }
Example #3
Show file File: rank.class.php Project: Keshaun1222/IRIN
0
 /**
  * @param User $user
  * @return array
  */
 public static function getRanks(User $user)
 {
     global $mysqli;
     $ranks = array();
     $query = $mysqli->query("SELECT * FROM ranks");
     while ($result = $query->fetch_array()) {
         $rank = new self($result['id']);
         if ($user->getAdmin() || $user->isThrone() || $user->isDivCommand() && ($user->getDivision()->isSame($rank->getDivision()) || $user->getDivision()->isAbove($rank->getDivision()))) {
             $ranks[] = $rank;
         }
     }
     return $ranks;
 }
Example #4
Show file File: user.class.php Project: Keshaun1222/IRIN
0
 /**
  * @param Division $div
  * @param User $user
  * @return User[]
  */
 public static function getTeamUsers(Division $div, User $user)
 {
     global $mysqli;
     $users = array();
     $query = $mysqli->query("SELECT * FROM users INNER JOIN admin ON users.id = admin.userid WHERE users.id <> 0 AND (users.division = {$div->getDivision()} OR users.division = 0 OR admin.teams LIKE '%{$div->getDivision()}%') ORDER BY users.id");
     while ($result = $query->fetch_array()) {
         $other = new User($result['id']);
         if ($other->getAdmin()->getAdminLevel() <= $user->getAdmin()->getAdminLevel()) {
             $users[] = $other;
         }
     }
     return $users;
 }
Example #5
Show file File: dashboard.php Project: KiriyaKeiji/projectxyz
0
<?php

if (empty($_COOKIE['type']) or $_COOKIE['type'] != 'admin') {
    header('location: ../index.php');
}
require_once '../lib/user.php';
$user = new User();
$rs = $user->getAdmin($_COOKIE['id']);
setcookie("name", $rs[0]['name'], time() + 3600, '/');
setcookie("department", $rs[0]['department'], time() + 3600, '/');
require_once '../models/pelaporan.php';
$Pelaporan = new Pelaporan();
$reports = $Pelaporan->getReportbyTujuan($_COOKIE['department']);
require_once 'header.php';
require_once 'sidebar.php';
?>


        <div id="page-wrapper">

            <div class="container-fluid">

                <!-- Page Heading -->
                <div class="row">
                    <div class="col-lg-12">
                        <h1 class="page-header">
                            Dashboard <small>Report Overview</small>
                        </h1>
                        <ol class="breadcrumb">
                            <li class="active">
                                <i class="fa fa-dashboard"></i> Dashboard
Example #6
Show file File: app.php Project: AbeerKhakwani/attending-
0
//create user
$app->get("/create_user", function () use($app) {
    return $app['twig']->render('create_user.twig', array('user_id' => $_SESSION['user_id'], 'exists' => 0, 'is_admin' => $_SESSION['is_admin']));
});
//create user post route,
//will render profile page if user doesn't already exist,
//will render "create user" page with error msg if user exists already
$app->post("/create_user", function () use($app) {
    $user = null;
    $exists = User::checkIfExists($_POST['username']);
    if ($exists == 0) {
        $user = new User($_POST['username'], $_POST['password'], 0, 0);
        $user->save();
        $new_user_id = $user->getId();
        $_SESSION['user_id'] = $new_user_id;
        $new_user_is_admin = $user->getAdmin();
        $_SESSION['is_admin'] = $new_user_is_admin;
    } else {
        return $app['twig']->render('create_user.twig', array('user_exist' => $user, 'user_id' => $_SESSION['user_id'], 'exists' => $exists, 'is_admin' => $_SESSION['is_admin']));
    }
    return $app['twig']->render('user.twig', array('user' => $user, 'user_id' => $_SESSION['user_id'], 'exists' => $exists, 'is_admin' => $_SESSION['is_admin']));
});
$app->post("/logout", function () use($app) {
    $_SESSION['user_id'] = null;
    $user = User::find($_SESSION['user_id']);
    return $app['twig']->render('main.twig', array('user_id' => $_SESSION['user_id'], 'user' => $user));
});
$app->post("/login", function () use($app) {
    $username = $_POST['signin_username'];
    $password = $_POST['user_password'];
    $user = User::authenticatePassword($username, $password);
Example #7
Show file File: survey_admin.php Project: tttodorov13/suSurvey
0
    ?>
"></span>
                        </a>
                    </td>
                    <td class="ac">
                        <a href="#" class="button">
                            <span class="<?php 
    $user->getCanAsk() == 1 ? print_r('tick') : print_r('delete');
    ?>
"></span>
                        </a>
                    </td>
                    <td class="ac">
                        <a href="#" class="button"s>
                            <span class="<?php 
    $user->getAdmin() == 1 ? print_r('tick') : print_r('delete');
    ?>
"></span>
                        </a>
                    </td>
                </tr>
                <?php 
}
?>
        </tbody>
    </table>
</div>
<br/>
<div class="ac">
    <div class="ac">
        <div class="action no-margin ac ui-widget">
Example #8
Show file File: header.php Project: KazakovVS/Store
0
echo Cart::countItems();
?>
</span>)
                                            </a>
                                        </li>
                                        <?php 
if (User::isGuest()) {
    ?>
                                        
                                            <li><a href="/user/login/"><i class="fa fa-lock"></i> Вход</a></li>
                                            <li><a href="/user/register/"><i class="fa fa-lock"></i> Регистрация</a></li>
                                        <?php 
} else {
    ?>
                                            <?php 
    if (User::getAdmin()) {
        ?>
                                                <li><a href="/admin/"><i class="fa fa-user"></i> АдминПанель</a></li>
                                            <?php 
    }
    ?>
                                            <li><a href="/cabinet/"><i class="fa fa-user"></i> Аккаунт</a></li>
                                            <li><a href="/user/logout/"><i class="fa fa-unlock"></i> Выход</a></li>
                                        <?php 
}
?>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
Example #9
Show file File: Export.php Project: jv10/pimpon
0
 private static function isAdmin(User $user)
 {
     return $user->getAdmin() === self::ADMIN;
 }
Example #10
Show file File: admin.php Project: Keshaun1222/IRIN
0
                            array_unshift($teams, $primary);
                        }
                        $user->getAdmin()->update($rank, $teams);
                        echo 'true';
                    }
                }
            }
        } else {
            if ($action == 'remove') {
                if ($do == 'none') {
                    ?>
        <a onclick="load('admin', 'remove', 'remove', {id: '<?php 
                    echo $_GET['id'];
                    ?>
'})">Continue?</a> (<b>NOTE:</b> This action cannot be reversed!)
        <?php 
                } else {
                    if ($do == 'remove') {
                        $user = new User($_GET['id']);
                        $user->getAdmin()->remove();
                        ?>
        <script>
            load('admin', 'none', 'none', {});
        </script>
        <?php 
                    }
                }
            }
        }
    }
}
Example #11
Show file File: document.class.php Project: Keshaun1222/IRIN
0
 /**
  * Get Documents. Only return documents that the user has access to (i.e. They've either made the document, been assigned to the document, or they're either an Admin or a member of the Throne.)
  * @param User $user
  * @return Document[]
  */
 public static function getDocuments(User $user)
 {
     global $mysqli;
     $docs = array();
     $query = $mysqli->query("SELECT id FROM documents ORDER BY date DESC");
     while ($result = $query->fetch_array()) {
         $doc = new self($result['id']);
         if ($user->getAdmin() || $user->isThrone() || $doc->isCreator($user) || $doc->isAssigned($user)) {
             $docs[] = $doc;
         }
     }
     return $docs;
 }
Example #12
Show file File: Page.php Project: rosko/Tempo-CMS
0
 public function install()
 {
     $obj = new self();
     $obj->title = Yii::t('cms', 'Homepage');
     $langs = array_keys(I18nActiveRecord::getLangs(Yii::app()->language));
     foreach ($langs as $lang) {
         $obj->{$lang . '_title'} = Yii::t('cms', 'Homepage', array(), null, $lang);
     }
     $obj->active = true;
     $obj->author_id = User::getAdmin()->id;
     $obj->create = new CDbExpression('NOW()');
     $obj->parent_id = 0;
     $obj->order = 0;
     $obj->save(false);
 }