本文整理汇总了PHP中Tinebase_Core::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Core::set方法的具体用法?PHP Tinebase_Core::set怎么用?PHP Tinebase_Core::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_Core
的用法示例。
在下文中一共展示了Tinebase_Core::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initFramework
/**
* init the test frameworks
*
*/
public function initFramework()
{
Setup_Core::initFramework();
//$this->getConfig();
Tinebase_Core::startCoreSession();
Tinebase_Core::set('frameworkInitialized', true);
}
示例2: tearDown
/**
* Tears down the fixture
* This method is called after a test is executed.
*
* @access protected
*/
protected function tearDown()
{
$currentUser = Tinebase_Core::getUser();
if ($currentUser->accountLoginName !== $this->_testUser->accountLoginName) {
Tinebase_Core::set(Tinebase_Core::USER, $this->_testUser);
}
}
示例3: setUp
/**
* Sets up the fixture.
*
* This method is called before a test is executed.
*/
protected function setUp()
{
Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
// we need that because the voip db tables can have a different prefix
Tinebase_Core::set('voipdbTablePrefix', SQL_TABLE_PREFIX);
$phoneId = Tinebase_Record_Abstract::generateUID();
$this->_objects['location'] = new Voipmanager_Model_Snom_Location(array('id' => Tinebase_Record_Abstract::generateUID(), 'name' => 'phpunit test location', 'registrar' => 'registrar'));
$this->_objects['software'] = new Voipmanager_Model_Snom_Software(array('id' => Tinebase_Record_Abstract::generateUID()));
$this->_objects['setting'] = new Voipmanager_Model_Snom_Setting(array('id' => Tinebase_Record_Abstract::generateUID(), 'name' => Tinebase_Record_Abstract::generateUID(), 'description' => Tinebase_Record_Abstract::generateUID(), 'language_w' => true));
$this->_objects['phonesettings'] = new Voipmanager_Model_Snom_PhoneSettings(array('phone_id' => $phoneId, 'language' => 'Deutsch'));
$this->_objects['template'] = new Voipmanager_Model_Snom_Template(array('id' => Tinebase_Record_Abstract::generateUID(), 'name' => 'phpunit test location', 'software_id' => $this->_objects['software']->getId(), 'setting_id' => $this->_objects['setting']->getId()));
$this->_objects['phone'] = new Voipmanager_Model_Snom_Phone(array('id' => $phoneId, 'macaddress' => "1234567890cd", 'location_id' => $this->_objects['location']->getId(), 'template_id' => $this->_objects['template']->getId(), 'current_model' => 'snom320', 'redirect_event' => 'none'));
$this->_objects['phoneOwner'] = array('account_id' => Zend_Registry::get('currentAccount')->getId(), 'account_type' => 'user');
$rights = new Tinebase_Record_RecordSet('Voipmanager_Model_Snom_PhoneRight', array($this->_objects['phoneOwner']));
$this->_objects['phone']->rights = $rights;
// create phone, location, template
$snomLocationBackend = new Voipmanager_Backend_Snom_Location();
$snomTemplateBackend = new Voipmanager_Backend_Snom_Template();
$snomSoftwareBackend = new Voipmanager_Backend_Snom_Software();
$snomPhoneBackend = new Voipmanager_Backend_Snom_Phone();
$snomSettingBackend = new Voipmanager_Backend_Snom_Setting();
$snomPhoneSettingsBackend = new Voipmanager_Backend_Snom_PhoneSettings();
$snomSoftwareBackend->create($this->_objects['software']);
$snomLocationBackend->create($this->_objects['location']);
$snomTemplateBackend->create($this->_objects['template']);
$snomSettingBackend->create($this->_objects['setting']);
$snomPhoneBackend->create($this->_objects['phone']);
$snomPhoneSettingsBackend->create($this->_objects['phonesettings']);
}
示例4: update_0
/**
* update to 9.1
*
* @return void
*/
public function update_0()
{
// we need at least addressbook version 9,7
if (version_compare($this->getApplicationVersion('Addressbook'), '9.8') < 0) {
return;
}
$setupUser = $this->_getSetupFromConfigOrCreateOnTheFly();
if ($setupUser) {
Tinebase_Core::set(Tinebase_Core::USER, $setupUser);
$filter = new Phone_Model_CallFilter(array(array('field' => 'start', 'operator' => 'after', 'value' => date('Y-m-d H:i:s', time() - 3600 * 24 * 30 * 3))), 'AND', array('ignoreAcl' => true));
$addressbookController = Addressbook_Controller_Contact::getInstance();
$phoneController = Phone_Controller_Call::getInstance();
$calls = $phoneController->search($filter);
foreach ($calls as $_record) {
// resolve telephone number to contacts if possible
$telNumber = Addressbook_Model_Contact::normalizeTelephoneNoCountry($phoneController->resolveInternalNumber($_record->destination));
if (null === $telNumber) {
continue;
}
$filter = new Addressbook_Model_ContactFilter(array(array('field' => 'telephone_normalized', 'operator' => 'equals', 'value' => $telNumber)));
$contacts = $addressbookController->search($filter);
$relations = array();
foreach ($contacts as $contact) {
$relations[] = array('related_model' => 'Addressbook_Model_Contact', 'related_id' => $contact->getId(), 'related_degree' => Tinebase_Model_Relation::DEGREE_SIBLING, 'related_backend' => Tinebase_Model_Relation::DEFAULT_RECORD_BACKEND, 'type' => 'CALLER');
}
if (count($relations) > 0) {
$_record->relations = $relations;
$phoneController->update($_record);
}
}
}
$this->setApplicationVersion('Phone', '9.1');
}
示例5: tearDown
/**
* Tears down the fixture
* This method is called after a test is executed.
*
* @access protected
*/
protected function tearDown()
{
if ($this->_transactionId) {
Tinebase_TransactionManager::getInstance()->rollBack();
}
if ($this->_user) {
Tinebase_Core::set(Tinebase_Core::USER, $this->_user);
}
}
示例6: tearDown
/**
* Tears down the fixture
* This method is called after a test is executed.
*
* @access protected
*/
protected function tearDown()
{
// need to be reset after triggerAsyncEvents run (singleton ...)
Tinebase_User::getInstance()->unregisterAllPlugins();
Tinebase_User::getInstance()->registerPlugins($this->_userPlugins);
$currentUser = Tinebase_Core::getUser();
if ($currentUser->accountLoginName !== $this->_testUser->accountLoginName) {
Tinebase_Core::set(Tinebase_Core::USER, $this->_testUser);
}
parent::tearDown();
}
示例7: _setupCliConfig
/**
* initializes the config
* - overwrite session_save_path
*/
public function _setupCliConfig()
{
$configData = @(include 'config.inc.php');
if ($configData === false) {
echo 'UNKNOWN STATUS / CONFIG FILE NOT FOUND (include path: ' . get_include_path() . ")\n";
exit(3);
}
$configData['sessiondir'] = Tinebase_Core::getTempDir();
$config = new Zend_Config($configData);
Tinebase_Core::set(Tinebase_Core::CONFIG, $config);
}
示例8: testTimezoneConversion
/**
* testTimezoneConversion
*/
public function testTimezoneConversion()
{
$exampleFilterData = self::getPersistentFilterData();
$savedFilterData = $this->testSaveFilter($exampleFilterData);
$testUserTimezone = Tinebase_Core::get(Tinebase_Core::USERTIMEZONE);
Tinebase_Core::set(Tinebase_Core::USERTIMEZONE, $testUserTimezone !== 'US/Pacific' ? 'US/Pacific' : 'UTC');
$originalDueDateFilter = $this->_getFilter('due', $exampleFilterData);
$convertedDueDataFilter = $this->_getFilter('due', $this->_uit->getPersistentFilter($savedFilterData['id']));
Tinebase_Core::set(Tinebase_Core::USERTIMEZONE, $testUserTimezone);
$this->assertNotEquals($originalDueDateFilter['value'], $convertedDueDataFilter['value']);
}
示例9: testDownloadLinkAcl
/**
* testDownloadLinkAcl
*/
public function testDownloadLinkAcl()
{
// try to access download link to personal container of another user
$downloadLink = $this->testCreateDownloadLink();
Tinebase_Core::set(Tinebase_Core::USER, $this->_personas['sclever']);
try {
$resultNode = $this->_getUit()->getNode($downloadLink, array());
$this->fail('user should not be able to access download link node');
} catch (Tinebase_Exception_AccessDenied $tead) {
$this->assertEquals('No permission to get node', $tead->getMessage());
}
}
示例10: setUp
/**
* Sets up the fixture.
*
* This method is called before a test is executed.
*/
protected function setUp()
{
// we need that because the voip db tables can have a different prefix
Tinebase_Core::set('voipdbTablePrefix', SQL_TABLE_PREFIX);
$this->_backend = new Voipmanager_Backend_Snom_Phone();
$this->_objects['location'] = new Voipmanager_Model_Snom_Location(array('id' => 20001, 'name' => 'phpunit test location', 'registrar' => 'registrar'));
$this->_objects['software'] = new Voipmanager_Model_Snom_Software(array('id' => 20003));
$this->_objects['setting'] = new Voipmanager_Model_Snom_Setting(array('id' => 20004));
$this->_objects['template'] = new Voipmanager_Model_Snom_Template(array('id' => 20002, 'name' => 'phpunit test location', 'software_id' => $this->_objects['software']->getId(), 'setting_id' => $this->_objects['setting']->getId()));
$this->_objects['phone'] = new Voipmanager_Model_Snom_Phone(array('id' => 1001, 'macaddress' => "1234567890cd", 'location_id' => $this->_objects['location']->getId(), 'template_id' => $this->_objects['template']->getId(), 'current_model' => 'snom320', 'redirect_event' => 'none'));
$this->_objects['phoneOwner'] = array('account_id' => Zend_Registry::get('currentAccount')->getId(), 'account_type' => 'user');
$rights = new Tinebase_Record_RecordSet('Voipmanager_Model_Snom_PhoneRight', array($this->_objects['phoneOwner']));
$this->_objects['phone']->rights = $rights;
}
示例11: _initialize
/**
* Override method: Setup needs additional initialisation
*
* @see tine20/Setup/Setup_Initialize#_initialize($_application)
*/
protected function _initialize(Tinebase_Model_Application $_application, $_options = null)
{
parent::_initialize($_application, $_options);
$initialAdminUserOptions = $this->_parseInitialAdminUserOptions($_options);
if (Tinebase_User::getInstance() instanceof Tinebase_User_Interface_SyncAble) {
Tinebase_User::syncUsers(true);
} else {
Tinebase_User::createInitialAccounts($initialAdminUserOptions);
}
// set current user
$initialUser = Tinebase_User::getInstance()->getUserByProperty('accountLoginName', $initialAdminUserOptions['adminLoginName']);
Tinebase_Core::set(Tinebase_Core::USER, $initialUser);
parent::_initialize($_application, $_options);
}
示例12: exportICS
/**
* exports calendars as ICS
*
* @param Zend_Console_Getopt $_opts
*/
public function exportICS($_opts)
{
Tinebase_Core::set('HOSTNAME', 'localhost');
$opts = $_opts->getRemainingArgs();
$container_id = $opts[0];
$filter = new Calendar_Model_EventFilter(array(array('field' => 'container_id', 'operator' => 'equals', 'value' => $container_id)));
$result = Calendar_Controller_MSEventFacade::getInstance()->search($filter, null, false, false, 'get');
if ($result->count() == 0) {
throw new Tinebase_Exception('this calendar does not contain any records.');
}
$converter = Calendar_Convert_Event_VCalendar_Factory::factory("generic");
$result = $converter->fromTine20RecordSet($result);
print $result->serialize();
}
示例13: testGetDispatchServerJSON
public function testGetDispatchServerJSON()
{
$request = \Zend\Http\PhpEnvironment\Request::fromString("OPTIONS /index.php HTTP/1.1\r\n" . "Host: localhost\r\n" . "User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b3pre) Gecko/20081130 Minefield/3.1b3pre\r\n" . "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" . "Accept-Language: en-us,en;q=0.5\r\n" . "Accept-Encoding: gzip,deflate\r\n" . "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n" . "Connection: keep-alive\r\n" . "Origin: http://foo.example\r\n" . "Access-Control-Request-Method: POST\r\n" . "Access-Control-Request-Headers: X-PINGOTHER");
Tinebase_Core::set(Tinebase_Core::REQUEST, $request);
$server = Tinebase_Core::getDispatchServer($request);
$this->assertInstanceOf('Tinebase_Server_Json', $server);
$request = \Zend\Http\PhpEnvironment\Request::fromString("POST /index.php HTTP/1.1\r\n" . "X-Tine20-Request-Type: JSON\r\n" . "\r\n" . '{"jsonrpc":"2.0","method":"Admin.searchUsers","params":{"filter":[{"field":"query","operator":"contains","value":"","id":"ext-record-2"}],"paging":{"sort":"accountLoginName","dir":"ASC","start":0,"limit":50}},"id":37}');
Tinebase_Core::set(Tinebase_Core::REQUEST, $request);
$server = Tinebase_Core::getDispatchServer($request);
$this->assertInstanceOf('Tinebase_Server_Json', $server);
$request = \Zend\Http\PhpEnvironment\Request::fromString("POST /index.php HTTP/1.1\r\n" . "Content-Type: application/json\r\n" . "\r\n" . '{"jsonrpc":"2.0","method":"Admin.searchUsers","params":{"filter":[{"field":"query","operator":"contains","value":"","id":"ext-record-2"}],"paging":{"sort":"accountLoginName","dir":"ASC","start":0,"limit":50}},"id":37}');
Tinebase_Core::set(Tinebase_Core::REQUEST, $request);
$server = Tinebase_Core::getDispatchServer($request);
$this->assertInstanceOf('Tinebase_Server_Json', $server);
}
示例14: testUpdateEvent
public function testUpdateEvent()
{
$persistentEvent = $this->testCreateEvent();
$currentTz = Tinebase_Core::get(Tinebase_Core::USERTIMEZONE);
Tinebase_Core::set(Tinebase_Core::USERTIMEZONE, 'farfaraway');
$persistentEvent->summary = 'Lunchtime';
$updatedEvent = $this->_controller->update($persistentEvent);
$this->assertEquals($persistentEvent->summary, $updatedEvent->summary);
$this->assertEquals($currentTz, $updatedEvent->originator_tz, 'originator_tz must not be touchet if dtsart is not updatet!');
$updatedEvent->dtstart->addHour(1);
$updatedEvent->dtend->addHour(1);
$secondUpdatedEvent = $this->_controller->update($updatedEvent);
$this->assertEquals(Tinebase_Core::get(Tinebase_Core::USERTIMEZONE), $secondUpdatedEvent->originator_tz, 'originator_tz must be adopted if dtsart is updatet!');
Tinebase_Core::set(Tinebase_Core::USERTIMEZONE, $currentTz);
}
示例15: _initialize
/**
* Override method: Setup needs additional initialisation
*
* @see tine20/Setup/Setup_Initialize#_initialize($_application)
*/
protected function _initialize(Tinebase_Model_Application $_application, $_options = null)
{
$initialAdminUserOptions = $this->_parseInitialAdminUserOptions($_options);
if (Tinebase_User::getInstance() instanceof Tinebase_User_Interface_SyncAble) {
Tinebase_User::syncUsers(array('syncContactData' => TRUE));
}
try {
$initialUser = Tinebase_User::getInstance()->getUserByProperty('accountLoginName', $initialAdminUserOptions['adminLoginName']);
} catch (Tinebase_Exception_NotFound $tenf) {
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . ' Could not find initial admin account in user backend. Creating new one ...');
}
Tinebase_User::createInitialAccounts($initialAdminUserOptions);
$initialUser = Tinebase_User::getInstance()->getUserByProperty('accountLoginName', $initialAdminUserOptions['adminLoginName']);
}
Tinebase_Core::set(Tinebase_Core::USER, $initialUser);
parent::_initialize($_application, $_options);
}