本文整理汇总了PHP中Tinebase_Core::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Core::get方法的具体用法?PHP Tinebase_Core::get怎么用?PHP Tinebase_Core::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_Core
的用法示例。
在下文中一共展示了Tinebase_Core::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCachedResults
public function testCachedResults()
{
$this->_uit->setCache(Tinebase_Core::get('cache'));
$this->testGetListOfTimezonesForOffsets();
$this->testGetListOfTimezonesForPackedStrings();
$this->_uit->setCache(null);
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:7,代码来源:TimezoneConverterTest.php
示例2: printDocs
public function printDocs()
{
// print payments which are debit returns and have flag print inquiry
$resultData = array();
$filters = array(array('field' => 'is_return_debit', 'operator' => 'equals', 'value' => '1'), array('field' => 'print_inquiry', 'operator' => 'equals', 'value' => '1'), array('field' => 'inquiry_print_date', 'operator' => 'isnull', 'value' => ''));
$objFilter = new Billing_Model_PaymentFilter($filters, 'AND');
$paymentIds = Billing_Controller_Payment::getInstance()->search($objFilter, null, null, true);
foreach ($paymentIds as $paymentId) {
$payment = Billing_Controller_Payment::getInstance()->get($paymentId);
// get base payment
$basePayment = $payment->getForeignRecordBreakNull('return_debit_base_payment_id', Billing_Controller_Payment::getInstance());
if ($basePayment) {
$batchJobDta = $basePayment->getForeignRecordBreakNull('batch_job_dta_id', Billing_Controller_BatchJobDta::getInstance());
if ($batchJobDta) {
$bankAccount = Billing_Api_BankAccount::getFromBatchJobDta($batchJobDta);
$debitor = $payment->getForeignRecord('debitor_id', Billing_Controller_Debitor::getInstance());
$contact = $debitor->getForeignRecord('contact_id', Addressbook_Controller_Contact::getInstance());
$data = array();
$dummyTextBlocks = null;
$data = array_merge($data, Addressbook_Custom_Template::getContactData(array('contact' => $contact, 'user' => Tinebase_Core::get(Tinebase_Core::USER), 'userContact' => Addressbook_Controller_Contact::getInstance()->getContactByUserId(Tinebase_Core::get(Tinebase_Core::USER)->getId())), $dummyTextBlocks));
$data = array_merge($data, array('bank_name' => $bankAccount->getBank(), 'account_name' => $bankAccount->getName(), 'account_nr' => $bankAccount->getNumber(), 'bank_code' => $bankAccount->getBankCode()));
$resultData[$contact->__get('n_fileas')] = $data;
$payment->__set('inquiry_print_date', new Zend_Date());
Billing_Controller_Payment::getInstance()->update($payment);
}
}
}
$outputFileName = 'Ruecklastschrift-Nachforschung-' . strftime('%d-%m-%Y %H-%M-%S') . '.pdf';
$templateId = Tinebase_Core::getPreference('Billing')->getValue(Billing_Preference::TEMPLATE_DEBIT_RETURN_INQUIRY);
ksort($resultData);
Billing_Controller_PrintJobRecordData::getInstance()->export($resultData, $templateId, $outputFileName);
}
示例3: uploadImage
/**
* upload image
*
* @param string $base64
*/
public function uploadImage($base64 = 'no')
{
$tmpFile = tempnam(Tinebase_Core::getTempDir(), '');
$file = new Zend_Form_Element_File('file');
$maxsize = $file->getMaxFileSize();
$sessionId = Tinebase_Core::get(Tinebase_Session::SESSIONID);
if (move_uploaded_file($_FILES['upload']['tmp_name'], $tmpFile)) {
$image_id = str_replace(Tinebase_Core::getTempDir() . '/', '', $tmpFile);
$image_size = filesize($tmpFile);
if ($base64 === 'yes') {
// converts image to base64
try {
$image = file_get_contents($tmpFile);
$encoded_data = base64_encode($image);
echo '{"success":true , "id":"' . $image_id . '", "session_id":"' . $sessionId . '", "size":"' . $image_size . '", "path":"' . $tmpFile . '", "base64":"' . $encoded_data . '"}';
} catch (Exception $e) {
echo '{"success":false, "error":' . $e . description . '}';
}
} else {
echo '{"success":true , "id":"' . $image_id . '", "session_id":"' . $sessionId . '", "size":"' . $image_size . '", "path":"' . $tmpFile . '"}';
}
} else {
echo '{"success":false, "method":"uploadImage", "maxsize":"' . $maxsize . '"}';
}
}
示例4: factory
/**
* factory function to return a selected account/imap backend class
*
* @param string|Expressomail_Model_Account $_accountId
* @return Expressomail_Backend_ImapProxy
* @throws Expressomail_Exception_IMAPInvalidCredentials
*/
public static function factory($_accountId, $_readOnly = FALSE)
{
$accountId = $_accountId instanceof Expressomail_Model_Account ? $_accountId->getId() : $_accountId;
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Getting IMAP backend for account id ' . $accountId);
}
if (!isset(self::$_backends[$accountId])) {
// get imap config from account
$account = $_accountId instanceof Expressomail_Model_Account ? $_accountId : Expressomail_Controller_Account::getInstance()->get($_accountId);
$imapConfig = $account->getImapConfig();
// we need to instantiate a new imap backend
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Connecting to server ' . $imapConfig['host'] . ':' . $imapConfig['port'] . ' (' . (array_key_exists('ssl', $imapConfig) ? $imapConfig['ssl'] : 'none') . ')' . ' with username ' . $imapConfig['user']);
}
try {
self::$_backends[$accountId] = new Expressomail_Backend_ImapProxy($imapConfig, $_readOnly);
if (Tinebase_Core::get(Tinebase_Core::SERVER_CLASS_NAME) !== 'ActiveSync_Server_Http') {
Expressomail_Controller_Account::getInstance()->updateCapabilities($account, self::$_backends[$accountId]);
}
} catch (Expressomail_Exception_IMAPInvalidCredentials $feiic) {
// add account and username to Expressomail_Exception_IMAPInvalidCredentials
$feiic->setAccount($account)->setUsername($imapConfig['user']);
throw $feiic;
}
}
return self::$_backends[$accountId];
}
示例5: getFilterImap
/**
*
* @return type
*/
public function getFilterImap()
{
$format = "d-M-Y";
// prepare value
$value = (array) $this->_getDateValues($this->_operator, $this->_value);
$timezone = Tinebase_Helper::array_value('timezone', $this->_options);
$timezone = $timezone ? $timezone : Tinebase_Core::get('userTimeZone');
foreach ($value as &$date) {
$date = new Tinebase_DateTime($date);
// should be in user timezone
$date->setTimezone(new DateTimeZone($timezone));
}
switch ($this->_operator) {
case 'within':
case 'inweek':
$value[1]->add(new DateInterval('P1D'));
// before is not inclusive, so we have to add a day
$return = "SINCE {$value[0]->format($format)} BEFORE {$value[1]->format($format)}";
break;
case 'before':
$return = "BEFORE {$value[0]->format($format)}";
break;
case 'after':
$return = "SINCE {$value[0]->format($format)}";
break;
case 'equals':
$return = "ON {$value[0]->format($format)}";
}
return $return;
}
示例6: getGroupMemberships
/**
* return all groups an account is member of
* - this function caches its result (with cache tag 'ldap')
*
* @param mixed $_accountId the account as integer or Tinebase_Model_User
* @return array
*/
public function getGroupMemberships($_accountId)
{
$cache = Tinebase_Core::get(Tinebase_Core::CACHE);
$cacheId = convertCacheId('getLdapGroupMemberships' . ($_accountId instanceof Tinebase_Model_FullUser ? $_accountId->getId() : $_accountId));
$result = $cache->load($cacheId);
if (!$result) {
if ($_accountId instanceof Tinebase_Model_FullUser) {
$memberuid = $_accountId->accountLoginName;
} else {
$account = Tinebase_User::getInstance()->getFullUserById($_accountId);
$memberuid = $account->accountLoginName;
}
$filter = "(&(objectclass=user)(sAMAccountName={$memberuid}))";
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' search filter: ' . $filter);
}
$groupMemberships = $this->_ldap->fetchAll($this->_options['userDn'], $filter, array('memberOf'));
$memberships = array();
foreach ($groupMemberships as $groupMembership) {
$group = $this->_ldap->fetch($groupMembership['memberOf'][0], 'objectClass=group', array('objectGUID'));
$memberships[] = $group['objectGUID'][0];
}
$result = $memberships;
$cache->save($result, $cacheId, array('ldap'), 240);
}
return $result;
}
示例7: create
/**
* add one record
*
* @param Tinebase_Record_Interface $_record
* @return Tinebase_Record_Interface
* @throws Tinebase_Exception_AccessDenied
* @throws Tinebase_Exception_Record_Validation
*/
public function create(Tinebase_Record_Interface $_task)
{
$this->_handleCompleted($_task);
$_task->originator_tz = $_task->originator_tz ? $_task->originator_tz : Tinebase_Core::get(Tinebase_Core::USERTIMEZONE);
$task = parent::create($_task);
$this->_addAutomaticAlarms($task);
return $task;
}
示例8: searchCalls
/**
* Search for calls matching given arguments
*
* @param array $filter
* @param array $paging
* @return array
*/
public function searchCalls($filter, $paging)
{
$filter = new Phone_Model_CallFilter($filter);
$pagination = new Tinebase_Model_Pagination($paging);
$calls = Phone_Controller::getInstance()->searchCalls($filter, $pagination);
// set timezone
$calls->setTimezone(Tinebase_Core::get('userTimeZone'));
return array('results' => $calls->toArray(), 'totalcount' => Phone_Controller::getInstance()->searchCallsCount($filter));
}
示例9: _setCredentials
/**
* set new password & credentials
*
* @param string $_username
* @param string $_password
*/
protected function _setCredentials($_username, $_password)
{
Tinebase_User::getInstance()->setPassword(Tinebase_Core::getUser(), $_password, true, false);
$oldCredentialCache = Tinebase_Core::get(Tinebase_Core::USERCREDENTIALCACHE);
// update credential cache
$credentialCache = Tinebase_Auth_CredentialCache::getInstance()->cacheCredentials($_username, $_password);
Tinebase_Core::set(Tinebase_Core::USERCREDENTIALCACHE, $credentialCache);
$event = new Tinebase_Event_User_ChangeCredentialCache($oldCredentialCache);
Tinebase_Event::fireEvent($event);
}
示例10: setUp
public function setUp()
{
// invalidate all caches
$cache = Tinebase_Core::get(Tinebase_Core::CACHE);
if (!$cache || !$cache->getOption('caching')) {
return;
}
$cache->clean(Zend_Cache::CLEANING_MODE_ALL);
Tinebase_Core::getDb()->query("RESET QUERY CACHE;");
$this->_json = new Calendar_Frontend_Json();
}
示例11: fromTine20RecordSet
/**
* converts Tinebase_Record_RecordSet to external format
*
* @param Tinebase_Record_RecordSet $_records
* @param array $_resolveUserFields
* @return mixed
*/
public function fromTine20RecordSet(Tinebase_Record_RecordSet $_records, $_resolveUserFields = array())
{
if (count($_records) == 0) {
return array();
}
Tinebase_Frontend_Json_Abstract::resolveContainerTagsUsers($_records, $_resolveUserFields);
$_records->setTimezone(Tinebase_Core::get(Tinebase_Core::USERTIMEZONE));
$_records->convertDates = true;
$result = $_records->toArray();
return $result;
}
示例12: 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']);
}
示例13: _migrateEgwRecordPage
/**
* @TODO: egw can have groups as owner
* -> map this to shared folder
* -> find appropriate creator / current_user for this
* -> support maps for group => creator and owner => folder?
*/
protected function _migrateEgwRecordPage($recordPage)
{
foreach ($recordPage as $egwContactData) {
try {
$this->_importResult['totalcount']++;
$currentUser = Tinebase_Core::get(Tinebase_Core::USER);
$owner = $egwContactData['contact_owner'] ? Tinebase_User::getInstance()->getFullUserById($this->mapAccountIdEgw2Tine($egwContactData['contact_owner'])) : $currentUser;
Tinebase_Core::set(Tinebase_Core::USER, $owner);
$contactData = array_merge($egwContactData, array('id' => $egwContactData['contact_id'], 'creation_time' => $this->convertDate($egwContactData['contact_created']), 'created_by' => $this->mapAccountIdEgw2Tine($egwContactData['contact_creator'], FALSE), 'last_modified_time' => $egwContactData['contact_modified'] ? $this->convertDate($egwContactData['contact_modified']) : NULL, 'last_modified_by' => $egwContactData['contact_modifier'] ? $this->mapAccountIdEgw2Tine($contact['contact_modifier'], FALSE) : NULL));
$contactData['created_by'] = $contactData['created_by'] ?: $owner;
$contactData['$egwContactData'] = $contactData['last_modified_time'] && !$contactData['last_modified_by'] ?: $owner;
// fix mandentory fields
if (!($egwContactData['org_name'] || $egwContactData['n_family'])) {
$contactData['org_name'] = 'N/A';
}
// add 'http://' if missing
foreach (array('contact_url', 'contact_url_home') as $urlProperty) {
if (!preg_match("/^http/i", $egwContactData[$urlProperty]) && !empty($egwContactData[$urlProperty])) {
$contactData[$urlProperty] = "http://" . $egwContactData[$urlProperty];
}
}
// normalize countynames
$contactData['adr_one_countryname'] = $this->convertCountryname2Iso($egwContactData['adr_one_countryname']);
$contactData['adr_two_countryname'] = $this->convertCountryname2Iso($egwContactData['adr_two_countryname']);
// handle bday
if ((isset($egwContactData['contact_bday']) || array_key_exists('contact_bday', $egwContactData)) && $egwContactData['contact_bday']) {
// @TODO evaluate contact_tz
$contactData['bday'] = new Tinebase_DateTime($egwContactData['contact_bday'], $this->_config->birthdayDefaultTimezone);
} else {
if ((isset($egwContactData['bday']) || array_key_exists('bday', $egwContactData)) && $egwContactData['bday']) {
// egw <= 1.4
$contactData['bday'] = $this->convertDate($egwContactData['bday']);
}
}
// handle tags
$contactData['tags'] = $this->convertCategories($egwContactData['cat_id']);
// @TODO handle photo
// handle container
if ($egwContactData['contact_owner'] && !$egwContactData['account_id']) {
$contactData['container_id'] = $egwContactData['contact_private'] && $this->_config->setPersonalContainerGrants ? $this->getPrivateContainer($this->mapAccountIdEgw2Tine($egwContactData['contact_owner']))->getId() : $this->getPersonalContainer($this->mapAccountIdEgw2Tine($egwContactData['contact_owner']))->getId();
}
// finally create the record
$tineContact = new Addressbook_Model_Contact($contactData);
$this->saveTineRecord($tineContact);
} catch (Exception $e) {
$this->_importResult['failcount']++;
Tinebase_Core::set(Tinebase_Core::USER, $currentUser);
$this->_log->ERR(__METHOD__ . '::' . __LINE__ . ' could not migrate contact "' . $egwContactData['contact_id'] . '" cause: ' . $e->getMessage());
$this->_log->DEBUG(__METHOD__ . '::' . __LINE__ . ' ' . $e);
}
}
}
示例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: getQueues
/**
* check available queues
*
* @return array of queueNames
*/
public function getQueues()
{
$cache = Tinebase_Core::get(Tinebase_Core::CACHE);
$cacheId = 'RequestTrackerGetQueues' . Tinebase_Core::getUser()->getId();
$availableQueues = $cache->load($cacheId);
if (!$availableQueues) {
$availableQueues = array();
foreach ($this->_config->rest->queues as $queueName) {
if ($this->_checkQueue($queueName)) {
$availableQueues[] = $queueName;
}
}
$cache->save($availableQueues, $cacheId, array('rt'));
}
return $availableQueues;
}