本文整理汇总了PHP中Engine::GetEntity方法的典型用法代码示例。如果您正苦于以下问题:PHP Engine::GetEntity方法的具体用法?PHP Engine::GetEntity怎么用?PHP Engine::GetEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine
的用法示例。
在下文中一共展示了Engine::GetEntity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetSubscribes
public function GetSubscribes($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" . Config::Get('db.table.subscribe') . "\n\t\t\t\tWHERE\n\t\t\t\t\t1 = 1\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 mail = ? }\n\t\t\t\t\t{ AND mail not IN (?a) }\n\t\t\t\t\t{ AND `key` = ? }\n\t\t\t\t\t{ AND status = ?d }\n\t\t\t\tORDER by {$sOrder}\n\t\t\t\tLIMIT ?d, ?d ;\n\t\t\t\t\t";
$aResult = array();
if ($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['mail']) ? $aFilter['mail'] : DBSIMPLE_SKIP, (isset($aFilter['exclude_mail']) and count($aFilter['exclude_mail'])) ? $aFilter['exclude_mail'] : DBSIMPLE_SKIP, isset($aFilter['key']) ? $aFilter['key'] : DBSIMPLE_SKIP, isset($aFilter['status']) ? $aFilter['status'] : DBSIMPLE_SKIP, ($iCurrPage - 1) * $iPerPage, $iPerPage)) {
foreach ($aRows as $aRow) {
$aResult[] = Engine::GetEntity('Subscribe', $aRow);
}
}
return $aResult;
}
示例2: Exec
/**
* Запуск обработки
*/
public function Exec()
{
$sEntity = $this->GetParam('entity');
$oTarget = $this->GetParam('target');
$sTargetType = $this->GetParam('target_type');
if (!$oTarget) {
$oTarget = Engine::GetEntity($sEntity);
}
$aBehaviors = $oTarget->GetBehaviors();
foreach ($aBehaviors as $oBehavior) {
if ($oBehavior instanceof ModuleCategory_BehaviorEntity) {
/**
* Если в параметрах был тип, то переопределяем значение. Это необходимо для корректной работы, когда тип динамический.
*/
if ($sTargetType) {
$oBehavior->setParam('target_type', $sTargetType);
}
/**
* Нужное нам поведение - получаем список текущих категорий
*/
$this->Viewer_Assign('categoriesSelected', $oBehavior->getCategories(), true);
/**
* Загружаем параметры
*/
$aParams = $oBehavior->getParams();
$this->Viewer_Assign('params', $aParams, true);
/**
* Загружаем список доступных категорий
*/
$this->Viewer_Assign('categories', $this->Category_GetCategoriesTreeByTargetType($oBehavior->getCategoryTargetType()), true);
break;
}
}
$this->SetTemplate('component@field.category');
}
示例3: UpdateImage
/**
* Edit image
*
* @param PluginLsgallery_ModuleImage_EntityImage $oImage
* @return boolean
*/
public function UpdateImage($oImage)
{
$oImageOld = $this->GetImageById($oImage->getId());
$oImage->setDateEdit();
/* @var $oAlbum PluginLsgallery_ModuleAlbum_EntityAlbum */
$oAlbum = $this->PluginLsgallery_Album_GetAlbumById($oImage->getAlbumId());
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("image_update"));
$this->Cache_Delete("image_{$oImage->getId()}");
$this->oMapper->UpdateImage($oImage);
if ($oImage->getImageTags() != $oImageOld->getImageTags()) {
/**
* Обновляем теги
*/
$aTags = explode(',', $oImage->getImageTags());
$this->DeleteImageTagsByImageId($oImage->getId());
if ($oAlbum->getType() == PluginLsgallery_ModuleAlbum_EntityAlbum::TYPE_OPEN) {
foreach ($aTags as $sTag) {
$oTag = Engine::GetEntity('PluginLsgallery_ModuleImage_EntityImageTag');
$oTag->setImageId($oImage->getId());
$oTag->setAlbumId($oImage->getAlbumId());
$oTag->setText(trim($sTag));
$this->oMapper->AddImageTag($oTag);
}
}
}
return true;
}
示例4: SendUserMarkImageNew
/**
* Отправляет пользователю сообщение о добавлении его в друзья
*
* @param ModuleUser_EntityUser $oUserTo
* @param ModuleUser_EntityUser $oUserFrom
* @param string $sText
*/
public function SendUserMarkImageNew(ModuleUser_EntityUser $oUserTo, ModuleUser_EntityUser $oUserFrom, $sText)
{
/**
* Если в конфигураторе указан отложенный метод отправки,
* то добавляем задание в массив. В противном случае,
* сразу отсылаем на email
*/
if (Config::Get('module.notify.delayed')) {
$oNotifyTask = Engine::GetEntity('Notify_Task', array('user_mail' => $oUserTo->getMail(), 'user_login' => $oUserTo->getLogin(), 'notify_text' => $sText, 'notify_subject' => $this->Lang_Get('plugin.lsgallery.lsgallery_marked_subject'), 'date_created' => date("Y-m-d H:i:s"), 'notify_task_status' => self::NOTIFY_TASK_STATUS_NULL));
if (Config::Get('module.notify.insert_single')) {
$this->aTask[] = $oNotifyTask;
} else {
$this->oMapper->AddTask($oNotifyTask);
}
} else {
/**
* Отправляем мыло
*/
$this->Mail_SetAdress($oUserTo->getMail(), $oUserTo->getLogin());
$this->Mail_SetSubject($this->Lang_Get('plugin.lsgallery.lsgallery_marked_subject'));
$this->Mail_SetBody($sText);
$this->Mail_setHTML();
$this->Mail_Send();
}
}
示例5: SubmitSaveSeopack
protected function SubmitSaveSeopack()
{
$this->sMainMenuItem = 'content';
if (!$this->CheckSeopackFields()) {
return false;
}
$sUrl = E::ModuleSeopack()->ClearUrl(F::GetRequest('url'));
if (!F::GetRequest('seopack_id')) {
if (!($oSeopack = E::ModuleSeopack()->GetSeopackByUrl($this->GetUri($sUrl)))) {
$oSeopack = Engine::GetEntity('PluginSeopack_ModuleSeopack_EntitySeopack');
$oSeopack->setUrl($this->GetUri($sUrl));
}
} elseif (!($oSeopack = E::ModuleSeopack()->GetSeopackBySeopackId(F::GetRequest('seopack_id')))) {
$oSeopack = Engine::GetEntity('PluginSeopack_ModuleSeopack_EntitySeopack');
$oSeopack->setUrl($this->GetUri($sUrl));
}
$oSeopack->setTitle(F::GetRequest('title_auto') ? null : strip_tags(F::GetRequest('title')));
$oSeopack->setDescription(F::GetRequest('description_auto') ? null : strip_tags(F::GetRequest('description')));
$oSeopack->setKeywords(F::GetRequest('keywords_auto') ? null : strip_tags(F::GetRequest('keywords')));
if ($oSeopack->Save()) {
E::ModuleMessage()->AddNotice(E::ModuleLang()->Get('plugin.seopack.seopack_edit_submit_save_ok'));
Router::Location('admin/seopack/');
} else {
E::ModuleMessage()->AddError(E::ModuleLang()->Get('system_error'));
}
}
示例6: EventAjaxSet
protected function EventAjaxSet()
{
if (!F::isPost('url')) {
return false;
}
if (!$this->CheckSeopackFields()) {
return false;
}
$sUrl = E::ModuleSeopack()->ClearUrl(F::GetRequest('url'));
if (!($oSeopack = E::ModuleSeopack()->GetSeopackByUrl($sUrl))) {
$oSeopack = Engine::GetEntity('PluginSeopack_ModuleSeopack_EntitySeopack');
$oSeopack->setUrl($sUrl);
}
if (F::GetRequest('title_auto') && F::GetRequest('description_auto') && F::GetRequest('keywords_auto')) {
$oSeopack->Delete();
E::ModuleMessage()->AddNotice(E::ModuleLang()->Get('plugin.seopack.seopack_edit_submit_save_ok'));
return;
}
$oSeopack->setTitle(F::GetRequest('title_auto') ? null : strip_tags(F::GetRequest('title')));
$oSeopack->setDescription(F::GetRequest('description_auto') ? null : strip_tags(F::GetRequest('description')));
$oSeopack->setKeywords(F::GetRequest('keywords_auto') ? null : strip_tags(F::GetRequest('keywords')));
if ($oSeopack->Save()) {
if ($oSeopack->getTitle()) {
E::ModuleViewer()->AssignAjax('title', $oSeopack->getTitle());
}
E::ModuleMessage()->AddNotice(E::ModuleLang()->Get('plugin.seopack.seopack_edit_submit_save_ok'));
}
return;
}
示例7: GetTopicsByArrayId
public function GetTopicsByArrayId($aArrayId)
{
$oUserCurrent = PluginLib_ModuleUser::GetUserCurrent();
$sAccessWhere = $oUserCurrent->isAdministrator() ? '' : ' AND ' . PluginAccesstotopic_ModuleAccess::GetAccessWhereStatment($oUserCurrent->getId());
if (!is_array($aArrayId) or count($aArrayId) == 0) {
return array();
}
$sql = 'SELECT
t.*,
tc.*
FROM
' . Config::Get('db.table.topic') . ' as t
JOIN ' . Config::Get('db.table.topic_content') . ' as tc ON t.topic_id=tc.topic_id
WHERE
t.topic_id IN(?a)
' . $sAccessWhere . '
ORDER BY FIELD(t.topic_id,?a) ';
$aTopics = array();
if ($aRows = $this->oDb->select($sql, $aArrayId, $aArrayId)) {
foreach ($aRows as $aTopic) {
$aTopics[] = Engine::GetEntity('Topic', $aTopic);
}
}
return $aTopics;
}
示例8: Exec
/**
* Запуск обработки
*/
public function Exec()
{
$sEntity = $this->GetParam('entity');
$oTarget = $this->GetParam('target');
$sTargetType = $this->GetParam('target_type');
if (!$oTarget) {
$oTarget = Engine::GetEntity($sEntity);
}
$aBehaviors = $oTarget->GetBehaviors();
foreach ($aBehaviors as $oBehavior) {
/**
* Определяем нужное нам поведение
*/
if ($oBehavior instanceof ModuleProperty_BehaviorEntity) {
/**
* Если в параметрах был тип, то переопределяем значение. Это необходимо для корректной работы, когда тип динамический.
*/
if ($sTargetType) {
$oBehavior->setParam('target_type', $sTargetType);
}
$aProperties = $this->Property_GetPropertiesForUpdate($oBehavior->getPropertyTargetType(), $oTarget->getId());
$this->Viewer_Assign('properties', $aProperties, true);
break;
}
}
$this->SetTemplate('component@property.input.list');
}
示例9: _createTopic
/**
* Create topic with default values
*
* @param int $iBlogId
* @param int $iUserId
* @param string $sTitle
* @param string $sText
* @param string $sTags
* @param string $sDate
*
* @return ModuleTopic_EntityTopic
*/
private function _createTopic($iBlogId, $iUserId, $sTitle, $sText, $sTags, $sDate)
{
$this->aActivePlugins = $this->oEngine->Plugin_GetActivePlugins();
$oTopic = Engine::GetEntity('Topic');
/* @var $oTopic ModuleTopic_EntityTopic */
$oTopic->setBlogId($iBlogId);
$oTopic->setUserId($iUserId);
$oTopic->setUserIp('127.0.0.1');
$oTopic->setForbidComment(false);
$oTopic->setType('topic');
$oTopic->setTitle($sTitle);
$oTopic->setPublishIndex(true);
$oTopic->setPublish(true);
$oTopic->setPublishDraft(true);
$oTopic->setDateAdd($sDate);
$oTopic->setTextSource($sText);
list($sTextShort, $sTextNew, $sTextCut) = $this->oEngine->Text_Cut($oTopic->getTextSource());
$oTopic->setCutText($sTextCut);
$oTopic->setText($this->oEngine->Text_Parser($sTextNew));
$oTopic->setTextShort($this->oEngine->Text_Parser($sTextShort));
$oTopic->setTextHash(md5($oTopic->getType() . $oTopic->getTextSource() . $oTopic->getTitle()));
$oTopic->setTags($sTags);
//with active plugin l10n added a field topic_lang
if (in_array('l10n', $this->aActivePlugins)) {
$oTopic->setTopicLang(Config::Get('lang.current'));
}
// @todo refact this
$oTopic->_setValidateScenario('topic');
$oTopic->_Validate();
$this->oEngine->Topic_AddTopic($oTopic);
return $oTopic;
}
示例10: Add
public function Add(ModuleUser_EntityUser $oUser)
{
if ($nUser = parent::Add($oUser)) {
$sId = $nUser->getId();
$aMhb = $this->PluginMHB_ModuleMain_GetAllMhb();
foreach ($aMhb as $oMhb) {
if ($oMhb->getAutoJoin()) {
if ($oBlog = $this->Blog_GetBlogById($oMhb->getBlogId())) {
$oBlogUserNew = Engine::GetEntity('Blog_BlogUser');
$oBlogUserNew->setUserId($sId);
$oBlogUserNew->setUserRole(ModuleBlog::BLOG_USER_ROLE_USER);
$oBlogUserNew->setBlogId($oBlog->getId());
$bResult = $this->Blog_AddRelationBlogUser($oBlogUserNew);
if ($bResult) {
$oBlog->setCountUser($oBlog->getCountUser() + 1);
$this->Blog_UpdateBlog($oBlog);
$this->Stream_write($sId, 'join_blog', $oBlog->getId());
$this->Userfeed_subscribeUser($sId, ModuleUserfeed::SUBSCRIBE_TYPE_BLOG, $oBlog->getId());
}
}
}
}
return $nUser;
}
return false;
}
示例11: GetQuestionByArrayId
public function GetQuestionByArrayId($aArrayId, $aOrder = null)
{
if (!is_array($aArrayId) || count($aArrayId) == 0) {
return array();
}
if (!is_array($aOrder)) {
$aOrder = array($aOrder);
}
$sOrder = '';
foreach ($aOrder as $key => $value) {
$value = (string) $value;
if (!in_array($key, array('question_id', 'question_category_id', 'question_date_add', 'question_user_ip'))) {
unset($aOrder[$key]);
} elseif (in_array($value, array('asc', 'desc'))) {
$sOrder .= " {$key} {$value},";
}
}
$sOrder = trim($sOrder, ',');
$sql = "SELECT * FROM " . Config::Get('db.table.receptiondesk_questions') . " WHERE question_id IN(?a) ORDER BY { FIELD(question_id,?a) }";
if ($sOrder != '') {
$sql .= $sOrder;
}
$aQuestion = array();
if ($aRows = $this->oDb->select($sql, $aArrayId, $sOrder == '' ? $aArrayId : DBSIMPLE_SKIP)) {
foreach ($aRows as $aRow) {
$aQuestion[] = Engine::GetEntity('PluginReceptiondesk_ModuleQuestion_EntityQuestion', $aRow);
}
}
return $aQuestion;
}
示例12: EventAdd
/**
* Добавление новой записи
*/
protected function EventAdd()
{
/**
* Устанавливаем title страницы
*/
$this->Viewer_AddHtmlTitle($this->Lang_Get('plugin.testimonials.add_testimonial_title'));
/**
* Проверяем авторизован ли пользователь
*/
if (!$this->User_IsAuthorization()) {
$this->Message_AddErrorSingle($this->Lang_Get('not_access'), $this->Lang_Get('error'));
return Router::Action('error');
}
/**
* Запускаем проверку корректности ввода полей.
* Дополнительно проверяем, что был отправлен POST запрос.
*/
if (!$this->checkTestimonialFields()) {
return false;
}
/**
* Если все ок, заполняем свойства
*/
$oTestimonial = Engine::GetEntity('PluginTestimonials_Testimonials');
$oTestimonial->setTextSource(getRequestStr('text'));
/**
* Парсим текст на предмет разных ХТМЛ тегов
*/
$sText = $this->Text_Parser(getRequestStr('text'));
$oTestimonial->setText($sText);
$oTestimonial->setUserId($this->oUserCurrent->getId());
$oTestimonial->setDateAdd(date("Y-m-d H:i:s"));
/**
* Проверяем права на постинг
*/
if (!$this->PluginTestimonials_ACL_CanAddTestimonial($this->oUserCurrent)) {
$this->Message_AddErrorSingle($this->Lang_Get('plugin.testimonials.create_error_noallow'), $this->Lang_Get('error'));
return false;
}
/**
* Проверяем разрешено ли постить по времени
*/
if (isPost('submit_testimonial_save') and !$this->PluginTestimonials_ACL_CanPostTestimonialTime($this->oUserCurrent)) {
$this->Message_AddErrorSingle($this->Lang_Get('topic_time_limit'), $this->Lang_Get('error'));
return;
}
/**
* Добавляем запись
*/
if ($this->PluginTestimonials_Testimonials_AddTestimonial($oTestimonial)) {
/**
* Добавляем событие в ленту
*/
$this->Stream_write($oTestimonial->getUserId(), 'add_testimonial', $oTestimonial->getId());
Router::Location(Router::GetPath('testimonials'));
} else {
$this->Message_AddError($this->Lang_Get('system_error'));
}
}
示例13: GetSubscriptionByMail
public function GetSubscriptionByMail($sMail, $sSubscriptionHash, $sUnsubscriptionHash)
{
$sql = "SELECT * FROM " . Config::Get('db.table.subscription_mail') . " WHERE subscription_mail=? { AND subscription_subscribe_hash=? } { AND subscription_unsubscribe_hash=? } AND subscription_unsubscribe_date IS NULL LIMIT 0,1;";
if ($aRow = $this->oDb->selectRow($sql, $sMail, !is_null($sSubscriptionHash) ? $sSubscriptionHash : DBSIMPLE_SKIP, !is_null($sUnsubscriptionHash) ? $sUnsubscriptionHash : DBSIMPLE_SKIP)) {
return Engine::GetEntity('PluginSubscription_ModuleSubscription_EntitySubscription', $aRow);
}
return false;
}
示例14: GetUserTalkSerialise
public function GetUserTalkSerialise($sUserId)
{
$sql = "SELECT * FROM " . Config::Get('plugin.talkbell.table.talk_bell') . " WHERE user_id = ?d";
if ($aRow = $this->oDb->selectRow($sql, $sUserId)) {
return Engine::GetEntity('PluginTalkbell_Talkbell', $aRow);
}
return false;
}
示例15: Write
/**
* Запись события в ленту
* @param type $oUser
* @param type $iEventType
* @param type $iTargetId
*/
public function Write($iUserId, $sEventType, $iTargetId)
{
$oEvent = Engine::GetEntity('Stream_Event');
$oEvent->setEventType($sEventType);
$oEvent->setUserId($iUserId);
$oEvent->setTargetId($iTargetId);
$oEvent->setDateAdded(date("Y-m-d H:i:s"));
$this->AddEvent($oEvent);
}