hasAuth()) { $id = $doc->getAuth()->getData('id'); $data = $this->_getFromDb($id); $data['fullName'] = self::getFullName($data); $this->_setHtmlPlaceholdersData($data); } return parent::getPlaceholdersData(); } public function getUsers4Json($term) { $select = $this->_db->select(); $select->from($this->_getPair('User'), self::getAutocompleteColumns()) ->where('`firstName` LIKE ? OR `lastName` LIKE ?', '%' . $term . '%'); return $this->_db->fetchAll($select); } static public function getFullName($data) { $name = $data['firstName'] . ' ' . $data['middleInitial'] . ' ' . $data['lastName']; if (!empty($data['suffix'])) { $name .= ', ' . $data['suffix']; } return $name; } protected static function _getAutocompleteItemSelect($userId) { $select = parent::_getAutocompleteItemSelect($userId); $select->where('active = "y"'); return $select; } public static function getStateTitle(array $data) { $state = isset($data['state']) ? $data['state'] : null; if (isset($data['countryId']) && $data['countryId'] == 'US' && strlen($state) === 2) { $table = new Qs_Db_Table('DState'); $state = $table->search($state, 'title'); } return $state; } public static function getStateId(array $data) { $state = isset($data['state']) ? $data['state'] : null; if (isset($data['countryId']) && $data['countryId'] == 'US' && strlen($state) > 2) { $table = new Qs_Db_Table('DState'); $state = $table->searchBy(array('title' => $state), 'id'); } return $state; } public static function getFullCountry($countryId) { if ($countryId) { $table = new Qs_Db_Table('DCountry'); return $table->search($countryId, 'title'); } return null; } public function getEmails() { $select = $this->_db->select(); $select->from($this->_getPair('User'), ['id', 'email']); return $this->_db->fetchPairs($select); } public function getUserIdByEMail($email) { $select = $this->_db->select(); $select->from($this->_getPair('User'), 'id')->where('email = ?', $email); return $this->_db->fetchOne($select); } }