本文整理汇总了PHP中SPFactory::EntryRow方法的典型用法代码示例。如果您正苦于以下问题:PHP SPFactory::EntryRow方法的具体用法?PHP SPFactory::EntryRow怎么用?PHP SPFactory::EntryRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPFactory
的用法示例。
在下文中一共展示了SPFactory::EntryRow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listSection
/**
*/
protected function listSection()
{
$parentPath = $this->parentPath(SPRequest::sid());
$this->assign($parentPath, 'current_path');
$this->_plgSect = '_SectionListTemplate';
$c = $this->get('categories');
$categories = array();
$entries = array();
/* get users/authors data first */
$usersData = array();
if (count($c)) {
foreach ($c as $cat) {
$usersData[] = $cat->get('owner');
}
reset($c);
}
$usersData = $this->userData($usersData);
/* handle the categories */
if (count($c)) {
foreach ($c as $cat) {
$category = array();
/* data needed to display in the list */
$category['name'] = $cat->get('name');
$category['state'] = $cat->get('state');
$category['approved'] = $cat->get('approved');
if (isset($usersData[$cat->get('owner')])) {
$uName = $usersData[$cat->get('owner')]->name;
$uUrl = SPUser::userUrl($usersData[$cat->get('owner')]->id);
$category['owner'] = "<a href=\"{$uUrl}\">{$uName}</a>";
} else {
$category['owner'] = Sobi::Txt('GUEST');
}
/* the rest - case someone need */
$category['position'] = $cat->get('position');
$category['createdTime'] = $cat->get('createdTime');
$category['cout'] = $cat->get('cout');
$category['coutTime'] = $cat->get('coutTime');
$category['id'] = $cat->get('id');
$category['validSince'] = $cat->get('validSince');
$category['validUntil'] = $cat->get('validUntil');
$category['description'] = $cat->get('description');
$category['icon'] = $cat->get('icon');
$category['introtext'] = $cat->get('introtext');
$category['parent'] = $cat->get('parent');
$category['confirmed'] = $cat->get('confirmed');
$category['counter'] = $cat->get('counter');
$category['nid'] = $cat->get('nid');
$category['metaDesc'] = $cat->get('metaDesc');
$category['metaKeys'] = $cat->get('metaKeys');
$category['metaAuthor'] = $cat->get('metaAuthor');
$category['metaRobots'] = $cat->get('metaRobots');
$category['ownerIP'] = $cat->get('ownerIP');
$category['updatedTime'] = $cat->get('updatedTime');
$category['updater'] = $cat->get('updater');
$category['updaterIP'] = $cat->get('updaterIP');
$category['version'] = $cat->get('version');
$category['object'] =& $cat;
$categories[] = $category;
}
}
/* re-assign the categories */
$this->assign($categories, 'categories');
/* handle the fields in this section for header */
$f = $this->get('fields');
$entriesOrdering = array(Sobi::Txt('ORDER_BY') => array(), 'e_sid.asc' => Sobi::Txt('EMN.ORDER_BY_ID_ASC'), 'e_sid.desc' => Sobi::Txt('EMN.ORDER_BY_ID_DESC'), $this->get('entries_field') . '.asc' => Sobi::Txt('EMN.ORDER_BY_NAME_ASC'), $this->get('entries_field') . '.desc' => Sobi::Txt('EMN.ORDER_BY_NAME_DESC'), 'state.asc' => Sobi::Txt('EMN.ORDER_BY_STATE_ASC'), 'state.desc' => Sobi::Txt('EMN.ORDER_BY_STATE_DESC'), 'createdTime.asc' => Sobi::Txt('EMN_ORDER_BY_CREATION_DATE_ASC'), 'createdTime.desc' => Sobi::Txt('EMN_ORDER_BY_CREATION_DATE_DESC'), 'updatedTime.asc' => Sobi::Txt('EMN_ORDER_BY_UPDATE_DATE_ASC'), 'updatedTime.desc' => Sobi::Txt('EMN_ORDER_BY_UPDATE_DATE_DESC'), 'approved.asc' => Sobi::Txt('EMN.ORDER_BY_APPROVAL_ASC'), 'approved.desc' => Sobi::Txt('EMN.ORDER_BY_APPROVAL_DESC'));
if ($this->get('task') == 'view') {
$entriesOrdering['position.asc'] = Sobi::Txt('EMN.ORDER_BY_ORDER_ASC');
$entriesOrdering['position.desc'] = Sobi::Txt('EMN.ORDER_BY_ORDER_DESC');
}
$customFields = array();
$customHeader = array();
if (count($f)) {
/* @var SPField $fit */
foreach ($f as $field) {
$entriesOrdering[Sobi::Txt('EMN.ORDER_BY_FIELD')][$field->get('nid') . '.asc'] = '\'' . $field->get('name') . '\' ' . Sobi::Txt('EMN.ORDER_BY_FIELD_ASC');
$entriesOrdering[Sobi::Txt('EMN.ORDER_BY_FIELD')][$field->get('nid') . '.desc'] = '\'' . $field->get('name') . '\' ' . Sobi::Txt('EMN.ORDER_BY_FIELD_DESC');
$customFields[] = $field->get('nid');
$customHeader[] = array('content' => $field->get('name'), 'attributes' => array('type' => 'text'));
}
}
$entriesOrdering['owner.desc'] = Sobi::Txt('EMN.ORDER_BY_OWNER');
$this->assign($customHeader, 'customHeader');
$this->assign($customFields, 'custom_fields');
$this->assign($entriesOrdering, 'entriesOrdering');
/* handle the entries */
$e = $this->get('entries');
if (count($e)) {
/* get users/authors data first */
$usersData = array();
foreach ($e as $i => $sid) {
$e[$i] = SPFactory::EntryRow($sid);
$usersData[] = $e[$i]->get('owner');
}
reset($e);
$usersData = $this->userData($usersData);
foreach ($e as $sentry) {
/* @var SPEntryAdm $sentry */
$entry = array();
//.........这里部分代码省略.........