getGenericDataValue( 'script_name' ); } /** * @param $value * @return bool */ function setScriptName( $value ) { $value = trim( $value ); return $this->setGenericDataValue( 'script_name', $value ); } /** * @return mixed */ function getName() { return $this->getGenericDataValue( 'name' ); } /** * @param $value * @return bool */ function setName( $value ) { $value = trim( $value ); return $this->setGenericDataValue( 'name', $value ); } /** * @return array|bool */ function getHelp() { $hglf = TTnew( 'HelpGroupListFactory' ); /** @var HelpGroupListFactory $hglf */ $hglf->getByHelpGroupControlId( $this->getId() ); foreach ( $hglf as $help_group_obj ) { $help_list[] = $help_group_obj->getHelp(); } if ( isset( $help_list ) ) { return $help_list; } return false; } /** * @param string $ids UUID * @return bool */ function setHelp( $ids ) { //If needed, delete mappings first. $hglf = TTnew( 'HelpGroupListFactory' ); /** @var HelpGroupListFactory $hglf */ $hglf->getByHelpGroupControlId( $this->getId() ); $help_ids = []; foreach ( $hglf as $help_group_entry ) { $help_id = $help_group_entry->getHelp(); Debug::text( 'Help ID: ' . $help_group_entry->getHelp(), __FILE__, __LINE__, __METHOD__, 10 ); //Delete all items first. $help_group_entry->Delete(); } if ( is_array( $ids ) && count( $ids ) > 0 ) { //Insert new mappings. $hgf = TTnew( 'HelpGroupFactory' ); /** @var HelpGroupFactory $hgf */ $i = 0; foreach ( $ids as $id ) { //if ( !in_array($id, $help_ids) ) { $hgf->setHelpGroupControl( $this->getId() ); $hgf->setOrder( $i ); $hgf->setHelp( $id ); if ( $this->Validator->isTrue( 'help', $hgf->isValid(), TTi18n::gettext( 'Incorrect Help Entry' ) ) ) { $hgf->save(); } //} $i++; } //return TRUE; } return true; } /** * @return bool */ function Validate() { // // BELOW: Validation code moved from set*() functions. // // Script Name $this->Validator->isLength( 'script_name', $this->getScriptName(), TTi18n::gettext( 'Incorrect Script Name' ), 2, 255 ); // Name $this->Validator->isLength( 'name', $this->getName(), TTi18n::gettext( 'Incorrect Name' ), 2, 255 ); // // ABOVE: Validation code moved from set*() functions. // return true; } } ?>