本文整理汇总了PHP中QueryObject::addOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryObject::addOrder方法的具体用法?PHP QueryObject::addOrder怎么用?PHP QueryObject::addOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryObject
的用法示例。
在下文中一共展示了QueryObject::addOrder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addQuestion
/**
* @param ISurveyQuestionTemplate $question
* @return $this
*/
public function addQuestion(ISurveyQuestionTemplate $question)
{
$query = new QueryObject();
$query->addOrder(QueryOrder::asc('Order'));
return AssociationFactory::getInstance()->getOne2ManyAssociation($this, 'Questions', $query)->add($question);
return $this;
}
示例2: exportCCLACompanies
public function exportCCLACompanies()
{
//clean output buffer
ob_end_clean();
// file name for download
$filename = "companies_ccla" . date('Ymd') . ".xls";
header("Content-Disposition: attachment; filename=\"{$filename}\"");
header("Content-Type: application/vnd.ms-excel");
$query = new QueryObject();
$query->addOrder(QueryOrder::asc('Name'));
list($list, $size) = $this->company_repository->getAll($query, 0, 1000);
$data = array();
foreach ($list as $company) {
$row = array();
$row['CompanyName'] = $company->Name;
$row['CCLADate'] = $company->isICLASigned() ? $company->CCLADate : 'N/A';
$row['CCLASigned'] = $company->isICLASigned() ? 'True' : 'False';
array_push($data, $row);
}
$flag = false;
foreach ($data as $row) {
if (!$flag) {
// display field/column names as first row
echo implode("\t", array_keys($row)) . "\n";
$flag = true;
}
array_walk($row, array($this, 'cleanData'));
echo implode("\t", array_values($row)) . "\n";
}
}
示例3: getLatestNElections
/**
* @param int $n
* @return IElection[]
*/
public function getLatestNElections($n)
{
$query = new QueryObject(new Election());
$query->addOrder(QueryOrder::desc('ElectionsOpen'));
list($list, $count) = $this->getAll($query, 0, $n);
return $list;
}
示例4: getNextAvailableByType
/**
* @param string $promo_code_type
* @param int $batch_size
* @return ISpeakerSummitRegistrationPromoCode
*/
public function getNextAvailableByType($promo_code_type, $batch_size = 10)
{
switch ($promo_code_type) {
case ISpeakerSummitRegistrationPromoCode::TypeAccepted:
if (count($this->promo_code_speaker_session_pool) === 0) {
$query = new QueryObject(new SpeakerSummitRegistrationPromoCode());
$query->addAndCondition(QueryCriteria::equal('Type', $promo_code_type));
$query->addAndCondition(QueryCriteria::equal('OwnerID', 0));
$query->addAndCondition(QueryCriteria::equal('SpeakerID', 0));
$query->addAndCondition(QueryCriteria::equal('SummitID', Summit::get_active()->ID));
$query->addOrder(QueryOrder::asc('ID'));
list($this->promo_code_speaker_session_pool, $count) = $this->getAll($query, 0, $batch_size);
}
return array_shift($this->promo_code_speaker_session_pool);
break;
case ISpeakerSummitRegistrationPromoCode::TypeAlternate:
if (count($this->promo_code_alternate_speaker_session_pool) === 0) {
$query = new QueryObject(new SpeakerSummitRegistrationPromoCode());
$query->addAndCondition(QueryCriteria::equal('Type', $promo_code_type));
$query->addAndCondition(QueryCriteria::equal('OwnerID', 0));
$query->addAndCondition(QueryCriteria::equal('SpeakerID', 0));
$query->addAndCondition(QueryCriteria::equal('SummitID', Summit::get_active()->ID));
$query->addOrder(QueryOrder::asc('ID'));
list($this->promo_code_alternate_speaker_session_pool, $count) = $this->getAll($query, 0, $batch_size);
}
return array_shift($this->promo_code_alternate_speaker_session_pool);
break;
}
return null;
}
开发者ID:Thingee,项目名称:openstack-org,代码行数:35,代码来源:SapphireSpeakerSummitRegistrationPromoCodeRepository.php
示例5: getUnprocessed
/**
* @param int $offset
* @param int $count
* @return array
*/
public function getUnprocessed($offset, $count)
{
$query = new QueryObject(new EventbriteEvent());
$query->addAndCondition(QueryCriteria::equal('Processed', 0));
$query->addOrder(QueryOrder::asc('ID'));
return $this->getAll($query, $offset, $count);
}
示例6: makeDigest
/**
* @param int $batch_size
* @param string $email_alert_to
* @param string $details_url
*/
public function makeDigest($batch_size = 15, $email_alert_to, $details_url)
{
$email_repository = $this->email_repository;
$repository = $this->repository;
$factory = $this->factory;
$this->tx_manager->transaction(function () use($batch_size, $email_alert_to, $details_url, $repository, $email_repository, $factory) {
$last_email = $email_repository->getLastOne();
$query = new QueryObject();
$query->addAndCondition(QueryCriteria::equal('isPosted', 0));
$query->addAndCondition(QueryCriteria::equal('isRejected', 0));
if ($last_email) {
$query->addAndCondition(QueryCriteria::greater('ID', $last_email->getLastEventRegistrationRequest()->getIdentifier()));
}
$query->addOrder(QueryOrder::asc('PostDate'));
list($list, $size) = $repository->getAll($query, 0, $batch_size);
if ($list && count($list) > 0) {
$last_one = end($list);
reset($list);
$email = EmailFactory::getInstance()->buildEmail(EVENT_REGISTRATION_REQUEST_EMAIL_FROM, $email_alert_to, "New Event Registration Requests");
$email->setTemplate('EventAlertEmail');
$email->populateTemplate(array('RegistrationRequests' => new ArrayList($list), 'Details' => $details_url));
$email->send();
$email_repository->add($factory->buildEventAlertEmail($last_one));
}
});
}
示例7: getAllApproved
/**
* @param int $offset
* @param int $limit
* @return array
*/
public function getAllApproved($offset = 0, $limit = 100)
{
$query = new QueryObject(new MarketPlaceReview());
$query->addAndCondition(QueryCriteria::equal('Approved', 1));
$query->addOrder(QueryOrder::desc('Created'));
return $this->getAll($query, $offset, $limit);
}
示例8: getSteps
/**
* @return ISurveyStep[]
*/
public function getSteps()
{
$query = new QueryObject(new SurveyStep());
$query->addAlias(QueryAlias::create('Template'));
$query->addOrder(QueryOrder::asc('Template.Order'));
return new ArrayList(AssociationFactory::getInstance()->getOne2ManyAssociation($this, 'Steps', $query)->toArray());
}
示例9: DateSortedJobs
public function DateSortedJobs()
{
$query = new QueryObject(new JobPage());
$request = Controller::curr()->getRequest();
if ($request->requestVar('foundation')) {
$query->addAndCondition(QueryCriteria::equal('FoundationJob', 1));
}
$now = new DateTime();
$query->addAndCondition(QueryCriteria::equal('Active', 1));
$post_date = $now->sub(new DateInterval('P6M'));
$query->addAndCondition(QueryCriteria::greaterOrEqual('JobPostedDate', $post_date->format('Y-m-d')));
$query->addAndCondition(QueryCriteria::greaterOrEqual('ExpirationDate', $now->format('Y-m-d')));
$query->addOrder(QueryOrder::desc('JobPostedDate'));
$query->addOrder(QueryOrder::desc('ID'));
list($jobs, $size) = $this->repository->getAll($query, 0, 1000);
return new ArrayList($jobs);
}
示例10: getDateSortedJobs
public function getDateSortedJobs($foundation = 0)
{
$query = new QueryObject(new Job());
if ($foundation) {
$query->addAndCondition(QueryCriteria::equal('IsFoundationJob', 1));
}
$now = new DateTime();
$six_months_ago = new DateTime();
$query->addAndCondition(QueryCriteria::equal('IsActive', 1));
$post_date = $six_months_ago->sub(new DateInterval('P6M'));
$query->addAndCondition(QueryCriteria::greaterOrEqual('PostedDate', $post_date->format('Y-m-d H:i:s')));
$query->addAndCondition(QueryCriteria::greaterOrEqual('ExpirationDate', $now->format('Y-m-d H:i:s')));
$query->addOrder(QueryOrder::desc('PostedDate'));
$query->addOrder(QueryOrder::desc('ID'));
list($jobs, $size) = $this->getAll($query, 0, PHP_INT_MAX);
return new ArrayList($jobs);
}
示例11: getAllPosted
/**
* @param int $offset
* @param int $limit
* @return array
*/
public function getAllPosted($offset = 0, $limit = 10)
{
$query = new QueryObject();
$query->addAndCondition(QueryCriteria::equal('Active', 1));
$query->addAndCondition(QueryCriteria::greater('ExpirationDate', date('Y-m-d')));
$query->addOrder(QueryOrder::desc('JobPostedDate'));
return $this->getAll($query, $offset, $limit);
}
示例12: getLastIdInserted
public function getLastIdInserted($summit_id)
{
$query = new QueryObject(new SummitType());
$query->addAndCondition(QueryCriteria::equal('SummitID', $summit_id));
$query->addOrder(QueryOrder::desc('ID'));
list($list, $count) = $this->getAll($query, 0, 1);
return array_pop($list)->ID;
}
示例13: getPackagesPurchaseOrder
public function getPackagesPurchaseOrder()
{
$query = new QueryObject(new SummitPackagePurchaseOrder());
$status = $this->getFilterParamStatus();
switch ($status) {
case 'pending':
$query->addAndCondition(QueryCriteria::equal('Approved', 0));
$query->addAndCondition(QueryCriteria::equal('Rejected', 0));
break;
case 'approved':
$query->addAndCondition(QueryCriteria::equal('Approved', 1));
$query->addAndCondition(QueryCriteria::equal('Rejected', 0));
break;
case 'rejected':
$query->addAndCondition(QueryCriteria::equal('Approved', 0));
$query->addAndCondition(QueryCriteria::equal('Rejected', 1));
break;
}
$query->addOrder(QueryOrder::asc('Created'));
list($list, $count) = $this->packages_repository->getAll($query, 0, 999999);
return new ArrayList($list);
}
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:22,代码来源:SangriaPageSummitSponsorshipPurchaseOrderExtension.php
示例14: getServicesOffered
public function getServicesOffered()
{
$query = new QueryObject(new ConsultantServiceOfferedType());
$query->addOrder(QueryOrder::asc('Type'));
list($list, $size) = $this->consultant_service_offered_type_repository->getAll($query, 0, 1000);
return new ArrayList($list);
}
示例15: getRegionalSupports
/**
* @param bool $only_new_ones
* @return IRegionalSupport[]
*/
public function getRegionalSupports($only_new_ones = false)
{
$query = new QueryObject($this);
$query->addOrder(QueryOrder::asc('Order'));
return AssociationFactory::getInstance()->getOne2ManyAssociation($this, 'RegionalSupports', $query)->toArray();
}