Example #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']);
 }
Example #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']);
 }
Example #3
0
 /**
  * @return stirng
  * @param string $templ_name - Шаблон оформления
  * @desc МАКРОС: Выводит форму подписки на рассылки
  */
 function form($templ_name = 'default')
 {
     $templ_file = '/subscription/' . $templ_name . '.tpl';
     $TEMPLATE = page::getTemplate($templ_file);
     if (!is_array($TEMPLATE)) {
         return page::errorNotFound('subscription.form', $templ_file);
     }
     $list = '';
     $sel = new ormSelect('subscription');
     $sel->where('lang', '=', languages::curId());
     $sel->where('domain', '=', domains::curId());
     $sel->where('active', '=', 1);
     $num = 0;
     while ($obj = $sel->getObject()) {
         page::assign('obj.id', $obj->id);
         page::assign('obj.name', $obj->name);
         $num++;
         page::assign('obj.num', $num);
         page::assign('class-first', $num == 1 ? 'first' : '');
         page::assign('class-last', $num == $sel->getObjectCount() ? 'last' : '');
         page::assign('class-odd', $num % 2 == 0 ? 'odd' : '');
         page::assign('class-even', $num % 2 != 0 ? 'even' : '');
         page::assign('class-third', $num % 3 == 0 ? 'third' : '');
         $list .= page::parse($TEMPLATE['list']);
     }
     // Парсим текст сообщения об ошибке
     page::parseError('subscription');
     if (empty($list)) {
         return page::parse($TEMPLATE['empty']);
     } else {
         page::assign('list', $list);
         return page::parse($TEMPLATE['frame']);
     }
 }
Example #4
0
 public function unsubscribeAction()
 {
     if (system::issetUrl(2) && system::issetUrl(3)) {
         if (($obj = ormObjects::get(system::url(2))) && $obj->isInheritor('subscription')) {
             mailingProcess::delEmailById(system::url(3), $obj->id);
             page::assign('name', $obj->name);
             return page::parse(lang::get('SUBSCRIPTION_MSG2'));
         }
     }
     return ormPages::get404();
 }
Example #5
0
 public function defAction()
 {
     if (file_exists(MODUL_DIR . '/subscription/template/settings.tpl')) {
         include MODUL_DIR . '/subscription/template/settings.tpl';
     }
     ui::newButton(lang::get('BTN_SAVE_ONLY'), "javascript:sendForm('save');");
     page::assignArray(lang::get('SUBSCRIBE_TEXT_SETTINGS'));
     page::assign('count_mails_day', reg::getKey('/subscription/count_mails_day'));
     page::assign('count_mails', reg::getKey('/subscription/count_mails'));
     return page::parse($TEMPLATE['frame']);
 }
Example #6
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']);
 }
Example #7
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']);
 }
Example #8
0
 private function createTree($parent, $TEMPLATE)
 {
     $items = '';
     while ($obj = ormClasses::getInheritor($parent)) {
         page::assign('subitem', $this->createTree($obj->id(), $TEMPLATE));
         page::assign('obj.id', $obj->id());
         page::assign('obj.url', system::au() . '/constructor/class_upd/' . $obj->id());
         page::assign('obj.name', $obj->getName());
         page::assign('obj.sname', $obj->getSName());
         page::assign('obj.parent', $obj->getParentId());
         $pach = '/css_mpanel/tree/images/classes/';
         $ico = file_exists(ROOT_DIR . $pach . $obj->getSName() . '.png') ? $obj->getSName() . '.png' : 'file1.gif';
         page::assign('obj.ico', $pach . $ico);
         $rights = '';
         reset($this->rights);
         while (list($right, $pict) = each($this->rights)) {
             $modul = $right == 'values' ? 'reference' : 'constructor';
             if (user::issetRight($right, $modul) || $pict == 'empty') {
                 if ($pict == 'empty') {
                     $rights .= page::parse($TEMPLATE['empty_right']);
                 } else {
                     $parse = true;
                     if ($right == 'values') {
                         $parse = $obj->isInheritor('handbook') && $obj->getSName() != 'handbook';
                     }
                     if ($right == 'class_del') {
                         $parse = !$obj->isSystem();
                     }
                     if ($parse) {
                         $del_button = $right == 'class_del' ? 'class="del_button"' : '';
                         page::assign('del_button', $del_button);
                         page::assign('right.url', system::au() . '/' . $modul . '/' . $right);
                         page::assign('right.title', lang::right($right, $modul));
                         page::assign('right.class', $pict);
                         $rights .= page::parse($TEMPLATE['right']);
                     } else {
                         $rights .= page::parse($TEMPLATE['empty_right']);
                     }
                 }
             }
         }
         page::assign('rights', $rights);
         $items .= page::parse($TEMPLATE['item']);
     }
     if (!empty($items)) {
         page::assign('items', $items);
         return page::parse($TEMPLATE['frame_items']);
     }
 }
