Exemple #1
0
 public function componentUser()
 {
     $this->userstates = entities\Userstate::getAll();
     $this->onlinestate = framework\Settings::getOnlineState();
     $this->awaystate = framework\Settings::getAwayState();
     $this->offlinestate = framework\Settings::getOfflineState();
 }
Exemple #2
0
 /**
  * Return the "away" userstate object
  * @return \thebuggenie\core\entities\Userstate
  */
 public static function getAwayState()
 {
     try {
         return \thebuggenie\core\entities\Userstate::getB2DBTable()->selectByID(self::get(self::SETTING_AWAYSTATE));
     } catch (\Exception $e) {
         return null;
     }
 }
Exemple #3
0
 public function runSetState(framework\Request $request)
 {
     try {
         $state = entities\Userstate::getB2DBTable()->selectById($request['state_id']);
         $this->getUser()->setState($state);
         $this->getUser()->save();
         return $this->renderJSON(array('userstate' => $this->getI18n()->__($state->getName())));
     } catch (\Exception $e) {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('error' => $this->getI18n()->__('An error occured while trying to update your status')));
     }
 }
            ?>
                            <div class="header" style="margin-bottom: 5px;">
                                <a href="javascript:void(0);" onclick="$('usermenu_changestate').toggle();" id="usermenu_changestate_toggler" class="button button-silver"><?php 
            echo __('Change');
            ?>
</a>
                                <?php 
            echo image_tag('spinning_16.gif', array('style' => 'display: none;', 'id' => 'change_userstate_dropdown'));
            ?>
                                <?php 
            echo __('You are: %userstate', array('%userstate' => '<span class="current_userstate userstate">' . __($tbg_user->getState()->getName()) . '</span>'));
            ?>
                            </div>
                            <div id="usermenu_changestate" style="display: none;" onclick="$('usermenu_changestate').toggle();">
                                <?php 
            foreach (\thebuggenie\core\entities\Userstate::getAll() as $state) {
                ?>
                                    <?php 
                if ($state->getID() == \thebuggenie\core\framework\Settings::getOfflineState()->getID()) {
                    continue;
                }
                ?>
                                    <a href="javascript:void(0);" onclick="TBG.Main.Profile.setState('<?php 
                echo make_url('set_state', array('state_id' => $state->getID()));
                ?>
', 'change_userstate_dropdown');"><?php 
                echo __($state->getName());
                ?>
</a>
                                <?php 
            }
Exemple #5
0
 public function loadFixtures()
 {
     // Load initial settings
     tables\Settings::getTable()->loadFixtures($this);
     \thebuggenie\core\framework\Settings::loadSettings();
     // Load group, users and permissions fixtures
     Group::loadFixtures($this);
     // Load initial teams
     Team::loadFixtures($this);
     // Set up user states, like "available", "away", etc
     Userstate::loadFixtures($this);
     // Set up data types
     list($b_id, $f_id, $e_id, $t_id, $u_id, $i_id, $ep_id) = Issuetype::loadFixtures($this);
     $scheme = IssuetypeScheme::loadFixtures($this);
     tables\IssueFields::getTable()->loadFixtures($this, $scheme, $b_id, $f_id, $e_id, $t_id, $u_id, $i_id, $ep_id);
     Datatype::loadFixtures($this);
     // Set up workflows
     Workflow::loadFixtures($this);
     WorkflowScheme::loadFixtures($this);
     tables\WorkflowIssuetype::getTable()->loadFixtures($this);
     // Set up left menu links
     tables\Links::getTable()->loadFixtures($this);
 }
Exemple #6
0
 public static function loadFixtures(Scope $scope)
 {
     $available = new Userstate();
     $available->setIsOnline();
     $available->setName('Available');
     $available->save();
     $offline = new Userstate();
     $offline->setIsUnavailable();
     $offline->setName('Offline');
     $offline->save();
     $busy = new Userstate();
     $busy->setIsUnavailable();
     $busy->setIsOnline();
     $busy->setName('Busy');
     $busy->save();
     $unavailable = new Userstate();
     $unavailable->setIsUnavailable();
     $unavailable->setIsOnline();
     $unavailable->setName('Unavailable');
     $unavailable->save();
     $in_a_meeting = new Userstate();
     $in_a_meeting->setIsUnavailable();
     $in_a_meeting->setIsInMeeting();
     $in_a_meeting->setName('In a meeting');
     $in_a_meeting->save();
     $coding = new Userstate();
     $coding->setIsUnavailable();
     $coding->setIsBusy();
     $coding->setIsOnline();
     $coding->setName('Coding');
     $coding->save();
     $coffee = new Userstate();
     $coffee->setIsUnavailable();
     $coffee->setIsBusy();
     $coffee->setIsOnline();
     $coffee->setName('On coffee break');
     $away = new Userstate();
     $away->setIsUnavailable();
     $away->setIsOnline();
     $away->setIsBusy();
     $away->setIsAbsent();
     $away->setName('Away');
     $away->save();
     $vacation = new Userstate();
     $vacation->setIsUnavailable();
     $vacation->setIsBusy();
     $vacation->setIsAbsent();
     $vacation->setName('On vacation');
     $vacation->save();
     \thebuggenie\core\framework\Settings::saveSetting(\thebuggenie\core\framework\Settings::SETTING_ONLINESTATE, $available->getID(), 'core', $scope->getID());
     \thebuggenie\core\framework\Settings::saveSetting(\thebuggenie\core\framework\Settings::SETTING_OFFLINESTATE, $offline->getID(), 'core', $scope->getID());
     \thebuggenie\core\framework\Settings::saveSetting(\thebuggenie\core\framework\Settings::SETTING_AWAYSTATE, $away->getID(), 'core', $scope->getID());
 }