作者:founderi
项目:thebuggeni
/**
* Forgotten password logic (AJAX call)
*
* @Route(url="/mailing/forgot")
* @AnonymousRoute
* @param \thebuggenie\core\framework\Request $request
*/
public function runForgot(framework\Request $request)
{
$i18n = framework\Context::getI18n();
try {
$username = str_replace('%2E', '.', $request['forgot_password_username']);
if (!empty($username)) {
if (($user = \thebuggenie\core\entities\User::getByUsername($username)) instanceof \thebuggenie\core\entities\User) {
if ($user->isActivated() && $user->isEnabled() && !$user->isDeleted()) {
if ($user->getEmail()) {
framework\Context::getModule('mailing')->sendForgottenPasswordEmail($user);
return $this->renderJSON(array('message' => $i18n->__('Please use the link in the email you received')));
} else {
throw new \Exception($i18n->__('Cannot find an email address for this user'));
}
} else {
throw new \Exception($i18n->__('Forbidden for this username, please contact your administrator'));
}
} else {
throw new \Exception($i18n->__('This username does not exist'));
}
} else {
throw new \Exception($i18n->__('Please enter an username'));
}
} catch (\Exception $e) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => $e->getMessage()));
}
}
作者:RTechSof
项目:thebuggeni
/**
* Load the user object into the user property
*
* @return \thebuggenie\core\entities\User
*/
public static function loadUser($user = null)
{
try {
self::$_user = $user === null ? User::loginCheck(self::getRequest(), self::getCurrentAction()) : $user;
if (self::$_user->isAuthenticated()) {
if (self::$_user->isOffline() || self::$_user->isAway()) {
self::$_user->setOnline();
}
if (!self::getRequest()->hasCookie('tbg3_original_username')) {
self::$_user->updateLastSeen();
}
if (!self::getScope()->isDefault() && !self::getRequest()->isAjaxCall() && !in_array(self::getRouting()->getCurrentRouteName(), array('add_scope', 'debugger', 'logout')) && !self::$_user->isGuest() && !self::$_user->isConfirmedMemberOfScope(self::getScope())) {
self::getResponse()->headerRedirect(self::getRouting()->generate('add_scope'));
}
self::$_user->save();
if (!self::$_user->getGroup() instanceof \thebuggenie\core\entities\Group) {
throw new \Exception('This user account belongs to a group that does not exist anymore. <br>Please contact the system administrator.');
}
}
} catch (exceptions\ElevatedLoginException $e) {
throw $e;
} catch (\Exception $e) {
self::$_user = new User();
throw $e;
}
return self::$_user;
}
作者:pkdevbox
项目:thebuggeni
public function do_execute()
{
$hostname = $this->getProvidedArgument('hostname');
$this->cliEcho('Checking scope availability ...');
if (tables\ScopeHostnames::getTable()->getScopeIDForHostname($hostname) === null) {
$this->cliEcho("available!\n");
$this->cliEcho("Creating scope ...");
$scope = new entities\Scope();
$scope->addHostname($hostname);
$scope->setName($this->getProvidedArgument('shortname'));
$uploads_enabled = $this->getProvidedArgument('enable_uploads', 'yes') == 'yes';
$scope->setUploadsEnabled((bool) $uploads_enabled);
$scope->setMaxUploadLimit($this->getProvidedArgument('upload_limit', 0));
$scope->setMaxProjects($this->getProvidedArgument('projects', 0));
$scope->setMaxUsers($this->getProvidedArgument('users', 0));
$scope->setMaxTeams($this->getProvidedArgument('teams', 0));
$scope->setMaxWorkflowsLimit($this->getProvidedArgument('workflows', 0));
$scope->setEnabled();
$this->cliEcho(".");
$scope->save();
$this->cliEcho(".done!\n");
$admin_user = $this->getProvidedArgument('scope_admin');
if ($admin_user) {
$user = entities\User::getByUsername($admin_user);
if ($user instanceof entities\User) {
$this->cliEcho("Adding user {$admin_user} to scope\n");
$admin_group_id = (int) framework\Settings::get(framework\Settings::SETTING_ADMIN_GROUP, 'core', $scope->getID());
tables\UserScopes::getTable()->addUserToScope($user->getID(), $scope->getID(), $admin_group_id, true);
} else {
$this->cliEcho("Could not add user {$admin_user} to scope (username not found)\n");
}
}
if ($this->getProvidedArgument('remove_admin', 'no') == 'yes') {
$this->cliEcho("Removing administrator user from scope\n");
tables\UserScopes::getTable()->removeUserFromScope(1, $scope->getID());
}
foreach (framework\Context::getModules() as $module) {
$module_name = $module->getName();
if ($module_name == 'publish') {
continue;
}
if ($this->getProvidedArgument("install_module_{$module_name}", "no") == 'yes') {
$this->cliEcho("Installing module {$module_name}\n");
entities\Module::installModule($module_name, $scope);
}
}
} else {
$this->cliEcho("not available\n", 'red');
}
$this->cliEcho("\n");
}
作者:founderi
项目:thebuggeni
public function addIdentity($identity, $user_id)
{
$user = \thebuggenie\core\entities\User::getB2DBTable()->selectById($user_id);
$crit = $this->getCriteria();
$crit->addInsert(self::IDENTITY, $identity);
$crit->addInsert(self::IDENTITY_HASH, User::hashPassword($identity, $user->getSalt()));
$crit->addInsert(self::UID, $user_id);
$type = 'openid';
foreach (self::getProviders() as $provider => $string) {
if (stripos($identity, $string) !== false) {
$type = $provider;
break;
}
}
$crit->addInsert(self::TYPE, $type);
$this->doInsert($crit);
}
作者:pkdevbox
项目:thebuggeni
public function runAuthenticate(framework\Request $request)
{
$username = trim($request['username']);
$password = trim($request['password']);
if ($username) {
$user = tables\Users::getTable()->getByUsername($username);
if ($password && $user instanceof entities\User) {
foreach ($user->getApplicationPasswords() as $app_password) {
if (!$app_password->isUsed()) {
if ($app_password->getHashPassword() == entities\User::hashPassword($password, $user->getSalt())) {
$app_password->useOnce();
$app_password->save();
return $this->renderJSON(array('token' => $app_password->getHashPassword()));
}
}
}
}
}
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => 'Incorrect username or application password'));
}
作者:founderi
项目:thebuggeni
public function findInConfig($details, $limit = 50, $allow_keywords = true)
{
$crit = $this->getCriteria();
switch ($details) {
case 'unactivated':
if ($allow_keywords) {
$crit->addWhere(self::ACTIVATED, false);
$limit = 500;
break;
}
case 'newusers':
if ($allow_keywords) {
$crit->addWhere(self::JOINED, NOW - 1814400, Criteria::DB_GREATER_THAN_EQUAL);
$limit = 500;
break;
}
case '0-9':
if ($allow_keywords) {
$ctn = $crit->returnCriterion(self::UNAME, array('0%', '1%', '2%', '3%', '4%', '5%', '6%', '7%', '8%', '9%'), Criteria::DB_IN);
$ctn->addOr(self::BUDDYNAME, array('0%', '1%', '2%', '3%', '4%', '5%', '6%', '7%', '8%', '9%'), Criteria::DB_IN);
$ctn->addOr(self::REALNAME, array('0%', '1%', '2%', '3%', '4%', '5%', '6%', '7%', '8%', '9%'), Criteria::DB_IN);
$crit->addWhere($ctn);
$limit = 500;
break;
}
case 'all':
if ($allow_keywords) {
$limit = 500;
break;
}
default:
if (mb_strlen($details) == 1) {
$limit = 500;
}
$details = mb_strlen($details) == 1 ? mb_strtolower("{$details}%") : mb_strtolower("%{$details}%");
$ctn = $crit->returnCriterion(self::UNAME, $details, Criteria::DB_LIKE);
$ctn->addOr(self::BUDDYNAME, $details, Criteria::DB_LIKE);
$ctn->addOr(self::REALNAME, $details, Criteria::DB_LIKE);
$ctn->addOr(self::EMAIL, $details, Criteria::DB_LIKE);
$crit->addWhere($ctn);
break;
}
$crit->addJoin(UserScopes::getTable(), UserScopes::USER_ID, self::ID, array(), Criteria::DB_INNER_JOIN);
$crit->addWhere(UserScopes::SCOPE, framework\Context::getScope()->getID());
$crit->addWhere(self::DELETED, false);
$users = array();
$res = null;
if ($details != '' && ($res = $this->doSelect($crit))) {
while (($row = $res->getNextRow()) && count($users) < $limit) {
$user_id = (int) $row->get(self::ID);
$details = UserScopes::getTable()->getUserDetailsByScope($user_id, framework\Context::getScope()->getID());
if (!$details) {
continue;
}
$users[$user_id] = \thebuggenie\core\entities\User::getB2DBTable()->selectById($user_id);
$users[$user_id]->setScopeConfirmed($details['confirmed']);
}
}
return $users;
}
作者:shoreless-Limite
项目:thebuggeni
/**
* Toggle favourite article (starring)
*
* @param \thebuggenie\core\framework\Request $request
*/
public function runToggleFavouriteArticle(framework\Request $request)
{
if ($article_id = $request['article_id']) {
try {
$article = Articles::getTable()->selectById($article_id);
$user = \thebuggenie\core\entities\User::getB2DBTable()->selectById($request['user_id']);
} catch (\Exception $e) {
return $this->renderText('fail');
}
} else {
return $this->renderText('no article');
}
if ($user->isArticleStarred($article_id)) {
$retval = !$user->removeStarredArticle($article_id);
} else {
$retval = $user->addStarredArticle($article_id);
if ($user->getID() != $this->getUser()->getID()) {
framework\Event::createNew('core', 'article_subscribe_user', $article, compact('user'))->trigger();
}
}
return $this->renderText(json_encode(array('starred' => $retval, 'subscriber' => $this->getComponentHTML('publish/articlesubscriber', array('user' => $user, 'article' => $article)))));
}
作者:nrense
项目:thebuggeni
/**
* Populate the array of starred articles
*/
protected function User__populateStarredArticles(User $user)
{
if ($user->_isset('publish', 'starredarticles') === null) {
$articles = UserArticles::getTable()->getUserStarredArticles($user->getID());
$user->_store('publish', 'starredarticles', $articles);
}
}
作者:founderi
项目:thebuggeni
<?php
if (!isset($include_issue_title) || $include_issue_title) {
?>
<?php
echo link_tag(make_url('viewissue', array('project_key' => $issue->getProject()->getKey(), 'issue_no' => $issue->getFormattedIssueNo())), $issue_title, array('class' => $log_action['change_type'] == \thebuggenie\core\entities\tables\Log::LOG_ISSUE_CLOSE ? 'issue_closed' : 'issue_open', 'style' => 'margin-top: 7px;'));
?>
<?php
}
?>
<?php
if ((!isset($include_issue_title) || $include_issue_title) && (isset($include_user) && $include_user == true)) {
?>
<br>
<span class="user">
<?php
if (($user = \thebuggenie\core\entities\User::getB2DBTable()->selectById($log_action['user_id'])) instanceof \thebuggenie\core\entities\User) {
?>
<?php
if ($log_action['change_type'] != \thebuggenie\core\entities\tables\Log::LOG_COMMENT) {
?>
<?php
echo $user->getNameWithUsername() . ':';
?>
<?php
} else {
?>
<?php
echo __('%user said', array('%user' => $user->getNameWithUsername())) . ':';
?>
<?php
}
作者:JonathanR
项目:thebuggeni
/**
* Return the default user
*
* @return \thebuggenie\core\entities\User
*/
public static function getDefaultUser()
{
try {
return \thebuggenie\core\entities\User::getB2DBTable()->selectByID((int) self::get(self::SETTING_DEFAULT_USER_ID));
} catch (\Exception $e) {
return null;
}
}
作者:RTechSof
项目:thebuggeni
public function getOrCreateUserFromEmailString($email_string)
{
$email = $this->getEmailAdressFromSenderString($email_string);
if (!($user = User::findUser($email))) {
$name = $email;
if (($q_pos = strpos($email_string, "<")) !== false) {
$name = trim(substr($email_string, 0, $q_pos - 1));
}
$user = new User();
try {
$user->setBuddyname($name);
$user->setEmail($email);
$user->setUsername($email);
$user->setValidated();
$user->setActivated();
$user->setEnabled();
$user->save();
} catch (\Exception $e) {
return null;
}
}
return $user;
}
作者:founderi
项目:thebuggeni
<?php
echo __('Set resolution to %resolution', array('%resolution' => '<span id="workflowtransitionaction_' . $action->getID() . '_value" style="font-weight: bold;">' . ($action->getTargetValue() ? \thebuggenie\core\entities\Resolution::getB2DBTable()->selectById((int) $action->getTargetValue())->getName() : __('Resolution provided by user')) . '</span>'));
?>
<?php
} elseif ($action->getActionType() == \thebuggenie\core\entities\WorkflowTransitionAction::ACTION_SET_REPRODUCABILITY) {
?>
<?php
echo __('Set reproducability to %reproducability', array('%reproducability' => '<span id="workflowtransitionaction_' . $action->getID() . '_value" style="font-weight: bold;">' . ($action->getTargetValue() ? \thebuggenie\core\entities\Reproducability::getB2DBTable()->selectById((int) $action->getTargetValue())->getName() : __('Reproducability provided by user')) . '</span>'));
?>
<?php
} elseif ($action->getActionType() == \thebuggenie\core\entities\WorkflowTransitionAction::ACTION_ASSIGN_ISSUE) {
?>
<?php
if ($action->hasTargetValue()) {
$target_details = explode('_', $action->getTargetValue());
echo __('Assign issue to %assignee', array('%assignee' => '<span id="workflowtransitionaction_' . $action->getID() . '_value" style="font-weight: bold;">' . ($target_details[0] == 'user' ? \thebuggenie\core\entities\User::getB2DBTable()->selectById((int) $target_details[1])->getNameWithUsername() : \thebuggenie\core\entities\Team::getB2DBTable()->selectById((int) $target_details[1])->getName()) . '</span>'));
} else {
echo __('Assign issue to %assignee', array('%assignee' => '<span id="workflowtransitionaction_' . $action->getID() . '_value" style="font-weight: bold;">' . __('User or team specified during transition') . '</span>'));
}
?>
<?php
} elseif ($action->isCustomSetAction()) {
?>
<?php
$tbg_response->addJavascript('calendarview.js');
switch (\thebuggenie\core\entities\CustomDatatype::getByKey($action->getCustomActionType())->getType()) {
case \thebuggenie\core\entities\CustomDatatype::INPUT_TEXTAREA_MAIN:
case \thebuggenie\core\entities\CustomDatatype::INPUT_TEXTAREA_SMALL:
case \thebuggenie\core\entities\CustomDatatype::INPUT_TEXT:
case \thebuggenie\core\entities\CustomDatatype::CALCULATED_FIELD:
echo __('Set issue field %key to %value', array('%key' => $action->getCustomActionType(), '%value' => '<span id="workflowtransitionaction_' . $action->getID() . '_value" style="font-weight: bold;">' . ($action->getTargetValue() ?: __('Value provided by user')) . '</span>'));
作者:underblaz
项目:thebuggenie-4.1.
/**
* Check if the given user is a friend of this user
*
* @param \thebuggenie\core\entities\User $user The user to check
*
* @return boolean
*/
public function isFriend($user)
{
$this->_setupFriends();
if (empty($this->_friends)) {
return false;
}
return array_key_exists($user->getID(), $this->_friends);
}
作者:founderi
项目:thebuggeni
function tbg_get_userstate_image(\thebuggenie\core\entities\User $user)
{
switch (true) {
case $user->getState()->isInMeeting():
return fa_image_tag('circle', array('class' => 'userstate in-meeting', 'title' => __($user->getState()->getName())));
break;
case $user->getState()->isBusy():
return fa_image_tag('minus-circle', array('class' => 'userstate busy', 'title' => __($user->getState()->getName())));
break;
case $user->isOffline():
return fa_image_tag('times-circle', array('class' => 'userstate offline', 'title' => __($user->getState()->getName())));
break;
case $user->getState()->isAbsent():
return fa_image_tag('circle', array('class' => 'userstate absent', 'title' => __($user->getState()->getName())));
break;
case $user->getState()->isUnavailable():
return fa_image_tag('circle-thin', array('class' => 'userstate unavailable', 'title' => __($user->getState()->getName())));
break;
default:
return fa_image_tag('check-circle', array('class' => 'userstate online', 'title' => __($user->getState()->getName())));
break;
}
}
作者:JonathanR
项目:thebuggeni
public function removeMember(\thebuggenie\core\entities\User $user)
{
if ($this->_members !== null) {
unset($this->_members[$user->getID()]);
}
if ($this->_num_members !== null) {
$this->_num_members--;
}
tables\TeamMembers::getTable()->removeUserFromTeam($user->getID(), $this->getID());
}
作者:JonathanR
项目:thebuggeni
/**
* Configure project leaders
*
* @param framework\Request $request The request object
*/
public function runSetItemLead(framework\Request $request)
{
try {
switch ($request['item_type']) {
case 'project':
$item = entities\Project::getB2DBTable()->selectById($request['project_id']);
break;
case 'edition':
$item = entities\Edition::getB2DBTable()->selectById($request['edition_id']);
break;
case 'component':
$item = entities\Component::getB2DBTable()->selectById($request['component_id']);
break;
}
} catch (\Exception $e) {
}
$this->forward403unless(isset($item) && $item instanceof entities\common\Identifiable);
if ($request->hasParameter('value')) {
$this->forward403unless($request['item_type'] == 'project' && $this->getUser()->canEditProjectDetails($this->selected_project) || $request['item_type'] != 'project' && $this->getUser()->canManageProjectReleases($this->selected_project));
if ($request->hasParameter('identifiable_type')) {
if (in_array($request['identifiable_type'], array('team', 'user')) && $request['value']) {
switch ($request['identifiable_type']) {
case 'user':
$identified = entities\User::getB2DBTable()->selectById($request['value']);
break;
case 'team':
$identified = entities\Team::getB2DBTable()->selectById($request['value']);
break;
}
if ($identified instanceof entities\common\Identifiable) {
if ($request['field'] == 'owned_by') {
$item->setOwner($identified);
} elseif ($request['field'] == 'qa_by') {
$item->setQaResponsible($identified);
} elseif ($request['field'] == 'lead_by') {
$item->setLeader($identified);
}
$item->save();
}
} else {
if ($request['field'] == 'owned_by') {
$item->clearOwner();
} elseif ($request['field'] == 'qa_by') {
$item->clearQaResponsible();
} elseif ($request['field'] == 'lead_by') {
$item->clearLeader();
}
$item->save();
}
}
if ($request['field'] == 'owned_by') {
return $this->renderJSON(array('field' => $item->hasOwner() ? array('id' => $item->getOwner()->getID(), 'name' => $item->getOwner() instanceof entities\User ? $this->getComponentHTML('main/userdropdown', array('user' => $item->getOwner())) : $this->getComponentHTML('main/teamdropdown', array('team' => $item->getOwner()))) : array('id' => 0)));
} elseif ($request['field'] == 'lead_by') {
return $this->renderJSON(array('field' => $item->hasLeader() ? array('id' => $item->getLeader()->getID(), 'name' => $item->getLeader() instanceof entities\User ? $this->getComponentHTML('main/userdropdown', array('user' => $item->getLeader())) : $this->getComponentHTML('main/teamdropdown', array('team' => $item->getLeader()))) : array('id' => 0)));
} elseif ($request['field'] == 'qa_by') {
return $this->renderJSON(array('field' => $item->hasQaResponsible() ? array('id' => $item->getQaResponsible()->getID(), 'name' => $item->getQaResponsible() instanceof entities\User ? $this->getComponentHTML('main/userdropdown', array('user' => $item->getQaResponsible())) : $this->getComponentHTML('main/teamdropdown', array('team' => $item->getQaResponsible()))) : array('id' => 0)));
}
}
}
作者:RTechSof
项目:thebuggeni
public function doLogin($username, $password, $mode = 1)
{
$validgroups = $this->getSetting('groups');
$base_dn = $this->getSetting('b_dn');
$dn_attr = $this->escape($this->getSetting('dn_attr'));
$username_attr = $this->escape($this->getSetting('u_attr'));
$fullname_attr = $this->escape($this->getSetting('f_attr'));
$buddyname_attr = $this->escape($this->getSetting('b_attr'));
$email_attr = $this->escape($this->getSetting('e_attr'));
$groups_members_attr = $this->escape($this->getSetting('g_attr'));
$user_class = framework\Context::getModule('auth_ldap')->getSetting('u_type');
$group_class = framework\Context::getModule('auth_ldap')->getSetting('g_type');
$email = null;
$integrated_auth = $this->getSetting('integrated_auth');
/*
* Do the LDAP check here.
*
* If a connection error or something, throw an exception and log
*
* If we can, set $mail and $realname to correct values from LDAP
* otherwise don't touch those variables.
*
* To log do:
* framework\Logging::log('error goes here', 'ldap', framework\Logging::LEVEL_FATAL);
*/
try {
/*
* First job is to connect to our control user (may be an anonymous bind)
* so we can find the user we want to log in as/validate.
*/
$connection = $this->connect();
$control_user = $this->getSetting('control_user');
$control_password = $this->getSetting('control_pass');
$this->bind($connection, $control_user, $control_password);
// Assume bind successful, otherwise we would have had an exception
/*
* Search for a user with the username specified. We search in the base_dn, so we can
* find users in multiple parts of the directory, and only return users of a specific
* class (default person).
*
* We want exactly 1 user to be returned. We get the user's full name, email, cn
* and dn.
*/
$fields = array($fullname_attr, $buddyname_attr, $email_attr, 'cn', $dn_attr);
$filter = '(&(objectClass=' . $this->escape($user_class) . ')(' . $username_attr . '=' . $this->escape($username) . '))';
$results = ldap_search($connection, $base_dn, $filter, $fields);
if (!$results) {
framework\Logging::log('failed to search for user: ' . ldap_error($connection), 'ldap', framework\Logging::LEVEL_FATAL);
throw new \Exception(framework\Context::geti18n()->__('Search failed: ') . ldap_error($connection));
}
$data = ldap_get_entries($connection, $results);
// User does not exist
if ($data['count'] == 0) {
framework\Logging::log('could not find user ' . $username . ', class ' . $user_class . ', attribute ' . $username_attr, 'ldap', framework\Logging::LEVEL_FATAL);
throw new \Exception(framework\Context::geti18n()->__('User does not exist in the directory'));
}
// If we have more than 1 user, something is seriously messed up...
if ($data['count'] > 1) {
framework\Logging::log('too many users for ' . $username . ', class ' . $user_class . ', attribute ' . $username_attr, 'ldap', framework\Logging::LEVEL_FATAL);
throw new \Exception(framework\Context::geti18n()->__('This user was found multiple times in the directory, please contact your administrator'));
}
/*
* If groups are specified, perform group restriction tests
*/
if ($validgroups != '') {
/*
* We will repeat this for every group, but groups are supplied as a comma-separated list
*/
if (strstr($validgroups, ',')) {
$groups = explode(',', $validgroups);
} else {
$groups = array();
$groups[] = $validgroups;
}
// Assumed we are initially banned
$allowed = false;
foreach ($groups as $group) {
// No need to carry on looking if we have access
if ($allowed == true) {
continue;
}
/*
* Find the group we are looking for, we search the entire directory as per users (See that stuff)
* We want to find 1 group, if we don't get 1, silently ignore this group.
*/
$fields2 = array($groups_members_attr);
$filter2 = '(&(objectClass=' . $this->escape($group_class) . ')(cn=' . $this->escape($group) . '))';
$results2 = ldap_search($connection, $base_dn, $filter2, $fields2);
if (!$results2) {
framework\Logging::log('failed to search for user after binding: ' . ldap_error($connection), 'ldap', framework\Logging::LEVEL_FATAL);
throw new \Exception(framework\Context::geti18n()->__('Search failed ') . ldap_error($connection));
}
$data2 = ldap_get_entries($connection, $results2);
if ($data2['count'] != 1) {
continue;
}
/*
* Look through the group's member list. If we are found, grant access.
*/
foreach ($data2[0][strtolower($groups_members_attr)] as $member) {
//.........这里部分代码省略.........
作者:AzerothShar
项目:thebuggeni
/**
* Register a user as working on the issue
*
* @param \thebuggenie\core\entities\User $user
*/
public function startWorkingOnIssue(User $user)
{
$this->_addChangedProperty('_being_worked_on_by_user', $user->getID());
$this->_being_worked_on_by_user_since = NOW;
}
作者:underblaz
项目:thebuggenie-4.1.
function tbg_get_userstate_image(\thebuggenie\core\entities\User $user)
{
switch (true) {
case $user->isOffline():
return image_tag('user-offline.png', array('class' => 'userstate', 'title' => __($user->getState()->getName())));
break;
case $user->getState()->isBusy():
case $user->getState()->isUnavailable():
return image_tag('user-busy.png', array('class' => 'userstate', 'title' => __($user->getState()->getName())));
break;
case $user->getState()->isAbsent():
return image_tag('user-invisible.png', array('class' => 'userstate', 'title' => __($user->getState()->getName())));
break;
case $user->getState()->isInMeeting():
return image_tag('user-away-extended.png', array('class' => 'userstate', 'title' => __($user->getState()->getName())));
break;
case $user->getState()->isUnavailable():
return image_tag('user-away.png', array('class' => 'userstate', 'title' => __($user->getState()->getName())));
break;
default:
return image_tag('user-online.png', array('class' => 'userstate', 'title' => __($user->getState()->getName())));
break;
}
}
作者:pkdevbox
项目:thebuggeni
$previous_value = $item->getPreviousValue() ? \thebuggenie\core\entities\Issue::getPainTypesOrLabel('pain_likelihood', $item->getPreviousValue()) : __('Not determined');
$new_value = $item->getCurrentValue() ? \thebuggenie\core\entities\Issue::getPainTypesOrLabel('pain_likelihood', $item->getCurrentValue()) : __('Not determined');
echo __("Likelihood on issue changed: %previous_value => %new_value", array('%previous_value' => '<strong>' . $previous_value . '</strong>', '%new_value' => '<strong>' . $new_value . '</strong>'));
}
break;
case \thebuggenie\core\entities\tables\Log::LOG_ISSUE_PAIN_CALCULATED:
echo image_tag('icon_percent.png');
if ($item->hasChangeDetails()) {
echo __("Calculated pain on issue changed: %value", array('%value' => '<strong>' . $item->getText() . '</strong>'));
}
break;
case \thebuggenie\core\entities\tables\Log::LOG_ISSUE_USERS:
echo image_tag('icon_user.png');
if ($item->hasChangeDetails()) {
$previous_value = $item->getPreviousValue() ? ($old_item = \thebuggenie\core\entities\User::getB2DBTable()->selectById($item->getPreviousValue())) ? __($old_item->getNameWithUsername()) : __('Unknown') : __('Not determined');
$new_value = $item->getCurrentValue() ? ($new_item = \thebuggenie\core\entities\User::getB2DBTable()->selectById($item->getCurrentValue())) ? __($new_item->getNameWithUsername()) : __('Unknown') : __('Not determined');
echo __("User working on issue changed: %previous_value => %new_value", array('%previous_value' => '<strong>' . $previous_value . '</strong>', '%new_value' => '<strong>' . $new_value . '</strong>'));
}
break;
case \thebuggenie\core\entities\tables\Log::LOG_ISSUE_ASSIGNED:
echo image_tag('icon_user.png');
echo __("Assignee changed to %new_value", array('%new_value' => '<strong>' . $item->getText() . '</strong>'));
break;
case \thebuggenie\core\entities\tables\Log::LOG_ISSUE_TIME_SPENT:
echo image_tag('icon_time.png');
echo __("Time spent changed: %value", array('%value' => '<strong>' . $item->getText() . '</strong>'));
break;
case \thebuggenie\core\entities\tables\Log::LOG_ISSUE_PERCENT:
echo image_tag('icon_percent.png');
if ($item->hasChangeDetails()) {
echo __("Percent complete changed: %previous_value => %new_value", array('%previous_value' => '<strong>' . (int) $item->getPreviousValue() . '</strong>', '%new_value' => '<strong>' . (int) $item->getCurrentValue() . '</strong>'));