本文整理汇总了PHP中Criteria::setOffset方法的典型用法代码示例。如果您正苦于以下问题:PHP Criteria::setOffset方法的具体用法?PHP Criteria::setOffset怎么用?PHP Criteria::setOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Criteria
的用法示例。
在下文中一共展示了Criteria::setOffset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: 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;
}
}
示例3: execute
public function execute()
{
$this->forceSystemAuthentication();
$hint = $this->getP("hint");
$search_partnerName = $this->getP("p_partnerName", true);
$search_description = $this->getP("p_description", true);
$search_url1 = $this->getP("p_url1", true);
$search_adminName = $this->getP("p_adminName", true);
$search_adminEmail = $this->getP("p_adminEmail", true);
$limit = $this->getP("limit", 300);
$offset = $this->getP("offset", 0);
$text_to_search = "%{$hint}%";
$c = new Criteria();
$crit = $c->getNewCriterion(PartnerPeer::PARTNER_NAME, $text_to_search, Criteria::LIKE);
if ($search_description) {
$crit->addOr($c->getNewCriterion(PartnerPeer::DESCRIPTION, $text_to_search, Criteria::LIKE));
}
if ($search_url1) {
$crit->addOr($c->getNewCriterion(PartnerPeer::URL1, $text_to_search, Criteria::LIKE));
}
if ($search_adminName) {
$crit->addOr($c->getNewCriterion(PartnerPeer::ADMIN_NAME, $text_to_search, Criteria::LIKE));
}
if ($search_adminEmail) {
$crit->addOr($c->getNewCriterion(PartnerPeer::ADMIN_EMAIL, $text_to_search, Criteria::LIKE));
}
$c->addAnd($crit);
// $this->count = PartnerPeer::doCount( $c );
$c->setLimit($limit);
if ($offset > 0) {
$c->setOffset($offset);
}
if ($hint) {
$this->partner_list = PartnerPeer::doSelect($c);
} else {
$this->partner_list = array();
}
/*
$arr = array();
foreach ( $this->partner_list as $partner )
{
$p = array (
"id" => $partner->getId() ,
"partnerName" => $partner->getPartnerName() ,
"description" => $partner->getDescription() ,
"url1" => $partner->getUrl1() ,
"adminName" => $partner->getAdminName() ,
"adminEmail" => $partner->getAdminEmail() ,
);
$arr[] = $p;
}
*/
$this->hint = $hint;
// return $this->renderText(json_encode ( $arr ) );
}
示例4: getAll
public static function getAll($offset = 0)
{
$c = new Criteria();
$c->addAscendingOrderByColumn(self::CREATED_AT);
$c->setOffset($offset);
$objs = self::doSelect($c);
if (count($objs) > 0) {
return $objs;
} else {
return false;
}
}
示例5: attachToCriteria
public function attachToCriteria(Criteria $c)
{
$limit = $this->pageSize;
if ($limit > baseObjectFilter::getMaxInValues()) {
$limit = baseObjectFilter::getMaxInValues();
}
$page = max($this->minPageIndex, $this->pageIndex);
$offset = ($page - 1) * $limit;
$c->setLimit($limit);
if ($offset > 0) {
$c->setOffset($offset);
}
}
示例6: getResults
/**
* Gets the paged results
* @param Object $obj
* @return ArrayObject $return
*/
public function getResults($obj)
{
if (!is_object($obj)) {
return false;
}
$criteria = new Criteria();
$criteria->addNotWhere();
$criteria->setLimit($this->limit);
$criteria->setOffset($this->offset);
$return = $obj->doSelect($criteria);
$this->totalRecords = count($return);
return $return;
}
示例7: attachToCriteria
public function attachToCriteria(Criteria $c)
{
$limit = $this->pageSize;
if ($limit > $this->maxPageSize) {
$limit = $this->maxPageSize;
}
$page = max($this->minPageIndex, $this->pageIndex);
$offset = ($page - 1) * $limit;
$c->setLimit($limit);
if ($offset > 0) {
$c->setOffset($offset);
}
}
示例8: getSubscriberGroupMemberships
public function getSubscriberGroupMemberships($oCriteria = null, PropelPDO $oCon = null, $iLimit = null, $iOffset = null)
{
if ($oCriteria === null) {
$oCriteria = new Criteria();
}
$oCriteria->addJoin(SubscriberGroupMembershipPeer::SUBSCRIBER_ID, SubscriberPeer::ID, Criteria::INNER_JOIN);
$oCriteria->addAscendingOrderByColumn(SubscriberPeer::EMAIL);
if ($iLimit !== null) {
$oCriteria->setLimit($iLimit);
if ($iOffset) {
$oCriteria->setOffset($iOffset);
}
}
return parent::getSubscriberGroupMemberships($oCriteria, $oCon);
}
示例9: testMergeWithOffset
public function testMergeWithOffset()
{
$c1 = new Criteria();
$c1->setOffset(123);
$c2 = new Criteria();
$c1->mergeWith($c2);
$this->assertEquals(123, $c1->getOffset(), 'mergeWith() does not remove an existing offset');
$c1 = new Criteria();
$c2 = new Criteria();
$c2->setOffset(123);
$c1->mergeWith($c2);
$this->assertEquals(123, $c1->getOffset(), 'mergeWith() merges the offset');
$c1 = new Criteria();
$c1->setOffset(456);
$c2 = new Criteria();
$c2->setOffset(123);
$c1->mergeWith($c2);
$this->assertEquals(456, $c1->getOffset(), 'mergeWith() does not merge the offset in case of conflict');
}
示例10: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
// the relevant puser_kuser is the one from the user_id NOT the uid (which is the logged in user investigationg
//$target_puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid($partner_id , null , $user_id , true );
$page = $this->getP("page");
$page_size = $this->getP("page_size");
$detailed = $this->getP("detailed", false);
$c = new Criteria();
$c->addAnd(kuserPeer::PARTNER_ID, $partner_id, Criteria::EQUAL);
$c->setLimit($page_size);
$c->setOffset(($page - 1) * $page_size);
$users = kuserPeer::doSelect($c);
$extra_fields = array();
if ($detailed) {
$extra_fields = array("country", "state", "city", "zip", "urlList", "networkHighschool", "networkCollege", "views", "fans", "entries", "producedKshows");
}
$level = objectWrapperBase::DETAIL_LEVEL_REGULAR;
$this->addMsg("count", count($users));
$this->addMsg("page", $page);
$this->addMsg("pageSize", $page_size);
$this->addMsg("users", objectWrapperBase::getWrapperClass($users, $level, objectWrapperBase::DETAIL_VELOCITY_DEFAULT, 0, $extra_fields));
}
示例11: rebuildModel
public function rebuildModel($name)
{
$options = $this->getSearch()->getParameter('models')->get($name);
$per = $options->get('rebuild_limit');
$peer = $options->get('peer');
// calculate total number of pages
$count = call_user_func(array($peer, 'doCount'), new Criteria());
$this->getSearch()->getEventDispatcher()->notify(new sfEvent($this, 'indexer.log', array('Discovered %d instances of model "%s"', $count, $name)));
$totalPages = ceil($count / $per);
$propel13 = class_exists('PropelPDO', true) ? true : false;
for ($page = 0; $page < $totalPages; $page++) {
$c = new Criteria();
$c->setOffset($page * $per);
$c->setLimit($per);
if ($propel13) {
$rs = call_user_func(array($peer, 'doSelectStmt'), $c);
while ($row = $rs->fetch(PDO::FETCH_NUM)) {
$instance = new $name();
$instance->hydrate($row);
$this->getFactory()->getModel($instance)->save();
unset($instance);
// free memory
}
} else {
$rs = call_user_func(array($peer, 'doSelectRS'), $c);
while ($rs->next()) {
$instance = new $name();
$instance->hydrate($rs);
$this->getFactory()->getModel($instance)->save();
unset($instance);
// free memory
}
}
unset($rs);
// free memory
}
}
示例12: getPagedApplicationUids
/**
* Get a paginated list of application uids from database.
*
* @param integer $skip
* the offset from where to return the application records
* @param integer $pagesize
* the size of the page
* @return array of application id's in the specified page.
*/
public function getPagedApplicationUids($skip, $pagesize)
{
$c = new Criteria();
$c->addSelectColumn(ApplicationPeer::APP_UID);
$c->setOffset($skip);
$c->setLimit($pagesize);
$rs = ApplicationPeer::doSelectRS($c);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs->next();
$row = $rs->getRow();
$appUIds = array();
while (is_array($row)) {
$appUIds[] = $row;
$rs->next();
$row = $rs->getRow();
}
return $appUIds;
}
示例13: getAll
public function getAll($start = 0, $limit = 20, $filter = '', $process = null)
{
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID);
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION);
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TYPE);
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TAG);
$oCriteria->addSelectColumn(AdditionalTablesPeer::PRO_UID);
$oCriteria->addSelectColumn(AdditionalTablesPeer::DBS_UID);
if (isset($process)) {
foreach ($process as $key => $pro_uid) {
if ($key == 'equal') {
$oCriteria->add(AdditionalTablesPeer::PRO_UID, $pro_uid, Criteria::EQUAL);
} else {
$oCriteria->add(AdditionalTablesPeer::PRO_UID, $pro_uid, Criteria::NOT_EQUAL);
}
}
}
if ($filter != '' && is_string($filter)) {
$oCriteria->add(
$oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_NAME, '%' . $filter . '%', Criteria::LIKE)->addOr(
$oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_DESCRIPTION, '%' . $filter . '%', Criteria::LIKE))
);
}
if (isset($_POST['sort'])) {
if ($_POST['dir'] == 'ASC') {
eval('$oCriteria->addAscendingOrderByColumn(AdditionalTablesPeer::' . $_POST['sort'] . ');');
} else {
eval('$oCriteria->addDescendingOrderByColumn(AdditionalTablesPeer::' . $_POST['sort'] . ');');
}
} else {
$oCriteria->addAscendingOrderByColumn(AdditionalTablesPeer::ADD_TAB_NAME);
}
$criteriaCount = clone $oCriteria;
$count = AdditionalTablesPeer::doCount($criteriaCount);
$oCriteria->setLimit($limit);
$oCriteria->setOffset($start);
$oDataset = AdditionalTablesPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$addTables = Array();
$proUids = Array();
while ($oDataset->next()) {
$row = $oDataset->getRow();
$row['PRO_TITLE'] = $row['PRO_DESCRIPTION'] = '';
$addTables[] = $row;
if ($row['PRO_UID'] != '') {
$proUids[] = $row['PRO_UID'];
}
}
//process details will have the info about the processes
$procDetails = Array();
if (count($proUids) > 0) {
//now get the labels for all process, using an array of Uids,
$c = new Criteria('workflow');
//$c->add ( ContentPeer::CON_CATEGORY, 'PRO_TITLE', Criteria::EQUAL );
$c->add(ContentPeer::CON_LANG, defined('SYS_LANG') ? SYS_LANG : 'en', Criteria::EQUAL);
$c->add(ContentPeer::CON_ID, $proUids, Criteria::IN);
$dt = ContentPeer::doSelectRS($c);
$dt->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($dt->next()) {
$row = $dt->getRow();
$procDetails[$row['CON_ID']][$row['CON_CATEGORY']] = $row['CON_VALUE'];
}
foreach ($addTables as $i => $addTable) {
if (isset($procDetails[$addTable['PRO_UID']]['PRO_TITLE'])) {
$addTables[$i]['PRO_TITLE'] = $procDetails[$addTable['PRO_UID']]['PRO_TITLE'];
}
if (isset($procDetails[$addTable['PRO_UID']]['PRO_DESCRIPTION'])) {
$addTables[$i]['PRO_DESCRIPTION'] = $procDetails[$addTable['PRO_UID']]['PRO_DESCRIPTION'];
}
}
}
return array('rows' => $addTables, 'count' => $count);
}
示例14: execute
public function execute()
{
die;
ini_set("memory_limit", "128M");
ini_set("max_execution_time", "240");
$this->forceSystemAuthentication();
$start = microtime(true);
$file_path = dirname(__FILE__) . "/../data/viewPartnersData.txt";
$partner_groups = new partnerGroups($file_path);
$this->partner_group_list = $partner_groups->partner_group_list;
$group_rest = new partnerGroup();
$group_rest->setName("_rest");
$this->partner_group_list[] = $group_rest;
$partner_filter = $this->getP("partner_filter");
$filter_type = $this->getP("filter_type", "project");
//"wiki_wordpress" ); // default a relatively short list
$this->type = $this->getP("type");
$gloabl_dual = false;
//true;
if ($this->type == 2) {
$gloabl_dual = false;
}
$this->from_date = $this->getP("from_date");
$this->to_date = $this->getP("to_date");
$this->days = $this->getP("days");
$page = $this->getP("page", 1);
if ($page < 1) {
$page = 1;
}
$this->page = $page;
$this->partners_between = $this->getP("partners_between");
if ($this->partners_between == "false") {
$this->partners_between = false;
}
// increment the to_date in one 1 (to be inclusive)
/*
if ( $this->to_date )
{
$timeStamp = strtotime( $this->to_date );
$timeStamp += 24 * 60 * 60 ; // add one day
$this->to_date = date("Y-m-d", $timeStamp);
}
*/
if ($this->days) {
$timeStamp = strtotime($this->to_date);
$timeStamp -= 24 * 60 * 60 * $this->days;
// (- $this->days days)
$this->from_date = date("Y-m-d", $timeStamp);
}
$this->new_first = $this->getP("new_first", null);
if ($this->new_first == "false") {
$this->new_first = false;
}
// don't display these partners
// $exclude_list = self::getIdList ( "exclude" );
$this->partners_stat = array();
$c = new Criteria();
$c->setLimit(self::MAX_PAGE_SIZE);
$c->setOffset(($page - 1) * self::MAX_PAGE_SIZE);
if ($this->new_first) {
$c->addDescendingOrderByColumn(PartnerPeer::ID);
} else {
$c->addAscendingOrderByColumn(PartnerPeer::ID);
}
// $c->addAnd ( PartnerPeer::ID , $exclude_list , Criteria::NOT_IN );
if ($this->to_date) {
$c->addAnd(PartnerPeer::CREATED_AT, $this->to_date, Criteria::LESS_EQUAL);
}
if ($this->partners_between) {
$c->addAnd(PartnerPeer::CREATED_AT, $this->from_date, Criteria::GREATER_EQUAL);
}
// TODO - change rule mechanism to be more flixible
$this->createCriteriaByGroup($partner_groups, $c, $filter_type, $partner_filter);
$partners = PartnerPeer::doSelect($c);
$ids = self::getIds($partners);
$updated_at = null;
if ($ids && count($ids) >= 1) {
$statsPool = self::getPartnersStats($ids, $this->from_date, $this->to_date);
// fdb::populateObjects( $partners , new PartnerStatsPeer() , "id" , "partnerStats" , false ,"partnerId");
foreach ($partners as $partner) {
$partner_id = $partner->getId();
$this->addStat($partner_id, "name", $partner_id == $partner->getPartnerName() ? $partner->getAdminName() : $partner->getpartnerName());
$this->addStat($partner_id, "email", $partner->getAdminEmail());
$this->addStat($partner_id, "description", $partner->getDescription());
$this->addStat($partner_id, "url1", $partner->getUrl1());
$this->addStat($partner_id, "created", substr($partner->getCreatedAt(), 0, 10));
$this->addStat($partner_id, "categories", $partner->getContentCategories());
$stats = @$statsPool[$partner_id];
if ($stats) {
$this->addExtraStats($partner_id, $stats);
}
}
}
$this->dual = $gloabl_dual;
$this->partner_filter = $partner_filter;
$this->filter_type = $filter_type;
$this->updated_at = $updated_at;
$end = microtime(true);
$this->bench = $end - $start;
}
示例15: getAll
function getAll($lang = 'en', $start = null, $limit = null, $search = null, $dateFrom = null, $dateTo = null)
{
$totalCount = 0;
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(TranslationPeer::TRN_ID);
$oCriteria->addSelectColumn(TranslationPeer::TRN_CATEGORY);
$oCriteria->addSelectColumn(TranslationPeer::TRN_LANG);
$oCriteria->addSelectColumn(TranslationPeer::TRN_VALUE);
$oCriteria->addSelectColumn(TranslationPeer::TRN_UPDATE_DATE);
$oCriteria->add(TranslationPeer::TRN_LANG, $lang);
$oCriteria->add(TranslationPeer::TRN_CATEGORY, 'LABEL');
//$oCriteria->addAscendingOrderByColumn ( 'TRN_CATEGORY' );
$oCriteria->addAscendingOrderByColumn('TRN_ID');
if ($search) {
$oCriteria->add($oCriteria->getNewCriterion(TranslationPeer::TRN_ID, "%{$search}%", Criteria::LIKE)->addOr($oCriteria->getNewCriterion(TranslationPeer::TRN_VALUE, "%{$search}%", Criteria::LIKE)));
}
// for date filter
if ($dateFrom && $dateTo) {
$oCriteria->add($oCriteria->getNewCriterion(TranslationPeer::TRN_UPDATE_DATE, "{$dateFrom}", Criteria::GREATER_EQUAL)->addAnd($oCriteria->getNewCriterion(TranslationPeer::TRN_UPDATE_DATE, "{$dateTo}", Criteria::LESS_EQUAL)));
}
// end filter
$c = clone $oCriteria;
$c->clearSelectColumns();
$c->addSelectColumn('COUNT(*)');
$oDataset = TranslationPeer::doSelectRS($c);
$oDataset->next();
$aRow = $oDataset->getRow();
if (is_array($aRow)) {
$totalCount = $aRow[0];
}
if ($start) {
$oCriteria->setOffset($start);
}
if ($limit) {
//&& !isset($seach) && !isset($search))
$oCriteria->setLimit($limit);
}
$rs = TranslationPeer::doSelectRS($oCriteria);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rows = array();
while ($rs->next()) {
$rows[] = $rs->getRow();
}
$result->data = $rows;
$result->totalCount = $totalCount;
return $result;
}