Ejemplo n.º 1
0
 public function defAction()
 {
     if (file_exists(MODUL_DIR . '/users/template/settings.tpl')) {
         include MODUL_DIR . '/users/template/settings.tpl';
     }
     ui::newButton(lang::get('BTN_SAVE_ONLY'), "javascript:sendForm('save');");
     page::assignArray(lang::get('USERS_FORM_FIELD'));
     page::assign('errorCountBlock', reg::getKey('/users/errorCountBlock'));
     // page::assign('errorCountCapcha', reg::getKey('/users/errorCountCapcha'));
     ui::CheckBox('gzip', 1, reg::getKey('/core/gzip'), lang::get('USERS_FORM_FIELD', 9));
     ui::CheckBox('reg', 1, reg::getKey('/users/reg'), lang::get('USERS_FORM_FIELD', 11));
     ui::CheckBox('activation', 1, reg::getKey('/users/activation'), lang::get('USERS_FORM_FIELD', 28));
     ui::CheckBox('confirm', 1, reg::getKey('/users/confirm'), lang::get('USERS_FORM_FIELD', 35));
     ui::CheckBox('ask_email', 1, reg::getKey('/users/ask_email'), lang::get('USERS_FORM_FIELD', 9));
     //авторизация чере соц. сети
     ui::CheckBox('twitter_bool', 1, reg::getKey('/users/twitter_bool'), lang::get('USERS_FORM_FIELD', 40));
     page::assign('twitter_id', reg::getKey('/users/twitter_id'));
     page::assign('twitter_secret', reg::getKey('/users/twitter_secret'));
     ui::CheckBox('vk_bool', 1, reg::getKey('/users/vk_bool'), lang::get('USERS_FORM_FIELD', 42));
     page::assign('vk_id', reg::getKey('/users/vk_id'));
     page::assign('vk_secret', reg::getKey('/users/vk_secret'));
     ui::CheckBox('ok_bool', 1, reg::getKey('/users/ok_bool'), lang::get('USERS_FORM_FIELD', 45));
     page::assign('ok_id', reg::getKey('/users/ok_id'));
     page::assign('ok_public', reg::getKey('/users/ok_public'));
     page::assign('ok_secret', reg::getKey('/users/ok_secret'));
     ui::CheckBox('facebook_bool', 1, reg::getKey('/users/facebook_bool'), lang::get('USERS_FORM_FIELD', 41));
     page::assign('facebook_id', reg::getKey('/users/facebook_id'));
     page::assign('facebook_secret', reg::getKey('/users/facebook_secret'));
     ui::CheckBox('yandex_bool', 1, reg::getKey('/users/yandex_bool'), lang::get('USERS_FORM_FIELD', 43));
     ui::CheckBox('google_bool', 1, reg::getKey('/users/google_bool'), lang::get('USERS_FORM_FIELD', 44));
     return page::parse($TEMPLATE['frame']);
 }
Ejemplo n.º 2
0
 function upd()
 {
     // Устанавливаем кнопки для формы
     ui::setCancelButton('/comments/list');
     ui::newButton(lang::get('BTN_SAVE'), "javascript:sendForm('save');");
     ui::newButton(lang::get('BTN_APPLY'), "javascript:sendForm('apply');");
     if (file_exists(MODUL_DIR . '/comments/template/comment.tpl')) {
         include MODUL_DIR . '/comments/template/comment.tpl';
     }
     if (!($obj = comments::get(system::url(2)))) {
         system::redirect('/comments/list');
     }
     if ($obj->getUserId() != 0 && user::issetRight('user_upd', 'users')) {
         $url = system::au() . '/users/user_upd/' . $obj->getUserId();
         page::assign('user_link', $url);
         page::fParse('user_name', $TEMPLATE['user_link']);
     } else {
         page::fParse('user_name', $TEMPLATE['user_name']);
     }
     page::assign('obj.id', $obj->id());
     page::assign('obj.username', $obj->getUserName());
     page::assign('obj.email', $obj->getEmail());
     page::assign('obj.text', $obj->getText());
     page::assign('obj.date', date('d.m.Y H:i', strtotime($obj->getPublDate())));
     page::assign('obj.parram', $obj->getParram());
     ui::CheckBox('active', 1, $obj->isActive(), 'Проверен');
     // Информация о странице
     if ($page = ormPages::get($obj->getObjId())) {
         page::assign('page.id', $page->id);
         page::assign('page.url', $page->url);
         page::assign('page.name', $page->name);
     }
     return page::parse($TEMPLATE['frame']);
 }
