Ejemplo n.º 1
0
 /**
  * Funkce pro úpravu anotace value description
  */
 function addValueDescription()
 {
     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));
         $vd = JRequest::getString('vd');
         $annotationText = JRequest::getString('annotationText');
         $annotationAuthor = JRequest::getString('annotationAuthor');
         if (!isset($xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->ValueDescriptions[0])) {
             $vdNode = $xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->addChild('ValueDescriptions');
         }
         $valueDescription = $xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->ValueDescriptions[0]->addChild('ValueDescription');
         // exit(var_dump($valueDescription));
         $valueDescription['type'] = (string) $vd;
         $valueDescription->addChild('Annotation');
         $valueDescription->Annotation[0]->addChild('Text', $annotationText);
         $valueDescription->Annotation[0]->addChild('Author', $annotationAuthor);
         $model->save(JRequest::getInt('article'), $xml->asXML());
         $this->_redirect = 'index.php?option=com_bkef&task=format&article=' . JRequest::getInt('article') . '&maId=' . $maId . '&fId=' . $fId . '#valueDescriptions';
     } else {
         //zobrazime dotaz
         require_once JPATH_COMPONENT . DS . 'views' . DS . 'iframe' . DS . 'addValueDescription.html.php';
         $view = new BkefViewAddValueDescription();
         $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 úpravu anotace value description
  */
 function addValueDescription()
 {
     /*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));
         $vdFeature = JRequest::getString('vdFeature');
         $annotationText = JRequest::getString('annotationText');
         $annotationAuthor = JRequest::getString('annotationAuthor');
         if (!isset($xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->ValueDescriptions[0])) {
             $vdNode = $xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->addChild('ValueDescriptions');
         }
         //pridame novou valueDescription
         $valueDescription = $xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->ValueDescriptions[0]->addChild('ValueDescription');
         //ulozime anotaci
         $valueDescription->addChild('Annotations');
         $annotation = $valueDescription->Annotations[0]->addChild('Annotation');
         $annotation->addChild('Created');
         $annotation->Created[0]->addChild('Timestamp', date('c'));
         $annotation->Created[0]->addChild('Author', $annotationAuthor);
         $annotation->addChild('LastModified');
         $annotation->LastModified[0]->addChild('Timestamp', date('c'));
         $annotation->LastModified[0]->addChild('Author', $annotationAuthor);
         $annotation->addChild('Text', $annotationText);
         //dalsi elementy
         $valueDescription->addChild('Scope');
         $valueDescription->addChild('Features');
         $valueDescription->Features[0]->addChild('Feature', (string) $vdFeature);
         //aktualizace data/casu posledni zmeny
         $xml->Header[0]->LastModified[0]->Author = $this->getUserName();
         $xml->Header[0]->LastModified[0]->Timestamp = date('c');
         $metaAttribute->LastModified[0]->Author = $this->getUserName();
         $metaAttribute->LastModified[0]->Timestamp = date('c');
         $metaAttribute->Formats[0]->Format[$fId]->LastModified[0]->Author = $this->getUserName();
         $metaAttribute->Formats[0]->Format[$fId]->LastModified[0]->Timestamp = date('c');
         //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 . '#valueDescriptions';
     } else {
         //zobrazime dotaz
         require_once JPATH_COMPONENT . DS . 'views' . DS . 'iframe' . DS . 'addValueDescription.html.php';
         $view = new BkefViewAddValueDescription();
         $view->xml = $model->load(JRequest::getInt('article'));
         $view->article = JRequest::getInt('article');
         $view->maId = JRequest::getInt('maId');
         $view->fId = JRequest::getInt('fId');
         $view->display();
     }
 }