/** * Funkce pro přidání value do ExhaustiveEnumeration Bin */ function equidistant() { require_once JPATH_COMPONENT . DS . 'models' . DS . 'bkef.php'; $model = new BkefModel(); if ($_POST['potvrzeni'] == 1) { //pridame hodnotu $xml = $model->load(JRequest::getInt('article')); $maId = intval(JRequest::getInt('maId', -1)); $fId = intval(JRequest::getInt('fId', -1)); $phId = intval(JRequest::getInt('phId', -1)); if (!isset($xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->PreprocessingHints[0]->PreprocessingHint[$phId]->DiscretizationHint[0]->Equidistant[0])) { $xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->PreprocessingHints[0]->PreprocessingHint[$phId]->DiscretizationHint[0]->addChild('Equidistant'); } $equidistant = $xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->PreprocessingHints[0]->PreprocessingHint[$phId]->DiscretizationHint[0]->Equidistant[0]; if (!isset($equidistant->Start)) { $equidistant->addChild('Start'); } if (!isset($equidistant->End)) { $equidistant->addChild('End'); } if (!isset($equidistant->Step)) { $equidistant->addChild('Step'); } $equidistant->Start[0]['type'] = JRequest::getString('leftBoundType'); $equidistant->Start[0] = checknumber(JRequest::getString('leftBoundValue')); $equidistant->End[0]['type'] = JRequest::getString('rightBoundType'); $equidistant->End[0] = checknumber(JRequest::getString('rightBoundValue')); $equidistant->Step[0] = checknumber(JRequest::getString('step')); $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 . 'equidistant.html.php'; $view = new BkefViewEquidistant(); $view->xml = $model->load(JRequest::getInt('article')); $view->article = JRequest::getInt('article'); $view->maId = JRequest::getInt('maId'); $view->fId = JRequest::getInt('fId'); $view->phId = JRequest::getInt('phId'); $view->bId = JRequest::getInt('bId'); $view->display(); } }
/** * Funkce pro nastaveni equidistant */ function equidistant() { /*DONE_X*/ require_once JPATH_COMPONENT . DS . 'models' . DS . 'bkef.php'; $model = new BkefModel(); if ($_POST['potvrzeni'] == 1) { //pridame hodnotu $xml = $model->load(JRequest::getInt('article')); $maId = intval(JRequest::getInt('maId', -1)); $fId = intval(JRequest::getInt('fId', -1)); $phId = intval(JRequest::getInt('phId', -1)); if (!isset($xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->PreprocessingHints[0]->DiscretizationHint[$phId]->EquidistantInterval[0])) { $xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->PreprocessingHints[0]->DiscretizationHint[$phId]->addChild('EquidistantInterval'); } $equidistant = $xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->PreprocessingHints[0]->DiscretizationHint[$phId]->EquidistantInterval[0]; if (!isset($equidistant->Start)) { $equidistant->addChild('Start'); } if (!isset($equidistant->End)) { $equidistant->addChild('End'); } if (!isset($equidistant->Step)) { $equidistant->addChild('Step'); } //zjistime parametry, pokud jsou prohozene start/end, tak to opravime $leftBound = checknumber(JRequest::getString('leftBoundValue')); $leftBoundType = JRequest::getString('leftBoundType'); $rightBound = checknumber(JRequest::getString('rightBoundValue')); $rightBoundType = JRequest::getString('rightBoundType'); if ($leftBound > $rightBound) { $xBound = $leftBound; $xBoundType = $leftBoundType; $leftBound = $rightBound; $leftBoundType = $rightBoundType; $rightBound = $xBound; $rightBoundType = $xBoundType; } $step = checknumber(JRequest::getString('step')); $closure = $leftBoundType . ucfirst($rightBoundType); //ulozime data $equidistant->Start[0] = $leftBound; $equidistant->End[0] = $rightBound; $equidistant->Step[0] = $step; $equidistant['closure'] = $closure; //aktualizujeme timestampy $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'); $xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->PreprocessingHints[0]->DiscretizationHint[$phId]->LastModified[0]->Author = $this->getUserName(); $xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId]->PreprocessingHints[0]->DiscretizationHint[$phId]->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 . '#preprocessingHints'; } else { //zobrazime dotaz require_once JPATH_COMPONENT . DS . 'views' . DS . 'iframe' . DS . 'equidistant.html.php'; $view = new BkefViewEquidistant(); $view->xml = $model->load(JRequest::getInt('article')); $view->article = JRequest::getInt('article'); $view->maId = JRequest::getInt('maId'); $view->fId = JRequest::getInt('fId'); $view->phId = JRequest::getInt('phId'); $view->bId = JRequest::getInt('bId'); $view->display(); } }