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


PHP User::getB2DBTable方法代码示例

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


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

示例1: addIdentity

 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);
 }
开发者ID:founderio,项目名称:thebuggenie,代码行数:17,代码来源:OpenIdAccounts.php

示例2: initializeUser

 protected static function initializeUser()
 {
     Logging::log('Loading user');
     try {
         Logging::log('is this logout?');
         if (self::getRequest()->getParameter('logout')) {
             Logging::log('yes');
             self::logout();
         } else {
             Logging::log('no');
             Logging::log('sets up user object');
             $event = Event::createNew('core', 'pre_login');
             $event->trigger();
             if ($event->isProcessed()) {
                 self::loadUser($event->getReturnValue());
             } elseif (!self::isCLI()) {
                 self::loadUser();
             } else {
                 self::$_user = new User();
             }
             Event::createNew('core', 'post_login', self::getUser())->trigger();
             Logging::log('loaded');
             Logging::log('caching permissions');
             self::cacheAllPermissions();
             Logging::log('done (caching permissions)');
         }
     } catch (exceptions\ElevatedLoginException $e) {
         Logging::log("Could not reauthenticate elevated permissions: " . $e->getMessage(), 'main', Logging::LEVEL_INFO);
         self::setMessage('elevated_login_message_err', $e->getMessage());
         self::$_redirect_login = 'elevated_login';
     } catch (\Exception $e) {
         Logging::log("Something happened while setting up user: " . $e->getMessage(), 'main', Logging::LEVEL_WARNING);
         $is_anonymous_route = self::isCLI() || self::getRouting()->isCurrentRouteAnonymousRoute();
         if (!$is_anonymous_route) {
             self::setMessage('login_message_err', $e->getMessage());
             self::$_redirect_login = 'login';
         } else {
             self::$_user = User::getB2DBTable()->selectById(Settings::getDefaultUserID());
         }
     }
     Logging::log('...done');
 }
开发者ID:JonathanRH,项目名称:thebuggenie,代码行数:42,代码来源:Context.php

示例3: link_tag

         <?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 
         }
开发者ID:founderio,项目名称:thebuggenie,代码行数:31,代码来源:_logitem.inc.php

