本文整理汇总了PHP中Criteria::addAnd方法的典型用法代码示例。如果您正苦于以下问题:PHP Criteria::addAnd方法的具体用法?PHP Criteria::addAnd怎么用?PHP Criteria::addAnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Criteria
的用法示例。
在下文中一共展示了Criteria::addAnd方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createAdvancedSearchCriteria
protected function createAdvancedSearchCriteria($arr)
{
$c = new Criteria();
if (strlen($arr['jobStatus'])) {
$c->add(JobPeer::STATUS_ID, $arr["jobStatus"]);
}
if (!is_null($arr["dueDateStart"])) {
$c->add(JobPeer::DUE_DATE, $arr["dueDateStart"], Criteria::GREATER_EQUAL);
}
if (!is_null($arr["dueDateEnd"])) {
$c->addAnd(JobPeer::DUE_DATE, $arr["dueDateEnd"], Criteria::LESS_EQUAL);
}
if (!is_null($arr["shootDateStart"])) {
$c->add(JobPeer::DATE, $arr["shootDateStart"], Criteria::GREATER_EQUAL);
}
if (!is_null($arr["shootDateEnd"])) {
$c->addAnd(JobPeer::DATE, $arr["shootDateEnd"], Criteria::LESS_EQUAL);
}
if (strlen($arr["clientId"])) {
$jobIds = JobClientPeer::getJobsByClientId($arr["clientId"]);
$c->add(JobPeer::ID, $jobIds, Criteria::IN);
}
if (strlen($arr["photographerId"])) {
$jobIds = JobPhotographerPeer::getJobsByPhotographerId($arr["photographerId"]);
$c->addAnd(JobPeer::ID, $jobIds, Criteria::IN);
}
if ($arr["sortDirection"] == 1) {
$c->addDescendingOrderByColumn($arr["sortOn"]);
} else {
$c->addAscendingOrderByColumn($arr["sortOn"]);
}
return $c;
}
示例2: myBatchPartnerUsage
public function myBatchPartnerUsage($partnerId = null)
{
self::initDb();
$partners_exists = true;
$start_pos = 0;
$bulk_size = 500;
while ($partners_exists) {
$c = new Criteria();
if (!is_null($partnerId)) {
$c->addAnd(PartnerPeer::ID, $partnerId);
}
$c->addAnd(PartnerPeer::PARTNER_PACKAGE, 1);
// get only free partners
$c->addAnd(PartnerPeer::MONITOR_USAGE, 1);
$c->addAnd(PartnerPeer::STATUS, Partner::PARTNER_STATUS_DELETED, CRITERIA::NOT_EQUAL);
$c->setOffset($start_pos);
$c->setLimit($bulk_size);
$partners = PartnerPeer::doSelect($c);
if (!$partners) {
KalturaLog::debug("No more partners. offset: {$start_pos} , limit: {$bulk_size} .");
$partners_exists = false;
} else {
KalturaLog::debug("Looping " . ($start_pos + $bulk_size - 1) . " partners, offset: {$start_pos} .");
foreach ($partners as $partner) {
myPartnerUtils::doPartnerUsage($partner, true);
}
}
unset($partners);
PartnerPeer::clearInstancePool();
$start_pos += $bulk_size;
}
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:32,代码来源:myBatchPartnerUsage.class.php
示例3: addAction
/**
* Add new Syndication Feed
*
* @action add
* @param KalturaBaseSyndicationFeed $syndicationFeed
* @return KalturaBaseSyndicationFeed
*/
public function addAction(KalturaBaseSyndicationFeed $syndicationFeed)
{
$syndicationFeed->validatePlaylistId();
if ($syndicationFeed instanceof KalturaGenericXsltSyndicationFeed) {
$syndicationFeed->validateXslt();
$syndicationFeedDB = new genericSyndicationFeed();
$syndicationFeedDB->setVersion(1);
} else {
$syndicationFeedDB = new syndicationFeed();
}
$syndicationFeed->partnerId = $this->getPartnerId();
$syndicationFeed->status = KalturaSyndicationFeedStatus::ACTIVE;
$syndicationFeed->toObject($syndicationFeedDB);
$syndicationFeedDB->save();
if ($syndicationFeed->addToDefaultConversionProfile) {
$partner = PartnerPeer::retrieveByPK($this->getPartnerId());
$c = new Criteria();
$c->addAnd(flavorParamsConversionProfilePeer::CONVERSION_PROFILE_ID, $partner->getDefaultConversionProfileId());
$c->addAnd(flavorParamsConversionProfilePeer::FLAVOR_PARAMS_ID, $syndicationFeed->flavorParamId);
$is_exist = flavorParamsConversionProfilePeer::doCount($c);
if (!$is_exist || $is_exist === 0) {
$fpc = new flavorParamsConversionProfile();
$fpc->setConversionProfileId($partner->getDefaultConversionProfileId());
$fpc->setFlavorParamsId($syndicationFeed->flavorParamId);
$fpc->save();
}
}
if ($syndicationFeed instanceof KalturaGenericXsltSyndicationFeed) {
$key = $syndicationFeedDB->getSyncKey(genericSyndicationFeed::FILE_SYNC_SYNDICATION_FEED_XSLT);
kFileSyncUtils::file_put_contents($key, $syndicationFeed->xslt);
}
$syndicationFeed->fromObject($syndicationFeedDB);
return $syndicationFeed;
}
示例4: getSuitableProfile
/**
* Will return the first virus scan profile of the entry's partner, that defines an entry filter suitable for the given entry.
* @param int $entryId
* @return VirusScanProfile the suitable profile object, or null if none found
*/
public static function getSuitableProfile($entryId)
{
$entry = entryPeer::retrieveByPK($entryId);
if (!$entry) {
KalturaLog::err('Cannot find entry with id [' . $entryId . ']');
return null;
}
if ($entry->getSource() == entry::ENTRY_MEDIA_SOURCE_WEBCAM) {
return null;
}
$cProfile = new Criteria();
$cProfile->addAnd(VirusScanProfilePeer::PARTNER_ID, $entry->getPartnerId());
$cProfile->addAnd(VirusScanProfilePeer::STATUS, VirusScanProfileStatus::ENABLED, Criteria::EQUAL);
$profiles = VirusScanProfilePeer::doSelect($cProfile);
if (!$profiles) {
KalturaLog::debug('No virus scan profiles found for partner [' . $entry->getPartnerId() . ']');
return null;
}
foreach ($profiles as $profile) {
$virusEntryFilter = $profile->getEntryFilterObject();
if ($virusEntryFilter->matches($entry)) {
KalturaLog::debug('Returning profile with id [' . $profile->getId() . ']');
return $profile;
}
}
return null;
}
示例5: retrieveByProviderAndPartnerID
public static function retrieveByProviderAndPartnerID($provider, $partnerId)
{
$c = new Criteria();
$c->addAnd(DrmProfilePeer::PROVIDER, $provider, Criteria::EQUAL);
$c->addAnd(DrmProfilePeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
return DrmProfilePeer::doSelectOne($c);
}
示例6: myBatchPartnerUsage
public function myBatchPartnerUsage()
{
self::initDb();
$partners_exists = true;
$start_pos = 0;
$bulk_size = 500;
while ($partners_exists) {
$c = new Criteria();
// get only free partners
$c->addAnd(PartnerPeer::PARTNER_PACKAGE, 1);
$c->addAnd(PartnerPeer::MONITOR_USAGE, 1);
$c->setOffset($start_pos);
$c->setLimit($bulk_size);
$partners = PartnerPeer::doSelect($c);
if (!$partners) {
TRACE("No more partners. offset: {$start_pos} , limit: {$bulk_size} .");
$partners_exists = false;
} else {
TRACE("Looping " . ($start_pos + $bulk_size - 1) . " partners, offset: {$start_pos} .");
foreach ($partners as $partner) {
myPartnerUtils::doPartnerUsage($partner, true);
}
}
unset($partners);
$start_pos += $bulk_size;
}
}
示例7: execute
public function execute()
{
die;
$this->forceSystemAuthentication();
$order = $this->getRequestParameter('sort', 'id');
$page = $this->getRequestParameter('page', 1);
$referer = $this->getRequestParameter('referer', "");
$c = new Criteria();
if ($referer) {
$c->add(WidgetLogPeer::REFERER, "%{$referer}%", Criteria::LIKE);
}
$c->addAnd(WidgetLogPeer::REFERER, "%diff=%", Criteria::NOT_LIKE);
$c->addAnd(WidgetLogPeer::REFERER, "%kaltura:%", Criteria::NOT_LIKE);
$partner_id = $this->getRequestParameter('partner_id', -1);
if ($partner_id >= 0) {
$c->add(WidgetLogPeer::PARTNER_ID, $partner_id);
//fixme: replace with myPartnerUtils::applyPartnerFilters( $partner_id );
}
$this->partner_id = $partner_id;
$pager = WidgetLogPeer::getWidgetOrderedPager($order, 100, $page, $c);
$widget_log_list = $pager->getResults();
// following variables will be used by the view
$this->firstTime = $this->getRequestParameter('first', 1) == 1;
$this->order = $order;
$this->page = $page;
$this->lastPage = $pager->getLastPage();
$this->numResults = $pager->getNbResults();
$this->widget_log_list = $widget_log_list;
$this->referer = $referer;
// allow the action buttons to show only for entires the user on their own pages
$this->allowactions = true;
}
示例8: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$limit = $this->getP("page_size", 20);
$limit = min($limit, 100);
$page = $this->getP("page", 1);
$offset = ($page - 1) * $limit;
$c = new Criteria();
$c->addAnd(BatchJobPeer::PARTNER_ID, $partner_id);
$c->addAnd(BatchJobPeer::JOB_TYPE, BatchJobType::BULKUPLOAD);
$c->addDescendingOrderByColumn(BatchJobPeer::ID);
$count = BatchJobPeer::doCount($c);
$c->setLimit($limit);
$c->setOffset($offset);
$jobs = BatchJobPeer::doSelect($c);
$obj = array();
foreach ($jobs as $job) {
$jobData = $job->getData();
if (!$jobData instanceof kBulkUploadJobData) {
continue;
}
$bulkResults = BulkUploadResultPeer::retrieveWithEntryByBulkUploadId($job->getId());
$obj[] = array("uploadedBy" => $jobData->getUploadedBy(), "uploadedOn" => $job->getCreatedAt(null), "numOfEntries" => count($bulkResults), "status" => $job->getStatus(), "error" => $job->getStatus() == BatchJob::BATCHJOB_STATUS_FAILED ? $job->getMessage() : '', "logFileUrl" => requestUtils::getCdnHost() . "/index.php/extwidget/bulkuploadfile/id/{$job->getId()}/pid/{$job->getPartnerId()}/type/log", "csvFileUrl" => requestUtils::getCdnHost() . "/index.php/extwidget/bulkuploadfile/id/{$job->getId()}/pid/{$job->getPartnerId()}/type/csv");
}
$this->addMsg("count", $count);
$this->addMsg("page_size", $limit);
$this->addMsg("page", $page);
$this->addMsg("bulk_uploads", $obj);
}
示例9: getByKuserAndUserRoleIds
/**
* Get objects by kuser and user role IDs
* @param int $kuserId
* @param int $userRoleId
* @return array Array of selected KuserToUserRole Objects
*/
public static function getByKuserAndUserRoleIds($kuserId, $userRoleId)
{
$c = new Criteria();
$c->addAnd(self::KUSER_ID, $kuserId, Criteria::EQUAL);
$c->addAnd(self::USER_ROLE_ID, $userRoleId, Criteria::EQUAL);
return self::doSelect($c);
}
示例10: objectAdded
/**
* @param BaseObject $object
* @return bool true if should continue to the next consumer
*/
public function objectAdded(BaseObject $object)
{
if (!$object instanceof FileSync || $object->getStatus() != FileSync::FILE_SYNC_STATUS_PENDING || $object->getFileType() != FileSync::FILE_SYNC_FILE_TYPE_FILE || $object->getDc() == kDataCenterMgr::getCurrentDcId()) {
return true;
}
$c = new Criteria();
$c->addAnd(FileSyncPeer::OBJECT_ID, $object->getObjectId());
$c->addAnd(FileSyncPeer::VERSION, $object->getVersion());
$c->addAnd(FileSyncPeer::OBJECT_TYPE, $object->getObjectType());
$c->addAnd(FileSyncPeer::OBJECT_SUB_TYPE, $object->getObjectSubType());
$c->addAnd(FileSyncPeer::ORIGINAL, '1');
$original_filesync = FileSyncPeer::doSelectOne($c);
if (!$original_filesync) {
KalturaLog::err('Original filesync not found for object_id[' . $object->getObjectId() . '] version[' . $object->getVersion() . '] type[' . $object->getObjectType() . '] subtype[' . $object->getObjectSubType() . ']');
return true;
}
$sourceFileUrl = $original_filesync->getExternalUrl();
if (!$sourceFileUrl) {
KalturaLog::err('External URL not found for filesync id [' . $object->getId() . ']');
return true;
}
$job = kMultiCentersManager::addFileSyncImportJob($this->getEntryId($object), $object->getPartnerId(), $object->getId(), $sourceFileUrl);
$job->setDc($object->getDc());
$job->save();
return true;
}
示例11: doSelectOutOfPeriod
public static function doSelectOutOfPeriod($activeOnly = true, $time = null)
{
if (is_null($time)) {
$time = time();
}
$now_hour = date('H:i:s', $time);
$c = new Criteria();
$critA = $c->getNewCriterion(self::START, self::START . ' < ' . self::STOP, Criteria::CUSTOM);
$critB = $c->getNewCriterion(self::START, self::START . ' > ' . self::STOP, Criteria::CUSTOM);
$critStartA = $c->getNewCriterion(self::START, $now_hour, Criteria::GREATER_EQUAL);
$critStopA = $c->getNewCriterion(self::STOP, $now_hour, Criteria::LESS_THAN);
$critStartB = $c->getNewCriterion(self::START, $now_hour, Criteria::GREATER_EQUAL);
$critStopB = $c->getNewCriterion(self::STOP, $now_hour, Criteria::LESS_THAN);
$critStopA->addOr($critStartA);
$critStopB->addAnd($critStartB);
$critA->addAnd($critStopA);
$critB->addAnd($critStopB);
$critA->addOr($critB);
if ($activeOnly) {
$c->addAnd(self::STATUS, true, Criteria::EQUAL);
}
$c->addAnd($critA);
$c->addAnd(self::START, self::START . ' <> ' . self::STOP, Criteria::CUSTOM);
return self::doSelect($c);
}
示例12: retrieveByDropFolderIdAndStatus
public static function retrieveByDropFolderIdAndStatus($dropFolderId, $status)
{
$c = new Criteria();
$c->addAnd(DropFolderFilePeer::DROP_FOLDER_ID, $dropFolderId, Criteria::EQUAL);
$c->addAnd(DropFolderFilePeer::STATUS, $status, Criteria::EQUAL);
$dropFolderFiles = DropFolderFilePeer::doSelect($c);
return $dropFolderFiles;
}
示例13: retrieveByEntryIdPartnerIdAndStatuses
public static function retrieveByEntryIdPartnerIdAndStatuses($entryId, $partnerId, $statuses)
{
$c = new Criteria();
$c->addAnd(DropFolderFilePeer::ENTRY_ID, $entryId, Criteria::EQUAL);
$c->addAnd(DropFolderFilePeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
$c->addAnd(DropFolderFilePeer::STATUS, $statuses, Criteria::IN);
$dropFolderFiles = DropFolderFilePeer::doSelect($c);
return $dropFolderFiles;
}
示例14: execute
public function execute()
{
$jobId = $this->getRequestParameter("id");
$partnerId = $this->getRequestParameter("pid");
$type = $this->getRequestParameter("type");
$c = new Criteria();
$c->addAnd(BatchJobPeer::ID, $jobId);
$c->addAnd(BatchJobPeer::PARTNER_ID, $partnerId);
$c->addAnd(BatchJobPeer::JOB_TYPE, BatchJobType::BULKUPLOAD);
$batchJob = BatchJobPeer::doSelectOne($c);
if (!$batchJob) {
die("File not found");
}
header("Content-Type: text/plain; charset=UTF-8");
if ($type == "log") {
$bulkUploadResults = BulkUploadResultPeer::retrieveByBulkUploadId($jobId);
if (!count($bulkUploadResults)) {
$syncKey = $batchJob->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_BULKUPLOADLOG);
if (kFileSyncUtils::file_exists($syncKey, true)) {
$content = kFileSyncUtils::file_get_contents($syncKey, true);
echo $content;
die;
}
die("Log file is not ready");
}
$STDOUT = fopen('php://output', 'w');
$data = $batchJob->getData();
foreach ($bulkUploadResults as $bulkUploadResult) {
$values = array($bulkUploadResult->getTitle(), $bulkUploadResult->getDescription(), $bulkUploadResult->getTags(), $bulkUploadResult->getUrl(), $bulkUploadResult->getContentType());
if ($data instanceof kBulkUploadJobData && $data->getCsvVersion() > kBulkUploadJobData::BULK_UPLOAD_CSV_VERSION_V1) {
$values[] = $bulkUploadResult->getConversionProfileId();
$values[] = $bulkUploadResult->getAccessControlProfileId();
$values[] = $bulkUploadResult->getCategory();
$values[] = $bulkUploadResult->getScheduleStartDate('Y-m-d\\TH:i:s');
$values[] = $bulkUploadResult->getScheduleEndDate('Y-m-d\\TH:i:s');
$values[] = $bulkUploadResult->getThumbnailUrl();
$values[] = $bulkUploadResult->getPartnerData();
}
$values[] = $bulkUploadResult->getEntryId();
$values[] = $bulkUploadResult->getEntryStatus();
$values[] = $bulkUploadResult->getErrorDescription();
fputcsv($STDOUT, $values);
}
fclose($STDOUT);
} else {
$syncKey = $batchJob->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_BULKUPLOADCSV);
if (kFileSyncUtils::file_exists($syncKey, true)) {
$content = kFileSyncUtils::file_get_contents($syncKey, true);
echo $content;
die;
} else {
die("File not found");
}
}
die;
// no template needed
}
示例15: retrieveByPartnerIdAndSystemName
public static function retrieveByPartnerIdAndSystemName($partnerId, $systemName, $type)
{
$c = new Criteria();
$c->addAnd(conversionProfile2Peer::PARTNER_ID, $partnerId);
$c->addAnd(conversionProfile2Peer::SYSTEM_NAME, $systemName);
$c->addAnd(conversionProfile2Peer::STATUS, ConversionProfileStatus::ENABLED);
$c->addAnd(conversionProfile2Peer::TYPE, $type);
return conversionProfile2Peer::doSelectOne($c);
}