Example #9
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']);
 }
Example #10
0
 /**
  * @return HTML
  * @param string $templ_name - Шаблон оформления
  * @desc МАКРОС: Выводит форму обратной связи (добавления отзыва, вопрос-ответа и пр.)
  */
 public function form($templ_name = 'default')
 {
     $templ_file = '/feedback/' . $templ_name . '.tpl';
     $TEMPLATE = page::getTemplate($templ_file);
     if (!is_array($TEMPLATE)) {
         return page::errorNotFound('feedback.form', $templ_file);
     }
     if (!user::isGuest()) {
         page::assign('feedback.name', user::get('surname') . ' ' . user::get('name'));
         page::assign('feedback.email', user::get('email'));
     }
     page::assignSavingPost('feedback');
     // Парсим текст сообщения об ошибке
     page::parseError('feedback');
     return page::parse($TEMPLATE['frame'], 1);
 }
Example #11
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']);
 }
Example #12
0
 public function defAction()
 {
     if (file_exists(MODUL_DIR . '/search/template/forms.tpl')) {
         include MODUL_DIR . '/search/template/forms.tpl';
         ui::newButton(lang::get('SEARCH_BTN_INDEX'), "javascript:startIndex();");
         ui::newButton(lang::get('SEARCH_BTN_CLEAR'), "javascript:sendForm('clear');");
         page::assign('count_page', searchIndex::getCountPages());
         page::assign('count_words', searchIndex::getCountWords());
         $d = reg::getKey(ormPages::getPrefix('search') . '/index_date');
         if (empty($d)) {
             $d = '-';
         }
         page::assign('index_date', $d);
         page::assign('text1', lang::get('SEARCH_TEXT_1'));
         page::assign('text2', lang::get('SEARCH_TEXT_2'));
         page::assign('text3', lang::get('SEARCH_TEXT_3'));
         page::assign('text4', lang::get('SEARCH_TEXT_4'));
         return page::parse($TEMPLATE['frame']);
     }
 }
Example #13
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();
 }
Example #14
0
 /**
  * @return HTML
  * @param int $obj_id - ID раздела, для которого необходимо вывести теги.
  * @param string $templ_name - Шаблон оформления.
  * @desc МАКРОС: Выводит список тегов для указанной страницы.
  */
 public function tags($obj_id, $templ_name = 'tags')
 {
     $templ_file = '/search/' . $templ_name . '.tpl';
     $TEMPLATE = page::getTemplate($templ_file);
     if (!is_array($TEMPLATE)) {
         return page::errorNotFound('search.tags', $templ_file);
     }
     $tags = tags::getTagsForObject($obj_id);
     $list = '';
     while (list($num, $tag) = each($tags)) {
         page::assign('obj.id', $tag['id']);
         page::assign('obj.name', $tag['name']);
         page::assign('obj.count', $tag['count']);
         page::assign('obj.url', '/search/tag/' . $tag['id']);
         $list .= !empty($num) ? page::parse($TEMPLATE['separator']) : '';
         $list .= page::parse($TEMPLATE['list']);
     }
     if (!empty($list)) {
         page::assign('list', $list);
         return page::parse($TEMPLATE['frame']);
     } else {
         return page::parse($TEMPLATE['empty']);
     }
 }
Example #15
0
 public function upd()
 {
     if (file_exists(MODUL_DIR . '/constructor/template/separator.tpl')) {
         include MODUL_DIR . '/constructor/template/separator.tpl';
     }
     if (system::action() == "upd") {
         // форма обновления информации
         $obj = new ormField(system::url(2));
         if ($obj->id() == '') {
             system::stop();
         }
         page::assign('obj.fname', $obj->getName());
         $max_size = $obj->getMaxSize() != '' ? $obj->getMaxSize() : 0;
         page::assign('obj.max_size', $max_size);
         page::assign('obj.id', $obj->id());
         page::assign('right', 'separator_proc_upd');
     } else {
         if (system::action() == "add") {
             // форма добавления информации
             if (system::issetUrl(2)) {
                 // Проверяем существует ли родитель?
                 $group = new ormFieldsGroup(system::url(2));
                 if ($group->id() == '') {
                     system::stop();
                 }
             }
             page::assign('obj.id', system::url(2));
             page::assign('right', 'separator_proc_add');
             page::assign('obj.max_size', 0);
         }
     }
     page::assignArray(lang::get('CONSTR_FORM_FIELD3'));
     page::assignSavingPost();
     echo page::parse($TEMPLATE['frame'], 1);
     system::stop();
 }
