本文整理匯總了PHP中Tinebase_Record_RecordSet::sort方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tinebase_Record_RecordSet::sort方法的具體用法?PHP Tinebase_Record_RecordSet::sort怎麽用?PHP Tinebase_Record_RecordSet::sort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Tinebase_Record_RecordSet
的用法示例。
在下文中一共展示了Tinebase_Record_RecordSet::sort方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSort
/**
* test sort
*/
public function testSort()
{
$this->object = new Tinebase_Record_RecordSet('Tinebase_Record_DummyRecord');
$this->object->addRecord(new Tinebase_Record_DummyRecord(array('id' => '100', 'string' => 'Test3'), true));
$this->object->addRecord(new Tinebase_Record_DummyRecord(array('id' => '200', 'string' => 'Test1'), true));
$this->object->addRecord(new Tinebase_Record_DummyRecord(array('id' => '300', 'string' => 'Test2'), true));
$result = $this->object->sort('string', 'ASC');
}
示例2: getLastOpenItem
public function getLastOpenItem(Tinebase_Record_RecordSet $batchJobMonitionItems)
{
if ($batchJobMonitionItems->getCount() == 0) {
throw new Billing_Exception_OpenItem('Recordset does not contain any monition open items and therefore no related order.');
}
$batchJobMonitionItems->sort('open_item_id', 'DESC');
$record = $batchJobMonitionItems->getFirstRecord();
$openItem = $record->getForeignRecord('open_item_id', Billing_Controller_OpenItem::getInstance());
return $openItem;
}
示例3: _createCustomers
/**
* create customers and their addresses
*
* @param number $count
* @return Tinebase_Record_RecordSet
*/
protected function _createCustomers($count = 4)
{
if (!$this->_contactRecords) {
// each customer may have 5 contacts
$this->_createContacts($count * 5);
}
$this->_customerController = Sales_Controller_Customer::getInstance();
$this->_customerRecords = new Tinebase_Record_RecordSet('Sales_Model_Customer');
$this->_addressController = Sales_Controller_Address::getInstance();
$this->_addressRecords = new Tinebase_Record_RecordSet('Sales_Model_Address');
$countAll = 0;
// customers
$customers = array(array('name' => 'Customer1', 'url' => 'www.customer1.de', 'discount' => 0), array('name' => 'Customer2', 'url' => 'www.customer2.de', 'discount' => 5), array('name' => 'Customer3', 'url' => 'www.customer3.de', 'discount' => 10), array('name' => 'Customer4', 'url' => 'www.customer4.de', 'discount' => 0));
$i = 0;
foreach ($customers as $customer) {
if ($countAll == $count) {
break;
}
$countAll++;
$customer['cpextern_id'] = $this->_contactRecords->getByIndex($i)->getId();
$i++;
$customer['cpintern_id'] = $this->_contactRecords->getByIndex($i)->getId();
$i++;
$customer['iban'] = Tinebase_Record_Abstract::generateUID(20);
$customer['bic'] = Tinebase_Record_Abstract::generateUID(12);
$customer['credit_term'] = 30;
$customer['currency'] = 'EUR';
$customer['currency_trans_rate'] = 1;
$this->_customerRecords->addRecord($this->_customerController->create(new Sales_Model_Customer($customer)));
}
foreach ($this->_customerRecords as $customer) {
foreach (array('postal', 'billing', 'delivery') as $type) {
$caddress = $this->_contactRecords->getByIndex($i);
$address = new Sales_Model_Address(array('customer_id' => $customer->getId(), 'type' => $type, 'prefix1' => $caddress->title, 'prefix2' => $caddress->n_fn, 'street' => $caddress->adr_two_street, 'postalcode' => $caddress->adr_two_postalcode, 'locality' => $caddress->adr_two_locality, 'region' => $caddress->adr_two_region, 'countryname' => $caddress->adr_two_countryname, 'custom1' => $type == 'billing' ? Tinebase_Record_Abstract::generateUID(5) : NULL));
$this->_addressRecords->addRecord($this->_addressController->create($address));
$i++;
}
}
$this->_customerRecords->sort('name', 'ASC');
return $this->_customerRecords;
}
示例4: _inspectBeforeCreate
/**
* inspect creation of one record (before create)
*
* @param Tinebase_Record_Interface $_record
* @return void
*/
protected function _inspectBeforeCreate(Tinebase_Record_Interface $_record)
{
$this->_freedaysToCreate = new Tinebase_Record_RecordSet('HumanResources_Model_FreeDay');
if (is_array($_record->employee_id)) {
$_record->employee_id = $_record->employee_id['id'];
}
if ($_record->freedays && !empty($_record->freedays)) {
foreach ($_record->freedays as $fd) {
if (!$fd instanceof HumanResources_Model_FreeDay) {
$fd = new HumanResources_Model_FreeDay($fd);
}
$this->_freedaysToCreate->addRecord($fd);
}
// normalize first-, last date and days_count
$this->_freedaysToCreate->sort('date', 'ASC');
$_record->firstday_date = $this->_freedaysToCreate->getFirstRecord()->date;
$this->_freedaysToCreate->sort('date', 'DESC');
$_record->lastday_date = $this->_freedaysToCreate->getFirstRecord()->date;
$_record->days_count = $this->_freedaysToCreate->count();
} else {
$_record->firstday_date = NULL;
}
}
示例5: _sortFolders
/**
* sort folder record set
* - begin with INBOX + other standard/system folders, add other folders
*
* @param Tinebase_Record_RecordSet $_folders
* @param string $_parentFolder
* @return Tinebase_Record_RecordSet
*/
protected function _sortFolders(Tinebase_Record_RecordSet $_folders, $_parentFolder)
{
$sortedFolders = new Tinebase_Record_RecordSet('Felamimail_Model_Folder');
$_folders->sort('localname', 'ASC', 'natcasesort');
$_folders->addIndices(array('globalname'));
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Sorting subfolders of "' . $_parentFolder . '".');
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($_folders->globalname, TRUE));
}
foreach ($this->_systemFolders as $systemFolderName) {
$folders = $_folders->filter('globalname', '@^' . $systemFolderName . '$@i', TRUE);
//if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . $systemFolderName . ' => ' . print_r($folders->toArray(), TRUE));
if (count($folders) > 0) {
$sortedFolders->addRecord($folders->getFirstRecord());
}
}
foreach ($_folders as $folder) {
if (!in_array(strtolower($folder->globalname), $this->_systemFolders)) {
$sortedFolders->addRecord($folder);
}
}
//if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . print_r($sortedFolders->globalname, TRUE));
return $sortedFolders;
}
示例6: _sortContainerNodes
/**
* sort nodes (only checks if we are on the container level and sort by container_name then)
*
* @param Tinebase_Record_RecordSet $nodes
* @param Tinebase_Model_Tree_Node_Path $path
* @param Tinebase_Model_Pagination $pagination
*/
protected function _sortContainerNodes(Tinebase_Record_RecordSet $nodes, Tinebase_Model_Tree_Node_Path $path, Tinebase_Model_Pagination $pagination = NULL)
{
if ($path->container || $pagination !== NULL && $pagination->sort && $pagination->sort !== 'name') {
// no toplevel path or no sorting by name -> sorting should be already handled by search()
return;
}
$dir = $pagination !== NULL && $pagination->dir ? $pagination->dir : 'ASC';
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Sorting container nodes by name (path: ' . $path->flatpath . ') / dir: ' . $dir);
}
$nodes->sort('container_name', $dir);
}
示例7: _applyExdateDiffToRecordSet
/**
* apply exdate diff to a recordset of events
*
* @param Calendar_Model_Event $exdate
* @param Tinebase_Record_Diff $diff
* @param Tinebase_Record_RecordSet $events
*/
protected function _applyExdateDiffToRecordSet($exdate, $diff, $events)
{
// make sure baseEvent gets updated first to circumvent concurrency conflicts
$events->sort('recurdid', 'ASC');
foreach ($events as $event) {
if ($event->getId() === $exdate->getId()) {
// skip the exdate
continue;
}
$this->_applyDiff($event, $diff, $exdate, FALSE);
$this->update($event);
}
}
示例8: setContracts
public function setContracts(Tinebase_Record_RecordSet $contracts)
{
$this->_contracts = $contracts;
$this->_contracts->sort('number');
}
開發者ID:ingoratsdorf,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:5,代碼來源:DeleteUsedBillingAddress.php