Ejemplo n.º 3
0
 public function defAction()
 {
     if (file_exists(MODUL_DIR . '/comments/template/settings.tpl')) {
         include MODUL_DIR . '/comments/template/settings.tpl';
     }
     ui::newButton(lang::get('BTN_SAVE_ONLY'), "javascript:sendForm('save');");
     page::assignArray(lang::get('ESHOP_TEXT_SETTINGS'));
     ui::CheckBox('only_reg', 1, reg::getKey('/comments/only_reg'), lang::get('COMMENT_ONLY_REG'));
     ui::CheckBox('com_moderation', 1, reg::getKey('/comments/com_moderation'), lang::get('COMMENT_COM_MODERATION'));
     page::assign('text_length', reg::getKey('/comments/text_length'));
     return page::parse($TEMPLATE['frame']);
 }
Ejemplo n.º 4
0
 function view()
 {
     // Устанавливаем кнопки для формы
     ui::setCancelButton('/eshop/list');
     ui::newButton(lang::get('BTN_SAVE'), "javascript:sendForm('save');");
     ui::newButton(lang::get('BTN_APPLY'), "javascript:sendForm('apply');");
     if (file_exists(MODUL_DIR . '/eshop/template/order.tpl')) {
         include MODUL_DIR . '/eshop/template/order.tpl';
     }
     if (!($obj = ormObjects::get(system::url(2), 'eshop_order'))) {
         system::redirect('/eshop/list');
     }
     $order = new eShopOrder($obj);
     // Вывод информации о товарах
     function getGoodsName($val, $obj)
     {
         if ($obj = ormPages::get($val, 'goods')) {
             return '<a href="' . $obj->url . '" target="_blank">' . $obj->name . '</a>';
         }
     }
     function getPrice($val, $obj)
     {
         return '&nbsp;&nbsp;&nbsp;&nbsp;' . $obj->cost * $obj->count . ' руб.';
     }
     $sel = new ormSelect('eshop_goods');
     $sel->where('parents', '=', $obj->id);
     $table = new ormMultiForm('goods');
     $table->setData($sel);
     $table->insideForm();
     $table->addColumn('goods_id', 0, 400, 0, false, 'getGoodsName');
     $table->addColumn('cost', 0, 100, 0, false);
     $table->addColumn('count', 0, 100);
     $table->addColumn('id', 'Общая стоимость', 100, 0, false, 'getPrice');
     $table->withoutAdditions();
     page::assign('goods_list', $table->getHTML());
     page::assign('order.number', $order->getNumber());
     page::assign('order.cost', $order->getCost());
     page::assign('order.cost_all', $order->getTotalCost());
     page::assign('order.delivery_price', $order->getDeliveryPrice());
     page::assign('order.delivery', $order->_delivery);
     $obj->parseAllFields();
     page::assign('obj.id', $order->id);
     page::assign('obj.date', date('d.m.Y в H:i', strtotime($obj->date)));
     page::assign('user_link', '/mpanel/users/user_upd/' . $order->getUserId());
     ui::SelectBox('state', ormObjects::getObjectsByClass('eshop_status'), $obj->state, 200);
     ui::CheckBox('is_payment', 1, $obj->is_payment, 'Оплачено');
     // Создаем форму и выводим ее на страницу
     // $form = new ormEditForm($obj, $right);
     //return $form->getHTML();
     return page::parse($TEMPLATE['frame']);
 }
Ejemplo n.º 5
0
 public function defAction()
 {
     if (file_exists(MODUL_DIR . '/eshop/template/settings.tpl')) {
         include MODUL_DIR . '/eshop/template/settings.tpl';
     }
     ui::newButton(lang::get('BTN_SAVE_ONLY'), "javascript:sendForm('save');");
     page::assignArray(lang::get('ESHOP_TEXT_SETTINGS'));
     ui::SelectBox('fisrt_state', ormObjects::getObjectsByClass('eshop_status'), reg::getKey('/eshop/fisrt_state'));
     ui::CheckBox('only_reg', 1, reg::getKey('/eshop/only_reg'), lang::get('ESHOP_TEXT_SETTINGS', 1));
     ui::CheckBox('check_count', 1, reg::getKey('/eshop/check_count'), lang::get('ESHOP_TEXT_SETTINGS', 2));
     ui::CheckBox('dubl_to_email', 1, reg::getKey('/eshop/dubl_to_email'), lang::get('ESHOP_TEXT_SETTINGS', 3));
     //page::assign('nds', reg::getKey('/eshop/nds'));
     page::assign('min_count', reg::getKey('/eshop/min_count'));
     return page::parse($TEMPLATE['frame']);
 }