Example #16
0
    /**
     * @return string HTML
     * @param integer $obj - Экземпляр объекта (ormObject, ormPage)
     * @param string $action - Тип действия: "upd" - изменение, "add" - добавление
     * @desc Выводит форму изменения прав доступа для объекта
     */
    public static function getListForObject($obj, $action)
    {
        if (file_exists(MODUL_DIR . '/users/template/right_list_object.tpl')) {
            include MODUL_DIR . '/users/template/right_list_object.tpl';
        }
        if (isset($_POST['query'])) {
            // Формируем список подсказок для пользователя
            $sel = new ormSelect('user');
            $sel->fields('login');
            $sel->where('id', '<>', '29');
            $sel->where('login', 'LIKE', '%' . $_POST['query'] . '%');
            $users = '';
            while ($user = $sel->getObject()) {
                $zapi = $sel->getObjectNum() != 0 ? ', ' : '';
                $users .= $zapi . "'" . $user->login . "'";
            }
            echo "{ query:'" . $_POST['query'] . "', suggestions:[" . $users . "], data:[] }";
            system::stop();
        } else {
            if (isset($_POST['user_name'])) {
                // Добавляем выбранного пользователя в список
                $sel = new ormSelect('user');
                $sel->fields('login');
                $sel->where('id', '<>', '29');
                $sel->where('login', '=', $_POST['user_name']);
                $sel->limit(1);
                $user = $sel->getObject();
                if ($user instanceof ormObject) {
                    page::assign("group.id", $user->id);
                    page::assign("group.name", $user->login);
                    page::assign("checked_edit", '');
                    page::assign("checked_view", 'checked');
                    echo page::parse($TEMPLATE['group']);
                }
                system::stop();
            }
        }
        // Выводим список групп
        $sel = new ormSelect('user_group');
        $sel->where('id', '<>', '32');
        $sel->orderBy('name', asc);
        $groups = $sel->getData();
        $rights = array();
        if ($action == 'upd') {
            $users = db::q('SELECT o_id, login o_name
							FROM <<rights>>, <<objects>>, <<__user>>
							WHERE r_obj_id = "' . $obj->id . '" and
								  r_group_id = o_id and
								  obj_id = o_id and
								  o_class_id <> 33;', records);
            $groups = array_merge($groups, $users);
            $tmp = db::q('SELECT r_state, r_group_id FROM <<rights>> WHERE r_obj_id = "' . $obj->id . '";', records);
            while (list($key, $right) = each($tmp)) {
                $rights[$right['r_group_id']] = $right['r_state'];
            }
            $select_all = count($tmp) == 1 && empty($tmp[0]['r_group_id']) ? $tmp[0]['r_state'] : false;
        } else {
            $select_all = 2;
        }
        $items = '';
        $num = $edit_num = $view_num = 0;
        while (list($key, $group) = each($groups)) {
            $state = isset($rights[$group['o_id']]) ? $rights[$group['o_id']] : 0;
            if ($state == 2) {
                $edit_num++;
            }
            $checked_edit = $state == 2 || $select_all == 2 ? 'checked' : '';
            page::assign("checked_edit", $checked_edit);
            if ($state > 0) {
                $view_num++;
            }
            $checked_view = $state > 0 || $select_all > 0 ? 'checked' : '';
            page::assign("checked_view", $checked_view);
            page::assign("group.id", $group['o_id']);
            page::assign("group.name", $group['o_name']);
            $items .= page::parse($TEMPLATE['group']);
            $num = $key + 1;
        }
        $checked_edit = $select_all == 2 || $num == $edit_num ? 'checked' : '';
        page::assign("checked_edit", $checked_edit);
        $checked_view = $select_all > 0 || $num == $view_num ? 'checked' : '';
        page::assign("checked_view", $checked_view);
        page::assign("text.all_user", lang::get('STRUCTURE_RIGHT_ALL_USER'));
        page::assign("text.title", lang::get('STRUCTURE_RIGHT_TITLE'));
        page::assign("groups", $items);
        return page::parse($TEMPLATE['frame']);
    }
Example #17
0
 private function showAuthForm($error = 0)
 {
     if (file_exists(MODUL_DIR . '/mpanel/template/auth.tpl')) {
         include MODUL_DIR . '/mpanel/template/auth.tpl';
         page::assign('title', lang::get('CMF'));
         if (user::isGuest()) {
             // Пользователь не авторизован
             page::assign('url', system::getCurrentUrl());
             page::assign('login', lang::get('AUTHFORM_LOGIN'));
             page::assign('passw', lang::get('AUTHFORM_PASSW'));
             page::assign('enter', lang::get('AUTHFORM_ENTER'));
             page::assign('error', $error);
             echo page::parse($TEMPLATE['frame']);
         } else {
             // Пользователь авторизован, но не является админом
             page::assign('exit_url', '/users/logout');
             page::assign('user', user::get('name'));
             page::assign('hello', lang::get('AUTHFORM_HELLO'));
             page::assign('big_text', lang::get('AUTHFORM_BIG_TEXT'));
             page::assign('exit_text', lang::get('AUTHFORM_EXIT_TEXT'));
             echo page::parse($TEMPLATE['frame_no_admin']);
         }
         system::stop();
     }
 }
Example #18
0
 public function getHTML($templ_name = 'filters')
 {
     if ($this->getCount() > 0 && file_exists(MODUL_DIR . '/mpanel/template/' . $templ_name . '.tpl')) {
         include MODUL_DIR . '/mpanel/template/' . $templ_name . '.tpl';
         $items = '';
         $num = 0;
         // Строим список фильтров
         reset($this->filters);
         while (list($key, $field) = each($this->filters)) {
             $num++;
             if (isset($this->new_filters[$num])) {
                 if ($this->new_filters[$num][2]) {
                     page::assign('field.name', $this->new_filters[$num][0]);
                     page::assign('field.content', $this->new_filters[$num][1]);
                     $items .= page::parse($TEMPLATE['field_spec']);
                 } else {
                     $items .= $this->new_filters[$num][1];
                 }
             }
             if (!isset($_SESSION['filters_' . $this->prefix][$field['f_sname']])) {
                 $_SESSION['filters_' . $this->prefix][$field['f_sname']] = '';
             }
             if (isset($this->show_filters[$field['f_sname']]) && !empty($this->show_filters[$field['f_sname']][0])) {
                 $field['f_name'] = $this->show_filters[$field['f_sname']][0];
             }
             page::assign('field.name', $field['f_name']);
             if ($field['f_type'] == 50 || $field['f_type'] > 69 && $field['f_type'] < 96) {
                 // Выпадающий список
                 $data = array();
                 if ($field['f_type'] == 50) {
                     $data = lang::get('FILTER_BOOL');
                 } else {
                     if ($field['f_type'] > 69 && $field['f_type'] < 86) {
                         $data = lang::get('FILTER_ISSET');
                     } else {
                         if ($field['f_type'] == 90 || $field['f_type'] == 95) {
                             $data = ormObjects::getObjectsByClass($field['f_list_id']);
                         }
                     }
                 }
                 $element = ui::SelectBox($field['f_sname'], $data, $_SESSION['filters_' . $this->prefix][$field['f_sname']], 172, '&nbsp;', '', 'selectbox_mini');
                 page::assign('element', $element);
                 $items .= page::parse($TEMPLATE['field_select']);
             } else {
                 if (isset($this->show_filters[$field['f_sname']]) && $this->show_filters[$field['f_sname']][1] || ($field['f_type'] == 25 || $field['f_type'] == 30 || $field['f_type'] == 32) && (!isset($this->show_filters[$field['f_sname']]) || $this->show_filters[$field['f_sname']][1] !== false)) {
                     // Выбор промежутка для чисел или дат
                     if (!isset($_SESSION['filters_' . $this->prefix][$field['f_sname'] . '_2'])) {
                         $_SESSION['filters_' . $this->prefix][$field['f_sname'] . '_2'] = '';
                     }
                     page::assign('field.sname', $field['f_sname']);
                     page::assign('field.value', $_SESSION['filters_' . $this->prefix][$field['f_sname']]);
                     page::assign('field.value2', $_SESSION['filters_' . $this->prefix][$field['f_sname'] . '_2']);
                     $items .= page::parse($TEMPLATE['field_period']);
                 } else {
                     // Обычный фильтр - текстовое поле
                     page::assign('field.sname', $field['f_sname']);
                     page::assign('field.value', $_SESSION['filters_' . $this->prefix][$field['f_sname']]);
                     $items .= page::parse($TEMPLATE['field']);
                 }
             }
         }
         $all_count = $num + count($this->new_filters);
         while ($num < $all_count) {
             $num++;
             if (isset($this->new_filters[$num])) {
                 if ($this->new_filters[$num][2]) {
                     page::assign('field.name', $this->new_filters[$num][0]);
                     page::assign('field.content', $this->new_filters[$num][1]);
                     $items .= page::parse($TEMPLATE['field_spec']);
                 } else {
                     $items .= $this->new_filters[$num][1];
                 }
             }
         }
         page::assign('fields', $items);
         return page::parse($TEMPLATE['frame']);
     }
 }
Example #19
0
 public static function _parse($page, $full = false)
 {
     return page::parse($page, $full);
 }
Example #20
0
 public function tagAction()
 {
     $templ_file = '/search/gettag.tpl';
     $TEMPLATE = page::getTemplate($templ_file);
     if (!is_array($TEMPLATE)) {
         return page::errorNotFound('search.getTag', $templ_file);
     }
     if (system::issetUrl(2) && ($tag = tags::infoTag(system::url(2)))) {
         $msg = lang::get('SEARCH_H1_TAGS') . ' "' . $tag['name'] . '"';
         page::globalVar('h1', $msg);
         page::globalVar('title', $msg);
         // Получаем список классов
         $classes_filter = array();
         if (!empty($_POST['classes'])) {
             $tmp = explode(",", $_POST['classes']);
             $classes_filter = array();
             foreach ($tmp as $v) {
                 $v = trim($v);
                 if (!empty($v)) {
                     $classes_filter[] = $v;
                 }
             }
         }
         $max_count = reg::getKey(ormPages::getPrefix('search') . '/max_count');
         $start = (system::getCurrentNavNum() - 1) * $max_count;
         $result = tags::find(array($tag['id']), $max_count, $start, $classes_filter);
         $list = '';
         while (list($num, $val) = each($result['pages'])) {
             if ($page = ormPages::get($val['page_id'])) {
                 page::assign('obj.id', $page->id);
                 page::assign('obj.num', $num + $start + 1);
                 page::assign('obj.name', $page->name);
                 page::assign('obj.url', $page->_url);
                 //page::assign('obj.content', $page->content);
                 $cn = $page->getClass()->getSName();
                 $block_name = isset($TEMPLATE['list_' . $cn]) ? 'list_' . $cn : 'list';
                 $list .= page::parse($TEMPLATE[$block_name]);
             }
         }
         page::assign('count_page', ceil($result['count'] / $max_count));
     } else {
         $list = '';
         $msg = lang::get('SEARCH_H1_TAGS2');
         page::globalVar('h1', $msg);
         page::globalVar('title', $msg);
     }
     if (!empty($list)) {
         page::assign('list', $list);
         page::fParse('list', $TEMPLATE['frame_list']);
     } else {
         page::fParse('list', $TEMPLATE['not_found']);
     }
     return page::parse($TEMPLATE['frame']);
 }
Example #21
0
 private function parse($val)
 {
     return page::parse(str_replace(array('{', '}'), '%', $val));
 }
Example #22
0
 private function selItems($TEMPLATE)
 {
     if ($this->hide_empty_columns) {
         while ($obj = $this->select->getObject()) {
             reset($this->columns);
             while (list($key, $column) = each($this->columns)) {
                 $value = $this->getProcValue($obj, $column['field'], $column['funct_name']);
                 if (empty($value)) {
                     if (isset($this->del_columns[$column['field']])) {
                         $this->del_columns[$column['field']]++;
                     } else {
                         $this->del_columns[$column['field']] = 1;
                     }
                 }
             }
         }
         $this->select->reset();
     }
     $items = '';
     while ($obj = $this->select->getObject()) {
         page::assign('id', $obj->id);
         page::assign('table_parent_id', $obj->getParentId());
         page::assign('url', $this->def_right . $obj->id);
         $item_vals = '';
         reset($this->columns);
         while (list($key, $column) = each($this->columns)) {
             if (!isset($this->del_columns[$column['field']]) || $this->del_columns[$column['field']] != $this->count) {
                 // Обработка значений
                 $value = $this->getProcValue($obj, $column['field'], $column['funct_name']);
                 page::assign('value', $value);
                 $first = empty($key) ? ' first' : '';
                 //   $first .= ($column['field'] == 'name') ? ' td_name' : '';
                 page::assign('first', $first);
                 $click = $column['click'] && !empty($this->def_right) ? '' : '_no_click';
                 $item_vals .= page::parse($TEMPLATE['item_val' . $click]);
             }
         }
         page::assign('item_vals', $item_vals);
         page::assign('act', $obj->__get('active') ? 1 : 0);
         $items .= page::parse($TEMPLATE['items']);
     }
     page::assign('items', $items);
 }
Example #23
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']);
 }
