public function SetSelectValues() { if ($this->TryToApplyUsualScheme()) { return; } $this->CheckSearch(); $fields = array(); switch ($this->samplingScheme) { case static::REGISTRATION_CHECK_SCHEME: $fields = SQL::PrepareFieldsForSelect(static::TABLE, [$this->idField, $this->GetFieldByName(static::LOGIN_FLD)]); break; case static::LOGIN_SCHEME: $fields = SQL::PrepareFieldsForSelect(static::TABLE, array($this->idField, $this->GetFieldByName(static::PASS_FLD), $this->GetFieldByName(static::SALT_FLD))); break; case static::PROFILE_INFO_SCHEME: $fields = SQL::PrepareFieldsForSelect(static::TABLE, [$this->idField, $this->GetFieldByName(static::NAME_FLD), $this->GetFieldByName(static::SURNAME_FLD), $this->GetFieldByName(static::PHONE_FLD), $this->GetFieldByName(static::ROOM_FLD), $this->GetFieldByName(static::DESCRIPTION_FLD), $this->GetFieldByName(static::REGISTER_DATE_FLD), $this->GetFieldByName(static::LAST_UPDATE_FLD), $this->GetFieldByName(static::PROFILE_VIEWS_FLD)]); $fields[] = ImageWithFlagSelectSQL(static::TABLE, $this->GetFieldByName(static::PHOTO_FLD)); $fields[] = sprintf("(SELECT get_user_ad_amount_by_id(%s)) as ad_amount", $this->accSelf ? SQL::ToTblNm(Session::TABLE, Session::USER_FLD) : SQL::ToTblNm(static::TABLE, static::ID_FLD)); break; case static::EXTRA_DATA_SCHEME: $fields = SQL::PrepareFieldsForSelect(static::TABLE, [$this->GetFieldByName(static::DESCRIPTION_FLD)]); break; case static::CONTACT_INFO_SCHEME: $fields = SQL::PrepareFieldsForSelect(static::TABLE, [$this->GetFieldByName(static::ROOM_FLD), $this->GetFieldByName(static::PHONE_FLD)]); break; case static::NAME_INFO_SCHEME: $fields = SQL::PrepareFieldsForSelect(static::TABLE, [$this->GetFieldByName(static::NAME_FLD), $this->GetFieldByName(static::SURNAME_FLD)]); break; } $this->selectFields = SQL::GetListFieldsForSelect($fields); }
public function ToTblNm($name) { return SQL::ToTblNm(static::TABLE, $name); }
public function GetSQL() { return SQL::ToTblNm($this->table, $this->field->GetName()); }
public function GetOrder() { $result = ''; $amount = count($this->fields); foreach ($this->fields as $key => $field) { $result .= (!empty($field['info']) ? SQL::ToTblNm($field['info']->table, $field['info']->GetFieldName()) : '') . ' ' . $field['type'] . ($key < $amount - 1 ? ', ' : ''); } return $result; }