本文整理汇总了PHP中E::GetEntityRows方法的典型用法代码示例。如果您正苦于以下问题:PHP E::GetEntityRows方法的具体用法?PHP E::GetEntityRows怎么用?PHP E::GetEntityRows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类E
的用法示例。
在下文中一共展示了E::GetEntityRows方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContentFields
/**
* Список полей типа контента
*
* @param array $aFilter Фильтр
*
* @return ModuleTopic_EntityField[]
*/
public function getContentFields($aFilter)
{
$sql = "SELECT\n cf.field_id AS ARRAY_KEY, cf.*\n FROM\n ?_content_field AS cf\n WHERE\n 1=1\n { AND cf.content_id = ?d }\n { AND cf.field_unique_name = ? }\n ORDER BY cf.field_sort DESC\n ";
$aResult = array();
$aRows = $this->oDb->select($sql, isset($aFilter['content_id']) ? $aFilter['content_id'] : DBSIMPLE_SKIP, empty($aFilter['field_unique_name']) ? DBSIMPLE_SKIP : $aFilter['field_unique_name']);
if ($aRows) {
$aResult = E::GetEntityRows('Topic_Field', $aRows);
}
return $aResult;
}
示例2: GetVoteByArray
/**
* Получить список голосований по списку айдишников
*
* @param array $aTargetId - Список ID владельцев
* @param string $sTargetType - Тип владельца
* @param int $iUserId - ID пользователя
*
* @return array
*/
public function GetVoteByArray($aTargetId, $sTargetType, $iUserId)
{
if (!is_array($aTargetId) || count($aTargetId) == 0) {
return array();
}
$sql = "SELECT\n\t\t\t\t\t*\n\t\t\t\tFROM \n\t\t\t\t\t?_vote\n\t\t\t\tWHERE\n\t\t\t\t\ttarget_id IN(?a)\n\t\t\t\t\tAND\n\t\t\t\t\ttarget_type = ?\n\t\t\t\t\tAND\n\t\t\t\t\tuser_voter_id = ?d ";
$aVotes = array();
if ($aRows = $this->oDb->select($sql, $aTargetId, $sTargetType, $iUserId)) {
$aVotes = E::GetEntityRows('Vote', $aRows);
}
return $aVotes;
}
示例3: GetTags
/**
* Возвращает список тегов по фильтру
*
* @param array $aFilter Фильтр
* @param array $aOrder Сортировка
* @param int $iCount Возвращает количество элементов
* @param int $iCurrPage Номер страницы
* @param int $iPerPage Количество элементов на страницу
*
* @return array
*/
public function GetTags($aFilter, $aOrder, &$iCount, $iCurrPage, $iPerPage)
{
$aOrderAllow = array('target_id', 'user_id', 'is_user');
$sOrder = '';
foreach ($aOrder as $key => $value) {
if (!in_array($key, $aOrderAllow)) {
unset($aOrder[$key]);
} elseif (in_array($value, array('asc', 'desc'))) {
$sOrder .= " {$key} {$value},";
}
}
$sOrder = trim($sOrder, ',');
if ($sOrder == '') {
$sOrder = ' target_id DESC ';
}
$sql = "SELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\t?_favourite_tag\n\t\t\t\tWHERE\n\t\t\t\t\t1 = 1\n\t\t\t\t\t{ AND user_id = ?d }\n\t\t\t\t\t{ AND target_type = ? }\n\t\t\t\t\t{ AND target_id = ?d }\n\t\t\t\t\t{ AND is_user = ?d }\n\t\t\t\t\t{ AND text = ? }\n\t\t\t\tORDER by {$sOrder}\n\t\t\t\tLIMIT ?d, ?d ;\n\t\t\t\t\t";
$aResult = array();
$aRows = $this->oDb->selectPage($iCount, $sql, isset($aFilter['user_id']) ? $aFilter['user_id'] : DBSIMPLE_SKIP, isset($aFilter['target_type']) ? $aFilter['target_type'] : DBSIMPLE_SKIP, isset($aFilter['target_id']) ? $aFilter['target_id'] : DBSIMPLE_SKIP, isset($aFilter['is_user']) ? $aFilter['is_user'] : DBSIMPLE_SKIP, isset($aFilter['text']) ? $aFilter['text'] : DBSIMPLE_SKIP, ($iCurrPage - 1) * $iPerPage, $iPerPage);
if ($aRows) {
$aResult = E::GetEntityRows('ModuleFavourite_EntityTag', $aRows);
}
return $aResult;
}
示例4: GetTopicsImageCategory
/**
* Возвращает информацию о категориях изображений пользователя
* с разбивкой по типу контента
*
* @param int $iUserId
*
* @return array
*/
public function GetTopicsImageCategory($iUserId)
{
$aFilter = array('user_id' => $iUserId, 'mresource_type' => ModuleMresource::TYPE_IMAGE | ModuleMresource::TYPE_PHOTO | ModuleMresource::TYPE_PHOTO_PRIMARY, 'target_type' => array('photoset', 'topic'));
if (E::IsUser() && E::User() !== $iUserId) {
// Если текущий юзер не совпадает с запрашиваемым, то получаем список доступных блогов
$aFilter['blogs_id'] = E::ModuleBlog()->GetAccessibleBlogsByUser(E::User());
// И топики должны быть опубликованы
$aFilter['topic_publish'] = 1;
}
if (!E::IsUser()) {
// Если юзер не авторизован, то считаем все доступные для индексации топики
$aFilter['topic_index_ignore'] = 0;
}
$aData = $this->oMapper->GetCountImagesByTopicType($aFilter);
if ($aData) {
foreach ($aData as $xIndex => $aRow) {
$sLabelKey = 'target_type_' . $aRow['id'];
if (($sLabel = E::ModuleLang()->Get($sLabelKey)) == mb_strtoupper($sLabelKey)) {
/** @var ModuleTopic_EntityContentType $oContentType */
$oContentType = E::ModuleTopic()->GetContentTypeByUrl($aRow['id']);
if ($oContentType) {
$sLabel = $oContentType->getContentTitleDecl();
}
}
$aData[$xIndex]['label'] = E::ModuleLang()->Get($sLabel);
}
$aResult = E::GetEntityRows('Mresource_MresourceCategory', $aData);
} else {
$aResult = array();
}
return $aResult;
}
示例5: GetMresourcesRelByTargetAndUser
/**
* Returns media resources' relation entities by target
*
* @param string|array $xTargetType
* @param int|array $xTargetId
* @param int|array $xUserId
*
* @return ModuleMresource_EntityMresourceRel[]
*/
public function GetMresourcesRelByTargetAndUser($xTargetType, $xTargetId, $xUserId)
{
if (is_array($xTargetType)) {
$aCriteria = array('filter' => array('target_types' => $xTargetType));
} else {
$aCriteria = array('filter' => array('target_type' => $xTargetType));
}
if (!is_null($xTargetId)) {
$aCriteria['filter']['target_id'] = $xTargetId;
}
if (!is_null($xUserId)) {
$aCriteria['filter']['user_id'] = $xUserId;
}
$aData = $this->_getMresourcesRelByCriteria($aCriteria);
$aResult = array();
if ($aData['data']) {
$aResult = E::GetEntityRows('Mresource_MresourceRel', $aData['data']);
}
return $aResult;
}
示例6: GetTopicValuesByArrayId
/**
* Возвращает список полей по списку id топиков
*
* @param array $aTargetId Список ID топиков
*
* @return ModuleTopic_EntityContentValues[]
*
* @TODO рефакторинг + solid
*/
public function GetTopicValuesByArrayId($aTargetId)
{
if (!is_array($aTargetId) || count($aTargetId) == 0) {
return array();
}
$sql = "SELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\t?_content_values\n\t\t\t\tWHERE\n\t\t\t\t\ttarget_id IN(?a)\n\t\t\t\t\tAND\n\t\t\t\t\ttarget_type = 'topic'\n\t\t\t\t";
$aFields = array();
if ($aRows = $this->oDb->select($sql, $aTargetId)) {
$aFields = E::GetEntityRows('Topic_ContentValues', $aRows);
}
return $aFields;
}
示例7: Read
/**
* Чтение событий
*
* @param array $aEventTypes Список типов событий
* @param array|null $aUsersList Список пользователей, чьи события читать
* @param int $iCount Количество
* @param int $iFromId ID события с которого начинать выборку
*
* @return array
*/
public function Read($aEventTypes, $aUsersList, $iCount, $iFromId)
{
$sql = 'SELECT * FROM ?_stream_event
WHERE
event_type IN (?a)
{ AND user_id IN (?a) }
AND publish = 1
{ AND id < ?d }
ORDER BY id DESC
{ LIMIT 0,?d }';
$aResult = array();
$aRows = $this->oDb->select($sql, $aEventTypes, (!is_null($aUsersList) and count($aUsersList)) ? $aUsersList : DBSIMPLE_SKIP, !is_null($iFromId) ? $iFromId : DBSIMPLE_SKIP, !is_null($iCount) ? $iCount : DBSIMPLE_SKIP);
if ($aRows) {
$aResult = E::GetEntityRows('Stream_Event', $aRows);
}
return $aResult;
}
示例8: GetTalkUsers
/**
* Возвращает массив пользователей, участвующих в разговоре
*
* @param int $iTalkId ID разговора
*
* @return array
*/
public function GetTalkUsers($iTalkId)
{
$sql = "\n\t\t\tSELECT \n\t\t\t\tt.* \n\t\t\tFROM \n\t\t\t\t?_talk_user as t\n\t\t\tWHERE\n\t\t\t\ttalk_id = ? \n\t\t\t";
$aResult = array();
if ($aRows = $this->oDb->select($sql, $iTalkId)) {
$aResult = E::GetEntityRows('Talk_TalkUser', $aRows);
}
return $aResult;
}
示例9: GetTracks
/**
* Возвращает список треков по фильтру
*
* @param array $aFilter Фильтр
* @param array $aOrder Сортировка
* @param int $iCount Возвращает общее количество элементов
* @param int $iCurrPage Номер страницы
* @param int $iPerPage Количество элементов на страницу
*
* @return array
*/
public function GetTracks($aFilter, $aOrder, &$iCount, $iCurrPage, $iPerPage)
{
$aOrderAllow = array('id', 'date_add', 'status');
$sOrder = '';
foreach ($aOrder as $key => $value) {
if (!in_array($key, $aOrderAllow)) {
unset($aOrder[$key]);
} elseif (in_array($value, array('asc', 'desc'))) {
$sOrder .= " {$key} {$value},";
}
}
$sOrder = trim($sOrder, ',');
if ($sOrder == '') {
$sOrder = ' id desc ';
}
if (isset($aFilter['exclude_mail']) and !is_array($aFilter['exclude_mail'])) {
$aFilter['exclude_mail'] = array($aFilter['exclude_mail']);
}
$sql = "SELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\t?_track trc\n\t\t\t\tWHERE\n\t\t\t\t\t1 = 1\n\t\t\t\t\t{ AND trc.target_type = ? }\n\t\t\t\t\t{ AND trc.target_id = ?d }\n\t\t\t\t\t{ AND trc.user_id = ?d }\n\t\t\t\t\t{ AND trc.user_id not IN (?a) }\n\t\t\t\t\t{ AND trc.`key` = ? }\n\t\t\t\t\t{ AND trc.status = ?d }\n\t\t\t\t\t{ AND exists ( SELECT ?d\n\t\t\t\t\t FROM ?_topic_read as tr,\n\t\t\t\t\t ?_topic as t\n\t\t\t\t\t WHERE t.topic_id = trc.target_id\n\t\t\t\t\t AND t.topic_id = tr.topic_id\n\t\t\t\t\t AND (t.topic_count_comment > tr.comment_count_last)\n\t\t\t\t\t AND tr.user_id = trc.user_id\n\t\t\t\t\t ) }\n\t\t\t\tORDER by {$sOrder}\n\t\t\t\tLIMIT ?d, ?d ;\n\t\t\t\t\t";
$aResult = array();
$aRows = $this->oDb->selectPage($iCount, $sql, isset($aFilter['target_type']) ? $aFilter['target_type'] : DBSIMPLE_SKIP, isset($aFilter['target_id']) ? $aFilter['target_id'] : DBSIMPLE_SKIP, isset($aFilter['user_id']) ? $aFilter['user_id'] : DBSIMPLE_SKIP, (isset($aFilter['exclude_user']) and count($aFilter['exclude_user'])) ? $aFilter['exclude_user'] : DBSIMPLE_SKIP, isset($aFilter['key']) ? $aFilter['key'] : DBSIMPLE_SKIP, isset($aFilter['status']) ? $aFilter['status'] : DBSIMPLE_SKIP, (isset($aFilter['only_new']) and $aFilter['only_new']) ? 1 : DBSIMPLE_SKIP, ($iCurrPage - 1) * $iPerPage, $iPerPage);
if ($aRows) {
$aResult = E::GetEntityRows('ModuleSubscribe_EntityTrack', $aRows);
}
return $aResult;
}
示例10: GetWallsByArrayId
/**
* Получение записей по ID, без дополнительных данных
*
* @param array $aMessagesId Список ID сообщений
*
* @return array
*/
public function GetWallsByArrayId($aMessagesId)
{
if (!is_array($aMessagesId) || count($aMessagesId) == 0) {
return array();
}
$nLimit = sizeof($aMessagesId);
$sql = "\n SELECT\n w.id AS ARRAY_KEY,\n w.*\n FROM ?_wall AS w\n WHERE\n w.id IN(?a)\n LIMIT {$nLimit}";
$aResult = array();
if ($aRows = $this->oDb->select($sql, $aMessagesId)) {
$aResult = E::GetEntityRows('Wall', $aRows, $aMessagesId);
}
return $aResult;
}
示例11: GetCities
/**
* Возвращает список стран по фильтру
*
* @param array $aFilter Фильтр
* @param array $aOrder Сортировка
* @param int $iCount Возвращает количество элементов
* @param int $iCurrPage Номер страницы
* @param int $iPerPage Количество элементов на страницу
*
* @return array
*/
public function GetCities($aFilter, $aOrder, &$iCount, $iCurrPage, $iPerPage)
{
$aOrderAllow = array('id', 'name_ru', 'name_en', 'sort', 'country_id', 'region_id');
$sOrder = '';
foreach ($aOrder as $key => $value) {
if (!in_array($key, $aOrderAllow)) {
unset($aOrder[$key]);
} elseif (in_array($value, array('asc', 'desc'))) {
$sOrder .= " {$key} {$value},";
}
}
$sOrder = trim($sOrder, ',');
if ($sOrder == '') {
$sOrder = ' id desc ';
}
if (isset($aFilter['country_id']) && !is_array($aFilter['country_id'])) {
$aFilter['country_id'] = array($aFilter['country_id']);
}
if (isset($aFilter['region_id']) && !is_array($aFilter['region_id'])) {
$aFilter['region_id'] = array($aFilter['region_id']);
}
$sql = "SELECT\n\t\t\t\t\tgc.id AS ARRAY_KEY, gc.*\n\t\t\t\tFROM\n\t\t\t\t\t?_geo_city as gc\n\t\t\t\tWHERE\n\t\t\t\t\t1 = 1\n\t\t\t\t\t{ AND id = ?d }\n\t\t\t\t\t{ AND id IN (?a) }\n\t\t\t\t\t{ AND name_ru = ? }\n\t\t\t\t\t{ AND name_ru LIKE ? }\n\t\t\t\t\t{ AND name_en = ? }\n\t\t\t\t\t{ AND name_en LIKE ? }\n\t\t\t\t\t{ AND country_id IN ( ?a ) }\n\t\t\t\t\t{ AND region_id IN ( ?a ) }\n\t\t\t\tORDER BY {$sOrder}\n\t\t\t\tLIMIT ?d, ?d ;\n\t\t\t\t\t";
$aResult = array();
$aRows = $this->oDb->selectPage($iCount, $sql, isset($aFilter['id']) && !is_array($aFilter['id']) ? $aFilter['id'] : DBSIMPLE_SKIP, isset($aFilter['id']) && is_array($aFilter['id']) ? $aFilter['id'] : DBSIMPLE_SKIP, isset($aFilter['name_ru']) ? $aFilter['name_ru'] : DBSIMPLE_SKIP, isset($aFilter['name_ru_like']) ? $aFilter['name_ru_like'] : DBSIMPLE_SKIP, isset($aFilter['name_en']) ? $aFilter['name_en'] : DBSIMPLE_SKIP, isset($aFilter['name_en_like']) ? $aFilter['name_en_like'] : DBSIMPLE_SKIP, isset($aFilter['country_id']) && count($aFilter['country_id']) ? $aFilter['country_id'] : DBSIMPLE_SKIP, isset($aFilter['region_id']) && count($aFilter['region_id']) ? $aFilter['region_id'] : DBSIMPLE_SKIP, ($iCurrPage - 1) * $iPerPage, $iPerPage);
if ($aRows) {
$aResult = E::GetEntityRows('ModuleGeo_EntityCity', $aRows);
}
return $aResult;
}
示例12: getListOfActivePages
/**
* List of active pages
*
* @param integer $iCount
* @param integer $iCurrPage
* @param integer $iPerPage
*
* @return array
*/
public function getListOfActivePages(&$iCount, $iCurrPage, $iPerPage)
{
$sql = 'SELECT
`page`.*
FROM
?_page AS `page`
WHERE
`page`.`page_active` = 1
ORDER BY
page_sort DESC, `page`.`page_id` ASC
LIMIT
?d, ?d
';
$aResult = array();
if ($aRows = $this->oDb->selectPage($iCount, $sql, ($iCurrPage - 1) * $iPerPage, $iPerPage)) {
$aResult = E::GetEntityRows('Page', $aRows);
}
return $aResult;
}
示例13: GetTasks
/**
* Получает массив заданий на публикацию из базы с указанным количественным ограничением (выборка FIFO)
*
* @param int $iLimit Количество
*
* @return array
*/
public function GetTasks($iLimit)
{
$sql = "SELECT *\n\t\t\t\tFROM ?_notify_task\n\t\t\t\tORDER BY date_created ASC\n\t\t\t\tLIMIT ?d";
$aResult = array();
if ($aRows = $this->oDb->select($sql, $iLimit)) {
$aResult = E::GetEntityRows('Notify_Task', $aRows);
}
return $aResult;
}
示例14: GetCommentsByArrayId
/**
* Список комментов по ID
*
* @param array $aCommentsId Список ID комментариев
*
* @return ModuleComment_EntityComment[]
*/
public function GetCommentsByArrayId($aCommentsId)
{
if (!$aCommentsId) {
return array();
}
if (!is_array($aCommentsId)) {
$aCommentsId = array(intval($aCommentsId));
}
$iLimit = sizeof($aCommentsId);
$sql = "\n SELECT\n c.comment_id AS ARRAY_KEYS,\n c.*\n FROM\n ?_comment AS c\n WHERE\n c.comment_id IN(?a)\n LIMIT {$iLimit}\n ";
$aComments = array();
if ($aRows = $this->oDb->select($sql, $aCommentsId)) {
$aComments = E::GetEntityRows('Comment', $aRows, $aCommentsId);
}
return $aComments;
}
示例15: getTagsArray
/**
* Возвращает массив тегов
*
* @param bool $bTextOnly
* @return array
*/
public function getTagsArray($bTextOnly = true)
{
if ($sTags = $this->getTags()) {
if ($bTextOnly) {
return explode(',', $sTags);
}
$aTexts = explode(',', $sTags);
$aData = array();
foreach ($aTexts as $nI => $sText) {
$aData[] = array('topic_tag_id' => -$nI, 'topic_id' => $this->getId(), 'user_id' => $this->getUserId(), 'blog_id' => $this->getBlogId(), 'topic_tag_text' => $sText);
}
return E::GetEntityRows('Topic_TopicTag', $aData);
}
return array();
}