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


PHP CUser::getName方法代码示例

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


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

示例1: getMenu

 public static function getMenu()
 {
     $name = null;
     $user = null;
     if (CUser::isAuthenticated()) {
         $name = CUser::getName();
         $user = "<li><a href='#'>Användare</a>\n                         <ul>\n                             <li><a href='add-news.php'>Lägg till nyhet</a></li>\n                             <li><a href='#'>Lägg till event</a></li>\n                             <li><a href='#'>Lägg till användare</a></li>\n                             <li><a href='#'>Ladda upp bilder</a></li>\n                             <li><a href='logout.php'>Logga ut</a></li>\n                         </ul>\n                     </li>\n                    ";
     }
     $hem = "<li>\n        <a href='index.php?p=hem'>Hem</a>\n        <ul>\n            <li><a href='login.php'>Logga in (webbredaktör)</a></li>\n        </ul>\n    </li>";
     if (CUser::isAuthenticated()) {
         $hem = "<li>\n        <a href='index.php?p=hem'>Hem</a>\n    </li>";
     }
     $html = "<nav id='menu-wrap'><ul id=\"menu\">\n        {$hem}\n        <li>\n        <a href=\"#\">Klubben</a>\n        <ul>\n            <li>\n            <a href=\"#\">Bli medlem</a>\n            <ul>\n                <li><a href='medlem.php?p=klubben'>Anmälningsformulär</a></li>\n            </ul>\n            </li>\n            <li><a href='page.php?p=2'>Styrelse</a></li>\n            <li><a href=\"#\">Information</a></li>\n            <li><a href=\"#\">Hitta till oss</a></li>\n        </ul>\n    </li>\n        <li><a href='page.php?p=1'>Kurser</a></li>\n    <li>\n        <a href=\"#\">Tävlingar</a>\n        <ul>\n            <li><a href=\"#\">Tävlingsekipage</a></li>\n            <li><a href=\"#\">Månadscupen</a></li>\n        </ul>\n    </li>\n    <li><a href='calender.php'>Kalender</a></li>\n    <li><a href='blog.php'>Blogg</a></li>\n    <li><a href='galleri.php'>Galleri</a></li>\n    {$user}\n    </ul></nav>";
     return $html;
 }
开发者ID:Hannesalm,项目名称:rbk,代码行数:15,代码来源:cNavigation.php

示例2: actionView

 public function actionView()
 {
     $set = new CRecordSet(false);
     $query = new CQuery();
     $set->setQuery($query);
     $query->select("DISTINCT subject.*")->from(TABLE_DISCIPLINES . " as subject")->innerJoin(TABLE_LIBRARY_DOCUMENTS . " as doc", "doc.subj_id = subject.id")->condition("doc.user_id = " . CRequest::getFilter("author"))->order("subject.name asc");
     $selectedUser = null;
     $usersQuery = new CQuery();
     $usersQuery->select("user.*")->from(TABLE_USERS . " as user")->order("user.fio asc")->innerJoin(TABLE_LIBRARY_DOCUMENTS . " as doc", "user.id = doc.user_id");
     // фильтр по автору
     if (!is_null(CRequest::getFilter("author"))) {
         $selectedUser = CRequest::getFilter("author");
         $author = CRequest::getFilter("author");
     } else {
         $query->condition("doc.user_id = " . CSession::getCurrentUser()->getId());
         $author = CSession::getCurrentUser()->getId();
     }
     $users = array();
     foreach ($usersQuery->execute()->getItems() as $ar) {
         $user = new CUser(new CActiveRecord($ar));
         $users[$user->getId()] = $user->getName();
     }
     $folders = new CArrayList();
     foreach ($set->getPaginated()->getItems() as $ar) {
         $folder = new CLibraryFolder(new CTerm($ar));
         $folders->add($folders->getCount(), $folder);
     }
     $this->addActionsMenuItem(array(array("title" => "Назад", "link" => WEB_ROOT . "_modules/_library/index.php", "icon" => "actions/edit-undo.png")));
     if (CSession::isAuth() and (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_ALL)) {
         $this->addActionsMenuItem(array(array("title" => "Добавить предмет", "link" => WEB_ROOT . "_modules/_library/index.php?action=addDocument&filter=author:" . $author, "icon" => "actions/list-add.png")));
     }
     $this->addCSSInclude(JQUERY_UI_CSS_PATH);
     $this->addJSInclude(JQUERY_UI_JS_PATH);
     $this->setData("folders", $folders);
     $this->setData("users", $users);
     $this->setData("selectedUser", $selectedUser);
     $this->setData("author", $author);
     $this->setData("paginator", $set->getPaginator());
     $this->renderView("_library/view.tpl");
 }