Example #24
0
 /**
  * @return HTML
  * @param int $comment_id - ID комментария
  * @param string $templ_name - Шаблон оформления комментария
  * @desc МАКРОС: Выводит информацию об указанном комментарии
  */
 public function view($comment_id, $templ_name = 'tree')
 {
     $templ_file = '/comments/' . $templ_name . '.tpl';
     $TEMPLATE = page::getTemplate($templ_file);
     if (!is_array($TEMPLATE)) {
         return page::errorNotFound('comments.view', $templ_file);
     }
     if ($comment = comments::get($comment_id)) {
         if ($comment->isActive() || reg::getKey('/comments/show_noactive')) {
             page::assign('obj.id', $comment->id());
             page::assign('obj.parent_id', $comment->getParentId());
             page::assign('obj.user_id', $comment->getUserId());
             page::assign('obj.publ_date', $comment->getPublDate());
             page::assign('obj.username', $comment->getUserName());
             page::assign('obj.email', $comment->getEmail());
             page::assign('obj.text', $comment->getText());
             page::assign('obj.rate', $comment->getRate());
             if (isset($_SESSION['comments_rate'][$comment->id()])) {
                 page::fParse('rate', $TEMPLATE['rate_change']);
             } else {
                 page::fParse('rate', $TEMPLATE['rate']);
             }
             page::assign('list', '');
             return page::parse($TEMPLATE['list']);
         }
     }
 }
