public function defAction() { function getClassName($val, $obj) { if ($obj = ormPages::get($val)) { return $obj->getClass()->getName(); } } $sel = new ormSelect('feedback'); $sel->findInPages(); $sel->where('form_id', '<>', 0); $sel->orderBy('create_date', desc); $table = new uiTable($sel); $table->showSearch(true); $table->formatValues(true); $table->addColumn('content', 'Текст сообщения', 300); $table->addColumn('name', 'Имя пользователя', 120); $table->addColumn('email', 'E-mail', 120); $table->addColumn('create_date', 'Дата публикации', 120); $table->addColumn('id', 'Тип', 120, 0, 1, 'getClassName'); $table->defaultRight('message_upd'); $table->addRight('message_act', 'active', multi); $table->addRight('message_upd', 'edit', single); $table->addRight('message_del', 'drop', multi); return $table->getHTML(); }
public function defAction() { function getSubscribersCount($id, $obj) { $sel = new ormSelect('subscribe_user'); $sel->where('parents', '=', $id); return $sel->getCount(); } ui::newButton(lang::get('SUBSCRIBE_BTN_ADD'), '/subscription/subscribe_add'); $sel = new ormSelect('subscription'); $sel->where('lang', '=', languages::curId()); $sel->where('domain', '=', domains::curId()); $table = new uiTable($sel); $table->formatValues(true); $table->addColumn('name', lang::get('SUBSCRIBE_TT1'), 200); $table->addColumn('last_subscribe', lang::get('SUBSCRIBE_TT2'), 200); $table->addColumn('id', lang::get('SUBSCRIBE_TT3'), 200, 0, 1, 'getSubscribersCount'); $table->defaultRight('msg'); $table->addRight('msg', 'list', single); $table->addRight('user', 'users', single); $table->addRight('subscribe_upd', 'edit', single); $table->addRight('subscribe_history', 'history', single); $table->addRight('subscribe_del', 'drop', multi); $table->addRight('subscribe_act', 'active', multi); $table->setDelMessage(lang::get('SUBSCRIBE_DEL_TITLE2'), lang::get('SUBSCRIBE_DEL_TEXT2')); $table->setMultiDelMessage(lang::get('SUBSCRIBE_DEL_TITLE_MULTI2'), lang::get('SUBSCRIBE_DEL_TEXT_MULTI2')); return $table->getHTML(); }
public function defAction() { if ($parent = ormObjects::get(system::url(2))) { ui::setNaviBar(lang::right('msg')); ui::setHeader($parent->name); } else { system::redirect('/subscription'); } ui::setBackButton('/subscription'); ui::newButton(lang::get('SUBSCRIBE_BTN_ADD2'), '/subscription/msg_add/' . system::url(2)); function getState($date, $obj) { if ($obj->error_part_num > 0) { $time = time() - strtotime($obj->last_subscribe); if ($time > 4) { return str_replace('%part%', $obj->error_part_num, lang::get('SUBSCRIBE_MSG', 1)); } else { return str_replace('%part%', $obj->error_part_num, lang::get('SUBSCRIBE_MSG', 2)); } } else { if ($obj->part_count_awaiting > 0) { page::assign('part1', $obj->part_count - $obj->part_count_awaiting); page::assign('part2', $obj->part_count); return page::parse(lang::get('SUBSCRIBE_MSG', 3)); } else { if ($obj->last_subscribe == '0000-00-00 00:00:00') { return lang::get('SUBSCRIBE_MSG', 4); } else { return lang::get('SUBSCRIBE_MSG', 5) . ' ' . date('d.m.Y ' . lang::get('SUBSCRIBE_MSG', 6) . ' H:i', strtotime($obj->last_subscribe)); } } } } // Выводим список сообщений рассылки $sel = new ormSelect('subscribe_msg'); $sel->fields('name, last_subscribe, part_count, part_count_awaiting, error_part_num'); $sel->where('parents', '=', system::url(2)); $sel->orderBy('create_date', desc); $table = new uiTable($sel); $table->formatValues(true); $table->addColumn('name', lang::get('SUBSCRIBE_MSG_TT1'), 300); $table->addColumn('last_subscribe', lang::get('SUBSCRIBE_MSG_TT2'), 300, 0, 1, 'getState'); $table->defaultRight('msg_upd'); $table->addRight('msg_upd', 'edit', single); $table->addRight('msg_del', 'drop', multi); return $table->getHTML(); }
public function defAction() { // Определяем какие кнопки будут $types = ormClasses::get('user')->getAllInheritors(); if (count($types) > 1) { $class_list = ''; while (list($id, $name) = each($types)) { $bclass = ormClasses::get($id); $class_list .= '<a href="' . system::au() . '/users/user_add/' . system::url(2) . '/' . $bclass->getSName() . '" style="line-height:17px;">' . $bclass->getName() . '</a><br />'; } ui::newButton(lang::get('BTN_NEW_USER'), "/users/user_add/" . system::url(2), 'class_list', $class_list); } else { ui::newButton(lang::get('BTN_NEW_USER'), "/users/user_add/" . system::url(2)); } ui::setBackButton('/users'); // Заголовок страницы if ($group = ormObjects::get(system::url(2))) { ui::setNaviBar($group->name); ui::setHeader(lang::right('userlist')); } // Выбираем пользователей $sel = new ormSelect('user'); if (system::issetUrl(2) && system::url(2) != 0) { $sel->where('parents', '=', system::url(2)); } $sel->orderBy('create_date', desc); // Строим таблицу $table = new uiTable($sel); $table->formatValues(true); $table->showSearch(true); $table->addColumn('login', lang::get('USERS_TABLE_FIELD_1'), 0, true); $table->addColumn('surname name', lang::get('USERS_TABLE_FIELD_2'), 0, true); $table->addColumn('create_date', lang::get('USERS_TABLE_FIELD_7'), 0, true, true, '', 1); $table->addColumn('last_visit', lang::get('USERS_TABLE_FIELD_3'), 0, true, true, '', 1); $table->addColumn('parents', lang::get('USERS_TABLE_FIELD_4'), 0, false, true); $table->defaultRight('user_upd'); $table->addRight('user_upd', 'edit', single); $table->addRight('user_act', 'active', multi); $table->addRight('user_del', 'drop', multi); $table->setDelMessage(lang::get('USERS_DEL_TITLE'), lang::get('USERS_DEL_TEXT')); $table->setMultiDelMessage(lang::get('USERS_DEL_TITLE_MULTI'), lang::get('USERS_DEL_TEXT_MULTI')); return $table->getHTML(); }
public function defAction() { function getNumber($val, $obj) { return substr('00000', 0, 5 - strlen($val)) . $val; } $sel = new ormSelect('eshop_order'); //$sel->where('form_id', '<>', 0); $sel->orderBy('date', desc); $table = new uiTable($sel); $table->showFilters(true); $table->formatValues(true); $table->addColumn('name', 'Номер', 100, false, true, 'getNumber'); $table->addColumn('state', 'Статус', 300); $table->addColumn('date', 'Дата', 300); $table->addColumn('email', 'E-mail', 300); $table->defaultRight('order_view'); $table->addRight('order_view', 'edit', single); $table->addRight('order_del', 'drop', multi); return $table->getHTML(); }
public function defAction() { ui::addLeftButton(lang::right('list'), 'list'); ui::addLeftButton(lang::right('state'), 'state'); ui::addLeftButton(lang::right('delivery'), 'delivery'); ui::addLeftButton(lang::right('payment'), 'payment'); ui::newButton(lang::get('ESHOP_ADD_STATE'), '/eshop/state_add'); $sel = new ormSelect('eshop_status'); //$sel->where('form_id', '<>', 0); $sel->orderBy('number', asc); $table = new uiTable($sel); $table->showFilters(true); $table->formatValues(true); $table->addColumn('number', '#', 10); $table->addColumn('name', 'Название', 200); $table->addColumn('notice', 'Описание', 400); $table->defaultRight('state_upd'); $table->addRight('state_upd', 'edit', single); $table->addRight('state_del', 'drop', multi); return $table->getHTML(); }
public function defAction() { ui::newButton(lang::get('FEEDBACK_BTN_ADD'), '/feedback/form_add'); function getClassName($val, $obj) { if ($class = ormClasses::get($val)) { return $class->getName(); } } function getAction($val, $obj) { $ret = ''; if (!empty($val)) { $ret .= 'Отправка письма на почту'; } if ($obj->any_sections || $obj->section != 0) { if (!empty($ret)) { $ret .= ', '; } $ret .= 'Сохранение заявки в БД'; } return $ret; } $sel = new ormSelect('feedback_form'); $sel->fields('mailing_list, captcha, form_class, section'); $table = new uiTable($sel); $table->formatValues(true); $table->addColumn('name', 'Название формы', 200); $table->addColumn('mailing_list', 'Выполняемое действие', 400, 0, 1, 'getAction'); $table->addColumn('captcha', 'Защита от спама', 100); $table->addColumn('form_class', 'Тип', 120, 0, 1, 'getClassName'); $table->defaultRight('form_upd'); $table->addRight('form_upd', 'edit', single); $table->addRight('form_del', 'drop', multi); return $table->getHTML(); }
public function defAction() { $_SESSION['STRUCTURE_LIST_FLAG'] = 1; // Если страниц нет, предлагаем добавить новую if (ormPages::getCountOfSection(0) == 0) { ui::MessageBox(lang::get('STRUCTURE_PAGE_NOT_FOUND'), lang::get('STRUCTURE_PAGE_NOT_FOUND2')); system::redirect('/structure/page_add'); } $obj_id = system::issetUrl(2) ? system::url(2) : 0; function getPageNotice($page) { $notice = ''; if ($page->is_home_page) { $notice = lang::get('STRUCTURE_TREE_TEXT12'); } if ($page->other_link != '') { $notice = lang::get('STRUCTURE_TREE_TEXT32'); } if (!$page->view_in_menu) { if (!empty($notice)) { $notice .= ', '; } $notice .= lang::get('STRUCTURE_TREE_TEXT22'); } if (!empty($notice)) { return '(' . $notice . ')'; } else { return ''; } } // Вывод дерева объектов $tree = new ormTree(328, 57); $tree->setClass('ormPage'); $tree->setRoot(0, reg::getKey(ormPages::getPrefix() . '/title_prefix'), 'list/0'); $tree->setNotice('getPageNotice'); $tree->setRightEdit('list'); $tree->setRightActive('page_proc_act'); $tree->setRightRemove('page_proc_moveto'); $tree->setRightAjaxLoad('list'); $tree->setDelMessage(lang::get('STRUCTURE_DEL_TITLE'), lang::get('STRUCTURE_DEL_TEXT')); $tree->addRight('page_upd', lang::right('page_upd'), 'compose_image'); $tree->addRight('page_add', lang::right('page_add'), 'add_image'); //, 'class_list', $class_list ui::setLeftPanel($tree->getHTML()); // Заголовок страницы ui::setHeader(lang::right('tree')); if (!empty($obj_id) && ($obj = ormPages::get($obj_id))) { ui::setNaviBar(lang::right('list')); ui::setHeader($obj->name); ui::setBackButton('/structure/list/' . $obj->getParentId()); } else { $obj_id = 0; } // Формируем список классов для быстрого добавления $class_name = ormPages::getPopularClass($obj_id); $class = ormClasses::get($class_name); $types = ormClasses::get('section')->getAllInheritors(); $no_edit = reg::getList(ormPages::getPrefix() . '/no_edit'); $elem_list = $cat_list = ''; while (list($id, $name) = each($types)) { if (!in_array($id, $no_edit)) { $bc = ormClasses::get($id); $pach = '/css_mpanel/tree/images/'; $ico = 'classes/' . $bc->getSName() . '.png'; if (!file_exists(ROOT_DIR . $pach . $ico)) { $ico = 'file1.gif'; } if ($bc->isInheritor('category') || $bc->getSName() == 'section') { $cat_list .= ' <li><img src="' . $pach . $ico . '"> <a href="' . system::au() . '/structure/page_add/' . $obj_id . '/' . $bc->getSName() . '">' . $bc->getName() . '</a></li>'; } else { $elem_list .= ' <li ><img src="' . $pach . $ico . '"> <a href="' . system::au() . '/structure/page_add/' . $obj_id . '/' . $bc->getSName() . '">' . $bc->getName() . '</a></li>'; } } } $class_list = '<ul>' . $cat_list . '</ul><ul>' . $elem_list . '</ul>'; ui::newButton(lang::get('PANEL_BTN_ADD_PART') . $class->getPadej(0), "/structure/page_add/" . $obj_id, 'class_list', $class_list); // Формируем выборку страниц для таблицы $sel = new ormSelect(); $sel->findInPages(); $sel->where('parents', '=', $obj_id); // Определяем способ сортировки списка $order_by = !empty($obj_id) ? $obj->order_by : ''; if (!empty($order_by)) { $pos = strpos($order_by, ' '); if ($pos) { $parram = substr($order_by, $pos + 1); $order_by = substr($order_by, 0, $pos); } else { $parram = ''; } $sel->orderBy($order_by, $parram); } else { $sel->orderBy(position, asc); } // Вывод таблицы $table = new uiTable($sel); $table->formatValues(true); $table->showSearch(true); $table->hideEmptyColumns(true); $table->addColumn('name', lang::get('STRUCTURE_TABLE_FIELD_1'), 500, true); $table->addColumn('image', lang::get('STRUCTURE_TABLE_FIELD_2'), 400, false, false); $table->addColumn('price', lang::get('STRUCTURE_TABLE_FIELD_3'), 400); $table->addColumn('publ_date', lang::get('STRUCTURE_TABLE_FIELD_4'), 400); $table->defaultRight('page_upd'); $table->addRight('page_upd', 'edit', single); $table->addRight('list', 'list', single); $table->addRight('page_history', 'history', single); $table->addRight('page_proc_act', 'active', multi); $table->addRight('page_del', 'drop', multi); $table->setDelMessage(lang::get('STRUCTURE_DEL_TITLE'), lang::get('STRUCTURE_DEL_TITLE')); $table->setMultiDelMessage(lang::get('STRUCTURE_DEL_TITLE_MULTI'), lang::get('STRUCTURE_DEL_TEXT_MULTI')); return $table->getHTML(); }