开发者ID:Trozeman,项目名称:ASUPortalPHP,代码行数:40,代码来源:CPublicLibraryController.class.php

示例3: CUser

/**
 * This is a Orange pagecontroller.
 *
 */
// Include the essential config-file which also creates the $Orange variable with its defaults.
include __DIR__ . '/config.php';
$Orange['title'] = "Startsida";
$message = "";
if (isset($_POST['username']) && isset($_POST['password'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $user = new CUser();
    $res = $user->login($username, $password);
    if ($res) {
        $user->setSessionVariablesAtLogin($res);
        $name = $user->getName();
        header('Location: login.php');
    } else {
        $message = "Wrong username or password";
    }
}
if (CUser::isAuthenticated()) {
    $message = "<p>Inloggad som: " . CUser::getName();
    $Orange['main'] = <<<EOD

        <h1></h1>
        <fieldset>
        <legend>Login</legend>
        <p>{$message}</p>
        </fieldset>
        </form>
开发者ID:Hannesalm,项目名称:rbk,代码行数:31,代码来源:login.php

示例4: CUser

<?php

/**
 * This is a Branax pagecontroller.
 *
 */
// Include the essential config-file which also creates the $branax variable with its defaults.
include __DIR__ . '/config.php';
// Create the user object
$user = new CUser($branax['database']);
// Check if user is authenticated.
$output = $user->isAuthenticated() ? "Du är inloggad som: {$user->getAcronym()} ({$user->getName()})" : "Du är INTE inloggad.";
// Check if user and password is okey and login the user
if (isset($_POST['login'])) {
    $user->login($_POST['acronym'], $_POST['password']);
    header('Location: user_status.php');
}
// Do it and store it all in variables in the Branax container.
$branax['title'] = "Login";
$branax['main'] = <<<EOD
<h1>{$branax['title']}</h1>

<form method=post>
  <fieldset>
  <legend>Login</legend>
  <p><label>Användare:<br/><input type='text' name='acronym' value=''/></label></p>
  <p><label>Lösenord:<br/><input type='password' name='password' value=''/></label></p>
  <p><input type='submit' name='login' value='Login'/></p>
  <p><a href='user_logout.php'>Logout</a></p>
  <p><a href='user_register.php'>Skapa ny användare</a></p>
  <output><b>{$output}</b></output>
开发者ID:britec,项目名称:branac-base,代码行数:31,代码来源:user_login.php

示例5: CUser

<?php

/**
 * This is a Branax pagecontroller.
 *
 */
// Include the essential config-file which also creates the $branax variable with its defaults.
include __DIR__ . '/config.php';
// Create the user object
$user = new CUser($branax['database']);
// Check if logged in user
$admin = $user->isAdmin() ? 'med administratörsrättigheter' : null;
$output = $user->isUser() ? "Du är inloggad som {$user->getAcronym()} ({$user->getName()}) {$admin}" : "Du är INTE inloggad.";
// Do it and store it all in variables in the Anax container.
$branax['title'] = "User status";
$branax['main'] = <<<EOD
<h1>{$branax['title']}</h1>
<form method=post>
  <fieldset>
  <legend>Login status</legend>
  <output><b>{$output}</b></output>
  <p><a href='user_login.php'>Login</a></p>
  <p><a href='user_logout.php'>Logout</a></p>
  </fieldset>
</form>

EOD;
// Finally, leave it all to the rendering phase of Branax.
include BRANAX_THEME_PATH;
开发者ID:britec,项目名称:branac-base,代码行数:29,代码来源:user_status.php

示例6: actionIndex


//.........这里部分代码省略.........
         $direction = "asc";
         if (CRequest::getString("direction") != "") {
             $direction = CRequest::getString("direction");
         }
         $query->order("contact_info " . $direction);
     } elseif (CRequest::getString("order") == "st.name") {
         $direction = "asc";
         if (CRequest::getString("direction") != "") {
             $direction = CRequest::getString("direction");
         }
         $query->leftJoin(TABLE_QUESTION_STATUS . " as st", "quest.status = st.id");
         $query->order("st.name " . $direction);
     } elseif (CRequest::getString("order") == "answer_text") {
         $direction = "asc";
         if (CRequest::getString("direction") != "") {
             $direction = CRequest::getString("direction");
         }
         $query->order("answer_text " . $direction);
     }
     // фильтр по пользователю
     if (!is_null(CRequest::getFilter("user"))) {
         $query->innerJoin(TABLE_USERS . " as user", "quest.user_id = user.id and user.id = " . CRequest::getFilter("user"));
         $selectedUser = CRequest::getFilter("user");
     }
     // фильтр по вопросу
     if (!is_null(CRequest::getFilter("question"))) {
         $query->condition("quest.id = " . CRequest::getFilter("question"));
     }
     // фильтр по ответу
     if (!is_null(CRequest::getFilter("answer"))) {
         $query->condition("quest.id = " . CRequest::getFilter("answer"));
     }
     // фильтр по контактам
     if (!is_null(CRequest::getFilter("contact"))) {
         $query->condition("quest.id = " . CRequest::getFilter("contact"));
     }
     $quests = new CArrayList();
     $isArchive = CRequest::getString("isArchive") == "1";
     if (!$isArchive) {
         if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) {
             $query->condition('quest.user_id = "' . CSession::getCurrentUser()->getId() . '" and (quest.datetime_quest > "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" or quest.datetime_quest is NULL) and quest.status!=5');
         } else {
             $query->condition('(quest.datetime_quest > "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" or quest.datetime_quest is NULL) and quest.status!=5');
         }
     } else {
         if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) {
             $query->condition('quest.user_id = "' . CSession::getCurrentUser()->getId() . '" and quest.status!=5');
         } else {
             $query->condition("quest.status!=5");
         }
     }
     if (CRequest::getInt("showAll") == 1) {
         if (!$isArchive) {
             if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) {
                 $query->condition('quest.user_id = "' . CSession::getCurrentUser()->getId() . '" and (quest.datetime_quest > "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" or quest.datetime_quest is NULL)');
             } else {
                 $query->condition('quest.datetime_quest > "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" or quest.datetime_quest is NULL');
             }
         } else {
             if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) {
                 $query->condition('quest.user_id = "' . CSession::getCurrentUser()->getId() . '"');
             }
         }
         $showAll = true;
     }
     foreach ($set->getPaginated()->getItems() as $ar) {
         $quest = new CQuestion($ar);
         $quests->add($quest->getId(), $quest);
     }
     if ($isArchive) {
         $requestParams = array();
         foreach (CRequest::getGlobalRequestVariables()->getItems() as $key => $value) {
             if ($key != "isArchive") {
                 $requestParams[] = $key . "=" . $value;
             }
         }
         $this->addActionsMenuItem(array(array("title" => "Текущий год", "link" => "?" . implode("&", $requestParams), "icon" => "mimetypes/x-office-calendar.png")));
     } else {
         $requestParams = array();
         foreach (CRequest::getGlobalRequestVariables()->getItems() as $key => $value) {
             $requestParams[] = $key . "=" . $value;
         }
         $requestParams[] = "isArchive=1";
         $this->addActionsMenuItem(array(array("title" => "Архив", "link" => "?" . implode("&", $requestParams), "icon" => "devices/media-floppy.png")));
     }
     $usersQuery = new CQuery();
     $usersQuery->select("user.*")->from(TABLE_USERS . " as user")->order("user.fio asc")->innerJoin(TABLE_QUESTION_TO_USERS . " as quest", "user.id = quest.user_id");
     $users = array();
     foreach ($usersQuery->execute()->getItems() as $ar) {
         $user = new CUser(new CActiveRecord($ar));
         $users[$user->getId()] = $user->getName();
     }
     $this->setData("isArchive", $isArchive);
     $this->setData("showAll", $showAll);
     $this->setData("quests", $quests);
     $this->setData("users", $users);
     $this->setData("selectedUser", $selectedUser);
     $this->setData("paginator", $set->getPaginator());
     $this->renderView("_question_answ/index.tpl");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:101,代码来源:CQuestionAnswerController.class.php


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