Skip to content

Commit

Permalink
Rebase ALSFRS stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
k00ni committed Nov 13, 2011
1 parent 741ff05 commit 3d0a136
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 159 deletions.
9 changes: 9 additions & 0 deletions classes/ALSFRS.php
Expand Up @@ -92,4 +92,13 @@ public function getTopicsWithOptions ( $topics, $currentLanguage = 'de' )


return $result; return $result;
} }


/**
*
*/
public function generateAlsfrsFormulaPredicates ()
{

}
} }
54 changes: 45 additions & 9 deletions classes/Formula.php
Expand Up @@ -35,6 +35,8 @@ public function __construct($index, $selectedModel)
$this->_data ['resource'] = ""; $this->_data ['resource'] = "";
$this->_data ['sections'] = array (); $this->_data ['sections'] = array ();
$this->_data ['selectResourceOfType'] = ''; $this->_data ['selectResourceOfType'] = '';
$this->_data ['formulaType'] = 'normal';
$this->_data ['formulaParameter'] = array ();


$this->_selectedModel = $selectedModel; $this->_selectedModel = $selectedModel;
} }
Expand All @@ -43,6 +45,42 @@ public function __construct($index, $selectedModel)
// ----------------------------------------------------------------- // -----------------------------------------------------------------




/**
* @return void
*/
public function setFormulaParameter ($value)
{
$this->_data ['formulaParameter'] = $value;
}


/**
* @return string
*/
public function getFormulaParameter ()
{
return $this->_data ['formulaParameter'];
}


/**
* @return void
*/
public function setFormulaType ($value)
{
$this->_data ['formulaType'] = $value;
}


/**
* @return string
*/
public function getFormulaType ()
{
return $this->_data ['formulaType'];
}


/** /**
* @return void * @return void
*/ */
Expand Down Expand Up @@ -332,6 +370,8 @@ public function getDataAsArrays ()
$arr = array ( $arr = array (
'title' => $this->getTitle (), 'title' => $this->getTitle (),
'index' => $this->getIndex (), 'index' => $this->getIndex (),
'formulaType' => $this->getFormulaType (),
'formulaParameter' => $this->getFormulaParameter (),
'description' => $this->getDescription (), 'description' => $this->getDescription (),
'selectResourceOfType' => $this->getSelectResourceOfType (), 'selectResourceOfType' => $this->getSelectResourceOfType (),
'labelparts' => $this->getLabelparts (), 'labelparts' => $this->getLabelparts (),
Expand Down Expand Up @@ -408,6 +448,11 @@ public function initByArray ($formArray)
$form->setTargetClass ($formArray ['targetclass']); $form->setTargetClass ($formArray ['targetclass']);


$form->setXmlFile ($formArray ['xmlfile']); $form->setXmlFile ($formArray ['xmlfile']);

$form->setFormulaType ($formArray ['formulaType']);

$form->setFormulaParameter ($formArray ['formulaParameter']);



foreach ($formArray ['sections'] as $entry) foreach ($formArray ['sections'] as $entry)
{ {
Expand Down Expand Up @@ -619,13 +664,4 @@ public function replaceNamespaces($s)


return str_replace('architecture:', $namespaceUri, $s); return str_replace('architecture:', $namespaceUri, $s);
} }


/**
*
*/
public function generateAlsfrsPredicates ()
{

}
} }
92 changes: 41 additions & 51 deletions classes/XmlConfig.php
Expand Up @@ -46,6 +46,7 @@ public function loadFile ($file, &$form)
$xmlFile = substr($xmlFile, 0, strpos ($xmlFile, '.')); // delete extension $xmlFile = substr($xmlFile, 0, strpos ($xmlFile, '.')); // delete extension
$form->setXmlFile($xmlFile); $form->setXmlFile($xmlFile);


// generate a specify XML


// ReadIn all readable data from XML-Config file. // ReadIn all readable data from XML-Config file.
foreach ($xml as $nodeName => $nodeValue) foreach ($xml as $nodeName => $nodeValue)
Expand Down Expand Up @@ -76,6 +77,33 @@ public function loadFile ($file, &$form)
break; break;




case 'formulaType':
$form->setTargetClass ((string) $nodeValue [0]);

break;


case 'formulaParameter':

$p = array ();

$p ['predicateToHealthState'] = (string) $xml->formulaParameter->predicateToHealthState;
$p ['healthState'] = (string) $xml->formulaParameter->healthState;

$p ['predicateToPropertySet'] = (string) $xml->formulaParameter->predicateToPropertySet;
$p ['propertySet'] = (string) $xml->formulaParameter->propertySet;

$p ['predicateToSymptomSet'] = (string) $xml->formulaParameter->predicateToSymptomSet;
$p ['symptomSet'] = (string) $xml->formulaParameter->predicateToSymptomSet;