Ejemplo n.º 6
0
 public function defAction()
 {
     if (file_exists(MODUL_DIR . '/structure/template/settings.tpl')) {
         include MODUL_DIR . '/structure/template/settings.tpl';
     }
     //  ui::newButton(lang::get('BTN_SAVE_ONLY'), "javascript:sendForm('save');");
     ui::newButton(lang::get('BTN_SAVE'), "javascript:sendForm('save');");
     ui::newButton(lang::get('BTN_APPLY'), "javascript:sendForm('apply');");
     if (isset($_SESSION['STRUCTURE_LIST_FLAG']) && $_SESSION['STRUCTURE_LIST_FLAG']) {
         ui::setCancelButton('/structure/list');
     } else {
         ui::setCancelButton('/structure/tree');
     }
     // Основные настройки
     page::assignArray(lang::get('STRUCTURE_FORM_FIELD'));
     page::assign('title_prefix', reg::getKey(ormPages::getPrefix() . '/title_prefix'));
     page::assign('keywords', reg::getKey(ormPages::getPrefix() . '/keywords'));
     page::assign('description', reg::getKey(ormPages::getPrefix() . '/description'));
     ui::CheckBox('cur_date', 1, reg::getKey('/structure/' . domains::curId() . '/cur_date'), lang::get('STRUCTURE_FORM_FIELD', 4));
     ui::CheckBox('no_view_no_edit', 1, reg::getKey(ormPages::getPrefix() . '/no_view_no_edit'), lang::get('STRUCTURE_FORM_FIELD', 7));
     ui::CheckBox('view_as_tree', 1, reg::getKey(ormPages::getPrefix() . '/view_as_tree'), lang::get('STRUCTURE_FORM_FIELD', 18));
     ui::CheckBox('auto_index', 1, reg::getKey(ormPages::getPrefix('search') . '/auto_index'), lang::get('STRUCTURE_FORM_FIELD', 19));
     $file = ROOT_DIR . '/robots_part_' . domains::curDomain()->getName() . '.txt';
     $robots = file_exists($file) ? file_get_contents($file) : '';
     page::assign('robots', $robots);
     // Форма редактирования шаблонов страниц
     $form = new uiMultiForm('page_tpl');
     $form->insideForm();
     $form->setData(templates::getByDestination());
     $form->addColumn('t_name', lang::get('STRUCTURE_TABLE_FIELD_5'), 300);
     $form->addColumn('t_file', lang::get('STRUCTURE_TABLE_FIELD_6'), 300, lang::get('STRUCTURE_TABLE_FIELD_7'));
     page::assign('page_tpl', $form->getHTML());
     // Форма редактирования шаблонов объектов
     $form = new uiMultiForm('obj_tpl');
     $form->insideForm();
     $form->setData(templates::getByDestination(1));
     $form->addColumn('t_name', lang::get('STRUCTURE_TABLE_FIELD_5'), 300);
     $form->addColumn('t_file', lang::get('STRUCTURE_TABLE_FIELD_6'), 300, lang::get('STRUCTURE_TABLE_FIELD_7'));
     page::assign('obj_tpl', $form->getHTML());
     // Управление отображением
     $classes = ormClasses::getPagesClassList();
     ui::SelectBox('no_view_classes', $classes, reg::getList(ormPages::getPrefix() . '/no_view'), 600, '&nbsp;', '', 'selectbox_multi_big');
     ui::SelectBox('no_edit_classes', $classes, reg::getList(ormPages::getPrefix() . '/no_edit'), 600, '&nbsp;', '', 'selectbox_multi_big');
     return page::parse($TEMPLATE['frame']);
 }
Ejemplo n.º 7
0
 public function upd()
 {
     if (!($obj = ormPages::get(system::url(2)))) {
         system::redirect('/feedback');
     }
     ui::setCancelButton('/feedback');
     ui::newButton(lang::get('BTN_SAVE'), "javascript:sendForm('save');");
     ui::newButton(lang::get('BTN_APPLY'), "javascript:sendForm('apply');");
     // Создаем форму и выводим ее на страницу
     $form = new ormEditForm($obj, 'message_proc_upd');
     $form->withoutSH();
     $form->withoutTabs();
     $form->tabuList('pseudo_url', 'h1', 'keywords', 'title', 'description', 'active', 'is_home_page', 'view_in_menu', 'view_submenu', 'in_search', 'in_index', 'in_new_window', 'other_link', 'img_act', 'img_no_act', 'img_h1');
     if (!$obj->active) {
         $form->addField('base', 10, 'publ', '', ui::CheckBox('publ', 1, 0, 'Опубликовать на сайте'));
     }
     if (!$obj->send_answer_to_user) {
         $form->addField('base', 11, 'send_to_email', '', ui::CheckBox('send_to_email', 1, 0, 'Отправить ответ на почту'));
     }
     return $form->getHTML();
 }
