public static function getPerson($id) { $person = PersonModel::personPrepare()->where(PersonModel::getField('id'), $id)->first(); if ($person->feed_id) { $person['posts'] = \Post::postsFeed($person->feed_id); } else { $person['posts'] = array(); } return $person; }
public function popup() { $session_id = \Session::get('chat_session_id'); $data = array('persons' => PersonModel::join(PersonLangModel::getTableName(), PersonLangModel::getField('person_id'), '=', PersonModel::getField('id'))->select(PersonModel::getField('id'), PersonLangModel::getField('first_name'), PersonLangModel::getField('function'), PersonLangModel::getField('last_name'))->orderBy(PersonLangModel::getField('first_name'))->where(PersonModel::getField('for_audience'), 1)->where(PersonLangModel::getField('lang_id'), \WebAPL\Language::getId())->get(), 'session_exist' => false); if ($session_id) { $data['chat'] = \FireChatSession::find($session_id); if ($data['chat']) { if ($data['chat']->active) { $data['session_exist'] = true; $data['person'] = PersonModel::join(PersonLangModel::getTableName(), PersonLangModel::getField('person_id'), '=', PersonModel::getField('id'))->select(PersonModel::getField('id'), PersonLangModel::getField('first_name'), PersonLangModel::getField('function'), PersonLangModel::getField('last_name'))->orderBy(PersonLangModel::getField('first_name'))->where(PersonModel::getField('for_audience'), 1)->where(\PersonModel::getField('id'), $data['chat']->person_id)->where(PersonLangModel::getField('lang_id'), \WebAPL\Language::getId())->first(); $data['person_icon'] = \Files::getfile('person_chat', $data['chat']->person_id); } } } echo Template::moduleView($this->module_name, 'views.chat-popup', $data); }