protected function setupTemplate()
 {
     parent::setupTemplate();
     $tid = $this->fieldData['editid'];
     $this->assign('templateID', $tid);
     $this->assign('templateFileName', MVCUtils::getTemplateFileName($tid));
     $this->assign('templateModel', MVCUtils::getModelClassNameFromDB($tid));
     $this->assign('templateViewer', MVCUtils::getViewerClassNameFromDB($tid));
     $this->assign('templateRealm', MVCUtils::getRealmIDFromDB($tid));
 }
 /**
  * Initialise the model
  *
  * Will initialise the model class. The class name is stored in the 
  * $modelClassName class variable.
  * 
  * @return Model Returns the initialised model for use if required
  */
 public static function initializeModel($templateIDS, $formName = null, $modelModuleName, $viewerModuleName, $fieldData = array(), $errors = array())
 {
     global $cfg;
     if (isset($fieldData['moduleName'])) {
         $modelClassName = MVCUtils::getModelClassNameFromDB($formName, $fieldData['moduleName']);
         MVCUtils::includeModel($modelClassName, $modelModuleName);
     } else {
         $modelClassName = MVCUtils::getModelClassNameFromDB();
         MVCUtils::includeModel($modelClassName, $modelModuleName);
     }
     $pathParts = pathinfo($modelClassName);
     $realClassName = $pathParts['basename'];
     eval("\$model = new " . $realClassName . "(\$templateIDS, \$formName, \$modelModuleName, \$viewerModuleName, \$fieldData, \$errors);");
     return $model;
 }