Esempio n. 1
0
 /**
  * Funkce pro úpravu AllowedRange
  */
 function editRange()
 {
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'bkef.php';
     $model = new BkefModel();
     if ($_POST['potvrzeni'] == 'interval' || $_POST['potvrzeni'] == 'enumeration') {
         //skutecne smazeme
         $xml = $model->load(JRequest::getInt('article'));
         $maId = intval(JRequest::getInt('maId', -1));
         $fId = intval(JRequest::getInt('fId', -1));
         $format = $xml->MetaAttributes[0]->MetaAttribute[$maId]->Formats[0]->Format[$fId];
         //smazeme puvodni hodnoty
         $allowedRange = $format->AllowedRange[0];
         unset($allowedRange->Interval[0]);
         unset($allowedRange->Enumeration[0]);
         unset($allowedRange);
         $format->addChild('AllowedRange');
         $allowedRange = $format->AllowedRange[0];
         if ($_POST['potvrzeni'] == 'interval') {
             /*------------------------------------------------------*/
             //ulozime interval
             $interval = $allowedRange->addChild('Interval');
             $leftBound = $interval->addChild('LeftBound');
             $leftBound['type'] = JRequest::getString('leftBoundType');
             $leftBound['value'] = checknumber(JRequest::getString('leftBoundValue'));
             $rightBound = $interval->addChild('RightBound');
             $rightBound['type'] = JRequest::getString('rightBoundType');
             $rightBound['value'] = checknumber(JRequest::getString('rightBoundValue'));
             /*------------------------------------------------------*/
             /*zkontrolujeme, jestli to neni v rozporu s collation*/
             if (isset($format->Collation[0])) {
                 if ($format->Collation[0]['type'] == 'Enumeration') {
                     unset($format->Collation[0]);
                 }
             }
             /*------------------------------------------------------*/
         } else {
             /*------------------------------------------------------*/
             //ulozime vycet prvku
             $enumArr = split("\n", JRequest::getString('enumeration'));
             $rangeArr = array();
             $enumeration = $allowedRange->addChild('Enumeration');
             if (count($enumArr) > 0) {
                 foreach ($enumArr as $value) {
                     if (trim($value) != '') {
                         $enumeration->addChild('Value', trim($value));
                         $rangeArr[] = trim($value);
                     }
                 }
             }
             /*------------------------------------------------------*/
             if (isset($format->Collation[0])) {
                 $collation = $format->Collation[0];
                 if ($collation['type'] == 'Enumeration') {
                     $valuesArr = array();
                     /*musime zkontrolovat, jestli allowed range odpovida collation*/
                     if (count($collation->Value) > 0) {
                         $delArr = array();
                         $vId = 0;
                         foreach ($collation->Value as $value) {
                             $valStr = (string) $value;
                             if (!in_array($valStr, $rangeArr)) {
                                 $delArr[] = $vId;
                             } else {
                                 $valuesArr[] = $valStr;
                                 // echo 'pridavam hodnotu'.$value.'<br /><br />';
                             }
                             $vId++;
                         }
                         for ($dId = count($delArr) - 1; $dId >= 0; $dId--) {
                             $deleteId = $delArr[$dId];
                             unset($format->Collation[0]->Value[$deleteId]);
                         }
                     }
                     if (count($rangeArr) > 0) {
                         foreach ($rangeArr as $value) {
                             if (!in_array($value, $valuesArr)) {
                                 $collation->addChild('Value', $value);
                             }
                         }
                     }
                 }
             }
             /*------------------------------------------------------*/
         }
         $model->save(JRequest::getInt('article'), $xml->asXML());
         $this->_redirect = 'index.php?option=com_bkef&task=format&article=' . JRequest::getInt('article') . '&maId=' . $maId . '&fId=' . $fId . '#basicSettings';
     } else {
         //zobrazime dotaz
         require_once JPATH_COMPONENT . DS . 'views' . DS . 'iframe' . DS . 'editRange.html.php';
         $view = new BkefViewEditRange();
         $view->xml = $model->load(JRequest::getInt('article'));
         $view->h1 = JText::_('ALLOWED_RANGE_EDITATION');
         $view->article = JRequest::getInt('article');
         $view->maId = JRequest::getInt('maId');
         $view->fId = JRequest::getInt('fId', -1);
         $view->display();
     }
 }
