php thebuggenie-core-framework-Context类(方法)实例源码

下面列出了php thebuggenie-core-framework-Context 类(方法)源码代码实例,从而了解它的用法。

作者:founderi    项目:thebuggeni   
public function quickfind($client_name)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::NAME, "%{$client_name}%", Criteria::DB_LIKE);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     return $this->select($crit);
 }

作者:founderi    项目:thebuggeni   
public function getByID($id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $row = $this->doSelectById($id, $crit, false);
     return $row;
 }

作者:founderi    项目:thebuggeni   
public function getAll()
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addOrderBy(self::ID, Criteria::SORT_ASC);
     return $this->select($crit);
 }

作者:founderi    项目:thebuggeni   
public function do_execute()
 {
     $this->cliEcho("Importing articles ... \n", 'white', 'bold');
     \thebuggenie\core\framework\Event::listen('publish', 'fixture_article_loaded', array($this, 'listenPublishFixtureArticleCreated'));
     $overwrite = (bool) ($this->getProvidedArgument('overwrite', 'no') == 'yes');
     \thebuggenie\core\framework\Context::getModule('publish')->loadFixturesArticles(\thebuggenie\core\framework\Context::getScope()->getID(), $overwrite);
 }

作者:AzerothShar    项目:thebuggeni   
public function runResolve(framework\Request $request)
 {
     $theme = isset($request['theme_name']) ? $request['theme_name'] : framework\Settings::getThemeName();
     if ($request->hasParameter('css')) {
         $this->getResponse()->setContentType('text/css');
         if (!$request->hasParameter('theme_name')) {
             $basepath = THEBUGGENIE_PATH . 'public' . DS . 'css';
             $asset = THEBUGGENIE_PATH . 'public' . DS . 'css' . DS . $request->getParameter('css');
         } else {
             $basepath = THEBUGGENIE_PATH . 'themes';
             $asset = THEBUGGENIE_PATH . 'themes' . DS . $theme . DS . 'css' . DS . $request->getParameter('css');
         }
     } elseif ($request->hasParameter('js')) {
         $this->getResponse()->setContentType('text/javascript');
         if ($request->hasParameter('theme_name')) {
             $basepath = THEBUGGENIE_PATH . 'themes';
             $asset = THEBUGGENIE_PATH . 'themes' . DS . $theme . DS . 'js' . DS . $request->getParameter('js');
         } elseif ($request->hasParameter('module_name') && framework\Context::isModuleLoaded($request['module_name'])) {
             $module_path = framework\Context::isInternalModule($request['module_name']) ? THEBUGGENIE_INTERNAL_MODULES_PATH : THEBUGGENIE_MODULES_PATH;
             $basepath = $module_path . $request['module_name'] . DS . 'public' . DS . 'js';
             $asset = $module_path . $request['module_name'] . DS . 'public' . DS . 'js' . DS . $request->getParameter('js');
         } else {
             $basepath = THEBUGGENIE_PATH . 'public' . DS . 'js';
             $asset = THEBUGGENIE_PATH . 'public' . DS . 'js' . DS . $request->getParameter('js');
         }
     } else {
         throw new \Exception('The expected theme Asset type is not supported.');
     }
     $fileAsset = new AssetCollection(array(new FileAsset($asset, array(), $basepath)));
     $fileAsset->load();
     // Do not decorate the asset with the theme's header/footer
     $this->getResponse()->setDecoration(framework\Response::DECORATE_NONE);
     return $this->renderText($fileAsset->dump());
 }

作者:pkdevbox    项目:thebuggeni   
public function do_execute()
 {
     $this->cliEcho('Authenticating with server: ');
     $this->cliEcho($this->getProvidedArgument('server_url'), 'white', 'bold');
     $this->cliEcho("\n");
     $path = THEBUGGENIE_CONFIG_PATH;
     try {
         file_put_contents($path . '.remote_server', $this->getProvidedArgument('server_url'));
     } catch (\Exception $e) {
         $path = getenv('HOME') . DS;
         file_put_contents($path . '.remote_server', $this->getProvidedArgument('server_url'));
     }
     $this->cliEcho('Authenticating as user: ');
     $username = $this->getProvidedArgument('username', \thebuggenie\core\framework\Context::getCurrentCLIusername());
     $this->cliEcho($username, 'white', 'bold');
     $this->cliEcho("\n");
     file_put_contents($path . '.remote_username', $username);
     $this->_current_remote_server = file_get_contents($path . '.remote_server');
     $this->cliEcho("\n");
     $this->cliEcho('You need to authenticate using an application-specific password.');
     $this->cliEcho("\n");
     $this->cliEcho("Create an application password from your account's 'Security' tab.");
     $this->cliEcho("\n");
     $this->cliEcho("Enter the application-specific password: ", 'white', 'bold');
     $password = $this->_getCliInput();
     $response = $this->getRemoteResponse($this->getRemoteURL('api_authenticate', array('username' => $username)), array('password' => $password));
     if (!is_object($response)) {
         throw new \Exception('An error occured when receiving authentication response from the server');
     }
     file_put_contents($path . '.remote_token', sha1($response->token));
     $this->cliEcho("Authentication successful!\n", 'white', 'bold');
 }

作者:founderi    项目:thebuggeni   
public function countWorkflows($scope = null)
 {
     $scope = $scope === null ? framework\Context::getScope()->getID() : $scope;
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, $scope);
     return $this->doCount($crit);
 }