Example #25
0
 /**
  * @return Сгенерированный HTML
  * @param ormClass $class -  экземпляр ORM-класса, для которого необходимо построить структуру
  * @param String $templ_name - имя шаблона оформления
  * @desc Генерирует структуру полей для класса данных
  */
 function getHTML($class, $templ_name = 'orm_fields_tree')
 {
     if (file_exists(MODUL_DIR . '/mpanel/template/' . $templ_name . '.tpl')) {
         include MODUL_DIR . '/mpanel/template/' . $templ_name . '.tpl';
         $nodes['groups'] = $class->getAllGroups();
         $nodes['fields'] = $class->getAllFields();
         $main_url = system::au() . '/' . system::url(0) . '/';
         page::assign('main_url', $main_url);
         if (is_array($nodes) && isset($nodes['groups']) && isset($nodes['fields'])) {
             $groups = '';
             while (list($key, $node) = each($nodes['groups'])) {
                 // Парсим данные о вложенных полях
                 $fields = '';
                 reset($nodes['fields']);
                 while (list($key, $field) = each($nodes['fields'])) {
                     if ($field['f_group_id'] == $node['fg_id']) {
                         if (empty($field['f_name'])) {
                             $field['f_name'] = '- - - - -';
                         }
                         page::assign('item.id', $field['f_id']);
                         page::assign('item.parent_id', $field['f_group_id']);
                         page::fParse('item.url', $this->rightEdit);
                         page::assign('item.name', $field['f_name']);
                         page::assign('item.sname', $field['f_sname']);
                         page::assign('item.type', lang::get('CONSTR_TYPE_LIST', $field['f_type']));
                         page::assign('star', $field['f_required'] ? '*' : '');
                         page::assign('sh', $field['f_view'] ? 'lshow' : 'lhide');
                         if (empty($field['f_type'])) {
                             page::assign('item.right', $this->getRightForField($TEMPLATE, $field['f_id'], $field['f_type'], $field['f_sname']));
                             $fields .= page::parse($TEMPLATE['separator']);
                         } else {
                             if ($field['f_system'] || $field['f_is_clone']) {
                                 $fields .= page::parse($TEMPLATE['field_not_edit']);
                             } else {
                                 page::assign('item.right', $this->getRightForField($TEMPLATE, $field['f_id'], $field['f_type'], $field['f_sname']));
                                 $fields .= page::parse($TEMPLATE['field_edit']);
                             }
                         }
                     }
                 }
                 page::assign('items', $fields);
                 page::assign('item.id', $node['fg_id']);
                 page::fParse('sub_items', $TEMPLATE['frame_items']);
                 // Парсим данные о группе полей 		fg_view   fg_sname
                 page::assign('item.id', $node['fg_id']);
                 page::assign('item.parent_id', 0);
                 page::fParse('item.url', $this->rightEdit2);
                 page::assign('item.name', $node['fg_name']);
                 page::assign('item.sname', $node['fg_sname']);
                 page::assign('sh', $node['fg_view'] ? ' lshow' : ' lhide');
                 $other = $node['fg_system'] || $node['fg_is_clone'] ? true : false;
                 page::assign('item.right', $this->getRightForGroup($TEMPLATE, $node['fg_id'], $other));
                 $groups .= page::parse($TEMPLATE['groups']);
             }
             page::assign('frame_items', $groups);
         } else {
             page::assign('frame_items', '');
         }
         ui::insertButton('button_new_group', lang::get('BTN_NEW_FGROUP'), 'javascript:changeGroup(' . $class->id() . ', \'add\');');
         return page::parse($TEMPLATE['main']);
     }
 }
