本文整理汇总了PHP中Tinebase_Record_Abstract::generateUID方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Record_Abstract::generateUID方法的具体用法?PHP Tinebase_Record_Abstract::generateUID怎么用?PHP Tinebase_Record_Abstract::generateUID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_Record_Abstract
的用法示例。
在下文中一共展示了Tinebase_Record_Abstract::generateUID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testTimeaccountContractFilter
/**
* test timeaccount - sales contract filter
* also tests Tinebase_Model_Filter_ExplicitRelatedRecord
*/
public function testTimeaccountContractFilter()
{
$this->_getTimeaccount(array('title' => 'TA1', 'number' => 12345, 'description' => 'UnitTest'), true);
$ta1 = $this->_timeaccountController->get($this->_lastCreatedRecord['id']);
$this->_getTimeaccount(array('title' => 'TA2', 'number' => 12346, 'description' => 'UnitTest'), true);
$ta2 = $this->_timeaccountController->get($this->_lastCreatedRecord['id']);
$cId = Tinebase_Container::getInstance()->getDefaultContainer('Sales_Model_Contract')->getId();
$contract = Sales_Controller_Contract::getInstance()->create(new Sales_Model_Contract(array('title' => 'testRelateTimeaccount', 'number' => Tinebase_Record_Abstract::generateUID(), 'container_id' => $cId)));
$ta1->relations = array($this->_getRelation($contract, $ta1));
$this->_timeaccountController->update($ta1);
// search by contract
$f = new Timetracker_Model_TimeaccountFilter(array(array('field' => 'contract', 'operator' => 'AND', 'value' => array(array('field' => ':id', 'operator' => 'equals', 'value' => $contract->getId())))));
$filterArray = $f->toArray();
$this->assertEquals($contract->getId(), $filterArray[0]['value'][0]['value']['id']);
$result = $this->_timeaccountController->search($f);
$this->assertEquals(1, $result->count());
$this->assertEquals('TA1', $result->getFirstRecord()->title);
// test empty filter (without contract)
$f = new Timetracker_Model_TimeaccountFilter(array(array('field' => 'contract', 'operator' => 'AND', 'value' => array(array('field' => ':id', 'operator' => 'equals', 'value' => null))), array('field' => 'description', 'operator' => 'equals', 'value' => 'UnitTest')));
$result = $this->_timeaccountController->search($f);
$this->assertEquals(1, $result->count(), 'Only one record should have been found!');
$this->assertEquals('TA2', $result->getFirstRecord()->title);
// test generic relation filter
$f = new Timetracker_Model_TimeaccountFilter(array(array('field' => 'foreignRecord', 'operator' => 'AND', 'value' => array('appName' => 'Sales', 'linkType' => 'relation', 'modelName' => 'Contract', 'filters' => array('field' => 'query', 'operator' => 'contains', 'value' => 'TA1')))));
$result = $this->_timeaccountController->search($f);
$this->assertEquals(1, $result->count());
$this->assertEquals('TA1', $result->getFirstRecord()->title);
// test "not" operator
$f = new Timetracker_Model_TimeaccountFilter(array(array('field' => 'contract', 'operator' => 'AND', 'value' => array(array('field' => ':id', 'operator' => 'not', 'value' => $contract->getId()))), array('field' => 'description', 'operator' => 'equals', 'value' => 'UnitTest')));
$result = $this->_timeaccountController->search($f);
// TODO is this correct? do we expect the timaccount without contract to be missing from results?
$this->assertEquals(0, $result->count(), 'No record should be found');
}
示例2: __construct
public function __construct(array $_values = array())
{
$this->_id = Tinebase_Record_Abstract::generateUID();
foreach ($_values as $key => $value) {
$this->{$key} = $value;
}
}
示例3: setUp
/**
* set up tests
*
*/
protected function setUp()
{
parent::setUp();
$this->_instance = Tinebase_Notes::getInstance();
$this->_objects['contact'] = new Addressbook_Model_Contact(array('id' => Tinebase_Record_Abstract::generateUID(), 'n_family' => 'phpunit notes contact'));
$this->_objects['record'] = array('id' => $this->_objects['contact']->getId(), 'model' => 'Addressbook_Model_Contact', 'backend' => 'Sql');
}
示例4: testToArrayJsonNonExisting
public function testToArrayJsonNonExisting()
{
$nonExistingId = Tinebase_Record_Abstract::generateUID();
$filter = new Addressbook_Model_ContactIdFilter('id', 'equals', $nonExistingId);
$filterArray = $filter->toArray(TRUE);
$this->assertEquals($nonExistingId, $filterArray['value']);
}
示例5: 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']);
}
示例6: _doConversions
/**
* do conversions
*
* @param array $_data
* @return array
*/
protected function _doConversions($_data)
{
$result = parent::_doConversions($_data);
if ((isset($result['warranty']) || array_key_exists('warranty', $result)) && empty($_data['warranty'])) {
unset($result['warranty']);
}
if ((isset($result['invoice_date']) || array_key_exists('invoice_date', $result)) && empty($_data['invoice_date'])) {
unset($result['invoice_date']);
}
if ((isset($result["name"]) || array_key_exists("name", $result)) && $result['name'] == "") {
$result['name'] = "!Not defined!";
}
if ((isset($result["inventory_id"]) || array_key_exists("inventory_id", $result)) && $result['inventory_id'] == "") {
$result['inventory_id'] = Tinebase_Record_Abstract::generateUID(40);
}
if (isset($result["costcentre"]) || array_key_exists("costcentre", $result)) {
$result["costcentre"] = $c = Sales_Controller_CostCenter::getInstance()->search(new Sales_Model_CostCenterFilter(array(array('field' => 'number', 'operator' => 'equals', 'value' => $result["costcentre"]))))->getFirstRecord();
}
if (isset($result["status"]) || array_key_exists("status", $result)) {
$statusRecord = Inventory_Config::getInstance()->get(Inventory_Config::INVENTORY_STATUS)->getKeyfieldRecordByValue($result["status"]);
if (empty($statusRecord)) {
$statusRecord = Inventory_Config::getInstance()->get(Inventory_Config::INVENTORY_STATUS)->getKeyfieldDefault();
}
$result["status"] = $statusRecord['id'];
}
return $result;
}
示例7: __construct
/**
* overwritten parent constructor to load configuration, calls parent constructor
*
* supported configuration keys:
* logruntime => prepend time passed since request started
* logdifftime => prepend time passed since last log message
*
* @param string $format
*/
function __construct(string $format = null)
{
parent::__construct($format);
if (!self::$_prefix) {
self::$_prefix = Tinebase_Record_Abstract::generateUID(5);
}
if (self::$_starttime === NULL) {
self::$_starttime = Tinebase_Core::get(Tinebase_Core::STARTTIME);
if (self::$_starttime === NULL) {
self::$_starttime = microtime(true);
}
}
if (self::$_logruntime === NULL || self::$_logdifftime === NULL) {
$config = Tinebase_Core::getConfig();
if ($config->logger->logruntime) {
self::$_logruntime = true;
} else {
self::$_logruntime = false;
}
if ($config->logger->logdifftime) {
self::$_logdifftime = true;
} else {
self::$_logdifftime = false;
}
}
}
示例8: appendFilterSql
/**
* appends sql to given select statement
*
* @param Zend_Db_Select $_select
* @param Tinebase_Backend_Sql_Abstract $_backend
* @throws Tinebase_Exception_UnexpectedValue
*/
public function appendFilterSql($_select, $_backend)
{
// don't take empty filter into account
if (empty($this->_value) || !is_array($this->_value) || !isset($this->_value['cfId']) || empty($this->_value['cfId']) || !isset($this->_value['value'])) {
return;
} else {
if ($this->_operator == 'in') {
throw new Tinebase_Exception_UnexpectedValue('Operator "in" not supported.');
}
}
// make sure $correlationName is a string
$correlationName = Tinebase_Record_Abstract::generateUID() . $this->_value['cfId'] . 'cf';
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Adding custom field filter: ' . print_r($this->_value, true));
}
$db = Tinebase_Core::getDb();
$idProperty = $db->quoteIdentifier($this->_options['idProperty']);
// per left join we add a customfield column named as the customfield and filter this joined column
// NOTE: we name the column we join like the customfield, to be able to join multiple customfield criteria (multiple invocations of this function)
$what = array($correlationName => SQL_TABLE_PREFIX . 'customfield');
$on = $db->quoteIdentifier("{$correlationName}.record_id") . " = {$idProperty} AND " . $db->quoteIdentifier("{$correlationName}.customfield_id") . " = " . $db->quote($this->_value['cfId']);
$_select->joinLeft($what, $on, array());
$valueIdentifier = $db->quoteIdentifier("{$correlationName}.value");
if ($this->_value['value'] === '') {
$where = $db->quoteInto($valueIdentifier . ' IS NULL OR ' . $valueIdentifier . ' = ?', $this->_value['value']);
} else {
$value = $this->_replaceWildcards($this->_value['value']);
$where = $db->quoteInto($valueIdentifier . $this->_opSqlMap[$this->_operator]['sqlop'], $value);
}
$_select->where($where . ' /* add cf filter */');
}
示例9: appendFilterSql
/**
* appends sql to given select statement
*
* @param Zend_Db_Select $_select
* @param Tinebase_Backend_Sql_Abstract $_backend
*/
public function appendFilterSql($_select, $_backend)
{
$correlationName = Tinebase_Record_Abstract::generateUID(30);
$db = $_backend->getAdapter();
$_select->joinLeft(array($correlationName => $db->table_prefix . 'adb_list_m_role'), $db->quoteIdentifier($correlationName . '.contact_id') . ' = ' . $db->quoteIdentifier('addressbook.id'), array());
$_select->where($db->quoteIdentifier($correlationName . '.list_role_id') . ' IN (?)', (array) $this->_value);
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:13,代码来源:ListRoleMemberFilter.php
示例10: testBackslashInDescription
/**
* testBackslashInDescription
*
* @see 0009176: iCal adds another backslash to description field
*/
public function testBackslashInDescription()
{
$event = new Calendar_Model_Event(array('summary' => 'CalDAV test', 'dtstart' => Tinebase_DateTime::now(), 'dtend' => Tinebase_DateTime::now()->addHour(1), 'description' => 'lalala \\\\', 'originator_tz' => 'Europe/Berlin', 'creation_time' => Tinebase_DateTime::now(), 'uid' => Tinebase_Record_Abstract::generateUID(), 'seq' => 1));
$converter = Calendar_Convert_Event_VCalendar_Factory::factory(Calendar_Convert_Event_VCalendar_Factory::CLIENT_MACOSX);
$vevent = $converter->fromTine20Model($event)->serialize();
$convertedEvent = $converter->toTine20Model($vevent);
$this->assertEquals($event->description, $convertedEvent->description);
}
示例11: createScheduledImport
/**
* Test create a scheduled import
*/
public function createScheduledImport($source = 'http://localhost/test.ics')
{
$id = Tinebase_Record_Abstract::generateUID();
$import = new Tinebase_Model_Import(array('id' => $id, 'user_id' => $this->_originalTestUser->getId(), 'interval' => Tinebase_Model_Import::INTERVAL_HOURLY, 'model' => Calendar_Controller::getInstance()->getDefaultModel(), 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId(), 'container_id' => $this->_testCalendar->getId(), 'sourcetype' => Tinebase_Model_Import::SOURCETYPE_REMOTE, 'source' => $source, 'options' => json_encode(array('forceUpdateExisting' => TRUE, 'import_defintion' => NULL, 'plugin' => 'Calendar_Import_Ical'))));
$record = $this->_uit->create($import);
$this->assertEquals(Calendar_Controller::getInstance()->getDefaultModel(), $this->_uit->get($id)->model);
return $record;
}
示例12: testCreateDirectory
/**
* test to create a new directory
*/
public function testCreateDirectory()
{
$randomName = Tinebase_Record_Abstract::generateUID();
$collection = new Addressbook_Frontend_WebDAV(\Sabre\CardDAV\Plugin::ADDRESSBOOK_ROOT . '/' . Tinebase_Core::getUser()->contact_id, true);
$collection->createDirectory($randomName);
$container = Tinebase_Container::getInstance()->getContainerByName('Addressbook', $randomName, Tinebase_Model_Container::TYPE_PERSONAL, Tinebase_Core::getUser());
$this->assertTrue($container instanceof Tinebase_Model_Container);
}
示例13: testSetLogout
/**
* Test create a access log and logout to set logout time
*
* @see 0010728: Strange error in tine20 log when performing logout from Web
*/
public function testSetLogout()
{
$accessLog = new Tinebase_Model_AccessLog(array('ip' => '127.0.0.1', 'li' => Tinebase_DateTime::now(), 'result' => Zend_Auth_Result::SUCCESS, 'clienttype' => 'unittest', 'login_name' => 'unittest', 'user_agent' => 'phpunit', 'sessionid' => Tinebase_Record_Abstract::generateUID()), true);
$this->_uit->setSessionId($accessLog);
$this->_uit->create($accessLog);
$accessLog = $this->_uit->setLogout();
$this->assertEquals(Tinebase_DateTime::now()->toString(), $accessLog->lo->toString(), 'logout time mismatch/empty: ' . print_r($accessLog, true));
}
示例14: testCreateContactWithPhoto
/**
* test create contact with photo
*
* @return Addressbook_Frontend_WebDAV_Contact
*/
public function testCreateContactWithPhoto()
{
$vcardStream = fopen(dirname(__FILE__) . '/../../Import/files/jan.vcf', 'r');
$id = Tinebase_Record_Abstract::generateUID();
$contact = Addressbook_Frontend_WebDAV_Contact::create($this->objects['initialContainer'], "{$id}.vcf", $vcardStream);
$record = $contact->getRecord();
$imgBlob = $record->getSmallContactImage();
$this->assertTrue(strlen($imgBlob) > 0);
$this->assertTrue(strlen($imgBlob) < Addressbook_Model_Contact::SMALL_PHOTO_SIZE);
}
示例15: copyTreeByShadowPath
/**
* @param $shadowPath
* @param $newPath
* @param $oldPath
* @param $newShadowPath
* @param $oldShadowPath
*/
public function copyTreeByShadowPath($shadowPath, $newPath, $oldPath, $newShadowPath, $oldShadowPath)
{
$select = $this->_db->select()->from($this->_tablePrefix . $this->_tableName, array('path' => new Zend_Db_Expr($this->_db->quoteInto($this->_db->quoteInto('REPLACE(path, ?', $oldPath) . ', ?)', $newPath)), 'shadow_path' => new Zend_Db_Expr($this->_db->quoteInto($this->_db->quoteInto('REPLACE(shadow_path, ?', $oldShadowPath) . ', ?)', $newShadowPath)), 'record_id' => 'record_id', 'creation_time' => new Zend_Db_Expr('NOW()')))->where($this->_db->quoteInto($this->_db->quoteIdentifier('shadow_path') . ' like ?', $shadowPath . '/%'));
$stmt = $this->_db->query($select);
$entries = $stmt->fetchAll(Zend_Db::FETCH_ASSOC);
foreach ($entries as $entry) {
$entry['id'] = Tinebase_Record_Abstract::generateUID();
$this->_db->insert($this->_tablePrefix . $this->_tableName, $entry);
}
}