当前位置: 首页>>代码示例>>PHP>>正文


PHP UserSession::getInstance方法代码示例

本文整理汇总了PHP中UserSession::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP UserSession::getInstance方法的具体用法?PHP UserSession::getInstance怎么用?PHP UserSession::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserSession的用法示例。


在下文中一共展示了UserSession::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: findAll

 public function findAll($qbuilder)
 {
     if (UserSession::getInstance()->getAccessLevel() < 3) {
         die("<h1>Forbidden resource for you.</h1>");
     }
     @($dao = new DAO(TestLog));
     if (!isset($qbuilder)) {
         $qbuilder = new QueryBuilder('testlog');
         $qbuilder->addOrder("tsl_tst_id", QueryBuilder::$DESC);
         $qbuilder->addOrder("usr_name", QueryBuilder::$ASC, 'user');
         $qbuilder->addOrder("tsl_time", QueryBuilder::$DESC);
         $qbuilder->addOrder("tsl_remoteAddr", QueryBuilder::$ASC);
     }
     $qbuilder->addJoin("user", "tsl_usr_id", "usr_id");
     $qbuilder->addJoin("test", "tsl_tst_id", "tst_id");
     $tlogs = $dao->findByQuery($qbuilder);
     return $tlogs;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:18,代码来源:TestLogBS.php

示例2: __construct

 public function __construct($testId, $password)
 {
     $this->user = UserSession::getInstance()->getUser();
     $this->testId = $testId;
     $this->password = $password;
     $tprbBS = new TestProblemsBS(null);
     $qbuilder = new QueryBuilder('testproblems');
     $qbuilder->addEqual("tpb_tst_id", $testId);
     $qbuilder->addOrder("tpb_questionNumber", QueryBuilder::$ASC);
     $this->problems = $tprbBS->findNotDeleted($qbuilder);
     $testBS = new TestBS(null);
     $qbuilder = new QueryBuilder('test');
     $qbuilder->addEqual("tst_id", $testId);
     $qbuilder->addEqual("tst_password", $password);
     $tests = $testBS->findNotDeleted($qbuilder);
     if (count($tests) < 1) {
         die("<h3>ACESSO NEGADO</h3>");
     }
     $this->test = $tests[0];
     $ttrialBS = new TestTrialBS(null);
     $ttrialBS->createUserTrials($this->problems);
     $qbuilder = new QueryBuilder('testtrial');
     $qbuilder->addEqual("ttl_tst_id", $testId);
     $qbuilder->addEqual("ttl_usr_id", $this->user->get('usr_id'));
     $trials = $ttrialBS->findNotDeleted($qbuilder);
     $this->trials = array();
     if (count($trials) > 0) {
         foreach ($trials as $t => $trial) {
             $this->trials[$trial->get('ttl_prb_id')] = $trial;
         }
     }
     // Gravando log
     if ($this->test->get("tst_enableLogging") != 0) {
         $testBS->logAction($this->user->get('usr_id'), $this->testId, "Usuário abriu a prova.");
     }
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:36,代码来源:TestTryView.php

示例3: findAll

 public function findAll($qbuilder)
 {
     if (UserSession::getInstance()->getAccessLevel() < 5) {
         die("<h1>Forbidden resource for you.</h1>");
     }
     @($dao = new DAO(Discipline));
     if (!isset($qbuilder)) {
         $qbuilder = new QueryBuilder('discipline');
         $qbuilder->addOrder("dsc_code", QueryBuilder::$ASC);
         $qbuilder->addOrder("dsc_name", QueryBuilder::$ASC);
     }
     $disciplines = $dao->findByQuery($qbuilder);
     return $disciplines;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:14,代码来源:DisciplineBS.php

示例4: __construct

 public function __construct()
 {
     $this->session = UserSession::getInstance();
 }
开发者ID:jamiezyx,项目名称:MorpheusPets,代码行数:4,代码来源:ViewModel.php

示例5: _before

 protected function _before()
 {
     $this->userSession = UserSession::getInstance();
 }
开发者ID:Endymion1977,项目名称:phonebook,代码行数:4,代码来源:AbstractSessionStorageTest.php

示例6: UserEdit

<?php

$__REQUIRED_ACCESS_LEVEL__ = 1;
$__REDIRECT_TO__ = "./";
include "static/header.php";
?>

<h1>Dados de Usuário</h1>

<p>
	Nesta janela você pode alterar/visualizar os dados do seu cadastro.
</p>

<?php 
include "view/UserEdit.php";
$widget = new UserEdit(UserSession::getInstance()->getUser());
$widget->render();
?>

<?php 
include "static/footer.php";
开发者ID:renatorroliveira,项目名称:algod,代码行数:21,代码来源:profile.php

示例7: findAll

 public function findAll($qbuilder)
 {
     if (UserSession::getInstance()->getAccessLevel() < 3) {
         die("<h1>Forbidden resource for you.</h1>");
     }
     @($dao = new DAO(Test));
     if (!isset($qbuilder)) {
         $qbuilder = new QueryBuilder('test');
         $qbuilder->addOrder("dsc_code", QueryBuilder::$ASC, 'discipline');
         $qbuilder->addOrder("tst_title", QueryBuilder::$ASC);
     }
     $qbuilder->addJoin("discipline", "tst_dsc_id", "dsc_id");
     $qbuilder->addLeftJoin("testproblems", "tst_id", "tpb_tst_id");
     $qbuilder->addGroupBy("tst_id", "test");
     $tests = $dao->findByQueryWithMetaFields($qbuilder);
     return $tests;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:17,代码来源:TestBS.php

示例8: findAll

 public function findAll($qbuilder)
 {
     if (UserSession::getInstance()->getAccessLevel() < 3) {
         die("<h1>Forbidden resource for you.</h1>");
     }
     @($dao = new DAO(EvaluationCase));
     if (!isset($qbuilder)) {
         $qbuilder = new QueryBuilder('evaluationcase');
         $qbuilder->addOrder("prb_title", QueryBuilder::$ASC, 'discipline');
         $qbuilder->addOrder("evc_id", QueryBuilder::$ASC);
     }
     $qbuilder->addJoin("problem", "evc_prb_id", "prb_id");
     $ecases = $dao->findByQuery($qbuilder);
     return $ecases;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:15,代码来源:EvaluationCaseBS.php

示例9: renderNotDeleted

        public function renderNotDeleted()
        {
            $bs = new DisciplineBS(null);
            $disciplines = $bs->findNotDeleted(null);
            if (count($disciplines) <= 0) {
                ?>
					<br/><i>Nenhuma disciplina cadastrada ainda.</i><br />
				<?php 
            } else {
                $wdg = new DisciplineEdit(new Discipline());
                $wdg->renderWithJSFieldsObject();
                ?>
					<script type="text/javascript">
					function editDiscipline(id, code, name) {
						DisciplineEdit_form.id.val(id);
						DisciplineEdit_form.code.val(code);
						DisciplineEdit_form.name.val(name);
						DisciplineEdit_form.dialogCt.dialog({
							modal:true,
							title: "Editar Disciplina",
							width: 'auto',
							height: 'auto',
							buttons: {
								Cancel: function(){
									$(this).dialog("close");
								}
							}
						});
					}
					function deleteDiscipline(id) {
						if (confirm("Deseja realmente excluir esta disciplina?")) {
							$("#dicipline-action-form input[name='_action']").val("delete");
							$("#dicipline-action-form input[name='dsc_id']").val(id);
							$("#dicipline-action-form").submit();
						}
					}
					</script>
					<form method="POST" action="./controller/DisciplineController.php" style="display:none;"
					id="dicipline-action-form">
						<input type="hidden" name="_action" />
						<input type="hidden" name="dsc_id" />
					</form>
					<table class="dataView">
					<tr>
						<th>Código</th>
						<th>Nome</th>
						<th style="min-width: 60px;width: 60px;max-width: 60px;">Ações</th>
					</tr>
					<?php 
                foreach ($disciplines as $d => $discipline) {
                    ?>
						<tr class="color<?php 
                    echo $d % 2;
                    ?>
">
							<td><?php 
                    echo $discipline->get('dsc_code');
                    ?>
</td>
							<td><?php 
                    echo $discipline->get('dsc_name');
                    ?>
</td>
							<td class="actions">
							<?php 
                    if ($discipline->get("dsc_usr_id") == UserSession::getInstance()->getUser()->get('usr_id')) {
                        ?>
								<span class="ui-state-default ui-corner-all" title="Editar Disciplina"
								onClick="editDiscipline(<?php 
                        echo "'" . $discipline->get('dsc_id') . "'";
                        echo ",'" . $discipline->get('dsc_code') . "'";
                        echo ",'" . $discipline->get('dsc_name') . "'";
                        ?>
);">
									<span class="ui-icon ui-icon-pencil"></span>
								</span>
								<span class="ui-state-default ui-corner-all" title="Excluir Disciplina"
								onClick="deleteDiscipline(<?php 
                        echo $discipline->get('dsc_id');
                        ?>
)">
									<span class="ui-icon ui-icon-trash"></span>
								</span>
							<?php 
                    }
                    ?>
							</td>
						</tr>
					<?php 
                }
                ?>
				</table>
				<?php 
            }
        }
开发者ID:renatorroliveira,项目名称:algod,代码行数:95,代码来源:DisciplineList.php

示例10: update

 protected function update($user)
 {
     @($dao = new DAO(User));
     $qbuilder = new QueryBuilder('user');
     $qbuilder->addEqual('usr_id', $user->get('usr_id'));
     $existent = $dao->findByQuery($qbuilder);
     if (count($existent) != 1) {
         die("<h1>Usuário inválido.</h1>");
     }
     $existent = $existent[0];
     if (!isset($existent)) {
         die("<h1>Usuários não existe.</h1>");
     }
     if ($existent->get('usr_id') != UserSession::getInstance()->getUser()->get("usr_id")) {
         if ($existent->get('usr_accessLevel') >= UserSession::getInstance()->getAccessLevel()) {
             die("<h1>Forbidden resource for you.</h1>");
         }
     } else {
         if ($user->get('usr_accessLevel') > UserSession::getInstance()->getAccessLevel()) {
             $user->set('usr_accessLevel', UserSession::getInstance()->getAccessLevel());
         }
     }
     $user->set('usr_confirmationCode', sha1($user->get('usr_id') . $user->get('usr_email') . $user->get('usr_accessLevel')));
     $status = $dao->update($user);
     if ($status !== true) {
         die("Um erro ocorreu ao tentar atualizar o usuário, favor contatar um professor:<br />" . $status);
     }
     return true;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:29,代码来源:UserBS.php

示例11: UserTestsList

<?php

// Nelson Haha! Haha!
//	header("Location: /algod/nelson.html");
$__REQUIRE_ACCESS_LEVEL__ = 1;
$__REDIRECT_TO__ = './login.php';
include "static/header.php";
?>

<h1>Minhas Provas</h1>

<?php 
include "view/UserTestsList.php";
$wdg = new UserTestsList(UserSession::getInstance()->getUser());
$wdg->render();
?>

<?php 
include "static/footer.php";
开发者ID:renatorroliveira,项目名称:algod,代码行数:19,代码来源:testsMine.php

示例12: findAll

 public function findAll($qbuilder)
 {
     if (UserSession::getInstance()->getAccessLevel() < 3) {
         die("<h1>Forbidden resource for you.</h1>");
     }
     @($dao = new DAO(TestProblems));
     if (!isset($qbuilder)) {
         $qbuilder = new QueryBuilder('testproblems');
         $qbuilder->addOrder("tst_title", QueryBuilder::$ASC, 'test');
         $qbuilder->addOrder("tpb_questionNumber", QueryBuilder::$ASC);
         $qbuilder->addOrder("prb_title", QueryBuilder::$ASC, 'problem');
     }
     $qbuilder->addJoin("test", "tpb_tst_id", "tst_id");
     $qbuilder->addJoin("problem", "tpb_prb_id", "prb_id");
     $tproblems = $dao->findByQuery($qbuilder);
     return $tproblems;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:17,代码来源:TestProblemsBS.php

示例13: findAll

 public function findAll($qbuilder)
 {
     if (UserSession::getInstance()->getAccessLevel() < 3) {
         die("<h1>Forbidden resource for you.</h1>");
     }
     @($dao = new DAO(Problem));
     if (!isset($qbuilder)) {
         $qbuilder = new QueryBuilder('problem');
         $qbuilder->addOrder("dsc_code", QueryBuilder::$ASC, 'discipline');
         $qbuilder->addOrder("prb_difficultyLevel", QueryBuilder::$ASC);
         $qbuilder->addOrder("prb_title", QueryBuilder::$ASC);
     }
     $qbuilder->addJoin("discipline", "prb_dsc_id", "dsc_id");
     $qbuilder->addLeftJoin("evaluationcase", "prb_id", "evc_prb_id");
     $qbuilder->addGroupBy("prb_id", "problem");
     $problems = $dao->findByQueryWithMetaFields($qbuilder);
     return $problems;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:18,代码来源:ProblemBS.php

示例14: TestOpenedList

<?php

include "static/header.php";
?>

<h1>Bem vindo ao AlGod!</h1>

<p>Encontre a prova que deseja fazer e clique em Fazer a Prova.</p>
<p>
Uma senha de acesso será solicitada para realizar cada prova.
Essa senha será fornecida pelo professor da disciplina no momento
em que a prova iniciar.
</p>


<h3>Provas em Aberto:</h3>

<?php 
if (UserSession::getInstance()->isLogged() === true) {
    include "view/TestOpenedList.php";
    $wdg = new TestOpenedList();
    $wdg->renderNotDeleted();
} else {
    echo "<br /><i>Faça login para ver as provas.</i><br />";
}
?>
<br />
<?php 
include "static/footer.php";
开发者ID:renatorroliveira,项目名称:algod,代码行数:29,代码来源:index.php

示例15: checkModule

 protected function checkModule()
 {
     if (Config::exists('modules.Session.User.enabled')) {
         if (Config::read('modules.Session.User.enabled') === true) {
             $this->User = UserSession::getInstance();
         }
     } else {
         if (Config::exists('modules.Session.enabled')) {
             if (Config::read('modules.Session.User.enabled') === true) {
                 $this->Session = Session::getInstance();
             }
         }
     }
 }
开发者ID:Nivl,项目名称:Ninaca_1,代码行数:14,代码来源:Controller.class.php


注:本文中的UserSession::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。