Esempio n. 2
0
             mail($email, 'Заявка', $mail_message, $headers);
             $errormessage = "Заявка успешно отправлена.";
         } else {
             $errormessage = 'Введены некорректные данные.';
         }
     } else {
         $errormessage = 'Введены некорректные данные.';
     }
 } else {
     if ($action == 'call') {
         //получаем данные с  формы
         $call_name = escape_chars($_POST['call_name']);
         $call_tel = escape_chars($_POST['call_tel']);
         //проверка данных
         if (!empty($call_name) && !empty($call_tel)) {
             if (checknumber($call_tel) == 1 && check_length($call_name, 2, 25) && check_length($call_tel, 5, 25)) {
                 //формирование емейла
                 $mail_message = "Заявка от лица:\n";
                 $mail_message .= "Имя: " . $call_name . "\n";
                 $mail_message .= "Телефон: " . $call_tel . "\n";
                 mail($email, 'Заявка', $mail_message, $headers);
                 $errormessage = "Заявка успешно отправлена.";
             } else {
                 $errormessage = 'Введены некорректные данные.';
             }
         } else {
             $errormessage = 'Введены некорректные данные.';
         }
     } else {
         $errormessage = "Не верное действие.";
     }
Esempio n. 3
0
     if ($calc_select_4 == 'Тип организации') {
         $calc_select_4 = 'Не указано';
     }
     if ($calc_name == '') {
         $errormessage = 'Пожалуйста, укажите Ваше имя.';
     } else {
         if ($calc_tel == '' || checknumber($calc_tel) == 0) {
             $errormessage = 'Пожалуйста, укажите номер телефона.';
         } else {
             if ($calc_email == '') {
                 $errormessage = 'Пожалуйста, укажите e-mail.';
             }
         }
     }
     //формирование емейла
     if ($calc_name != '' && $calc_tel != '' && $calc_email != '' && checknumber($calc_tel) == 1) {
         $mail_message = "Заказ услуги СРО от лица:\n";
         $mail_message .= "Имя: " . $calc_name . "\n";
         $mail_message .= "Телефон: " . $calc_tel . "\n";
         $mail_message .= "E-Mail: " . $calc_email . "\n";
         $mail_message .= "Стоимость: " . $calc_price_result . "\n";
         $mail_message .= "Тип деятельности: " . $calc_select_1 . "\n";
         $mail_message .= "Сумма ген. подряда: " . $calc_select_2 . "\n";
         $mail_message .= "Опасность работ: " . $calc_select_3 . "\n";
         $mail_message .= "Тип организации: " . $calc_select_4 . "\n";
         mail($email, 'Заказ услуги', $mail_message, $headers);
         $errormessage = "Заказ успешно отправлен.";
     }
 } else {
     $errormessage = "Не верное действие.";
 }
