本文整理汇总了PHP中xPDOObject::getMany方法的典型用法代码示例。如果您正苦于以下问题:PHP xPDOObject::getMany方法的具体用法?PHP xPDOObject::getMany怎么用?PHP xPDOObject::getMany使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xPDOObject
的用法示例。
在下文中一共展示了xPDOObject::getMany方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareRow
/**
* Prepare the row for iteration
* @param xPDOObject $object
* @return array
*/
public function prepareRow(xPDOObject $object)
{
$objectArray = $object->toArray();
$objectArray['usergroups'] = '';
if (!empty($objectArray['user_id'])) {
$userObj = $this->modx->getObject('modUser', $objectArray['user_id']);
if ($userObj) {
$usergroups = $userObj->getUserGroupNames();
if ($usergroups) {
$objectArray['usergroups'] = @implode(',', $usergroups);
}
}
}
$subscribersHasCategories = $object->getMany('vnewsSubscribersHasCategories');
$objectArray['categories'] = '';
if ($subscribersHasCategories) {
$categories = array();
foreach ($subscribersHasCategories as $subsHasCats) {
$category = $subsHasCats->getOne('vnewsCategories');
$categories[] = $category->get('name');
}
$objectArray['categories'] = @implode(',', $categories);
}
return $objectArray;
}
示例2: prepareRow
/**
* Prepare the row for iteration
* @param xPDOObject $object
* @return array
*/
public function prepareRow(xPDOObject $object)
{
$objectArray = $object->toArray();
$objectArray['newsid'] = $objectArray['id'];
$objectArray['text'] = $objectArray['subject'] . ' (' . $objectArray['id'] . ')';
$objectArray['leaf'] = TRUE;
$objectArray['scheduled_for'] = date('m/d/Y', $objectArray['scheduled_for']);
$categories = $object->getMany('vnewsNewslettersHasCategories');
$categoriesArray = array();
if ($categories) {
foreach ($categories as $category) {
$categoryId = $category->get('category_id');
$categoryObj = $this->modx->getObject('vnewsCategories', $categoryId);
if ($categoryObj) {
$categoriesArray[] = array('category_id' => $categoryId, 'category' => $categoryObj->get('name'));
}
}
} else {
$categoriesArray[] = array('category_id' => 0, 'category' => 'uncategorized');
}
$objectArray['categories'] = $categoriesArray;
unset($objectArray['id']);
// avoid Ext component's ID
return $objectArray;
}
示例3: prepareRow
public function prepareRow(xPDOObject $object)
{
$array = $object->toArray();
$payments = $object->getMany('Payments');
$enabled = array();
foreach ($payments as $payment) {
$enabled[$payment->get('payment_id')] = 1;
}
$array['payments'] = $enabled;
return $array;
}
示例4: prepareRow
public function prepareRow(xPDOObject $object)
{
$data = $object->toArray();
$categories = $object->getMany('OptionCategories');
$data['categories'] = array();
/** @var msCategoryOption $cat */
foreach ($categories as $cat) {
$category = $cat->getOne('Category');
if ($category) {
$data['categories'][] = $category->get(array('id', 'pagetitle'));
}
}
return $data;
}
示例5: prepareRow
/** {@inheritDoc} */
public function prepareRow(xPDOObject $object)
{
$array = $object->toArray();
$routes = $object->getMany('Routes');
$enabled = array();
foreach ($routes as $route) {
if ($route->active == 0) {
continue;
}
$enabled[$route->id] = 1;
}
$array['routes'] = $enabled;
return $array;
}
示例6: prepareRow
public function prepareRow(xPDOObject $object)
{
$arr = $object->toArray();
$arr['usergroups'] = '';
// fill number of buttons
$c = $this->modx->newQuery('qsbButton');
$c->where(array('set' => $object->get('id')));
$arr['btnscount'] = $this->modx->getCount('qsbButton', $c);
// fill usergroups
$userGroups = $object->getMany('UserGroup');
if (!empty($userGroups)) {
/** @var qsbSetUserGroup $userGroup */
foreach ($userGroups as $userGroup) {
/** @var modUserGroup $group */
$group = $userGroup->getOne('UserGroup');
if (!empty($group) && is_object($group)) {
$arr['usergroups'] .= (!empty($arr['usergroups']) ? ', ' : '') . $group->get('name');
}
}
}
return $arr;
}
示例7: prepareRow
/**
* Prepare the row for iteration
* @param xPDOObject $object
* @return array
*/
public function prepareRow(xPDOObject $object)
{
$objectArray = $object->toArray();
$combo = $this->getProperty('combo', false);
if ($combo) {
return $objectArray;
}
if (!empty($objectArray['started_on'])) {
$objectArray['started_date'] = date('m/d/Y', $objectArray['started_on']);
$objectArray['started_time'] = date('H:i', $objectArray['started_on']);
}
if (!empty($objectArray['ended_on'])) {
$objectArray['ended_date'] = date('m/d/Y', $objectArray['ended_on']);
$objectArray['ended_time'] = date('H:i', $objectArray['ended_on']);
}
$ctxs = $object->getMany('MeetingsContexts');
if ($ctxs) {
$data = array();
foreach ($ctxs as $ctx) {
$data[] = $ctx->get('context_key');
}
$objectArray['context_key'] = @implode(',', $data);
}
$ugs = $object->getMany('MeetingsUsergroups');
if ($ugs) {
$moderator = array();
$viewer = array();
foreach ($ugs as $ug) {
$ugArray = $ug->toArray();
if ($ugArray['enroll'] === 'moderator') {
$moderator[] = $ugArray['usergroup_id'];
} else {
$viewer[] = $ugArray['usergroup_id'];
}
}
$objectArray['moderator_usergroups'] = @implode(',', $moderator);
$objectArray['viewer_usergroups'] = @implode(',', $viewer);
}
$users = $object->getMany('MeetingsUsers');
if ($users) {
$moderator = array();
$viewer = array();
foreach ($users as $user) {
$userArray = $user->toArray();
if ($userArray['enroll'] === 'moderator') {
$moderator[] = $userArray['user_id'];
} else {
$viewer[] = $userArray['user_id'];
}
}
$objectArray['moderator_users'] = @implode(',', $moderator);
$objectArray['viewer_users'] = @implode(',', $viewer);
}
$objectArray['is_created'] = $this->modx->bbbx->getMeetingInfo($objectArray['meeting_id']);
$objectArray['can_create'] = false;
if (!$objectArray['is_created']) {
$c = $this->modx->newQuery('bbbxMeetings');
$time = time();
$c->where(array('meeting_id' => $objectArray['meeting_id'], 'started_on:<=' => $time, 'ended_on:>=' => $time));
$meeting = $this->modx->getObject('bbbxMeetings', $c);
if ($meeting) {
$objectArray['can_create'] = true;
}
}
$objectArray['is_running'] = $this->modx->bbbx->isMeetingRunning($objectArray['meeting_id']);
if ($objectArray['is_created']) {
$objectArray['joinURL'] = $this->modx->bbbx->getJoinMeetingURL($objectArray['meeting_id'], $objectArray['moderator_pw']);
}
$objectArray['recordings'] = $this->modx->bbbx->getRecordings($objectArray['meeting_id']);
return $objectArray;
}