exportValues(); $this->arrayParseUrl2Tag($data); $files = array(); $this->initFromArray($data, $files); $this->_data['ids_member'] = array_keys((array)$_REQUEST['ids_member']); return true; } function getFromDB($id, $field = false) { $id = intval($id); $sql = " SELECT {$this->tableName}.* FROM {$this->tableNameDB} AS {$this->tableName} WHERE {$this->tableName}.id = $id "; $res = $this->db->queryRow($sql); if ($field === false) { $res['ids_member'] = $this->getMembersFromDB($id); } $this->arrayParseTag2Url(&$res); return $this->getSubElem($res, $field); } function getMembersFromDB($id_parent) { $from = " Member.id, CONCAT(Member.first_name, ' ', Member.middle_initial, IF (Member.middle_initial = '' , '', '. '), Member.last_name, ' (', Member.email,')') as full_name FROM {$this->tableNameDB} as Member "; $sql = " SELECT {$from} LEFT JOIN {$this->tableNameDB}2Member as Member2Member ON Member.id = Member2Member.id_member WHERE 1 AND Member2Member.id_parent = " . intval($id_parent) . " AND Member.is_support_account = 'n' UNION SELECT {$from} WHERE Member.id = ".intval($id_parent)." ORDER BY full_name "; $res = $this->db->queryAll($sql, 0, nnull, true); $this->_sqlError($res); return $res; } function update($data = null, $files = null) { require_once('app/SupportAccount/SupportAccountAuth.php'); 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]); SupportAccountAuth::setSessionData($this->_data[$this->pass_field], $this->pass_field); } SupportAccountAuth::setSessionData($this->_data[$this->login_field], $this->login_field); if (!is_null($data)) { $this->initFromArray($data, $files); } $this->_initTable(); $this->table->update($this->_data, 'id = '. $this->db->quote($this->id, 'integer') ); $this->updateIds($this->tableNameDB.'2Member', 'id_member', $this->_data['ids_member']); return true; } function getAgentsInvitations() { $sql = " SELECT MemberSupportRequest.*, CONCAT(Member.first_name, ' ', Member.middle_initial, IF (Member.middle_initial = '' , '', '. '), Member.last_name, ' (', Member.email,')') as full_name FROM {$this->db->tblMemberSupportRequest} as MemberSupportRequest JOIN {$this->db->tblMember} as Member ON Member.id = MemberSupportRequest.id_member WHERE MemberSupportRequest.id_support_account = ".$this->db->quote($this->id)." AND MemberSupportRequest.authorized = 'n' "; $res = $this->db->queryAll($sql); $this->_sqlError($res); return $res; } function getMyRequests() { $sql = " SELECT SupportAccountRequest.*, CONCAT(Member.first_name, ' ', Member.middle_initial, IF (Member.middle_initial = '' , '', '. '), Member.last_name, ' (', Member.email,')') as full_name FROM {$this->db->tblSupportAccountRequest} as SupportAccountRequest JOIN {$this->db->tblMember} as Member ON Member.id = SupportAccountRequest.id_requested_member WHERE SupportAccountRequest.id_support_account = ".$this->db->quote($this->id)." AND SupportAccountRequest.authorized = 'n' "; $res = $this->db->queryAll($sql); $this->_sqlError($res); return $res; } }