Esempio n. 4
0
                if ($night == true) {
                    $mail_message .= "Ночной режим\n";
                }
                if ($online_control == true) {
                    $mail_message .= "Онлайн контроль\n";
                }
                mail($email, 'Заявка онлайн подключения', $mail_message, $headers);
                $errormessage = "Заявка успешно отправлена.";
            }
        } else {
            if ($action == 'Callme') {
                //заказать звонок
                $call_name = escape_chars($_POST['call_name']);
                $call_tel = escape_chars($_POST['call_tel']);
                if ($call_name == '') {
                    $errormessage = 'Пожалуйста, укажите Ваше имя.';
                } else {
                    if ($call_tel == '' || checknumber($call_tel) == 0) {
                        $errormessage = 'Пожалуйста, укажите номер телефона.';
                    }
                }
                if ($call_name != '' && $call_tel != '' && checknumber($call_tel) == 1) {
                    $mail_message = "Просит позвонить " . $call_name . " по номеру " . $call_tel;
                    mail($email, 'Заявка на звонок', $mail_message, $headers);
                    $errormessage = "Заявка успешно отправлена.";
                }
            }
        }
    }
}
echo $errormessage;
Esempio n. 5
0
 $name = escape_chars($_POST['zakaz_name']);
 $tel = escape_chars($_POST['zakaz_tel']);
 $email = escape_chars($_POST['zakaz_email']);
 $uslugi = escape_chars($_POST['zakaz_uslugi']);
 $price = escape_chars($_POST['zakaz_price']);
 $sitetype = escape_chars($_POST['zakaz_sitetype']);
 if ($uslugi) {
     $uslugi_ar = split(';', $uslugi);
     $uslugi = '';
     foreach ($uslugi_ar as $u) {
         if ($u != '') {
             $uslugi .= ' • ' . $u . "\n";
         }
     }
 }
 if ($name == '' || $tel == '' || checknumber($tel) == 0 || $email == '' || check_length($name, 2, 50) == 0 || check_length($tel, 2, 20) == 0) {
     $errormessage = 'Неверные данные.';
 } else {
     $mail_message = "Заявка ";
     $mail_message .= "от " . $name . "\n";
     $mail_message .= "тел. " . $tel . "\n";
     if ($email) {
         $mail_message .= "email: " . $email . "\n";
     }
     if ($sitetype) {
         $mail_message .= "Тип сайта: " . $sitetype . "\n";
     }
     if ($price) {
         $mail_message .= "Цена: " . $price . "\n";
     }
     if ($uslugi) {
Esempio n. 6
0
 /**
  * Funkce pro přidání hodnoty do value description
  */
 function addValueDescriptionValue()
 {
     /*DONE*/
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'bkef.php';
     $model = new BkefModel();
     if ($_POST['potvrzeni'] == 'value' || $_POST['potvrzeni'] == 'regex' || $_POST['potvrzeni'] == 'interval') {
         //skutecne ukladame
         $xml = $model->load(JRequest::getInt('article'));
         $maId = intval(JRequest::getInt('maId', -1));
         $fId = intval(JRequest::getInt('fId', -1));
         $vdId = intval(JRequest::getInt('vdId', -1));
         $metaAttribute = $xml->MetaAttributes[0]->MetaAttribute[$maId];
         $valueDescription = $metaAttribute->Formats[0]->Format[$fId]->ValueDescriptions[0]->ValueDescription[$vdId];
         if (!isset($valueDescription->Scope)) {
             $scope = $valueDescription->addChild('Scope');
         } else {
             $scope = $valueDescription->Scope[0];
         }
         //ulozime dle zvolene varianty
         if ($_POST['potvrzeni'] == 'value') {
             //smazeme nadbytecne hodnoty
             while (isset($scope->Interval[0])) {
                 unset($scope->Interval[0]);
             }
             while (isset($scope->Regex[0])) {
                 unset($scope->Regex[0]);
             }
             //pridame hodnotu
             $scope->addChild('Value', checknumber(JRequest::getString('value')));
         } elseif ($_POST['potvrzeni'] == 'regex') {
             //smazeme nadbytecne hodnoty
             while (isset($scope->Interval[0])) {
                 unset($scope->Interval[0]);
             }
             while (isset($scope->Value[0])) {
                 unset($scope->Value[0]);
             }
             while (isset($scope->Regex[0])) {
                 unset($scope->Regex[0]);
             }
             //pridame hodnotu
             $scope->addChild('Value', checknumber(JRequest::getString('value')));
         } elseif ($_POST['potvrzeni'] == 'interval') {
             //smazeme nadbytecne hodnoty
             while (isset($scope->Value[0])) {
                 unset($scope->Value[0]);
             }
             while (isset($scope->Interval[0])) {
                 unset($scope->Interval[0]);
             }
             while (isset($scope->Regex[0])) {
                 unset($scope->Regex[0]);
             }
             //TODO doresit moznost vice intervalu
             //pridame hodnotu
             $interval = $valueDescription->addChild('Interval');
             if (JRequest::getString('leftBoundType') == 'closed') {
                 $intClosure = 'closed';
             } else {
                 $intClosure = 'open';
             }
             if (JRequest::getString('rightBoundType') == 'closed') {
                 $intClosure .= 'Closed';
             } else {
                 $intClosure .= 'Open';
             }
             $interval->addAttribute('closure', $intClosure);
             $interval->addAttribute('leftMargin', checknumber(JRequest::getString('leftBoundValue')));
             $interval->addAttribute('rightMargin', checknumber(JRequest::getString('rightBoundValue')));
         }
         //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';
         //--skutecne ukladame
     } else {
         //zobrazime dotaz
         require_once JPATH_COMPONENT . DS . 'views' . DS . 'iframe' . DS . 'addValueDescriptionValue.html.php';
         $view = new BkefViewAddValueDescriptionValue();
         $view->xml = $model->load(JRequest::getInt('article'));
         $view->article = JRequest::getInt('article');
         $view->maId = JRequest::getInt('maId');
         $view->fId = JRequest::getInt('fId');
         $view->vdId = JRequest::getInt('vdId');
         $view->potvrzeni = JRequest::getString('type');
         $view->display();
     }
 }