Example #26
0
 function parseSepar($field, $TEMPLATE)
 {
     if (!empty($field['f_max_size'])) {
         page::assign('size', ' style="margin-top:' . $field['f_max_size'] . 'px;"');
     } else {
         page::assign('size', '');
     }
     if (!empty($field['f_name'])) {
         page::assign('title', $field['f_name']);
         return page::parse($TEMPLATE['field_0_text']);
     } else {
         return page::parse($TEMPLATE['field_0']);
     }
 }
Example #27
0
 /**
  * @return null
  * @param string $templ_name - Полный путь до шаблона письма, от папки /template
  * @param string $email - E-mail на который нужно отправить письмо.
  * @param string $from - E-mail от кого отправляется письмо
  * @param string $from_name - Имя автора письма
  * @desc Парсит письмо по указанному шаблону и отправляет его на указанный ящик.
  */
 static function sendMail($templ_name, $email, $from = '', $from_name = '')
 {
     $TEMPLATE = page::getTemplate($templ_name);
     if (is_array($TEMPLATE)) {
         page::assign('domain', domains::curDomain()->getName());
         page::assign('site_name', domains::curDomain()->getSiteName());
         page::assign('base_email', domains::curDomain()->getEmail());
         if (empty($from)) {
             $from = domains::curDomain()->getEmail();
         }
         if (empty($from_name)) {
             $from_name = domains::curDomain()->getSiteName();
         }
         // Отправляет письмо с инструкциями
         $mail = new phpmailer();
         $mail->From = $from;
         $mail->FromName = $from_name;
         $mail->AddAddress($email);
         $mail->WordWrap = 50;
         $mail->IsHTML(true);
         $mail->Subject = page::parse($TEMPLATE['subject']);
         $mail->Body = page::parse($TEMPLATE['frame']);
         $mail->Send();
     }
 }
