本文整理汇总了PHP中thebuggenie\core\framework\Context类的典型用法代码示例。如果您正苦于以下问题:PHP Context类的具体用法?PHP Context怎么用?PHP Context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Context类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: quickfind
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);
}
示例2: getByID
public function getByID($id)
{
$crit = $this->getCriteria();
$crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
$row = $this->doSelectById($id, $crit, false);
return $row;
}
示例3: getAll
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);
}
示例4: do_execute
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);
}
示例5: runResolve
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());
}
示例6: do_execute
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');
}
示例7: countWorkflows
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);
}
示例8: markUserNotificationsReadByTypesAndId
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);
}
示例9: deleteProcessedMessages
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);
}
示例10: getAbbreviation
public function getAbbreviation()
{
if ($this->_abbreviation === null) {
$this->_abbreviation = mb_substr(framework\Context::getI18n()->__($this->getName()), 0, 1);
}
return $this->_abbreviation;
}
示例11: do_execute
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);
}
示例12: countTeams
public function countTeams()
{
$crit = $this->getCriteria();
$crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
$crit->addWhere(self::ONDEMAND, false);
return $this->doCount($crit);
}
示例13: doesGroupNameExist
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);
}
示例14: getByTransitionID
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);
}
示例15: deleteBySearchID
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);
}