$p ['predicateToPropertyOption'] = (string) $xml->formulaParameter->predicateToPropertyOption;
$p ['predicateToSymptomOption'] = (string) $xml->formulaParameter->predicateToSymptomOption;

$form->setFormulaParameter ( $p );

break;


case 'labelparts': case 'labelparts':


foreach ($xml->labelparts->item as $nodeValue) foreach ($xml->labelparts->item as $nodeValue)
Expand Down Expand Up @@ -109,61 +137,23 @@ public function loadFile ($file, &$form)


// set typeparameters // set typeparameters
switch ( $type ) switch ( $type )
{ {
// ALSFRS: complex structure of relations and instances // a ALSFRS question with options
case 'alsfrs': case 'alsfrsquestion':


$typeparameter ['predicateToHealthState'] = (string) $options = array ();
$predicate->typeparameter->predicateToHealthState;


$typeparameter ['healthState'] = $predicate->typeparameter->healthState; foreach ($predicate->typeparameter->options->item as $i)

$options [] = (string) $i;
$typeparameter ['predicateToPropertySet'] = (string)
$predicate->typeparameter->predicateToPropertySet; $typeparameter [] = array (

'topicUri' => (string) $predicate->typeparameter->topicUri,
$typeparameter ['propertySet'] = $predicate->typeparameter->propertySet; 'pertainsTo' => (string) $predicate->typeparameter->pertainsTo,

'options' => $options
$typeparameter ['predicateToSymptomSet'] = (string) );
$predicate->typeparameter->predicateToSymptomSet;

$typeparameter ['symptomSet'] = $predicate->typeparameter->symptomSet;

$typeparameter ['predicateToPropertyOption'] = (string)
$predicate->typeparameter->predicateToPropertyOption;

$typeparameter ['predicateToSymptomOption'] = (string)
$predicate->typeparameter->predicateToSymptomOption;

// topic
$typeparameter ['topic'] = (string)
$predicate->typeparameter->topic;

$typeparameter ['topicLabel'] = (string)
$predicate->typeparameter->topicLabel;

$typeparameter ['topicSuggestedQuestion'] = (string)
$predicate->typeparameter->topicSuggestedQuestion;

$typeparameter ['topicHasOption'] = (string)
$predicate->typeparameter->topicHasOption;

// option
$typeparameter ['option'] = (string)
$predicate->typeparameter->option;

$typeparameter ['optionLabel'] = (string)
$predicate->typeparameter->optionLabel;

// clear assignment which topics are SymptomOptions
foreach ($predicate->typeparameter->pertainsToSymptomSet->item as $parameter)
$typeparameter ['pertainsToSymptomSet'][] = (string) $parameter;


// clear assignment which topics are PropertyOptions
foreach ($predicate->typeparameter->pertainsToPropertySet->item as $parameter)
$typeparameter ['pertainsToPropertySet'][] = (string) $parameter;

break; break;

case 'date': case 'date':
break; break;


Expand Down
41 changes: 0 additions & 41 deletions jshtmlplugins/alsfrs.phtml

This file was deleted.

34 changes: 34 additions & 0 deletions jshtmlplugins/alsfrsquestion.phtml
@@ -0,0 +1,34 @@
<?php
/**
* @category OntoWiki
* @package OntoWiki_extensions_formgenerator
* @author Lars Eidam <larseidam@googlemail.com>
* @author Konrad Abicht <konrad@inspirito.de>
* @copyright Copyright (c) 2011
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
*/


?>

<div class="content">
<!-- question -->
<h3><?php echo 'FRAGE'; ?></h3>

<input type="radio" name="<?php echo $element ['name']; ?>"/>

<?php /*echo $topic ['suggestedQuestion']; ?></h3>
<!-- list of options -->
<?php foreach ( $topic['options'] as $option ) { ?>
<br/>
<input type="radio" value="" name=""/>
&nbsp; <?php echo $option ['label']; ?>
<?php }*/ ?>

</div>


<div class="content">
6 changes: 3 additions & 3 deletions templates/formgenerator/form.phtml
Expand Up @@ -114,9 +114,9 @@


<?php require $this->dirJsHtmlPlugins . 'resource.phtml'; ?> <?php require $this->dirJsHtmlPlugins . 'resource.phtml'; ?>


<?php } elseif ('alsfrs' == $element ['type']) { ?> <?php } elseif ('alsfrsquestion' == $element ['type']) { ?>

</div>
<?php require $this->dirJsHtmlPlugins . 'alsfrs.phtml'; ?> <?php require $this->dirJsHtmlPlugins . 'alsfrsquestion.phtml'; ?>


<?php } else { ?> <?php } else { ?>


Expand Down

0 comments on commit 3d0a136

Please sign in to comment.