Ejemplo n.º 1
0
 /**
  * Funkce pro přidání PreprocessingHint
  */
 function addPreprocessingHint()
 {
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'bkef.php';
     $model = new BkefModel();
     if ($_POST['potvrzeni'] == 1) {
         //skutecne smazeme
         $xml = $model->load(JRequest::getInt('article'));
         $maId = intval(JRequest::getInt('maId', -1));
         $fId = intval(JRequest::getInt('fId', -1));
         if (!isset($xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->PreprocessingHints[0])) {
             $xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->addChild('PreprocessingHints');
         }
         $preprocessingHint = $xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->PreprocessingHints[0]->addChild('PreprocessingHint');
         $preprocessingHint['name'] = JRequest::getString('name');
         /*if (JRequest::getString('type')=="IntervalEnumeration"){
             $preprocessingHint->addChild('DiscretizationHint')->addChild('IntervalEnumeration');
             $preprocessingHint->addChild('DiscretizationHint')->addChild('Equidistant');
           }else {  */
         $preprocessingHint->addChild('DiscretizationHint')->addChild((string) JRequest::getString('type'));
         /*}*/
         //exit(var_dump($preprocessingHint));
         $model->save(JRequest::getInt('article'), $xml->asXML());
         $this->_redirect = 'index.php?option=com_bkef&task=format&article=' . JRequest::getInt('article') . '&maId=' . $maId . '&fId=' . $fId . '#preprocessingHints';
     } else {
         //zobrazime dotaz
         require_once JPATH_COMPONENT . DS . 'views' . DS . 'iframe' . DS . 'addPreprocessingHint.html.php';
         $view = new BkefViewAddPreprocessingHint();
         $view->xml = $model->load(JRequest::getInt('article'));
         $view->article = JRequest::getInt('article');
         $view->maId = JRequest::getInt('maId');
         $view->fId = JRequest::getInt('fId');
         $view->display();
     }
 }
Ejemplo n.º 2
0
 /**
  * Funkce pro přidání PreprocessingHint
  */
 function addPreprocessingHint()
 {
     /*DONE*/
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'bkef.php';
     $model = new BkefModel();
     if ($_POST['potvrzeni'] == 1) {
         //skutecne ukladame
         $xml = $model->load(JRequest::getInt('article'));
         $maId = intval(JRequest::getInt('maId', -1));
         $fId = intval(JRequest::getInt('fId', -1));
         if (!isset($xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->PreprocessingHints[0])) {
             $xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->addChild('PreprocessingHints');
         }
         $discretizationHint = $xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->PreprocessingHints[0]->addChild('DiscretizationHint');
         $discretizationHint->addChild('Name', JRequest::getString('name'));
         //aktualizace data/casu posledni zmeny
         $created = $discretizationHint->addChild('Created');
         $created->addChild('Timestamp', date('c'));
         $created->addChild('Author', $this->getUserName());
         $modified = $discretizationHint->addChild('LastModified');
         $modified->addChild('Timestamp', date('c'));
         $modified->addChild('Author', $this->getUserName());
         $discretizationHint->addChild('Annotations');
         $xml->Header[0]->LastModified[0]->Author = $this->getUserName();
         $xml->Header[0]->LastModified[0]->Timestamp = date('c');
         $xml->MetaAttributes[0]->MetaAttribute[$maId]->LastModified[0]->Author = $this->getUserName();
         $xml->MetaAttributes[0]->MetaAttribute[$maId]->LastModified[0]->Timestamp = date('c');
         $xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->LastModified[0]->Author = $this->getUserName();
         $xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->LastModified[0]->Timestamp = date('c');
         //typ
         $discretizationHintType = (string) JRequest::getString('type');
         $discretizationHintCreated = $discretizationHint->addChild($discretizationHintType);
         if ($discretizationHingType == 'EquidistantInterval') {
             $discretizationHintCreated->addChild('Start');
             $discretizationHintCreated->addChild('End');
             $discretizationHintCreated->addChild('Step');
         }
         //save
         $model->save(JRequest::getInt('article'), $xml->asXML());
         $this->_redirect = 'index.php?option=com_bkef&task=format&article=' . JRequest::getInt('article') . '&maId=' . $maId . '&fId=' . $fId . '#preprocessingHints';
     } else {
         //zobrazime dotaz
         require_once JPATH_COMPONENT . DS . 'views' . DS . 'iframe' . DS . 'addPreprocessingHint.html.php';
         $view = new BkefViewAddPreprocessingHint();
         $view->xml = $model->load(JRequest::getInt('article'));
         $view->article = JRequest::getInt('article');
         $view->maId = JRequest::getInt('maId');
         $view->fId = JRequest::getInt('fId');
         $view->display();
     }
 }