TTi18n::gettext( 'Form' ), 20 => TTi18n::gettext( 'Page' ), ]; break; case 'status': $retval = [ 10 => TTi18n::gettext( 'NEW' ), 15 => TTi18n::gettext( 'Pending Approval' ), 20 => TTi18n::gettext( 'ACTIVE' ), ]; break; } return $retval; } /** * @return int */ function getType() { return (int)$this->getGenericDataValue( 'type_id' ); } /** * @param $value * @return bool */ function setType( $value ) { $value = trim( $value ); $key = Option::getByValue( $value, $this->getOptions( 'type' ) ); if ( $key !== false ) { $value = $key; } Debug::Text( 'bType: ' . $value, __FILE__, __LINE__, __METHOD__, 10 ); return $this->setGenericDataValue( 'type_id', $value ); } /** * @return int */ function getStatus() { return (int)$this->getGenericDataValue( 'status_id' ); } /** * @param $value * @return bool */ function setStatus( $value ) { $value = trim( $value ); $key = Option::getByValue( $value, $this->getOptions( 'status' ) ); if ( $key !== false ) { $value = $key; } return $this->setGenericDataValue( 'status_id', $value ); } /** * @return mixed */ function getHeading() { return $this->getGenericDataValue( 'heading' ); } /** * @param $value * @return bool */ function setHeading( $value ) { $value = trim( $value ); return $this->setGenericDataValue( 'heading', $value ); } /** * @return mixed */ function getBody() { return $this->getGenericDataValue( 'body' ); } /** * @param $value * @return bool */ function setBody( $value ) { $value = trim( $value ); return $this->setGenericDataValue( 'body', $value ); } /** * @return mixed */ function getKeywords() { return $this->getGenericDataValue( 'keywords' ); } /** * @param $value * @return bool */ function setKeywords( $value ) { $value = trim( $value ); return $this->setGenericDataValue( 'keywords', $value ); } /** * @return bool */ function getPrivate() { return $this->fromBool( $this->getGenericDataValue( 'private' ) ); } /** * @param $value * @return bool */ function setPrivate( $value ) { return $this->setGenericDataValue( 'private', $this->toBool( $value ) ); } /** * @return bool */ function Validate() { // // BELOW: Validation code moved from set*() functions. // // Type $this->Validator->inArrayKey( 'type', $this->getType(), TTi18n::gettext( 'Incorrect Type' ), $this->getOptions( 'type' ) ); // Status $this->Validator->inArrayKey( 'status', $this->getStatus(), TTi18n::gettext( 'Incorrect Status' ), $this->getOptions( 'status' ) ); // Heading length if ( $this->getHeading() != null ) { $this->Validator->isLength( 'heading', $this->getHeading(), TTi18n::gettext( 'Incorrect Heading length' ), 2, 255 ); } // Body if ( $this->getBody() != null ) { $this->Validator->isLength( 'body', $this->getBody(), TTi18n::gettext( 'Incorrect Body length' ), 2, 2048 ); } // Keywords if ( $this->getKeywords() != null ) { $this->Validator->isLength( 'keywords', $this->getKeywords(), TTi18n::gettext( 'Incorrect Keywords length' ), 2, 1024 ); } // // ABOVE: Validation code moved from set*() functions. // return true; } } ?>