Example #28
0
 /**
  * @return string
  * @param string $templ_name - Шаблон оформления
  * @desc МАКРОС: Выводит форму второго шага авторизации через соц сети, если требуется указать e-mail или согласиться с правилами.
  */
 function socialAuthConfirm($templ_name = 'social_auth_confirm')
 {
     $templ_file = '/users/' . $templ_name . '.tpl';
     $TEMPLATE = page::getTemplate($templ_file);
     if (!is_array($TEMPLATE)) {
         return page::errorNotFound('users.socialAuthConfirm', $templ_file);
     }
     if (user::isGuest() && !empty($_SESSION['SOCIAL_AUTH_USER_INFO'])) {
         page::assign('obj.email', '');
         foreach ($_SESSION['SOCIAL_AUTH_USER_INFO'] as $key => $val) {
             page::assign('obj.' . $key, $val);
         }
         page::assign('email_block', reg::getKey('/users/ask_email') && empty($_SESSION['SOCIAL_AUTH_USER_INFO']['email']) ? page::parse($TEMPLATE['email']) : '');
         page::assign('confirm_block', reg::getKey('/users/confirm') ? page::parse($TEMPLATE['confirm']) : '');
         // Вывод сообщения об ошибках
         page::parseError('social_auth_confirm');
         return page::parse($TEMPLATE['frame']);
     }
 }
Example #29
0
 public function goodsList($order_id, $templ_name = 'goods_list')
 {
     $templ_file = '/eshop/' . $templ_name . '.tpl';
     $TEMPLATE = page::getTemplate($templ_file);
     if (!is_array($TEMPLATE)) {
         return page::errorNotFound('eshop.goodsList', $templ_file);
     }
     if ($order = ormObjects::get($order_id, 'eshop_order')) {
         $fields = page::getFields('obj', $TEMPLATE['list']);
         $sel = new ormSelect('eshop_goods');
         $sel->where('parents', '=', $order_id);
         $list = '';
         $num = $cost = 0;
         while ($goods = $sel->getObject()) {
             if ($obj = ormPages::get($goods->goods_id, 'goods')) {
                 $num++;
                 if (isset($fields['obj'])) {
                     while (list($key, $val) = each($fields['obj'])) {
                         if ($val != 'url' && $val != 'class' && $val != 'num') {
                             page::assign('obj.' . $val, $obj->__get($val));
                         }
                     }
                 }
                 page::assign('obj.num', $num);
                 page::assign('class-first', $num == 1 ? 'first' : '');
                 page::assign('class-last', $num == $sel->getObjectCount() ? 'last' : '');
                 page::assign('class-odd', $num % 2 == 0 ? 'odd' : '');
                 page::assign('class-even', $num % 2 != 0 ? 'even' : '');
                 page::assign('class-third', $num % 3 == 0 ? 'third' : '');
                 page::assign('obj.id', $obj->id);
                 page::assign('obj.name', $obj->name);
                 page::assign('obj.cost', $goods->cost);
                 page::assign('obj.count', $goods->count);
                 page::assign('obj.url', $obj->url);
                 $cost_all = $goods->cost * $goods->count;
                 page::assign('obj.cost_all', $cost_all);
                 $cost += $cost_all;
                 $list .= page::parse($TEMPLATE['list']);
             }
         }
         if (!empty($list)) {
             page::assign('cost', $cost);
             page::assign('list', $list);
             return page::parse($TEMPLATE['frame']);
         } else {
             return page::parse($TEMPLATE['empty']);
         }
     }
 }