Ejemplo n.º 8
0
 public function upd()
 {
     if (file_exists(MODUL_DIR . '/constructor/template/fgroup.tpl')) {
         include MODUL_DIR . '/constructor/template/fgroup.tpl';
     }
     if (system::action() == "upd") {
         // форма обновления информации
         $group = new ormFieldsGroup(system::url(2));
         if ($group->id() == '') {
             system::stop();
         }
         page::assign('obj.group_name', $group->getName());
         page::assign('obj.group_sname', $group->getSName());
         page::assign('obj.id', $group->id());
         $view = $group->getView();
         $system = $group->getSystem();
         page::assign('right', 'fgroup_proc_upd');
     } else {
         if (system::action() == "add") {
             // форма добавления информации
             if (system::issetUrl(2)) {
                 // Проверяем существует ли родитель?
                 $class = new ormClass(system::url(2));
                 if ($class->id() == '') {
                     system::stop();
                 }
             }
             $view = 1;
             $system = 0;
             page::assign('obj.id', system::url(2));
             page::assign('right', 'fgroup_proc_add');
         }
     }
     page::assignArray(lang::get('CONSTR_FORM_FIELD2'));
     page::assignSavingPost();
     ui::CheckBox('group_view', 1, $view, lang::get('CONSTR_FORM_FIELD2', 3));
     ui::CheckBox('group_system', 1, $system, lang::get('CONSTR_FORM_FIELD2', 4));
     echo page::parse($TEMPLATE['frame'], 1);
     system::stop();
 }
Ejemplo n.º 9
0
 private function parseField($obj, $field, $TEMPLATE, $current_id)
 {
     $is_upd = $obj->id == '' ? false : true;
     $is_editable = !isset($field['editable']) || $field['editable'];
     $width = empty($field['width']) ? $this->width : $field['width'];
     page::assign('width', $width);
     if (isset($_SESSION['SAVING_POST']['obj' . $this->form_name]) && ($field['f_type'] < 70 || $field['f_type'] > 85)) {
         $tmp = $_SESSION['SAVING_POST']['obj' . $this->form_name];
         if (isset($tmp[$current_id][$field['f_sname']])) {
             $value = $tmp[$current_id][$field['f_sname']];
         }
     } else {
         $value = '';
     }
     if (empty($value)) {
         if ($field['f_type'] == 105) {
             $value = $obj->__get('_' . $field['f_sname']);
         } else {
             $value = $obj->__get($field['f_sname']);
         }
         $function = !empty($field['funct_name']) ? $field['funct_name'] : '';
         if (!$is_editable) {
             $value = parent::processValue($obj, $field['f_sname'], $field['f_type'], $value, $function);
         }
     }
     if ($is_editable) {
         page::assign('field.id', $field['f_id']);
         page::assign('field.name', $field['f_name']);
         page::assign('field.sname', $field['f_sname']);
         page::assign('field.value', $value);
         $obj_id = $field['f_sname'] . '_' . $current_id;
         $elem_name = 'obj' . $this->form_name . '[' . $current_id . '][' . $field['f_sname'] . ']';
         // Специальная обработка данных
         if ($field['f_type'] == 50) {
             page::assign('element', ui::CheckBox($elem_name, 1, $value, '', '', $obj_id));
         } else {
             if ($field['f_type'] == 32) {
                 if (empty($value) || $value == '0000-00-00 00:00:00') {
                     page::assign('field.date', '');
                     page::assign('field.time', '00:00');
                 } else {
                     page::assign('field.date', date('d.m.Y', strtotime($value)));
                     page::assign('field.time', date('H:i', strtotime($value)));
                 }
             } else {
                 if ($field['f_type'] == 25) {
                     $time = empty($value) || $value == '0000-00-00' ? '' : date('d.m.Y', strtotime($value));
                     page::assign('field.date', $time);
                 } else {
                     if ($field['f_type'] == 30) {
                         $time = empty($value) ? '' : date('H:i:s', strtotime($value));
                         page::assign('field.time', $time);
                     } else {
                         if ($field['f_type'] > 69 && $field['f_type'] < 86) {
                             // файлы
                             if (system::$isAdmin) {
                                 page::assign('element', ui::loadFile($elem_name, $value, 'load_file_mini', $obj_id));
                             } else {
                                 page::fParse('element', '');
                             }
                         } else {
                             if ($field['f_type'] == 90 || $field['f_type'] == 95) {
                                 // Выпадающий список или Список со множественным выбором
                                 // Получаем список объектов справочника
                                 $data = ormObjects::getObjectsByClass($field['f_list_id']);
                                 $multi = $field['f_type'] == 95 ? 'selectbox_multi' : 'selectbox_template';
                                 $empty = !$field['f_required'] ? '&nbsp;' : '';
                                 if ($field['f_quick_add']) {
                                     $width = $width - 22;
                                 }
                                 $min = $field['f_type'] == 95 ? 8 : 30;
                                 page::assign('width_plu', $width - $min);
                                 page::assign('element', ui::SelectBox($elem_name, $data, $value, $width, $empty, '', $multi, $obj_id));
                                 if ($field['f_quick_add']) {
                                     page::fParse('plus', $TEMPLATE['field_' . $field['f_type'] . '_plus']);
                                 } else {
                                     page::assign('plus', '');
                                 }
                             } else {
                                 if ($field['f_type'] == 100) {
                                     // Связь с объектом
                                     page::assign('element', ui::objectLinks($obj, $field['f_id'], '_' . $current_id, $elem_name, $width - 30, 'objectLinks2'));
                                 }
                             }
                         }
                     }
                 }
             }
         }
         // Генерируем яву (создаем правила проверки для элементов формы)
         if ($field['f_required'] && ($field['f_type'] == 35 && $this->action == 'add' || $field['f_type'] != 35)) {
             $msg = str_replace('%title%', $field['f_name'], lang::get('CONSTR_BASE_FIELD_E2'));
             $zpt = !empty($this->requred_field) ? ', ' : '';
             $empty = $field['f_type'] == 90 || $field['f_type'] == 95 ? 'null' : '""';
             if ($field['f_type'] == 100) {
                 $this->requred_field .= $zpt . '["' . $obj_id . '", "' . $current_id . '", "' . $msg . '", ' . $empty . ', 1]';
             } else {
                 $this->requred_field .= $zpt . '["' . $obj_id . '", "' . $current_id . '", "' . $msg . '", ' . $empty . ']';
             }
         }
         if ($field['f_type'] == 15) {
             $this->java .= page::parse('rules.push("valid_email,' . $obj_id . ',' . lang::get('CONSTR_BASE_FIELD_E3') . '");');
         }
         if ($field['f_type'] == 20) {
             $this->java .= page::parse('rules.push("reg_exp,' . $obj_id . ',^(((f|ht){1}tp:/)*/[-a-zA-Z0-9@:%_\\+.~#?&//=]+)*$|^\\/{1}, ' . lang::get('CONSTR_BASE_FIELD_E4') . '");');
         }
         if ($field['f_type'] == 40) {
             $this->java .= page::parse('rules.push("digits_only,' . $obj_id . ',' . lang::get('CONSTR_BASE_FIELD_E6') . '");');
         }
         if ($field['f_type'] == 45) {
             $this->java .= page::parse('rules.push("float_only,' . $obj_id . ',' . lang::get('CONSTR_BASE_FIELD_E7') . '");');
         }
         if ($field['f_type'] == 47) {
             $this->java .= page::parse('rules.push("price_only,' . $obj_id . ',' . lang::get('CONSTR_BASE_FIELD_E8') . '");');
         }
         if (isset($TEMPLATE['field_' . $field['f_type']])) {
             $value = page::parse($TEMPLATE['field_' . $field['f_type']]);
         } else {
             $value = str_replace('%title%', $field['f_sname'], lang::get('CONSTR_BASE_FIELD_E5'));
         }
     }
     page::assign('content', $value);
     return page::parse($TEMPLATE['field_frame']);
 }