示例4: perform

 public function perform(\thebuggenie\core\entities\Issue $issue, $request = null)
 {
     switch ($this->_action_type) {
         case self::ACTION_ASSIGN_ISSUE_SELF:
             $issue->setAssignee(framework\Context::getUser());
             break;
         case self::ACTION_SET_STATUS:
             if ($this->getTargetValue()) {
                 $issue->setStatus(Status::getB2DBTable()->selectById((int) $this->getTargetValue()));
             } else {
                 $issue->setStatus($request['status_id']);
             }
             break;
         case self::ACTION_CLEAR_MILESTONE:
             $issue->setMilestone(null);
             break;
         case self::ACTION_SET_MILESTONE:
             if ($this->getTargetValue()) {
                 $issue->setMilestone(Milestone::getB2DBTable()->selectById((int) $this->getTargetValue()));
             } else {
                 $issue->setMilestone($request['milestone_id']);
             }
             break;
         case self::ACTION_CLEAR_PRIORITY:
             $issue->setPriority(null);
             break;
         case self::ACTION_SET_PRIORITY:
             if ($this->getTargetValue()) {
                 $issue->setPriority(Priority::getB2DBTable()->selectById((int) $this->getTargetValue()));
             } else {
                 $issue->setPriority($request['priority_id']);
             }
             break;
         case self::ACTION_CLEAR_PERCENT:
             $issue->setPercentCompleted(0);
             break;
         case self::ACTION_SET_PERCENT:
             if ($this->getTargetValue()) {
                 $issue->setPercentCompleted((int) $this->getTargetValue());
             } else {
                 $issue->setPercentCompleted((int) $request['percent_complete_id']);
             }
             break;
         case self::ACTION_CLEAR_DUPLICATE:
             $issue->setDuplicateOf(null);
             break;
         case self::ACTION_SET_DUPLICATE:
             $issue->setDuplicateOf($request['duplicate_issue_id']);
             break;
         case self::ACTION_CLEAR_RESOLUTION:
             $issue->setResolution(null);
             break;
         case self::ACTION_SET_RESOLUTION:
             if ($this->getTargetValue()) {
                 $issue->setResolution(Resolution::getB2DBTable()->selectById((int) $this->getTargetValue()));
             } else {
                 $issue->setResolution($request['resolution_id']);
             }
             break;
         case self::ACTION_CLEAR_REPRODUCABILITY:
             $issue->setReproducability(null);
             break;
         case self::ACTION_SET_REPRODUCABILITY:
             if ($this->getTargetValue()) {
                 $issue->setReproducability(Reproducability::getB2DBTable()->selectById((int) $this->getTargetValue()));
             } else {
                 $issue->setReproducability($request['reproducability_id']);
             }
             break;
         case self::ACTION_CLEAR_ASSIGNEE:
             $issue->clearAssignee();
             break;
         case self::ACTION_ASSIGN_ISSUE:
             if ($this->getTargetValue()) {
                 $target_details = explode('_', $this->_target_value);
                 if ($target_details[0] == 'user') {
                     $assignee = \thebuggenie\core\entities\User::getB2DBTable()->selectById((int) $target_details[1]);
                 } else {
                     $assignee = Team::getB2DBTable()->selectById((int) $target_details[1]);
                 }
                 $issue->setAssignee($assignee);
             } else {
                 $assignee = null;
                 switch ($request['assignee_type']) {
                     case 'user':
                         $assignee = \thebuggenie\core\entities\User::getB2DBTable()->selectById((int) $request['assignee_id']);
                         break;
                     case 'team':
                         $assignee = Team::getB2DBTable()->selectById((int) $request['assignee_id']);
                         break;
                 }
                 if ((bool) $request->getParameter('assignee_teamup', false) && $assignee instanceof \thebuggenie\core\entities\User && $assignee->getID() != framework\Context::getUser()->getID()) {
                     $team = new \thebuggenie\core\entities\Team();
                     $team->setName($assignee->getBuddyname() . ' & ' . framework\Context::getUser()->getBuddyname());
                     $team->setOndemand(true);
                     $team->save();
                     $team->addMember($assignee);
                     $team->addMember(framework\Context::getUser());
                     $assignee = $team;
                 }
//.........这里部分代码省略.........
开发者ID:AzerothShard,项目名称:thebuggenie,代码行数:101,代码来源:WorkflowTransitionAction.php

示例5: __

         $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>'));
开发者ID:pkdevboxy,项目名称:thebuggenie,代码行数:31,代码来源:_issuelogitem.inc.php

示例6: runDoImportCSV

 public function runDoImportCSV(framework\Request $request)
 {
     try {
         if ($request['csv_data'] == '') {
             throw new \Exception($this->getI18n()->__('No data supplied to import'));
         }
         $csv = str_replace("\r\n", "\n", $request['csv_data']);
         $csv = html_entity_decode($csv);
         $headerrow = null;
         $data = array();
         $errors = array();
         // Parse CSV
         $handle = fopen("php://memory", 'r+');
         fputs($handle, $csv);
         rewind($handle);
         $i = 0;
         while (($row = fgetcsv($handle, 1000)) !== false) {
             if (!$headerrow) {
                 $headerrow = $row;
             } else {
                 if (count($headerrow) == count($row)) {
                     $data[] = array_combine($headerrow, $row);
                 } else {
                     $errors[] = $this->getI18n()->__('Row %row does not have the same number of elements as the header row', array('%row' => $i));
                 }
             }
             $i++;
         }
         fclose($handle);
         if (empty($data)) {
             throw new \Exception($this->getI18n()->__('Insufficient data to import'));
         }
         // Verify required columns are present based on type
         $requiredcols = array(self::CSV_TYPE_CLIENTS => array(self::CSV_CLIENT_NAME), self::CSV_TYPE_PROJECTS => array(self::CSV_PROJECT_NAME), self::CSV_TYPE_ISSUES => array(self::CSV_ISSUE_TITLE, self::CSV_ISSUE_PROJECT, self::CSV_ISSUE_ISSUE_TYPE));
         if (!isset($requiredcols[$request['type']])) {
             throw new \Exception('Sorry, this type is unimplemented');
         }
         foreach ($requiredcols[$request['type']] as $col) {
             if (!in_array($col, $headerrow)) {
                 $errors[] = $this->getI18n()->__('Required column \'%col\' not found in header row', array('%col' => $col));
             }
         }
         // Check if rows are long enough and fields are not empty
         for ($i = 0; $i != count($data); $i++) {
             $activerow = $data[$i];
             // Check if fields are empty
             foreach ($activerow as $col => $val) {
                 if (strlen($val) == 0) {
                     $errors[] = $this->getI18n()->__('Row %row column %col has no value', array('%col' => $col, '%row' => $i + 1));
                 }
             }
         }
         if (count($errors) == 0) {
             // Check if fields are valid
             switch ($request['type']) {
                 case self::CSV_TYPE_PROJECTS:
                     for ($i = 0; $i != count($data); $i++) {
                         $activerow = $data[$i];
                         // Check if project exists
                         $key = str_replace(' ', '', $activerow[self::CSV_PROJECT_NAME]);
                         $key = mb_strtolower($key);
                         $tmp = entities\Project::getByKey($key);
                         if ($tmp !== null) {
                             $errors[] = $this->getI18n()->__('Row %row: A project with this name already exists', array('%row' => $i + 1));
                         }
                         // First off are booleans
                         $boolitems = array(self::CSV_PROJECT_SCRUM, self::CSV_PROJECT_ALLOW_REPORTING, self::CSV_PROJECT_AUTOASSIGN, self::CSV_PROJECT_FREELANCE, self::CSV_PROJECT_EN_BUILDS, self::CSV_PROJECT_EN_COMPS, self::CSV_PROJECT_EN_EDITIONS, self::CSV_PROJECT_SHOW_SUMMARY);
                         foreach ($boolitems as $boolitem) {
                             if (array_key_exists($boolitem, $activerow) && isset($activerow[$boolitem]) && $activerow[$boolitem] != 1 && $activerow[$boolitem] != 0) {
                                 $errors[] = $this->getI18n()->__('Row %row column %col: invalid value (must be 1/0)', array('%col' => $boolitem, '%row' => $i + 1));
                             }
                         }
                         // Now identifiables
                         $identifiableitems = array(array(self::CSV_PROJECT_QA, self::CSV_PROJECT_QA_TYPE), array(self::CSV_PROJECT_LEAD, self::CSV_PROJECT_LEAD_TYPE), array(self::CSV_PROJECT_OWNER, self::CSV_PROJECT_OWNER_TYPE));
                         foreach ($identifiableitems as $identifiableitem) {
                             if (!array_key_exists($identifiableitem[1], $activerow) && array_key_exists($identifiableitem[0], $activerow) || array_key_exists($identifiableitem[1], $activerow) && !array_key_exists($identifiableitem[0], $activerow)) {
                                 $errors[] = $this->getI18n()->__('Row %row: Both the type and item ID must be supplied for owner/lead/qa fields', array('%row' => $i + 1));
                                 continue;
                             }
                             if (array_key_exists($identifiableitem[1], $activerow) && isset($activerow[$identifiableitem[1]]) !== null && $activerow[$identifiableitem[1]] != self::CSV_IDENTIFIER_TYPE_USER && $activerow[$identifiableitem[1]] != self::CSV_IDENTIFIER_TYPE_TEAM) {
                                 $errors[] = $this->getI18n()->__('Row %row column %col: invalid value (must be 1 for a user or 2 for a team)', array('%col' => $identifiableitem[1], '%row' => $i + 1));
                             }
                             if (array_key_exists($identifiableitem[0], $activerow) && isset($activerow[$identifiableitem[0]]) && !is_numeric($activerow[$identifiableitem[0]])) {
                                 $errors[] = $this->getI18n()->__('Row %row column %col: invalid value (must be a number)', array('%col' => $identifiableitem[0], '%row' => $i + 1));
                             } elseif (array_key_exists($identifiableitem[0], $activerow) && isset($activerow[$identifiableitem[0]]) && is_numeric($activerow[$identifiableitem[0]])) {
                                 // check if they exist
                                 switch ($activerow[$identifiableitem[1]]) {
                                     case self::CSV_IDENTIFIER_TYPE_USER:
                                         try {
                                             entities\User::getB2DBTable()->selectByID($activerow[$identifiableitem[0]]);
                                         } catch (\Exception $e) {
                                             $errors[] = $this->getI18n()->__('Row %row column %col: user does not exist', array('%col' => $identifiableitem[0], '%row' => $i + 1));
                                         }
                                         break;
                                     case self::CSV_IDENTIFIER_TYPE_TEAM:
                                         try {
                                             entities\Team::getB2DBTable()->selectById($activerow[$identifiableitem[0]]);
                                         } catch (\Exception $e) {
                                             $errors[] = $this->getI18n()->__('Row %row column %col: team does not exist', array('%col' => $identifiableitem[0], '%row' => $i + 1));
                                         }
//.........这里部分代码省略.........
开发者ID:pkdevboxy,项目名称:thebuggenie,代码行数:101,代码来源:Main.php

示例7: listen_Article_doSave

 public function listen_Article_doSave(framework\Event $event)
 {
     $article = $event->getSubject();
     $change_reason = $event->getParameter('reason');
     $revision = $event->getParameter('revision');
     $subject = 'Wiki article updated: %article_name';
     $user = \thebuggenie\core\entities\User::getB2DBTable()->selectById((int) $event->getParameter('user_id'));
     $parameters = compact('article', 'change_reason', 'user', 'revision');
     $to_users = $this->_getArticleRelatedUsers($article, $user);
     if (!empty($to_users)) {
         $this->_markArticleSent($article, $to_users);
         $messages = $this->getTranslatedMessages('articleupdate', $parameters, $to_users, $subject, array('%article_name' => html_entity_decode($article->getTitle(), ENT_COMPAT, framework\Context::getI18n()->getCharset())));
         foreach ($messages as $message) {
             if ($project = $article->getProject()) {
                 $this->_addProjectEmailAddress($message, $project);
             }
             $this->sendMail($message);
         }
     }
 }
开发者ID:RTechSoft,项目名称:thebuggenie,代码行数:20,代码来源:Mailing.php

示例8: _setupFriends

 /**
  * Sets up the internal friends array
  */
 protected function _setupFriends()
 {
     if ($this->_friends === null) {
         $userids = tables\Buddies::getTable()->getFriendsByUserID($this->getID());
         $friends = array();
         foreach ($userids as $friend) {
             try {
                 $friend = \thebuggenie\core\entities\User::getB2DBTable()->selectById((int) $friend);
                 $friends[$friend->getID()] = $friend;
             } catch (\Exception $e) {
                 $this->removeFriend($friend);
             }
         }
         $this->_friends = $friends;
     }
 }
开发者ID:underblaze,项目名称:thebuggenie-4.1.0,代码行数:19,代码来源:User.php

示例9: _processChanges

 protected function _processChanges()
 {
     $related_issues_to_save = array();
     $changed_properties = $this->_getChangedProperties();
     if (count($changed_properties)) {
         $is_saved_estimated = false;
         $is_saved_spent = false;
         $is_saved_assignee = false;
         $is_saved_owner = false;
         foreach ($changed_properties as $property => $value) {
             $compare_value = is_object($this->{$property}) ? $this->{$property}->getID() : $this->{$property};
             $original_value = $value['original_value'];
             if ($original_value != $compare_value) {
                 switch ($property) {
                     case '_title':
                         $this->addLogEntry(tables\Log::LOG_ISSUE_UPDATE_TITLE, framework\Context::getI18n()->__("Title updated"), $original_value, $compare_value);
                         break;
                     case '_shortname':
                         $this->addLogEntry(tables\Log::LOG_ISSUE_UPDATE_SHORTNAME, framework\Context::getI18n()->__("Issue label updated"), $original_value, $compare_value);
                         break;
                     case '_description':
                         $this->addLogEntry(tables\Log::LOG_ISSUE_UPDATE_DESCRIPTION, framework\Context::getI18n()->__("Description updated"), $original_value, $compare_value);
                         break;
                     case '_reproduction_steps':
                         $this->addLogEntry(tables\Log::LOG_ISSUE_UPDATE_REPRODUCTIONSTEPS, framework\Context::getI18n()->__("Reproduction steps updated"), $original_value, $compare_value);
                         break;
                     case '_category':
                         if ($original_value != 0) {
                             $old_name = ($old_item = \thebuggenie\core\entities\Category::getB2DBTable()->selectById($original_value)) ? $old_item->getName() : framework\Context::getI18n()->__('Not determined');
                         } else {
                             $old_name = framework\Context::getI18n()->__('Not determined');
                         }
                         $new_name = $this->getCategory() instanceof Datatype ? $this->getCategory()->getName() : framework\Context::getI18n()->__('Not determined');
                         $this->addLogEntry(tables\Log::LOG_ISSUE_CATEGORY, $old_name . ' &rArr; ' . $new_name, $original_value, $compare_value);
                         break;
                     case '_pain_bug_type':
                         if ($original_value != 0) {
                             $old_name = ($old_item = self::getPainTypesOrLabel('pain_bug_type', $original_value)) ? $old_item : framework\Context::getI18n()->__('Not determined');
                         } else {
                             $old_name = framework\Context::getI18n()->__('Not determined');
                         }
                         $new_name = ($new_item = self::getPainTypesOrLabel('pain_bug_type', $value['current_value'])) ? $new_item : framework\Context::getI18n()->__('Not determined');
                         $this->addLogEntry(tables\Log::LOG_ISSUE_PAIN_BUG_TYPE, $old_name . ' &rArr; ' . $new_name, $original_value, $compare_value);
                         break;
                     case '_pain_effect':
                         if ($original_value != 0) {
                             $old_name = ($old_item = self::getPainTypesOrLabel('pain_effect', $original_value)) ? $old_item : framework\Context::getI18n()->__('Not determined');
                         } else {
                             $old_name = framework\Context::getI18n()->__('Not determined');
                         }
                         $new_name = ($new_item = self::getPainTypesOrLabel('pain_effect', $value['current_value'])) ? $new_item : framework\Context::getI18n()->__('Not determined');
                         $this->addLogEntry(tables\Log::LOG_ISSUE_PAIN_EFFECT, $old_name . ' &rArr; ' . $new_name, $original_value, $compare_value);
                         break;
                     case '_pain_likelihood':
                         if ($original_value != 0) {
                             $old_name = ($old_item = self::getPainTypesOrLabel('pain_likelihood', $original_value)) ? $old_item : framework\Context::getI18n()->__('Not determined');
                         } else {
                             $old_name = framework\Context::getI18n()->__('Not determined');
                         }
                         $new_name = ($new_item = self::getPainTypesOrLabel('pain_likelihood', $value['current_value'])) ? $new_item : framework\Context::getI18n()->__('Not determined');
                         $this->addLogEntry(tables\Log::LOG_ISSUE_PAIN_LIKELIHOOD, $old_name . ' &rArr; ' . $new_name, $original_value, $compare_value);
                         break;
                     case '_user_pain':
                         $this->addLogEntry(tables\Log::LOG_ISSUE_PAIN_CALCULATED, $original_value . ' &rArr; ' . $value['current_value']);
                         break;
                     case '_status':
                         if ($original_value != 0) {
                             $old_name = ($old_item = \thebuggenie\core\entities\Status::getB2DBTable()->selectById($original_value)) ? $old_item->getName() : framework\Context::getI18n()->__('Unknown');
                         } else {
                             $old_name = framework\Context::getI18n()->__('Not determined');
                         }
                         $new_name = $this->getStatus() instanceof Datatype ? $this->getStatus()->getName() : framework\Context::getI18n()->__('Not determined');
                         $this->addLogEntry(tables\Log::LOG_ISSUE_STATUS, $old_name . ' &rArr; ' . $new_name, $original_value, $compare_value);
                         break;
                     case '_reproducability':
                         if ($original_value != 0) {
                             $old_name = ($old_item = \thebuggenie\core\entities\Reproducability::getB2DBTable()->selectById($original_value)) ? $old_item->getName() : framework\Context::getI18n()->__('Unknown');
                         } else {
                             $old_name = framework\Context::getI18n()->__('Not determined');
                         }
                         $new_name = $this->getReproducability() instanceof Datatype ? $this->getReproducability()->getName() : framework\Context::getI18n()->__('Not determined');
                         $this->addLogEntry(tables\Log::LOG_ISSUE_REPRODUCABILITY, $old_name . ' &rArr; ' . $new_name, $original_value, $compare_value);
                         break;
                     case '_priority':
                         if ($original_value != 0) {
                             $old_name = ($old_item = \thebuggenie\core\entities\Priority::getB2DBTable()->selectById($original_value)) ? $old_item->getName() : framework\Context::getI18n()->__('Unknown');
                         } else {
                             $old_name = framework\Context::getI18n()->__('Not determined');
                         }
                         $new_name = $this->getPriority() instanceof Datatype ? $this->getPriority()->getName() : framework\Context::getI18n()->__('Not determined');
                         $this->addLogEntry(tables\Log::LOG_ISSUE_PRIORITY, $old_name . ' &rArr; ' . $new_name, $original_value, $compare_value);
                         break;
                     case '_assignee_team':
                     case '_assignee_user':
                         if (!$is_saved_assignee) {
                             $new_name = $this->getAssignee() instanceof \thebuggenie\core\entities\common\Identifiable ? $this->getAssignee()->getName() : framework\Context::getI18n()->__('Not assigned');
                             if ($this->getAssignee() instanceof \thebuggenie\core\entities\User) {
                                 $this->startWorkingOnIssue($this->getAssignee());
                             }
                             $this->addLogEntry(tables\Log::LOG_ISSUE_ASSIGNED, $new_name);
//.........这里部分代码省略.........
开发者ID:AzerothShard,项目名称:thebuggenie,代码行数:101,代码来源:Issue.php

示例10: runAddClientMember

 public function runAddClientMember(framework\Request $request)
 {
     try {
         $user_id = (int) $request['user_id'];
         $client = tables\Clients::getTable()->selectById((int) $request['client_id']);
         $user = entities\User::getB2DBTable()->selectByID($user_id);
         $client->addMember($user);
         return $this->renderJSON(array('clientlistitem' => $this->getComponentHTML('configuration/clientuserlistitem', compact('client', 'user_id', 'user')), 'update_clients' => array('ids' => array($client->getID()), 'membercounts' => array($client->getID() => $client->getNumberOfMembers()))));
     } catch (\Exception $e) {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('error' => $e->getMessage()));
     }
 }
开发者ID:nrensen,项目名称:thebuggenie,代码行数:13,代码来源:Main.php

示例11: getPostedBy

 /**
  * Returns the user who posted the comment
  *
  * @return \thebuggenie\core\entities\User
  */
 public function getPostedBy()
 {
     try {
         return $this->_posted_by instanceof \thebuggenie\core\entities\User ? $this->_posted_by : \thebuggenie\core\entities\User::getB2DBTable()->selectById($this->_posted_by);
     } catch (\Exception $e) {
         return null;
     }
 }
开发者ID:founderio,项目名称:thebuggenie,代码行数:13,代码来源:Comment.php

示例12: runGetACLFormEntry

 public function runGetACLFormEntry(framework\Request $request)
 {
     switch ($request['identifiable_type']) {
         case 'user':
             $target = entities\User::getB2DBTable()->selectById((int) $request['identifiable_value']);
             break;
         case 'team':
             $target = entities\Team::getB2DBTable()->selectById((int) $request['identifiable_value']);
             break;
     }
     if (!$target instanceof entities\common\Identifiable) {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('error' => $this->getI18n()->__('Could not show permissions list')));
     }
     return $this->renderJSON(array('content' => $this->getComponentHTML('main/issueaclformentry', array('target' => $target))));
 }
开发者ID:nrensen,项目名称:thebuggenie,代码行数:16,代码来源:Main.php

示例13: getByPermissionTargetIDAndModule

 public function getByPermissionTargetIDAndModule($permission, $target_id, $module = 'core')
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::PERMISSION_TYPE, $permission);
     $crit->addWhere(self::TARGET_ID, $target_id);
     $crit->addWhere(self::MODULE, $module);
     $permissions = array();
     if ($res = $this->doSelect($crit)) {
         while ($row = $res->getNextRow()) {
             $target = null;
             if ($uid = $row->get(self::UID)) {
                 $target = \thebuggenie\core\entities\User::getB2DBTable()->selectById($uid);
             }
             if ($tid = $row->get(self::TID)) {
                 $target = \thebuggenie\core\entities\Team::getB2DBTable()->selectById($tid);
             }
             if ($gid = $row->get(self::GID)) {
                 $target = \thebuggenie\core\entities\Group::getB2DBTable()->selectById($gid);
             }
             if ($target instanceof \thebuggenie\core\entities\common\Identifiable) {
                 $permissions[] = array('target' => $target, 'allowed' => (bool) $row->get(self::ALLOWED), 'user_id' => $row->get(self::UID), 'team_id' => $row->get(self::TID), 'group_id' => $row->get(self::GID));
             }
         }
     }
     return $permissions;
 }
开发者ID:founderio,项目名称:thebuggenie,代码行数:26,代码来源:Permissions.php

示例14: findInConfig

 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;
 }
开发者ID:founderio,项目名称:thebuggenie,代码行数:60,代码来源:Users.php

示例15: runSetItemLead

 /**
  * 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)));
         }
     }
 }
开发者ID:JonathanRH,项目名称:thebuggenie,代码行数:64,代码来源:Main.php


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