Switch the active organization
164869
public function changeUiAction()
    {
        $request  = $this->getRequest();
        $orgId    = urldecode($request->getParam('org'));
        $oldOrg   = $this->currentUser->getCurrentOrganizationId();
        $origUrl  = base64_decode($request->getParam('current_uri'));

        $allowedOrganizations = $this->currentUser->getAllowedOrganizations();
        if (isset($allowedOrganizations[$orgId])) {
            $this->currentUser->setCurrentOrganization($orgId);

            if ($origUrl) {
                // Check for organization id in url, but not when a patient id is stated
                if (strpos($origUrl, '/' . \MUtil_Model::REQUEST_ID1 . '/') === false) {
                    foreach ($this->currentUser->possibleOrgIds as $key) {
                        $finds[]    = '/' . $key. '/' . $oldOrg;
                        $replaces[] = '/' . $key. '/' . $orgId;
                    }
                    $correctUrl = str_replace($finds, $replaces, $origUrl);
                } else {
                    $correctUrl = $origUrl;
                }
                // \MUtil_Echo::track($origUrl, $correctUrl);
                $this->getResponse()->setRedirect($correctUrl);
            } else {
                $this->currentUser->gotoStartPage($this->menu, $request);
            }
            return;
        }

        throw new \Gems_Exception(
                $this->_('Inaccessible or unknown organization'),
                403, null,
                sprintf(
                        $this->_('Access to this page is not allowed for current role: %s.'),
                        $this->currentUser->getRole()
                        )
                );
    }
990056
def _assemble_active_form(self, stmt):
        """"""
        act_agent = Agent(stmt.agent.name, db_refs=stmt.agent.db_refs)
        act_agent.activity = ActivityCondition(stmt.activity, True)
        activates = stmt.is_active
        relation = get_causal_edge(stmt, activates)
        self._add_nodes_edges(stmt.agent, act_agent, relation, stmt.evidence)
298625
public function change()
    {
        $table = $this->table('languages');
        $table->addColumn('is_rtl', 'boolean', [
            'default' => false,
            'null' => false,
        ]);
        $table->addColumn('trashed', 'datetime', [
            'default' => null,
            'null' => true,
        ]);
        $table->changeColumn('is_active', 'boolean', [
            'default' => true,
            'null' => false,
        ]);
        $table->renameColumn('short_code', 'code');
        $table->removeColumn('description');
        $table->update();
    }
1366602
def switch_on(self):
        """"""
        success = self.set_status(CONST.STATUS_ON_INT)

        if success:
            self._json_state['status'] = CONST.STATUS_ON

        return success
260698
function(e) {
			var self = this;
	
			if (self.isLocked) return;
			if (self.settings.mode === 'multi') {
				e.preventDefault();
				self.setActiveItem(e.currentTarget, e);
			}
		}
557284
@Override
  public void setActive(boolean active) {
    super.setActive(active);
    if (this.gitFlowGraphMonitor != null) {
      this.gitFlowGraphMonitor.setActive(active);
    }
  }
1289211
def _toggleSectionActiveState(self, sectionName, state, skipList):
        

        # Get model data, the list of pars
        theParamList = self._taskParsObj.getParList()

        # Loop over their assoc. entries
        for i in range(self.numParams):
            if theParamList[i].scope == sectionName:
                if skipList and theParamList[i].name in skipList:
#                   self.entryNo[i].setActiveState(True) # these always active
                    pass # if it started active, we don't need to reactivate it
                else:
                    self.entryNo[i].setActiveState(state)
845591
function(dir) {
			var curr = this.menu.one('li.active'),
				targetNode = curr[dir]();

			this.menu.one('li.active').removeClass('active');

			targetNode.addClass('active');
			return this;
		}
982875
def set_active(self, ind):
        
        DEBUG_MSG("set_active()", 1, self)
        self._ind = ind
        if ind != None:
            self._active = [ self._axes[i] for i in self._ind ]
        else:
            self._active = []
        # Now update button text wit active axes
        self._menu.updateButtonText(ind)