Ejemplo n.º 10
0
    private function parseField($field, $TEMPLATE)
    {
        if (in_array($field['f_sname'], $this->read_only)) {
            $value = $this->obj->__get($field['f_sname']);
            page::assign('value', $value);
            if ($field['f_type'] == 90 || $field['f_type'] == 95 || $field['f_type'] == 105) {
                page::assign('val', $this->obj->__get('_' . $field['f_sname']));
            } else {
                page::assign('val', $value);
            }
            $value = page::parse($TEMPLATE['read_only']);
            page::assign('content', $value);
            return page::parse($TEMPLATE['field_standart']);
        }
        // Определяем значение поля
        if (isset($_SESSION['SAVING_POST']) && ($field['f_type'] < 70 || $field['f_type'] > 85) && isset($_SESSION['SAVING_POST'][$field['f_sname']])) {
            $value = $_SESSION['SAVING_POST'][$field['f_sname']];
        } else {
            if ($field['f_type'] == 105) {
                $value = $this->obj->__get('_' . $field['f_sname']);
            } else {
                $value = $this->obj->__get($field['f_sname']);
            }
        }
        page::assign('field.value', $value);
        // Для страниц, для кнопки "Показать \ скрыть доп. поля"
        if ($this->obj instanceof ormPage && in_array($field['f_sname'], $this->page_fields)) {
            $sh_page = isset($_SESSION['SH_FIELDS']) && $_SESSION['SH_FIELDS'] == 'show' ? '' : ' style="display:none;"';
            page::assign('sh_page', $sh_page);
        } else {
            page::assign('sh_page', '');
        }
        // Специальная обработка данных
        if ($field['f_type'] == 50) {
            page::assign('element', ui::CheckBox($field['f_sname'], 1, $value));
        } else {
            if ($field['f_type'] == 32) {
                if (empty($value) || $value == '0000-00-00 00:00:00') {
                    page::assign('field.date', '');
                    page::assign('field.time', '00:00');
                } else {
                    page::assign('field.date', date('d.m.Y', strtotime($value)));
                    page::assign('field.time', date('H:i', strtotime($value)));
                }
            } else {
                if ($field['f_type'] == 25) {
                    $time = empty($value) || $value == '0000-00-00' ? '' : date('d.m.Y', strtotime($value));
                    page::assign('field.date', $time);
                } else {
                    if ($field['f_type'] == 30) {
                        $time = empty($value) ? '' : date('H:i:s', strtotime($value));
                        page::assign('field.time', $time);
                    } else {
                        if ($field['f_type'] == 70 || $field['f_type'] == 75 || $field['f_type'] == 80 || $field['f_type'] == 85) {
                            if (system::$isAdmin) {
                                page::assign('element', ui::loadFile($field['f_sname'], $value));
                            } else {
                                page::fParse('element', $TEMPLATE['upload_file_field']);
                            }
                        } else {
                            if ($field['f_type'] == 73) {
                                page::assign('element', ui::listFile($field['f_sname'], $value));
                            } else {
                                if ($field['f_type'] == 90 || $field['f_type'] == 95) {
                                    // Выпадающий список или Список со множественным выбором
                                    // Получаем список объектов справочника
                                    page::assign('field.sname', $field['f_sname']);
                                    $data = ormObjects::getObjectsByClass($field['f_list_id']);
                                    $multi = $field['f_type'] == 95 ? 'selectbox_multi' : 'selectbox_template';
                                    $empty = !$field['f_required'] ? '&nbsp;' : '';
                                    if (system::$isAdmin) {
                                        page::assign('element', ui::SelectBox($field['f_sname'], $data, $value, 400, $empty, '', $multi));
                                        if ($field['f_quick_add']) {
                                            page::fParse('plus', $TEMPLATE['field_' . $field['f_type'] . '_plus']);
                                        } else {
                                            page::assign('plus', '');
                                        }
                                    } else {
                                        page::assign('element', ui::SelectBox($field['f_sname'], $data, $value, 200, $empty, '', $multi));
                                    }
                                } else {
                                    if ($field['f_type'] == 97) {
                                        // Подчиненный справочник
                                        // Получаем список объектов справочника
                                        $sel = new ormSelect($field['f_list_id']);
                                        $sel->where('parents', '=', $this->obj->id);
                                        // Выводим мультиформу для добавления и редактирования
                                        $form = new ormMultiForm('subject_list_' . $field['f_id']);
                                        $form->setData($sel);
                                        $form->insideForm();
                                        $re = $form->getHTML();
                                        //  echo $re;
                                        page::assign('element', $re);
                                    } else {
                                        if ($field['f_type'] == 100) {
                                            // Связь с объектом
                                            page::assign('element', ui::objectLinks($this->obj, $field['f_id']));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        page::assign('field.id', $field['f_id']);
        page::assign('field.name', $field['f_name']);
        page::assign('field.hint', $field['f_hint']);
        page::assign('field.sname', $field['f_sname']);
        page::fParse('field.dotted', !empty($field['f_hint']) ? 'dotted' : '');
        if (empty($field['f_max_size'])) {
            $field['f_max_size'] = $field['f_type'] == 60 ? 200 : 100;
        }
        page::assign('field.max_size', $field['f_max_size']);
        // Генерируем яву (создаем правила проверки для элементов формы)
        if ($field['f_required'] && ($field['f_type'] == 35 && $this->obj->id == '' || $field['f_type'] != 35)) {
            $msg = str_replace('%title%', $field['f_name'], lang::get('CONSTR_BASE_FIELD_E2'));
            if ($field['f_type'] == 60) {
                // HTML - редактор
                $this->addit_function .= page::parse('
  					function checkValue%field.sname%(){
  					 	var value = CKEDITOR.instances["%field.sname%"].getData();
    					return (value != "") ? true : [[ "cke_%field.sname%", "' . $msg . '" ]];
					}
  				');
                $this->java .= page::parse('rules.push("function,checkValue%field.sname%");');
            } else {
                if ($field['f_type'] == 100) {
                    // Выбор объекта
                    $this->addit_function .= page::parse('
  					function checkObjectLinks%field.sname%(){
  						var count = $("#objectsLinkList_%field.sname% > li").length;
    					return (count > 0) ? true : [[ %field.sname%, "' . $msg . '" ]];
					}
  				');
                    $this->java .= page::parse('rules.push("function,checkObjectLinks%field.sname%");');
                } else {
                    if ($field['f_type'] == 32) {
                        // Каледарь и время
                        $this->java .= page::parse('rules.push("required,%field.sname%_date,' . $msg . '");');
                    } else {
                        $this->java .= page::parse('rules.push("required,%field.sname%,' . $msg . '");');
                    }
                }
            }
            $zvezd = 'chek';
        } else {
            $zvezd = '';
        }
        page::assign('field.zvezd', $zvezd);
        if ($field['f_type'] == 15) {
            $this->java .= page::parse('rules.push("valid_email,%field.sname%,' . lang::get('CONSTR_BASE_FIELD_E3') . '");');
        }
        if ($field['f_type'] == 20) {
            $this->java .= page::parse('rules.push("reg_exp,%field.sname%,^(((f|ht){1}tp:/)*/[-a-zA-Z0-9@:%_\\+.~#?&//=]+)*$|^\\/{1}, ' . lang::get('CONSTR_BASE_FIELD_E4') . '");');
        }
        if ($field['f_type'] == 40) {
            $this->java .= page::parse('rules.push("digits_only,%field.sname%,' . lang::get('CONSTR_BASE_FIELD_E6') . '");');
        }
        if ($field['f_type'] == 45) {
            $this->java .= page::parse('rules.push("float_only,%field.sname%,' . lang::get('CONSTR_BASE_FIELD_E7') . '");');
        }
        if ($field['f_type'] == 47) {
            $this->java .= page::parse('rules.push("price_only,%field.sname%,' . lang::get('CONSTR_BASE_FIELD_E8') . '");');
        }
        if (isset($TEMPLATE['field_' . $field['f_type']])) {
            return page::parse($TEMPLATE['field_' . $field['f_type']]);
        } else {
            return str_replace('%title%', $field['f_sname'], lang::get('CONSTR_BASE_FIELD_E5'));
        }
    }
Ejemplo n.º 11
0
 public function upd()
 {
     if (file_exists(MODUL_DIR . '/constructor/template/field.tpl')) {
         include MODUL_DIR . '/constructor/template/field.tpl';
     }
     if (system::action() == "upd") {
         // форма обновления информации
         $obj = new ormField(system::url(2));
         if ($obj->id() == '') {
             system::stop();
         }
         page::assign('obj.fname', $obj->getName());
         page::assign('obj.fsname', $obj->getSName());
         page::assign('obj.hint', $obj->getHint());
         page::assign('obj.max_size', $obj->getMaxSize());
         page::assign('obj.id', $obj->id());
         $view = $obj->getView();
         $inherit = $obj->getInherit();
         $search = $obj->getSearch();
         $filter = $obj->getFilter();
         $required = $obj->getRequired();
         $system = $obj->getSystem();
         $type = $obj->getType();
         $list_id = $obj->getListId();
         $uniqum = $obj->getUniqum();
         $quick_add = $obj->getQuickAdd();
         $relation = $obj->getRelType();
         $spec = $obj->getSpec();
         $fr = $obj->getSName() == 'name' ? '_name' : '';
         page::assign('right', 'field_proc_upd');
     } else {
         if (system::action() == "add") {
             // форма добавления информации
             if (system::issetUrl(2)) {
                 // Проверяем существует ли родитель?
                 $group = new ormFieldsGroup(system::url(2));
                 if ($group->id() == '') {
                     system::stop();
                 }
             }
             $view = $inherit = 1;
             $search = $filter = $required = $system = $type = $list_id = $uniqum = $spec = $quick_add = $relation = 0;
             $fr = '';
             page::assign('obj.id', system::url(2));
             page::assign('right', 'field_proc_add');
         }
     }
     page::assignArray(lang::get('CONSTR_FORM_FIELD3'));
     page::assignSavingPost();
     ui::CheckBox('view', 1, $view, lang::get('CONSTR_FORM_FIELD3', 6));
     ui::CheckBox('inherit', 1, $inherit, lang::get('CONSTR_FORM_FIELD3', 7));
     ui::CheckBox('search', 1, $search, lang::get('CONSTR_FORM_FIELD3', 8));
     ui::CheckBox('filter', 1, $filter, lang::get('CONSTR_FORM_FIELD3', 9));
     ui::CheckBox('required', 1, $required, lang::get('CONSTR_FORM_FIELD3', 10));
     ui::CheckBox('system', 1, $system, lang::get('CONSTR_FORM_FIELD3', 11));
     ui::CheckBox('uniqum', 1, $uniqum, lang::get('CONSTR_FORM_FIELD3', 13));
     ui::CheckBox('quick_add', 1, $quick_add, lang::get('CONSTR_FORM_FIELD3', 14));
     ui::CheckBox('spec', 1, $spec, lang::get('CONSTR_FORM_FIELD3', 16));
     ui::SelectBox('reltype', lang::get('CONSTR_RELTYPE'), $relation, 300);
     ui::SelectBox('type', lang::get('CONSTR_TYPE_LIST' . $fr), $type, 300);
     $list = ormClasses::getHandbooks();
     ui::SelectBox('list_id', $list, $list_id, 300, '&nbsp;');
     page::assign('sh', !empty($list_id) ? '' : 'style="display:none;"');
     page::assign('sh2', $type > 69 && $type < 86 ? '' : 'style="display:none;"');
     page::assign('sh3', $type == 90 || $type == 95 || $type == 100 ? '' : 'style="display:none;"');
     page::assign('sh4', $type == 55 || $type == 60 ? '' : 'style="display:none;"');
     echo page::parse($TEMPLATE['frame' . $fr], 1);
     system::stop();
 }
Ejemplo n.º 12
0
 public function upd()
 {
     $is_page = false;
     if (file_exists(MODUL_DIR . '/constructor/template/class.tpl')) {
         include MODUL_DIR . '/constructor/template/class.tpl';
     }
     if (system::action() == "upd") {
         // форма обновления информации
         $class = new ormClass(system::url(2));
         if ($class->id() == '') {
             system::redirect('/constructor/tree');
         }
         page::assign('obj.class_name', $class->getName());
         page::assign('obj.sname', $class->getSName());
         page::assign('obj.text', $class->getPadej());
         page::assign('obj.id', $class->id());
         $system = $class->isSystem();
         $is_list = $class->isList();
         $is_page = $class->isPage();
         $is_user = $class->isInheritor('user');
         $base_class = $class->getBaseClass();
         page::assign('right', 'class_proc_upd');
         // Выводим дерево для отображения структуры класса
         $tree = new ormFieldsTree();
         page::assign('fields', $tree->getHTML($class));
     } else {
         if (system::action() == "add") {
             // форма добавления информации
             $system = $is_list = $uniqum = $base_class = 0;
             // Проверяем существует ли родитель?
             if (system::issetUrl(2)) {
                 $parent = new ormClass(system::url(2));
                 if ($parent->id() == '') {
                     system::redirect('/constructor/tree');
                 }
                 $is_list = $parent->isList();
                 $is_page = $parent->isPage();
                 $is_user = $parent->isInheritor('user');
             } else {
                 $is_user = false;
             }
             page::assign('obj.id', system::url(2));
             page::assign('right', 'class_proc_add');
         }
     }
     if ($is_page) {
         ui::SelectBox('class_list', ormClasses::getPagesClassList(), $base_class, 400, '&nbsp;');
         ui::SelectBox('template_list1', templates::getByDestination(0, true), isset($class) ? $class->getDefTemplate(0) : 0, 400, '&nbsp;');
         ui::SelectBox('template_list2', templates::getByDestination(1, true), isset($class) ? $class->getDefTemplate(1) : 0, 400, '&nbsp;');
         page::fParse('page_fields', $TEMPLATE['page_fields']);
     } else {
         if ($is_user) {
             page::fParse('page_fields', $TEMPLATE['user_fields']);
         } else {
             page::assign('page_fields', '');
         }
     }
     if (system::action() == "add" || !$class->isSystem()) {
         ui::newButton(lang::get('BTN_SAVE'), "javascript:sendForm('save');");
         ui::newButton(lang::get('BTN_APPLY'), "javascript:sendForm('apply');");
         ui::setCancelButton('/constructor');
     } else {
         ui::setBackButton('/constructor');
     }
     page::assignArray(lang::get('CONSTR_FORM_FIELD'));
     page::assignSavingPost();
     ui::CheckBox('system', 1, $system, lang::get('CONSTR_FORM_FIELD', 3));
     ui::CheckBox('is_list', 1, $is_list, lang::get('CONSTR_FORM_FIELD', 4));
     return page::parse($TEMPLATE['frame'], 1);
 }
Ejemplo n.º 13
0
 private function getTemplateBox($field_name, $templs, $value, $fla = 0)
 {
     $empty = $field_name == 'template2_id' ? lang::get('STRUCTURE_NO_CHANGE') : '';
     return ui::SelectBox($field_name, $templs, $value, 400, $empty, '', 'selectbox_template') . '
              <div id="' . $field_name . '_edit_block" class="input_min_2" style="display:none;">
                 <input value="" id="' . $field_name . '_new_val" name="' . $field_name . '_new_val" class="" />
                 <input value="" id="' . $field_name . '_new_val2" name="' . $field_name . '_new_val2" class="" />
              </div>
              <span class="add_value" onclick="return AddNewTemplate(this, ' . $fla . ');"></span>
              <small>' . ui::CheckBox($field_name . '_all', 1, 0, 'Применить для всех подразделов', 0, 0, 0) . '</small>';
 }
Ejemplo n.º 14
0
 function getCheckBox($val, $obj)
 {
     return '<div align="center">' . ui::CheckBox('objdomains[' . $obj['id'] . '][d_online]', 1, $val) . '</div>';
 }