Example #30
0
 public function upd()
 {
     if (system::url(3) == 'view') {
         header('Content-Type: text/html; charset=utf-8');
         page::assign('hello', '');
         page::assign('user_name', user::get('name'));
         echo page::parse(mailingProcess::getMailHTML(system::url(2)));
         system::stop();
     }
     // Указываем для какого объекта строить форму
     if (system::action() == "upd") {
         // Если это редактирование
         $obj = ormObjects::get(system::url(2));
         $parent_id = $obj->parent_id;
         $right = 'msg_proc_upd';
         if ($obj->error_part_num > 0) {
             $time = time() - strtotime($obj->last_subscribe);
             if ($time < 5) {
                 ui::MessageBox(lang::get('SUBSCRIBE_MSG_MB_TITLE'), lang::get('SUBSCRIBE_MSG_MB_TEXT'));
                 system::redirect('/subscription/msg/' . $parent_id);
             }
         }
     } else {
         if (system::action() == "add") {
             // Если это добавление нового объекта
             $parent_id = system::url(2);
             $right = 'msg_proc_add';
             $obj = new ormObject();
             $obj->setClass('subscribe_msg');
             $obj->setParent($parent_id);
             $obj->publ_date = date('d.m.Y');
         }
     }
     // Если произошли ошибки, перенаправляем на главную страницу модуля
     if ($obj->issetErrors()) {
         system::redirect('/subscription');
     }
     // Устанавливаем кнопки для формы
     ui::setCancelButton('/subscription/msg/' . $parent_id);
     ui::newButton(lang::get('BTN_SAVE'), "javascript:sendForm('save');");
     ui::newButton(lang::get('BTN_APPLY'), "javascript:sendForm('apply');");
     // Создаем форму и выводим ее на страницу
     $form = new ormEditForm($obj, $right);
     // Формируем форму рассылки сообщений
     $send_form = '';
     if (system::action() == "upd" && user::issetRight('msg_send') && ($parent = ormObjects::get($parent_id))) {
         if (file_exists(MODUL_DIR . '/subscription/template/subscription.tpl')) {
             include MODUL_DIR . '/subscription/template/subscription.tpl';
             $links = '';
             // Получаем количество частей в рассылке
             $count = mailingProcess::getPartCount($parent->id);
             if ($count > 0) {
                 $part_num = $obj->part_count - $obj->part_count_awaiting + 1;
                 if ($part_num > $obj->part_count) {
                     $part_num = 1;
                 }
                 page::assign('subject', $parent->subject);
                 // page::assign('count_part', ruNumbers::decl($count, lang::get('SUBSCRIBE_TS')));
                 page::assign('count_part', $count);
                 page::assign('count_part2', $count);
                 page::assign('part_num', $part_num);
                 page::assign('release_id', $obj->id);
                 if ($obj->error_part_num == 0) {
                     page::assign('error_part_num', $part_num);
                     page::fParse('sh1', 'block');
                     page::fParse('sh2', 'none');
                 } else {
                     page::assign('error_part_num', $obj->error_part_num);
                     ui::MessageBox(lang::get('SUBSCRIBE_TEXT_SEND', 9) . $obj->error_part_num . lang::get('SUBSCRIBE_TEXT_SEND', 10), lang::get('SUBSCRIBE_TEXT_SEND', 11));
                     page::fParse('sh2', 'block');
                     page::fParse('sh1', 'none');
                 }
                 $send_form = page::parse($TEMPLATE['frame']);
                 $links .= page::parse($TEMPLATE['send_link']);
             }
             page::assignArray(lang::get('SUBSCRIBE_TEXT_SEND'));
             page::assign('url', system::au() . '/subscription/msg_upd/' . $obj->id . '/view');
             $links .= page::parse($TEMPLATE['view_link']);
             page::assign('list', $links);
             $form->addInBottomTabs('base', page::parse($TEMPLATE['frame_link']));
         }
     }
     return $send_form . $form->getHTML();
 }