750197
public function make_inactive() {
        $this->isactive = false;
        $this->remove_class('active_tree_node');
        if ($this->parent !== null) {
            $this->parent->make_inactive();
        }
    }
184177
def set_scene_active(self, scene_id):
        """"""
        if self.state.activeSceneId != scene_id: # do nothing if scene has not changed
            self._deactivate_scene()
            sequence_number = self.zmq_publisher.publish_active_scene(scene_id)
            self.state.activeSceneId = scene_id
            if self.state.mainswitch is True: # activate scene only if we are switched on
                self._activate_scene()
            logging.debug("Set scene {sceneNum} as active scene".format(sceneNum=scene_id))
            return (True, sequence_number, "OK")
        else:
            logging.debug("Scene {sceneNum} already is active scene".format(sceneNum=scene_id))
            return (False, 0, "This already is the activated scene.")
427637
private function updateActive()
    {
        $this->each(function ($item) {
            if (isset($item->links)) {
                $this->makeActive($item);
            }
        });
    }
614818
def activate(self, event):
        """"""
        self._index += 1
        if self._index >= len(self._values):
            self._index = 0

        self._selection = self._values[self._index]
        self.ao2.speak(self._selection)
683247
def _switch(self, future):
        """"""
        scoop._control.current = self
        assert self.greenlet is not None, ("No greenlet to switch to:"
                                           "\n{0}".format(self.__dict__))
        return self.greenlet.switch(future)
259592
function setActive() {
      for (var i = 0; i < this._n.length; i++) {
        this.addClass(this._n[i].children);
      }
    }
1035024
def replace_activities(self):
        """"""
        logger.debug('Running PySB Preassembler replace activities')
        # TODO: handle activity hierarchies
        new_stmts = []

        def has_agent_activity(stmt):
            """Return True if any agents in the Statement have activity."""
            for agent in stmt.agent_list():
                if isinstance(agent, Agent) and agent.activity is not None:
                    return True
            return False
        # First collect all explicit active forms
        self._gather_active_forms()
        # Iterate over all statements
        for j, stmt in enumerate(self.statements):
            logger.debug('%d/%d %s' % (j + 1, len(self.statements), stmt))
            # If the Statement doesn't have any activities, we can just
            # keep it and move on
            if not has_agent_activity(stmt):
                new_stmts.append(stmt)
                continue
            stmt_agents = stmt.agent_list()
            num_agents = len(stmt_agents)
            # Make a list with an empty list for each Agent so that later
            # we can build combinations of Agent forms
            agent_forms = [[] for a in stmt_agents]
            for i, agent in enumerate(stmt_agents):
                # This is the case where there is an activity flag on an
                # Agent which we will attempt to replace with an explicit
                # active form
                if agent is not None and isinstance(agent, Agent) and \
                        agent.activity is not None:
                    base_agent = self.agent_set.get_create_base_agent(agent)
                    # If it is an "active" state
                    if agent.activity.is_active:
                        active_forms = base_agent.active_forms
                        # If no explicit active forms are known then we use
                        # the generic one
                        if not active_forms:
                            active_forms = [agent]
                    # If it is an "inactive" state
                    else:
                        active_forms = base_agent.inactive_forms
                        # If no explicit inactive forms are known then we use
                        # the generic one
                        if not active_forms:
                            active_forms = [agent]
                    # We now iterate over the active agent forms and create
                    # new agents
                    for af in active_forms:
                        new_agent = fast_deepcopy(agent)
                        self._set_agent_context(af, new_agent)
                        agent_forms[i].append(new_agent)
                # Otherwise we just copy over the agent as is
                else:
                    agent_forms[i].append(agent)
            # Now create all possible combinations of the agents and create new
            # statements as needed
            agent_combs = itertools.product(*agent_forms)
            for agent_comb in agent_combs:
                new_stmt = fast_deepcopy(stmt)
                new_stmt.set_agent_list(agent_comb)
                new_stmts.append(new_stmt)
        self.statements = new_stmts
1325274
protected function setActiveSorting()
    {
        $this->sSorting = Input::get('sort');
        if (empty($this->sSorting)) {
            $this->sSorting = $this->property('sorting');
        }
    }