作者:JonathanR    项目:thebuggeni   
public function markUserNotificationsReadByTypesAndId($types, $id, $user_id)
 {
     if (!is_array($types)) {
         $types = array($types);
     }
     $crit = $this->getCriteria();
     $crit->addWhere(self::USER_ID, $user_id);
     if (count($types)) {
         if (is_array($id)) {
             $crit->addWhere(self::TARGET_ID, $id, Criteria::DB_IN);
         } else {
             $crit->addWhere(self::TARGET_ID, $id);
         }
         $crit->addWhere(self::NOTIFICATION_TYPE, $types, Criteria::DB_IN);
     }
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addUpdate(self::IS_READ, true);
     $this->doUpdate($crit);
     $crit = $this->getCriteria();
     $crit->addWhere(self::USER_ID, $user_id);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addWhere(self::IS_READ, true);
     $crit->addWhere('notifications.created_at', NOW - 86400 * 30, Criteria::DB_LESS_THAN_EQUAL);
     $this->doDelete($crit);
 }

作者:founderi    项目:thebuggeni   
public function deleteProcessedMessages($ids)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::ID, (array) $ids, Criteria::DB_IN);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $res = $this->doDelete($crit);
 }

作者:JonathanR    项目:thebuggeni   
public function getAbbreviation()
 {
     if ($this->_abbreviation === null) {
         $this->_abbreviation = mb_substr(framework\Context::getI18n()->__($this->getName()), 0, 1);
     }
     return $this->_abbreviation;
 }

作者:founderi    项目:thebuggeni   
public function do_execute()
 {
     /* Prepare variables */
     try {
         $project_id = $this->getProvidedArgument('projectid');
         $project_row = \thebuggenie\core\entities\tables\Projects::getTable()->getById($project_id, false);
         \thebuggenie\core\framework\Context::setScope(new \thebuggenie\core\entities\Scope($project_row[\thebuggenie\core\entities\tables\Projects::SCOPE]));
         $project = new \thebuggenie\core\entities\Project($project_id, $project_row);
     } catch (\Exception $e) {
         $this->cliEcho("The project with the ID " . $this->getProvidedArgument('projectid') . " does not exist\n", 'red', 'bold');
         exit;
     }
     $author = $this->getProvidedArgument('author');
     $new_rev = $this->getProvidedArgument('revno');
     $commit_msg = $this->getProvidedArgument('log');
     $changed = $this->getProvidedArgument('changed');
     $old_rev = $this->getProvidedArgument('oldrev', null);
     $date = $this->getProvidedArgument('date', null);
     $branch = $this->getProvidedArgument('branch', null);
     if (\thebuggenie\core\framework\Settings::get('access_method_' . $project->getKey()) == Vcs_integration::ACCESS_HTTP) {
         $this->cliEcho("This project uses the HTTP access method, and so access via the CLI has been disabled\n", 'red', 'bold');
         exit;
     }
     if ($old_rev === null && !ctype_digit($new_rev)) {
         $this->cliEcho("Error: if only the new revision is specified, it must be a number so that old revision can be calculated from it (by substracting 1 from new revision number).");
     } else {
         if ($old_rev === null) {
             $old_rev = $new_rev - 1;
         }
     }
     $output = Vcs_integration::processCommit($project, $commit_msg, $old_rev, $new_rev, $date, $changed, $author, $branch);
     $this->cliEcho($output);
 }

作者:founderi    项目:thebuggeni   
public function countTeams()
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addWhere(self::ONDEMAND, false);
     return $this->doCount($crit);
 }

作者:founderi    项目:thebuggeni   
public function doesGroupNameExist($group_name)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::NAME, $group_name);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     return (bool) $this->doCount($crit);
 }

作者:founderi    项目:thebuggeni   
public function getByTransitionID($transition_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addWhere(self::TRANSITION_ID, $transition_id);
     return $this->select($crit);
 }

作者:founderi    项目:thebuggeni   
public function deleteBySearchID($saved_search_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addWhere(self::SEARCH_ID, $saved_search_id);
     $this->doDelete($crit);
 }

作者:RTechSof    项目:thebuggeni   
public function addStarredIssue($user_id, $issue_id)
 {
     $crit = $this->getCriteria();
     $crit->addInsert(self::ISSUE, $issue_id);
     $crit->addInsert(self::UID, $user_id);
     $crit->addInsert(self::SCOPE, framework\Context::getScope()->getID());
     $this->doInsert($crit);
 }

作者:pkdevbox    项目:thebuggeni   
public function removeEditionComponent($edition_id, $component_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::EDITION, $edition_id);
     $crit->addWhere(self::COMPONENT, $component_id);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $res = $this->doDelete($crit);
 }

作者:shoreless-Limite    项目:thebuggeni   
public function getTextColor()
 {
     if (!\thebuggenie\core\framework\Context::isCLI()) {
         \thebuggenie\core\framework\Context::loadLibrary('ui');
     }
     $rgb = hex2rgb($this->_itemdata);
     return 0.299 * $rgb['red'] + 0.587 * $rgb['green'] + 0.114 * $rgb['blue'] > 170 ? '#333' : '#FFF';
 }

作者:founderi    项目:thebuggeni   
public function addStarredArticle($user_id, $article_id)
 {
     $crit = $this->getCriteria();
     $crit->addInsert(self::ARTICLE, $article_id);
     $crit->addInsert(self::UID, $user_id);
     $crit->addInsert(self::SCOPE, framework\Context::getScope()->getID());
     $this->doInsert($crit);
 }

作者:JonathanR    项目:thebuggeni   
/**
  * Get all rows by issue ID
  * @param integer $id
  * @return \b2db\Row
  */
 public function getByIssueID($id, $scope = null)
 {
     $scope = $scope === null ? \thebuggenie\core\framework\Context::getScope()->getID() : $scope;
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, $scope);
     $crit->addWhere(self::ISSUE_NO, $id);
     return $this->select($crit);
 }


问题


面经


文章

微信
公众号

扫码关注公众号