• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP UserCache类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_get_by_login_and_remove

 /**
  * Test, if a user cached by login gets removed on clear()
  */
 function test_get_by_login_and_remove()
 {
     $UserCache = new UserCache();
     $this->MockDB->expectCallCount('get_row', 2);
     $this->MockDB->expect('get_row', array(new PatternExpectation('/SELECT \\*\\s+FROM T_users.*login/is'), '*', '*', '*'), 'DB select ok.');
     $UserCache->get_by_login('login');
     $UserCache->clear();
     $UserCache->get_by_login('login');
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:12,代码来源:usercache.class.simpletest.php


示例2: getIssueGeneralInfo

 /**
  * Get general info of an issue
  * @param Issue $issue The issue
  * @param bool $isManager if true: show MgrEffortEstim column
  * @param bool $displaySupport If true, display support
  * @return mixed[]
  */
 public static function getIssueGeneralInfo(Issue $issue, $isManager = false, $displaySupport = false)
 {
     $withSupport = true;
     // include support in elapsed & Drift
     $drift = $issue->getDrift($withSupport);
     $issueGeneralInfo = array("issueId" => $issue->getId(), "issueSummary" => htmlspecialchars(preg_replace('![\\t\\r\\n]+!', ' ', $issue->getSummary())), "issueType" => $issue->getType(), "issueDescription" => htmlspecialchars($issue->getDescription()), "projectName" => $issue->getProjectName(), "categoryName" => $issue->getCategoryName(), "issueExtRef" => $issue->getTcId(), 'mantisURL' => Tools::mantisIssueURL($issue->getId(), NULL, true), 'issueURL' => Tools::mantisIssueURL($issue->getId()), 'statusName' => $issue->getCurrentStatusName(), 'priorityName' => $issue->getPriorityName(), 'severityName' => $issue->getSeverityName(), 'handlerName' => UserCache::getInstance()->getUser($issue->getHandlerId())->getName(), "issueEffortTitle" => $issue->getEffortEstim() . ' + ' . $issue->getEffortAdd(), "issueEffort" => $issue->getEffortEstim() + $issue->getEffortAdd(), "issueReestimated" => $issue->getReestimated(), "issueBacklog" => $issue->getBacklog(), "issueDriftColor" => $issue->getDriftColor($drift), "issueDrift" => round($drift, 2), "progress" => round(100 * $issue->getProgress()), 'relationships' => self::getFormattedRelationshipsInfo($issue));
     if ($isManager) {
         $issueGeneralInfo['issueMgrEffortEstim'] = $issue->getMgrEffortEstim();
         $driftMgr = $issue->getDriftMgr($withSupport);
         $issueGeneralInfo['issueDriftMgrColor'] = $issue->getDriftColor($driftMgr);
         $issueGeneralInfo['issueDriftMgr'] = round($driftMgr, 2);
     }
     if ($withSupport) {
         $issueGeneralInfo['issueElapsed'] = $issue->getElapsed();
     } else {
         $issueGeneralInfo['issueElapsed'] = $issue->getElapsed() - $issue->getElapsed(Jobs::JOB_SUPPORT);
     }
     if ($displaySupport) {
         if ($isManager) {
             $driftMgr = $issue->getDriftMgr(!$withSupport);
             $issueGeneralInfo['issueDriftMgrSupportColor'] = $issue->getDriftColor($driftMgr);
             $issueGeneralInfo['issueDriftMgrSupport'] = round($driftMgr, 2);
         }
         $drift = $issue->getDrift(!$withSupport);
         $issueGeneralInfo['issueDriftSupportColor'] = $issue->getDriftColor($drift);
         $issueGeneralInfo['issueDriftSupport'] = round($drift, 2);
     }
     return $issueGeneralInfo;
 }
开发者ID:dfuzeau,项目名称:codev,代码行数:36,代码来源:issue_info_tools.php


示例3: display

 protected function display()
 {
     // Admins only
     if (Tools::isConnectedUser()) {
         $session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
         if ($session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
             $this->smartyHelper->assign('defaultColor', Holidays::$defaultColor);
             if (isset($_POST['hol_color'])) {
                 $formatedDate = Tools::getSecurePOSTStringValue('date');
                 $timestamp = Tools::date2timestamp($formatedDate);
                 $hol_desc = Tools::getSecurePOSTStringValue('hol_desc');
                 $hol_color = Tools::getSecurePOSTStringValue('hol_color');
                 if (!Holidays::save($timestamp, $hol_desc, $hol_color)) {
                     $this->smartyHelper->assign('error', T_("Couldn't add the holiday"));
                 }
             } elseif (isset($_POST['hol_id'])) {
                 $hol_id = Tools::getSecurePOSTIntValue('hol_id');
                 if (!Holidays::delete($hol_id)) {
                     $this->smartyHelper->assign('error', T_("Couldn't remove the holiday"));
                 }
             }
             $this->smartyHelper->assign('holidays', Holidays::getHolidays());
         }
     }
 }
开发者ID:fg-ok,项目名称:codev,代码行数:25,代码来源:edit_holidays.php


示例4: actionRefreshOperations

 /**
  * actionRefreshOperations 
  * 
  * @param int $id - task id
  */
 public function actionRefreshOperations($id)
 {
     UserOperation::updateData();
     // Reset cache
     UserCache::model()->updateAll(array('status' => 0));
     $this->redirect(array('view', 'id' => $id));
 }
开发者ID:shakyapranin,项目名称:IMS,代码行数:12,代码来源:UserTaskController.php


示例5: execute

 /**
  *
  * 执行登录检查,如果错误,将返回状态代码403
  *
  * @access public
  * @param 无
  * @return void
  */
 public function execute($request)
 {
     Logger::debug('----- ' . __CLASS__ . ' is started -----');
     // 验证 SessionKey
     $user_id = $request->getRequestParameter(Constants::PARAM_SESSION_KEY);
     $clientSendKey = $request->getRequestParameter(Constants::PARAM_USER_ID);
     $userCache = UserCache::getCacheInstance();
     $serverSaveKey = $userCache->getByKey($user_id, Constants::CURRENT_SESSION_KEY);
     if ($serverSaveKey !== $clientSendKey) {
         Logger::debug('Stopping ' . __CLASS__ . '. caused by: Invalid session key.');
         Logger::debug('server save session key: ', $serverSaveKey);
         Logger::debug('client send session key: ', $clientSendKey);
         $view = new JsonView();
         $view->setValue('result', Constants::RESP_RESULT_ERROR);
         $view->setValue('message', "session key not match");
         $view->display();
         throw new ForbiddenException("Session Key not match.");
     }
     // 登录检查
     /*if( !$authorizer->loginCheck($auth_param) )
       {
           Logger::debug( 'Stopping ' . __CLASS__ . '. caused by: The request not authenticated.' );
           throw new ForbiddenException();
       }*/
     Logger::debug(__CLASS__ . ' is success.');
     Logger::debug('----- ' . __CLASS__ . ' is finished -----');
 }
开发者ID:YYLP,项目名称:y_game,代码行数:35,代码来源:LoginFilter.class.php


示例6: display

 protected function display()
 {
     if (Tools::isConnectedUser()) {
         // Admins only
         $session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
         if ($session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
             if (NULL != Constants::$codevtt_logfile && file_exists(Constants::$codevtt_logfile)) {
                 $nbLinesToDisplay = 1500;
                 $lines = file(Constants::$codevtt_logfile);
                 if (count($lines) > $nbLinesToDisplay) {
                     $offset = count($lines) - $nbLinesToDisplay;
                 } else {
                     $offset = 0;
                 }
                 $logs = array();
                 for ($i = $offset; $i <= $offset + $nbLinesToDisplay, $i < count($lines); $i++) {
                     $logs[$i + 1] = htmlspecialchars($lines[$i], ENT_QUOTES, "UTF-8");
                     #echo "DEBUG $line_num - ".$logs[$line_num]."<br>";
                 }
                 $this->smartyHelper->assign('logs', $logs);
             } else {
                 $this->smartyHelper->assign('error', T_('Sorry, logfile not found:') . ' [' . Constants::$codevtt_logfile . ']');
             }
         } else {
             $this->smartyHelper->assign('error', T_('Sorry, you need to be in the admin-team to access this page.'));
         }
     } else {
         $this->smartyHelper->assign('error', T_('Sorry, you need to be in the admin-team to access this page.'));
     }
 }
开发者ID:fg-ok,项目名称:codev,代码行数:30,代码来源:logs.php


示例7: display

 protected function display()
 {
     if (Tools::isConnectedUser()) {
         // Admins only
         $session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
         if ($session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
             $projectList = $this->getProjectList(false);
             if (isset($_POST['projectid']) && array_key_exists($_POST['projectid'], $projectList)) {
                 $projectid = Tools::getSecurePOSTIntValue('projectid');
                 $_SESSION['projectid'] = $projectid;
             } elseif (isset($_SESSION['projectid']) && array_key_exists($_SESSION['projectid'], $projectList)) {
                 $projectid = $_SESSION['projectid'];
             } else {
                 $projectIds = array_keys($projectList);
                 if (count($projectIds) > 0) {
                     $projectid = $projectIds[0];
                 } else {
                     $projectid = 0;
                 }
             }
             $this->smartyHelper->assign('projects', SmartyTools::getSmartyArray($projectList, $projectid));
             // display current workflow
             if (0 != $projectid) {
                 $clone_projectid = Tools::getSecurePOSTIntValue('clone_projectid', 0);
                 if ($clone_projectid == $projectid || !array_key_exists($clone_projectid, $projectList)) {
                     $clone_projectid = 0;
                 }
                 $action = Tools::getSecurePOSTStringValue('action', '');
                 if ("cloneToProject" == $action) {
                     #echo "Clone $projectid ---> $clone_projectid<br>";
                     $errMsg = Project::cloneAllProjectConfig($projectid, $clone_projectid);
                     $this->smartyHelper->assign('msg', 'Clone to project : ' . $errMsg);
                 } elseif ("cloneFromProject" == $action) {
                     #echo "Clone $clone_projectid ---> $projectid<br>";
                     $errMsg = Project::cloneAllProjectConfig($clone_projectid, $projectid);
                     $this->smartyHelper->assign('msg', 'Clone from project : ' . $errMsg);
                 }
                 unset($projectList[$projectid]);
                 $this->smartyHelper->assign('cloneProjects', SmartyTools::getSmartyArray($projectList, $clone_projectid));
                 $proj = ProjectCache::getInstance()->getProject($projectid);
                 $this->smartyHelper->assign('currentProjectId', $projectid);
                 $this->smartyHelper->assign('defaultProjectId', $clone_projectid);
                 $this->smartyHelper->assign('currentProjectName', $proj->getName());
                 $this->smartyHelper->assign('disabled', 0 == $clone_projectid);
                 $projectsInfo = array();
                 $projectsInfo[] = $this->getProjectInfo($proj, "tabsProject");
                 if (0 != $clone_projectid) {
                     $cproj = ProjectCache::getInstance()->getProject($clone_projectid);
                     $this->smartyHelper->assign('defaultProjectName', $cproj->getName());
                     $projectsInfo[] = $this->getProjectInfo($cproj, "tabsCloneProject");
                 }
                 $this->smartyHelper->assign('projectsInfo', $projectsInfo);
             }
         }
     }
 }
开发者ID:fg-ok,项目名称:codev,代码行数:56,代码来源:workflow.php


示例8: display

 protected function display()
 {
     if (Tools::isConnectedUser()) {
         $session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
         // Admins only
         if ($session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
             $this->smartyHelper->assign('access', true);
             $is_modified = Tools::getSecurePOSTStringValue('is_modified', 'false');
             // init
             // 'is_modified' is used because it's not possible to make a difference
             // between an unchecked checkBox and an unset checkbox variable
             if ("false" == $is_modified) {
                 $isBackup = true;
             } else {
                 $isBackup = $_POST['cb_backup'];
             }
             $filename = Tools::getSecurePOSTStringValue('backup_filename', "codevtt_backup_" . date("Ymd") . ".sql");
             $this->smartyHelper->assign('isBackup', $isBackup);
             $this->smartyHelper->assign('filename', $filename);
             if (isset($_POST['cb_backup'])) {
                 $result = true;
                 if ($isBackup) {
                     $result = SqlWrapper::getInstance()->sql_dump($filename) && $this->saveConfigFiles();
                     $this->smartyHelper->assign('backupResult', $result);
                 }
                 $this->smartyHelper->assign('stepOneResult', $result);
                 if ($result) {
                     $prjList = $this->displayProjectsToRemove();
                     $this->smartyHelper->assign('projects', $prjList);
                 }
                 $this->smartyHelper->assign('stepTwoResult', $result);
                 if ($result) {
                     $result = $this->removeCustomFields();
                 }
                 $this->smartyHelper->assign('stepThreeResult', $result);
                 if ($result) {
                     $result = Tools::execSQLscript2("uninstall.sql");
                 }
                 $this->smartyHelper->assign('stepFourResult', $result);
                 if ($result) {
                     $result = $this->deleteConfigFiles();
                 }
                 $this->smartyHelper->assign('stepFiveResult', $result);
                 if ($result) {
                     $result = $this->removeCustomMenuItem('CodevTT');
                 }
                 $this->smartyHelper->assign('stepSixResult', $result);
             } else {
                 Config::setQuiet(true);
                 $this->smartyHelper->assign('codevReportsDir', Constants::$codevOutputDir . DIRECTORY_SEPARATOR . 'reports');
                 Config::setQuiet(false);
                 $this->smartyHelper->assign('is_modified', $is_modified);
             }
         }
     }
 }
开发者ID:fg-ok,项目名称:codev,代码行数:56,代码来源:uninstall.php


示例9: login

function login($user, $password)
{
    $logger = Logger::getLogger('login');
    // WARN: if logger is LoggerAppenderEcho, then logs will break the login Ajax call !
    try {
        $appenders = $logger->getParent()->getAllAppenders();
        $isLog = true;
        foreach ($appenders as $appender) {
            if ('LoggerAppenderEcho' === get_class($appender)) {
                $isLog = false;
                break;
            }
        }
    } catch (Exception $e) {
        // logs should never break application
        $isLog = false;
    }
    $password = md5($password);
    $formattedUser = SqlWrapper::sql_real_escape_string($user);
    $formattedPass = SqlWrapper::sql_real_escape_string($password);
    $query = "SELECT id, username, realname FROM `mantis_user_table` WHERE username = '" . $formattedUser . "' AND password = '" . $formattedPass . "' AND enabled = 1;";
    $result = SqlWrapper::getInstance()->sql_query($query);
    if ($result && SqlWrapper::getInstance()->sql_num_rows($result) == 1 && ($row_login = SqlWrapper::getInstance()->sql_fetch_object($result))) {
        $_SESSION['userid'] = $row_login->id;
        $_SESSION['username'] = $row_login->username;
        $_SESSION['realname'] = $row_login->realname;
        try {
            $user = UserCache::getInstance()->getUser($row_login->id);
            $locale = $user->getDefaultLanguage();
            if (NULL != $locale) {
                $_SESSION['locale'] = $locale;
            }
            $teamid = $user->getDefaultTeam();
            if (0 != $teamid) {
                $_SESSION['teamid'] = $teamid;
            }
            $projid = $user->getDefaultProject();
            if (0 != $projid) {
                $_SESSION['projectid'] = $projid;
            }
        } catch (Exception $e) {
            if ($isLog && self::$logger->isDebugEnabled()) {
                $logger->debug("could not load preferences for user {$row_login->id}");
            }
        }
        if ($isLog) {
            $ua = Tools::getBrowser();
            $browserStr = $ua['name'] . ' ' . $ua['version'] . ' (' . $ua['platform'] . ')';
            $logger->info('user ' . $row_login->id . ' ' . $row_login->username . ' (' . $row_login->realname . '), Team ' . $user->getDefaultTeam() . ', ' . $browserStr);
        }
        return TRUE;
    } else {
        #$error = 'login failed !';
        return FALSE;
    }
}
开发者ID:fg-ok,项目名称:codev,代码行数:56,代码来源:login.php


示例10: setSessionKey

 public static function setSessionKey($user_id, $oldSessionKey)
 {
     // 生成缓存
     $newSessionKey = Util::generateSessionKey($user_id);
     Logger::debug('SessionKey1:' . $oldSessionKey);
     Logger::debug('SessionKey2:' . $newSessionKey);
     UserCache::setByKey($user_id, Constants::PREVIOUS_SESSION_KEY, $oldSessionKey);
     UserCache::setByKey($user_id, Constants::CURRENT_SESSION_KEY, $newSessionKey);
     return $newSessionKey;
 }
开发者ID:YYLP,项目名称:y_game,代码行数:10,代码来源:CharacterModel.class.php


示例11: getCommandIssues

 /**
  * @param Command $command
  * @return mixed[]
  */
 private static function getCommandIssues(Command $command)
 {
     $issueArray = array();
     $issues = $command->getIssueSelection()->getIssueList();
     foreach ($issues as $id => $issue) {
         $driftMgr = $issue->getDriftMgr();
         $driftMgrColor = $issue->getDriftColor($driftMgr);
         $drift = $issue->getDrift();
         $driftColor = $issue->getDriftColor($drift);
         $user = UserCache::getInstance()->getUser($issue->getHandlerId());
         $issueArray[$id] = array("mantisLink" => Tools::mantisIssueURL($issue->getId(), NULL, TRUE), "bugid" => Tools::issueInfoURL(sprintf("%07d\n", $issue->getId())), "extRef" => $issue->getTcId(), "project" => $issue->getProjectName(), "target" => $issue->getTargetVersion(), "status" => $issue->getCurrentStatusName(), "progress" => round(100 * $issue->getProgress()), "effortEstim" => $issue->getEffortEstim() + $issue->getEffortAdd(), "mgrEffortEstim" => $issue->getMgrEffortEstim(), "elapsed" => $issue->getElapsed(), "driftMgr" => $driftMgr, "driftMgrColor" => $driftMgrColor, "drift" => $drift, "driftColor" => $driftColor, "duration" => $issue->getDuration(), "summary" => $issue->getSummary(), "type" => $issue->getType(), "handlerName" => $user->getName());
     }
     return $issueArray;
 }
开发者ID:dfuzeau,项目名称:codev,代码行数:18,代码来源:command_tools.php


示例12: getUserData

 protected function getUserData()
 {
     $userId = $this->userId;
     $cache = UserCache::getInstance();
     $data = $cache->read($userId);
     if ((ENVIRONMENT & PRODUCTION) > 0 && !$data) {
         list($fp) = $cache->lock($userId);
         $data = $this->_getUserData($userId);
         $cache->write($fp, $data);
     }
     if (!$data) {
         $data = $this->_getUserData($userId);
     }
     return Sabel_ValueObject::fromArray(array("userId" => $userId, "friends" => Follower::getFriends($userId, FRIENDS_ICON_LIMIT + 1), "friendsCount" => $data["friends"], "followersCount" => $data["followers"], "statusesCount" => $data["statuses"], "latestComment" => $data["comment"]));
 }
开发者ID:hamaco,项目名称:phwittr-on-xoops,代码行数:15,代码来源:Submenu.php


示例13: logicsFollowRemove

 protected function logicsFollowRemove($userId, $targetId, $result)
 {
     if ($result->isFailure() || $result->removeType !== "follow") {
         return;
     }
     $cache = UserCache::getInstance();
     list($fp, $data) = $cache->lock($userId);
     if ($data) {
         $data["friends"]--;
         $cache->write($fp, $data);
     }
     list($fp, $data) = $cache->lock($targetId);
     if ($data) {
         $data["followers"]--;
         $cache->write($fp, $data);
     }
 }
开发者ID:hamaco,项目名称:phwittr-on-xoops,代码行数:17,代码来源:UserCache.php


示例14: checkAnalyzed

 /**
  * fiches analyzed dont BI non renseignes
  * fiches analyzed dont RAE non renseignes
  * @return ConsistencyError[]
  */
 public function checkAnalyzed()
 {
     // CoDev FDJ custom, defined in Mantis
     $status_analyzed = Config::getVariableKeyFromValue(Config::id_statusNames, 'analyzed');
     $status_accepted = Config::getVariableKeyFromValue(Config::id_statusNames, 'accepted');
     $status_deferred = Config::getVariableKeyFromValue(Config::id_statusNames, 'deferred');
     $FDJ_teamid = Config::getInstance()->getValue(Config::id_ClientTeamid);
     $cerrList = array();
     // select all issues which current status is 'analyzed'
     $query = "SELECT * " . "FROM `mantis_bug_table` " . "WHERE status in ({$status_analyzed}, {$status_accepted}, " . Constants::$status_open . ", {$status_deferred}) ";
     if (0 != count($this->projectList)) {
         $formatedProjects = implode(', ', array_keys($this->projectList));
         $query .= "AND project_id IN ({$formatedProjects}) ";
     }
     $query .= "ORDER BY last_updated DESC, bug_id DESC";
     $result = SqlWrapper::getInstance()->sql_query($query);
     if (!$result) {
         echo "<span style='color:red'>ERROR: Query FAILED</span>";
         exit;
     }
     while ($row = SqlWrapper::getInstance()->sql_fetch_object($result)) {
         $issue = IssueCache::getInstance()->getIssue($row->id, $row);
         if (NULL == $issue->getEffortEstim()) {
             $cerr = new ConsistencyError($row->id, $row->handler_id, $row->status, $row->last_updated, T_("BI not specified: BI = Time(Analysis + Dev + Tests)"));
             $cerr->severity = T_("Error");
             $cerrList[] = $cerr;
         }
         if (is_null($issue->getBacklog())) {
             $cerr = new ConsistencyError($row->bug_id, $row->handler_id, $row->status, $row->last_updated, T_("Backlog not specified: Backlog = Time(BI - Analysis)"));
             $cerr->severity = T_("Error");
             $cerrList[] = $cerr;
         }
         if ($status_analyzed == $row->status) {
             $user = UserCache::getInstance()->getUser($row->handler_id);
             if (!$user->isTeamMember($FDJ_teamid)) {
                 $cerr = new ConsistencyError($row->bug_id, $row->handler_id, $row->status, $row->last_updated, T_("Once analysed, a Task must be assigned to 'FDJ' for validation"));
                 $cerr->severity = T_("Error");
                 $cerrList[] = $cerr;
             }
         }
     }
     // check if fields correctly set
     return $cerrList;
 }
开发者ID:fg-ok,项目名称:codev,代码行数:49,代码来源:consistency_check_fdj.class.php


示例15: display

 protected function display()
 {
     if (Tools::isConnectedUser()) {
         // Admins only
         $session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
         if ($session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
             if (isset($_POST['projects']) && !empty($_POST['projects'])) {
                 $selectedProjects = $_POST['projects'];
                 $result = array();
                 foreach ($selectedProjects as $projectid) {
                     $project = ProjectCache::getInstance()->getProject($projectid);
                     $result[$projectid] = $project->getName();
                     Project::prepareProjectToCodev($projectid);
                 }
                 $this->smartyHelper->assign('result', $result);
             }
             $this->smartyHelper->assign('projects', $this->getProjectList());
         }
     }
 }
开发者ID:fg-ok,项目名称:codev,代码行数:20,代码来源:prepare_project.php


示例16: getBlogPosts

 /**
  * @param BlogPost[] $postList
  * @return mixed[]
  */
 private function getBlogPosts(array $postList)
 {
     $blogPosts = array();
     foreach ($postList as $id => $bpost) {
         $srcUser = UserCache::getInstance()->getUser($bpost->src_user_id);
         $item = array();
         // TODO
         $item['category'] = Config::getVariableValueFromKey(Config::id_blogCategories, $bpost->category);
         $item['severity'] = BlogPost::getSeverityName($bpost->severity);
         $item['summary'] = $bpost->summary;
         $item['content'] = $bpost->content;
         $item['date_submitted'] = date('Y-m-d G:i', $bpost->date_submitted);
         $item['from'] = $srcUser->getRealname();
         // find receiver
         if (0 != $bpost->dest_user_id) {
             $destUser = UserCache::getInstance()->getUser($bpost->dest_user_id);
             $item['to'] = $destUser->getRealname();
         } else {
             if (0 != $bpost->dest_team_id) {
                 $team = TeamCache::getInstance()->getTeam($bpost->dest_team_id);
                 $item['to'] = $team->getName();
             } else {
                 if (0 != $bpost->dest_project_id) {
                     $destProj = ProjectCache::getInstance()->getProject($bpost->dest_project_id);
                     $item['to'] = $destProj->getName();
                 } else {
                     $item['to'] = '?';
                 }
             }
         }
         $item['activity'] = 'activities...';
         $item['buttons'] = "<input type='button' value='" . T_('Ack') . "' onclick='javascript: ackPost(" . $bpost->id . ")' />";
         $item['buttons'] .= "<input type='button' value='" . T_('Hide') . "' onclick='javascript: hidePost(" . $bpost->id . ")' />";
         // TODO only if i'm the owner
         $item['buttons'] .= "<input type='button' value='" . T_('Delete') . "' onclick='javascript: deletePost(" . $bpost->id . ")' />";
         $item['isHidden'] = '0';
         $blogPosts[$id] = $item;
     }
     return $blogPosts;
 }
开发者ID:fg-ok,项目名称:codev,代码行数:44,代码来源:blog.php


示例17: getTeamConsistencyErrors

 /**
  * Get consistency errors
  * @param int $teamid
  * @return mixed[]
  */
 private function getTeamConsistencyErrors($teamid)
 {
     if (self::$logger->isDebugEnabled()) {
         self::$logger->debug("getTeamConsistencyErrors teamid={$teamid}");
     }
     // get team projects
     $issueList = TeamCache::getInstance()->getTeam($teamid)->getTeamIssueList(true, false);
     if (self::$logger->isDebugEnabled()) {
         self::$logger->debug("getTeamConsistencyErrors nbIssues=" . count($issueList));
     }
     #$ccheck = new ConsistencyCheck2($issueList);
     $ccheck = new ConsistencyCheck2($issueList, $teamid);
     $cerrList = $ccheck->check();
     $cerrs = NULL;
     if (count($cerrList) > 0) {
         $i = 0;
         foreach ($cerrList as $cerr) {
             $i += 1;
             if (NULL != $cerr->userId) {
                 $user = UserCache::getInstance()->getUser($cerr->userId);
             } else {
                 $user = NULL;
             }
             if (Issue::exists($cerr->bugId)) {
                 $issue = IssueCache::getInstance()->getIssue($cerr->bugId);
                 $summary = $issue->getSummary();
                 $projName = $issue->getProjectName();
                 $refExt = $issue->getTcId();
             } else {
                 $summary = '';
                 $projName = '';
             }
             $cerrs[$i] = array('userName' => isset($user) ? $user->getName() : '', 'issueURL' => NULL == $cerr->bugId ? '' : Tools::issueInfoURL($cerr->bugId, $summary), 'mantisURL' => NULL == $cerr->bugId ? '' : Tools::mantisIssueURL($cerr->bugId, $summary, true), 'extRef' => NULL == $refExt ? '' : $refExt, 'date' => NULL == $cerr->timestamp ? '' : date("Y-m-d", $cerr->timestamp), 'status' => NULL == $cerr->status ? '' : Constants::$statusNames[$cerr->status], 'severity' => $cerr->getLiteralSeverity(), 'project' => $projName, 'desc' => $cerr->desc, 'summary' => $summary);
         }
     }
     return $cerrs;
 }
开发者ID:fg-ok,项目名称:codev,代码行数:42,代码来源:check.php


示例18: display

 protected function display()
 {
     if (Tools::isConnectedUser()) {
         $session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
         $mTeamList = $session_user->getDevTeamList();
         $lTeamList = $session_user->getLeadedTeamList();
         $oTeamList = $session_user->getObservedTeamList();
         $managedTeamList = $session_user->getManagedTeamList();
         $teamList = $mTeamList + $lTeamList + $oTeamList + $managedTeamList;
         $defaultTeam = isset($_SESSION['teamid']) ? $_SESSION['teamid'] : 0;
         $teamid = Tools::getSecureGETIntValue('teamid', $defaultTeam);
         $_SESSION['teamid'] = $teamid;
         $this->smartyHelper->assign('teams', SmartyTools::getSmartyArray($teamList, $teamid));
         // if current team is not in allowed list, do not display
         if (array_key_exists($teamid, $teamList)) {
             $team = TeamCache::getInstance()->getTeam($teamid);
             $start_year = date("Y", $team->getDate());
             $start_month = date("m", $team->getDate());
             $start_day = date("d", $team->getDate());
             $statusNames = Config::getInstance()->getValue("statusNames");
             ksort($statusNames);
             $this->smartyHelper->assign('statusNames', $statusNames);
             $periodStatsReport = new PeriodStatsReport($start_year, $start_month, $start_day, $teamid);
             $periodStatsList = $periodStatsReport->computeReport();
             $periods = array();
             foreach ($periodStatsList as $date => $ps) {
                 $status = array();
                 foreach ($statusNames as $s => $sname) {
                     $status[$s] = $ps->getStatusCount($s);
                 }
                 $periods[Tools::formatDate("%B %Y", $date)] = $status;
             }
             $this->smartyHelper->assign('periods', $periods);
         }
     }
 }
开发者ID:fg-ok,项目名称:codev,代码行数:36,代码来源:mantis_reports.php


示例19: actionView

 /**
  * actionView 
  * 
  * @param int $id 
  */
 public function actionView($id)
 {
     $model = $this->loadModel($id);
     // Fill taskIds for checkBoxList
     foreach ($model->tasks as $task) {
         $model->taskIds[] = $task->id;
     }
     if (isset($_POST['UserRole']['taskIds'])) {
         UserRoleHasUserTask::model()->deleteAllByAttributes(array('user_role_id' => $id));
         // Reset cache
         UserCache::model()->updateAll(array('status' => 0));
         if (is_array($_POST['UserRole']['taskIds'])) {
             foreach ($_POST['UserRole']['taskIds'] as $taskId) {
                 $newTask = new UserRoleHasUserTask();
                 $newTask->user_role_id = $id;
                 $newTask->user_task_id = $taskId;
                 $newTask->save(false);
             }
         }
         Yii::app()->user->setFlash('taskSaved', 'aga');
         $this->redirect(array('view', 'id' => $id));
     }
     $this->render('view', compact('model'));
 }
开发者ID:shakyapranin,项目名称:IMS,代码行数:29,代码来源:UserRoleController.php


示例20: updateTeamSelector

 protected function updateTeamSelector()
 {
     if (Tools::isConnectedUser()) {
         // use the teamid set in the form, if not defined (first page call) use session teamid
         if (isset($_GET['teamid'])) {
             $this->teamid = Tools::getSecureGETIntValue('teamid');
             $_SESSION['teamid'] = $this->teamid;
         } else {
             $this->teamid = isset($_SESSION['teamid']) ? $_SESSION['teamid'] : 0;
         }
         $this->smartyHelper->assign('teamid', $this->teamid);
         $this->session_userid = $_SESSION['userid'];
         $this->session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
         $this->teamList = $this->session_user->getTeamList();
         if (count($this->teamList) > 0) {
             $this->smartyHelper->assign('teams', SmartyTools::getSmartyArray($this->teamList, $_SESSION['teamid']));
         }
         $this->session_user->setDefaultTeam($this->teamid);
         // used to disable some menu items
         if ($this->session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
             $this->smartyHelper->assign('isAdmin', true);
         }
     }
 }
开发者ID:fg-ok,项目名称:codev,代码行数:24,代码来源:controller.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP UserClass类代码示例发布时间:2022-05-23
下一篇:
PHP UserAuth类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap