本文整理汇总了PHP中common_ext_ExtensionsManager类的典型用法代码示例。如果您正苦于以下问题:PHP common_ext_ExtensionsManager类的具体用法?PHP common_ext_ExtensionsManager怎么用?PHP common_ext_ExtensionsManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了common_ext_ExtensionsManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: update
/**
*
* @param string $currentVersion
* @return string $versionUpdatedTo
*/
public function update($initialVersion)
{
$currentVersion = $initialVersion;
//migrate from 2.6 to 2.6.1
if ($currentVersion == '2.6') {
//data upgrade
OntologyUpdater::syncModels();
$currentVersion = '2.6.1';
}
if ($currentVersion == '2.6.1') {
$ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoDelivery');
$className = $ext->getConfig(\taoDelivery_models_classes_execution_ServiceProxy::CONFIG_KEY);
if (is_string($className)) {
$impl = null;
switch ($className) {
case 'taoDelivery_models_classes_execution_OntologyService':
$impl = new \taoDelivery_models_classes_execution_OntologyService();
break;
case 'taoDelivery_models_classes_execution_KeyValueService':
$impl = new \taoDelivery_models_classes_execution_KeyValueService(array(\taoDelivery_models_classes_execution_KeyValueService::OPTION_PERSISTENCE => 'deliveryExecution'));
break;
default:
\common_Logger::w('Unable to migrate custom execution service');
}
if (!is_null($impl)) {
$proxy = \taoDelivery_models_classes_execution_ServiceProxy::singleton();
$proxy->setImplementation($impl);
$currentVersion = '2.6.2';
}
}
}
return $currentVersion;
}
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:38,代码来源:Updater.php
示例2: __construct
/**
* get the lang of the class in case we want to filter the media on language
*
* @param array $options
*/
public function __construct($options = array())
{
parent::__construct($options);
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoMediaManager');
$this->lang = isset($options['lang']) ? $options['lang'] : '';
$this->rootClassUri = isset($options['rootClass']) ? $options['rootClass'] : MediaService::singleton()->getRootClass();
}
开发者ID:nagyist,项目名称:extension-tao-mediamanager,代码行数:12,代码来源:MediaSource.php
示例3: __invoke
/**
* @param $params
* @return Report
*/
public function __invoke($params)
{
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoProctoring');
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoDeliveryRdf');
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
$report = new Report(Report::TYPE_INFO, 'Updating of delivery monitoring cache...');
$testCenters = TestCenterService::singleton()->getRootClass()->getInstances(true);
$deliveryMonitoringService = $this->getServiceLocator()->get(DeliveryMonitoringService::CONFIG_ID);
$deliveryService = $this->getServiceLocator()->get(DeliveryService::CONFIG_ID);
$eligibilityService = EligibilityService::singleton();
foreach ($testCenters as $testCenter) {
$deliveries = $eligibilityService->getEligibleDeliveries($testCenter, false);
foreach ($deliveries as $delivery) {
if ($delivery->exists()) {
$deliveryExecutions = $deliveryService->getCurrentDeliveryExecutions($delivery->getUri(), $testCenter->getUri());
foreach ($deliveryExecutions as $deliveryExecution) {
$data = $deliveryMonitoringService->getData($deliveryExecution, true);
if ($deliveryMonitoringService->save($data)) {
$report->add(new Report(Report::TYPE_SUCCESS, "Delivery execution {$deliveryExecution->getUri()} successfully updated."));
} else {
$errors = $data->getErrors();
$errorsStr = " " . PHP_EOL;
array_walk($errors, function ($val, $key) use(&$errorsStr) {
$errorsStr .= " {$key} - {$val}" . PHP_EOL;
});
$report->add(new Report(Report::TYPE_ERROR, "Delivery execution {$deliveryExecution->getUri()} was not updated. {$errorsStr}"));
}
}
}
}
}
return $report;
}
开发者ID:oat-sa,项目名称:extension-tao-proctoring,代码行数:37,代码来源:RefreshMonitoringData.php
示例4: __construct
public function __construct($extName)
{
$configFile = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'generis.conf.php';
parent::__construct($configFile);
// load extension constants
common_ext_ExtensionsManager::singleton()->getExtensionById($extName);
}
开发者ID:oat-sa,项目名称:tao-core,代码行数:7,代码来源:class.Bootstrap.php
示例5: run
public function run()
{
// load the constants
common_ext_ExtensionsManager::singleton()->getExtensionById('taoDelivery');
$this->migrateCompiledDeliveryToAssembly();
$this->removeAssemblyFromGroup();
}
开发者ID:llecaque,项目名称:extension-tao-update,代码行数:7,代码来源:class.UpdateDeliveryAssembly.php
示例6: scriptRunner
public function scriptRunner($script, $extension)
{
$error = false;
$errorStack = array();
if (isset($extension) && $extension != null) {
$ext = common_ext_ExtensionsManager::singleton()->getExtensionById($extension);
}
if ($script != null) {
$parameters = array();
$options = array('argv' => array(0 => 'Script ' . $script), 'output_mode' => 'log_only');
try {
$scriptName = $script;
if (!class_exists($scriptName)) {
throw new taoUpdate_models_classes_UpdateException('Could not find scriptName class ' . $script);
}
new $scriptName(array('parameters' => $parameters), $options);
$error = false;
} catch (Exception $e) {
common_Logger::e('Error occurs during update ' . $e->getMessage());
$error = true;
$errorStack[] = 'Error in script ' . $script . ' ' . $e->getMessage();
}
if ($error) {
echo json_encode(array('success' => 0, 'failed' => $errorStack));
} else {
echo json_encode(array('success' => 1, 'failed' => array()));
}
} else {
echo json_encode(array('success' => 0, 'failed' => array('not scriptname provided')));
}
}
开发者ID:llecaque,项目名称:extension-tao-update,代码行数:31,代码来源:class.Data.php
示例7: run
public function run()
{
$extmanger = common_ext_ExtensionsManager::singleton();
$ext = $extmanger->getExtensionById('taoCe');
$extinstaller = new tao_install_ExtensionInstaller($ext);
$extinstaller->install();
}
开发者ID:llecaque,项目名称:extension-tao-update,代码行数:7,代码来源:class.InstallNewExtension.php
示例8: __invoke
public function __invoke($params)
{
// recreate languages
$modelCreator = new \tao_install_utils_ModelCreator(LOCAL_NAMESPACE);
$models = $modelCreator->getLanguageModels();
foreach ($models as $ns => $modelFiles) {
foreach ($modelFiles as $file) {
$modelCreator->insertLocalModel($file);
}
}
OntologyUpdater::syncModels();
// reapply access rights
$exts = \common_ext_ExtensionsManager::singleton()->getInstalledExtensions();
foreach ($exts as $ext) {
$installer = new \tao_install_ExtensionInstaller($ext);
$installer->installManagementRole();
$installer->applyAccessRules();
}
// recreate admin
if (count($params) >= 2) {
$login = array_shift($params);
$password = array_shift($params);
$sysAdmin = $this->getResource(INSTANCE_ROLE_SYSADMIN);
$userClass = $this->getClass(CLASS_TAO_USER);
\core_kernel_users_Service::singleton()->addUser($login, $password, $sysAdmin, $userClass);
}
// empty cache
\common_cache_FileCache::singleton()->purge();
return \common_report_Report::createSuccess('All done');
}
开发者ID:oat-sa,项目名称:extension-tao-devtools,代码行数:30,代码来源:RestoreModelOne.php
示例9: __construct
/**
* call the (empty) parent constructor
* initialise the campaign class
*
* @access protected
* @author Joel Bout, <[email protected]>
* @return mixed
*/
protected function __construct()
{
parent::__construct();
// ensure the taoCampaign extension is loaded, since it can be called from taoDelivery
common_ext_ExtensionsManager::singleton()->getExtensionById('taoCampaign')->load();
$this->campaignClass = new core_kernel_classes_Class(TAO_DELIVERY_CAMPAIGN_CLASS);
}
开发者ID:nagyist,项目名称:extension-tao-campaign,代码行数:15,代码来源:class.CampaignService.php
示例10: getFinishedSniplet
public static function getFinishedSniplet()
{
$taoExt = common_ext_ExtensionsManager::singleton()->getExtensionById('tao');
$tpl = $taoExt->getConstant('DIR_VIEWS') . 'templates' . DIRECTORY_SEPARATOR . 'snippet' . DIRECTORY_SEPARATOR . 'finishService.tpl';
$renderer = new Renderer($tpl);
return $renderer->render();
}
开发者ID:oat-sa,项目名称:tao-core,代码行数:7,代码来源:class.ServiceJavascripts.php
示例11: testImport
public function testImport()
{
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoItems');
$url = $this->host . 'taoQtiItem/RestQtiItem/import';
$post_data = ['content' => new \CURLFile(__DIR__ . '/../samples/package/QTI/package.zip', 'application/zip')];
$return = $this->curl($url, CURLOPT_POST, 'data', array(CURLOPT_POSTFIELDS => $post_data));
$data = json_decode($return, true);
$this->assertInternalType('array', $data);
$this->assertTrue(isset($data['success']));
$this->assertTrue($data['success']);
$this->assertTrue(isset($data['data']['items']));
$items = $data['data']['items'];
$this->assertInternalType('array', $items);
$this->assertEquals(1, count($items));
$itemUri = reset($items);
$this->assertInternalType('string', $itemUri);
$item = $this->getResource($itemUri);
$this->assertTrue($item->exists());
$itemService = \taoItems_models_classes_ItemsService::singleton();
$model = $itemService->getItemModel($item);
$this->assertNotNull($model);
$this->assertEquals(ItemModel::MODEL_URI, $itemService->getItemModel($item)->getUri());
$this->assertTrue($itemService->deleteResource($item));
$this->assertFalse($item->exists());
}
开发者ID:oat-sa,项目名称:extension-tao-itemqti,代码行数:25,代码来源:RestQtiItemTest.php
示例12: __invoke
/**
* @param array $params
* @return Report
*/
public function __invoke($params)
{
$this->params = $params;
$this->report = new Report(Report::TYPE_INFO, 'Termination expired paused executions...');
common_Logger::d('Termination expired paused execution started at ' . date(DATE_RFC3339));
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoDeliveryRdf');
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
$deliveryExecutionService = \taoDelivery_models_classes_execution_ServiceProxy::singleton();
$count = 0;
$testSessionService = ServiceManager::getServiceManager()->get(TestSessionService::SERVICE_ID);
/** @var DeliveryMonitoringService $deliveryMonitoringService */
$deliveryMonitoringService = ServiceManager::getServiceManager()->get(DeliveryMonitoringService::CONFIG_ID);
$deliveryExecutionsData = $deliveryMonitoringService->find([DeliveryMonitoringService::STATUS => [DeliveryExecution::STATE_ACTIVE, DeliveryExecution::STATE_PAUSED]]);
foreach ($deliveryExecutionsData as $deliveryExecutionData) {
$data = $deliveryExecutionData->get();
$deliveryExecution = $deliveryExecutionService->getDeliveryExecution($data[DeliveryMonitoringService::DELIVERY_EXECUTION_ID]);
if ($testSessionService->isExpired($deliveryExecution)) {
try {
$this->terminateExecution($deliveryExecution);
$count++;
} catch (\Exception $e) {
$this->addReport(Report::TYPE_ERROR, $e->getMessage());
}
}
}
$msg = $count > 0 ? "{$count} executions has been terminated." : "Expired executions not found.";
$this->addReport(Report::TYPE_INFO, $msg);
common_Logger::d('Termination expired paused execution finished at ' . date(DATE_RFC3339));
return $this->report;
}
开发者ID:oat-sa,项目名称:extension-tao-proctoring,代码行数:34,代码来源:TerminatePausedAssessment.php
示例13: __construct
/**
* Constructor performs initializations actions
* @return void
*/
public function __construct()
{
parent::__construct();
$this->userService = tao_models_classes_UserService::singleton();
$this->defaultData();
$extManager = common_ext_ExtensionsManager::singleton();
}
开发者ID:oat-sa,项目名称:tao-core,代码行数:11,代码来源:class.Users.php
示例14: run
public function run()
{
$this->out('Bypassing model restriction');
$oldUpdatableModels = core_kernel_persistence_smoothsql_SmoothModel::getUpdatableModelIds();
core_kernel_persistence_smoothsql_SmoothModel::forceUpdatableModelIds(core_kernel_persistence_smoothsql_SmoothModel::getReadableModelIds());
$this->out('Loading extensions');
$diffPath = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ontologyData26' . DIRECTORY_SEPARATOR;
// remove All
foreach (common_ext_ExtensionsManager::singleton()->getInstalledExtensions() as $extension) {
$diffFile = $diffPath . 'diff' . ucfirst($extension->getId()) . '.php';
if (file_exists($diffFile)) {
$this->out('Updating model of ' . $extension->getId());
$data = (include $diffFile);
foreach ($data['toRemove'] as $tripple) {
$this->remove($tripple);
}
}
}
// add All
foreach (common_ext_ExtensionsManager::singleton()->getInstalledExtensions() as $extension) {
$diffFile = $diffPath . 'diff' . ucfirst($extension->getId()) . '.php';
if (file_exists($diffFile)) {
$this->out('Updating model of ' . $extension->getId());
$data = (include $diffFile);
foreach ($data['toAdd'] as $tripple) {
$this->add($tripple);
}
}
}
$this->out('Restoring model restriction');
core_kernel_persistence_smoothsql_SmoothModel::forceUpdatableModelIds($oldUpdatableModels);
}
开发者ID:llecaque,项目名称:extension-tao-update,代码行数:32,代码来源:class.UpdateOntologyModel.php
示例15: update
/**
* @param string $initialVersion
* @return string string
*/
public function update($initialVersion)
{
$currentVersion = $initialVersion;
$ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('ltiTestConsumer');
$this->setVersion($currentVersion);
$this->skip('0.8', '0.9.0');
}
开发者ID:oat-sa,项目名称:extension-tao-testlti,代码行数:11,代码来源:Updater.php
示例16: setUp
/**
* tests initialization
*/
public function setUp()
{
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoTestTaker');
TaoPhpUnitTestRunner::initTest();
$this->subjectsService = TestTakerService::singleton();
$this->testCenterService = TestCenterService::singleton();
}
开发者ID:nagyist,项目名称:extension-tao-testcenter,代码行数:10,代码来源:TestCenterServiceTest.php
示例17: login
/**
* Login process
* Check if url successCallback is set
* If login form is post valid, setcookie & redirect to successCallback
* Else create LoginForm with ?errorMessage
*/
public function login()
{
try {
if (!$this->hasRequestParameter('successCallback')) {
throw new \common_exception_MissingParameter('Internal error, please retry in few moment');
}
if ($this->isRequestPost()) {
$authorizationService = $this->getServiceManager()->get(Authorization::SERVICE_ID);
if (!$authorizationService instanceof RequireUsername) {
throw new InvalidCallException('Authenticator need to be call by requireusername');
}
if ($authorizationService->validateLogin($this->getRequestParameter('login'))) {
$baseUrl = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoClientDiagnostic')->getConstant('BASE_URL');
$elements = parse_url($baseUrl);
$this->setCookie('login', $this->getRequestParameter('login'), null, $elements['path']);
$this->redirect($this->getRequestParameter('successCallback'));
}
}
} catch (InvalidLoginException $e) {
$this->setData('errorMessage', $e->getUserMessage());
}
$this->setData('successCallback', $this->getRequestParameter('successCallback'));
$this->setData('client-config-url', $this->getClientConfigUrl());
$this->setData('content-controller', 'taoClientDiagnostic/controller/Authenticator/login');
$this->setData('content-template', 'Authenticator' . DIRECTORY_SEPARATOR . 'login.tpl');
$this->setView('index.tpl');
}
开发者ID:oat-sa,项目名称:extension-tao-clientdiag,代码行数:33,代码来源:Authenticator.php
示例18: modelsProvider
/**
*
* @author Lionel Lecaque, [email protected]
* @return array
*/
public function modelsProvider()
{
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoTests');
$testModelClass = new core_kernel_classes_Class(CLASS_TESTMODEL);
$models = $testModelClass->getInstances();
return array(array($models));
}
开发者ID:nagyist,项目名称:extension-tao-test,代码行数:12,代码来源:TestsTest.php
示例19: getAuthoring
/**
* @deprecated
* @see taoTests_models_classes_TestModel::getAuthoring()
*/
public function getAuthoring(core_kernel_classes_Resource $test)
{
$ext = common_ext_ExtensionsManager::singleton()->getExtensionById('taoWfTest');
$testService = taoTests_models_classes_TestsService::singleton();
$itemSequence = array();
$itemUris = array();
$i = 1;
foreach ($testService->getTestItems($test) as $item) {
$itemUris[] = $item->getUri();
$itemSequence[$i] = array('uri' => tao_helpers_Uri::encode($item->getUri()), 'label' => $item->getLabel());
$i++;
}
// data for item sequence, terrible solution
// @todo implement an ajax request for labels or pass from tree to sequence
$allItems = array();
foreach ($testService->getAllItems() as $itemUri => $itemLabel) {
$allItems['item_' . tao_helpers_Uri::encode($itemUri)] = $itemLabel;
}
$widget = new Renderer($ext->getConstant('DIR_VIEWS') . 'templates' . DIRECTORY_SEPARATOR . 'authoring.tpl');
$widget->setData('uri', $test->getUri());
$widget->setData('allItems', json_encode($allItems));
$widget->setData('itemSequence', $itemSequence);
// data for generis tree form
$widget->setData('relatedItems', json_encode(tao_helpers_Uri::encodeArray($itemUris)));
$openNodes = tao_models_classes_GenerisTreeFactory::getNodesToOpen($itemUris, new core_kernel_classes_Class(TAO_ITEM_CLASS));
$widget->setData('itemRootNode', TAO_ITEM_CLASS);
$widget->setData('itemOpenNodes', $openNodes);
$widget->setData('saveUrl', _url('saveItems', 'Authoring', 'taoWfTest'));
return $widget->render();
}
开发者ID:nagyist,项目名称:extension-tao-testwf,代码行数:34,代码来源:class.WfTestModel.php
示例20: update
/**
*
* @param string $currentVersion
* @return string $versionUpdatedTo
*/
public function update($initialVersion)
{
$currentVersion = $initialVersion;
if ($currentVersion == '1.0') {
$currentVersion = '1.0.1';
}
if ($currentVersion == '1.0.1') {
$currentVersion = '1.1.0';
}
if ($currentVersion == '1.1.0') {
$accessService = \funcAcl_models_classes_AccessService::singleton();
$anonymous = new \core_kernel_classes_Resource('http://www.tao.lu/Ontologies/generis.rdf#AnonymousRole');
$accessService->grantModuleAccess($anonymous, 'taoClientDiagnostic', 'CompatibilityChecker');
$currentVersion = '1.1.1';
}
if ($currentVersion == '1.1.1') {
$extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoClientDiagnostic');
$extension->setConfig('clientDiag', array('footer' => ''));
$currentVersion = '1.2.0';
}
if ($currentVersion == '1.2.0') {
$extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoClientDiagnostic');
$config = $extension->getConfig('clientDiag');
$extension->setConfig('clientDiag', array_merge($config, array('performances' => array('samples' => array('taoClientDiagnostic/tools/performances/data/sample1/', 'taoClientDiagnostic/tools/performances/data/sample2/', 'taoClientDiagnostic/tools/performances/data/sample3/'), 'occurrences' => 10, 'timeout' => 30, 'optimal' => 0.025, 'threshold' => 0.25), 'bandwidth' => array('unit' => 0.16, 'ideal' => 45, 'max' => 100))));
$currentVersion = '1.3.0';
}
return $currentVersion;
}
开发者ID:nagyist,项目名称:extension-tao-clientdiag,代码行数:33,代码来源:Updater.php
注:本文中的common_ext_ExtensionsManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论