本文整理汇总了PHP中TBGContext::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP TBGContext::factory方法的具体用法?PHP TBGContext::factory怎么用?PHP TBGContext::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBGContext
的用法示例。
在下文中一共展示了TBGContext::factory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getScope
public function getScope()
{
if (!$this->_scope instanceof TBGScope) {
$this->_scope = TBGContext::factory()->TBGScope($this->_scope);
}
return $this->_scope;
}
示例2: getByValueAndKey
/**
* Return a custom data type option by value and key
*
* @param string|integer $value
* @param string $key
*
* @return TBGCustomDatatypeOption
*/
public static function getByValueAndKey($value, $key)
{
$row = B2DB::getTable('TBGCustomFieldOptionsTable')->getByValueAndKey($value, $key);
if ($row) {
return TBGContext::factory()->TBGCustomDatatypeOption($row->get(TBGCustomFieldOptionsTable::ID), $row);
}
return null;
}
示例3: createNew
/**
* Create a new status
*
* @param string $name The status description
* @param string $itemdata[optional] The color if any (default FFF)
*
* @return TBGStatus
*/
public static function createNew($name, $itemdata = null)
{
$itemdata = $itemdata === null || trim($itemdata) == '' ? '#FFF' : $itemdata;
if (substr($itemdata, 0, 1) != '#') {
$itemdata = '#' . $itemdata;
}
$res = parent::_createNew($name, self::STATUS, $itemdata);
return TBGContext::factory()->TBGStatus($res->getInsertID());
}
示例4: getAll
public static function getAll()
{
if (self::$_groups === null) {
self::$_groups = array();
if ($res = TBGGroupsTable::getTable()->getAll()) {
while ($row = $res->getNextRow()) {
self::$_groups[$row->get(TBGGroupsTable::ID)] = TBGContext::factory()->TBGGroup($row->get(TBGGroupsTable::ID), $row);
}
}
}
return self::$_groups;
}
示例5: getAll
/**
* Returns all categories available
*
* @return array
*/
public static function getAll()
{
if (self::$_items === NULL) {
self::$_items = array();
if ($items = TBGListTypesTable::getTable()->getAllByItemType(self::CATEGORY)) {
foreach ($items as $row_id => $row) {
self::$_items[$row_id] = TBGContext::factory()->TBGCategory($row_id, $row);
}
}
}
return self::$_items;
}
示例6: getProjectsByTeamID
public function getProjectsByTeamID($team_id)
{
$projects = array();
$crit = $this->getCriteria();
$crit->addWhere(self::TID, $team_id);
if ($res = $this->doSelect($crit)) {
foreach ($res->getNextRow() as $row) {
$projects[$row->get(TBGComponentsTable::PROJECT)] = TBGContext::factory()->TBGProject($row->get(TBGComponentsTable::PROJECT));
}
}
return $projects;
}
示例7: preExecute
/**
* The currently selected project in actions where there is one
*
* @access protected
* @property TBGProject $selected_project
*/
public function preExecute(TBGRequest $request, $action)
{
try {
if ($project_key = $request->getParameter('project_key')) {
$this->selected_project = TBGProject::getByKey($project_key);
} elseif ($project_id = (int) $request->getParameter('project_id')) {
$this->selected_project = TBGContext::factory()->TBGProject($project_id);
}
TBGContext::setCurrentProject($this->selected_project);
} catch (Exception $e) {
}
}
示例8: getByTransitionID
public function getByTransitionID($transition_id)
{
$crit = $this->getCriteria();
$crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
$crit->addWhere(self::TRANSITION_ID, $transition_id);
$actions = array('pre' => array(), 'post' => array());
if ($res = $this->doSelect($crit, false)) {
while ($row = $res->getNextRow()) {
$actions[$row->get(self::PRE_OR_POST)][$row->get(self::RULE)] = TBGContext::factory()->TBGWorkflowTransitionValidationRule($row->get(self::ID), $row);
}
}
return $actions;
}
示例9: _getByTypeID
protected function _getByTypeID($type, $id)
{
$crit = $this->getCriteria();
$crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
$crit->addWhere($type == 'step' ? self::OUTGOING_STEP_ID : self::WORKFLOW_ID, $id);
$return_array = array();
if ($res = $this->doSelect($crit)) {
while ($row = $res->getNextRow()) {
$return_array[$row->get(self::ID)] = TBGContext::factory()->TBGWorkflowTransition($row->get(self::ID), $row);
}
}
return $return_array;
}
示例10: preExecute
/**
* The currently selected project in actions where there is one
*
* @access protected
* @property TBGProject $selected_project
*/
public function preExecute(TBGRequest $request, $action)
{
try {
if ($project_key = $request['project_key']) {
$this->selected_project = TBGProject::getByKey($project_key);
} elseif ($project_id = (int) $request['project_id']) {
$this->selected_project = TBGContext::factory()->TBGProject($project_id);
}
if ($this->selected_project instanceof TBGProject) {
TBGContext::setCurrentProject($this->selected_project);
}
} catch (Exception $e) {
}
}
示例11: getAll
public static function getAll()
{
if (self::$_userstates === null) {
if (!($states = TBGCache::get(TBGCache::KEY_USERSTATES_CACHE))) {
$res = TBGUserStateTable::getTable()->doSelectAll();
$states = array();
while ($row = $res->getNextRow()) {
$states[$row->get(TBGUserStateTable::ID)] = TBGContext::factory()->TBGUserstate($row->get(TBGUserStateTable::ID), $row);
}
TBGCache::add(TBGCache::KEY_USERSTATES_CACHE, $states);
}
self::$_userstates = $states;
}
return self::$_userstates;
}
示例12: getByIssueID
public function getByIssueID($issue_id)
{
$crit = $this->getCriteria();
$crit->addWhere(self::ISSUE_ID, $issue_id);
$res = $this->doSelect($crit);
$ret_arr = array();
if ($res) {
while ($row = $res->getNextRow()) {
$file = TBGContext::factory()->TBGFile($row->get(TBGFilesTable::ID), $row);
$file->setUploadedAt($row->get(self::ATTACHED_AT));
$ret_arr[$row->get(TBGFilesTable::ID)] = $file;
}
}
return $ret_arr;
}
示例13: _populateSchemes
protected static function _populateSchemes()
{
if (self::$_schemes === null) {
self::$_schemes = array();
if ($res = TBGIssuetypeSchemesTable::getTable()->getAll()) {
while ($row = $res->getNextRow()) {
$scheme = TBGContext::factory()->TBGIssuetypeScheme($row->get(TBGIssuetypeSchemesTable::ID), $row);
if (self::$_core_scheme === null) {
self::$_core_scheme = $scheme;
}
self::$_schemes[$row->get(TBGIssuetypeSchemesTable::ID)] = $scheme;
}
}
}
}
示例14: _populateWorkflows
protected static function _populateWorkflows()
{
if (self::$_workflows === null) {
self::$_workflows = array();
if ($res = TBGWorkflowsTable::getTable()->getAll()) {
while ($row = $res->getNextRow()) {
$workflow = TBGContext::factory()->TBGWorkflow($row->get(TBGWorkflowsTable::ID), $row);
if (self::$_core_workflow === null) {
self::$_core_workflow = $workflow;
}
self::$_workflows[$row->get(TBGWorkflowsTable::ID)] = $workflow;
}
}
}
}
示例15: _getIdentifiable
/**
* Return the identifiable object for a specific field
*
* @param string $field
*
* @return TBGIdentifiable
*/
protected function _getIdentifiable($field)
{
if (is_numeric($this->{$field})) {
$type_field = "{$field}_type";
try {
if ($this->{$type_field} == TBGIdentifiableClass::TYPE_USER) {
$this->{$field} = TBGContext::factory()->TBGUser($this->{$field});
} elseif ($this->{$type_field} == TBGIdentifiableClass::TYPE_TEAM) {
$this->{$field} = TBGContext::factory()->TBGTeam($this->{$field});
}
} catch (Exception $e) {
$this->{$field} = null;
$this->{$type_field} = null;
}
}
return $this->{$field};
}