_getPair('Email') . ' ' . 'WHERE ' . $this->quoteField('completed', 'Email') . ' = "y" ' . 'ORDER BY added DESC ' . 'LIMIT 8'; $ids = $this->db->queryCol($sql); Qs_Db::isError($ids); if (empty($ids)) { return array(); } $sql = 'SELECT ' . '`Email`.`id`, ' . '`Email`.`id_individual`, ' . '`Email`.`subject`, ' . 'CONCAT(`Member`.`first_name`, " ", `Member`.`middle_initial`, ' . ' IF(`Member`.`middle_initial` = "" , "", ". "), ' . ' `Member`.`last_name`) AS `individual_full_name`, ' . '`Member`.`img` AS `individual_img`, ' . '`Company`.`name` AS `company_name`, ' . 'DEmailType.title AS `type` ' . 'FROM ' . $this->_getPair('Email') . ' ' . 'JOIN ' . $this->_getPair('DEmailType') . ' ' . ' ON `DEmailType`.`id` = `Email`.`id_type` ' . 'JOIN ' . $this->_getPair('Member') . ' ' . ' ON `Member`.`id` = `Email`.`id_individual` ' . 'LEFT JOIN ' . $this->_getPair('Location') . ' ' . ' ON `Location`.`id` = `Member`.`id_location` ' . 'LEFT JOIN ' . $this->_getPair('Company') . ' ' . ' ON `Company`.`id` = `Location`.`id_company` ' . 'WHERE `Email`.`id` IN (' . implode(', ', $ids) . ') ' . 'ORDER BY `Email`.`added` DESC'; $list = $this->db->queryAll($sql); Qs_Db::isError($list); return array('list' => $list); } function initFromForm(&$frm) { parent::initFromForm($frm); if (!$this->isAllowedBio()) { unset($this->_data['bio']); } $this->_data['profile_update'] = date('Y-m-d H:i:s'); return true; } public function touch() { $this->getTable()->update( array('profile_update' => date('Y-m-d H:i:s')), 'id=' . $this->db->quote($this->id, 'integer') ); } protected function _initAcountTypeFromForm(&$data) { } function isAllowedBio() { if (in_array($this->memberData['id_mncar_type'], $this->_allowedMncar2Bio) || in_array($this->memberData['id_mncar_l_type'], $this->_allowedMncarL2Bio) ) { return true; } return false; } function isAllowedBioCategories() { if (in_array($this->memberData['id_mncar_type'], $this->_allowedMncar2BioCategories) || in_array($this->memberData['id_mncar_l_type'], $this->_allowedMncarL2BioCategories) ) { return true; } return false; } function isAllowedTypeOfBusiness() { if (in_array($this->memberData['id_mncar_l_type'], $this->_allowedMncarL2TypeOfBusiness)) { return true; } return false; } function isMCPEAccess() { if ($this->memberData['allow_mcpe_access'] == 'y' ) { return true; } return false; } function update($data = null, $files = null) { if (empty($this->_data[$this->pass_field])){ unset($this->_data[$this->pass_field]); } else { $this->_data[$this->pass_field] = $this->_encryptPass($this->_data[$this->pass_field]); require_once('app/Member/MemberAuth.php'); MemberAuth::setSessionData($this->_data[$this->pass_field], $this->pass_field); } if (!is_null($data)) { $this->initFromArray($data, $files); } $this->_initTable(); $this->table->update($this->_data, 'id = '. $this->db->quote($this->id, 'integer') ); if ($this->isAllowedBioCategories()) { $this->updateIds($this->tableNameDB.'2SpecialtyInfo', 'id_specialty_info', $this->_data['id_specialty_info']); $this->updateIds($this->tableNameDB.'2AreaInfo', 'id_area_info', $this->_data['id_area_info']); $this->updateIds($this->tableNameDB.'2Area', 'id_area', $this->_data['id_area']); $this->updateIds($this->tableNameDB.'2Specialty', 'id_specialty', $this->_data['id_specialty']); $this->updateIds($this->tableNameDB.'2LineOfWork', 'id_line_of_work', $this->_data['id_line_of_work']); } if ($this->isMCPEAccess()) { $this->updateIds($this->tableNameDB.'2EmailType', 'id_email_type', $this->_data['id_email_type']); $this->updateIds($this->tableNameDB.'2EmailGroup', 'group_id', $this->_data['id_email_group'], 'member_id'); } $this->updateIds($this->tableNameDB.'2BlockedMember', 'id_blocked_member', $this->_data['id_blocked_member']); $this->handleFiles(); return true; } function deactivate($id) { $id = intval($id); $this->_initTable(); $this->table->update(array('email_verified'=>'n', 'info_verified'=>'n'), 'id = '. $this->db->quote($id, 'integer')); } function updateRow($data) { $this->_initTable(); $this->table->update($data, 'id=' . $this->db->quote($this->id, 'integer')); } }