Esempio n. 1
0
 function getEditRSSForm()
 {
     $form = new A_Form("plugin_rss_edit.tpl");
     $form->data = A::$DB->getRowById($_POST['id'], STRUCTURE);
     $form->data['sections'] = A::$DB->getAssoc("SELECT id,caption FROM " . DOMAIN . "_sections WHERE module='catalog'");
     $form->data['categories'] = array();
     if ($form->data['sections']) {
         if ($section = getSectionById($form->data['idsec'])) {
             $this->getCats($section, $form->data['categories'], 0);
         }
         $this->RESULT['html'] = $form->getContent();
     } else {
         $this->RESULT['html'] = AddLabel("Не найдены разделы материалов.");
     }
 }
Esempio n. 2
0
 /**
  * Обработчик действия: Отдает форму перемещения альбомов.
  */
 function getMoveItemsForm()
 {
     if (empty($_POST['items'])) {
         return;
     }
     $form = new A_Form("module_gallery_move.tpl");
     $form->data['idcat'] = $_POST['idcat'];
     $form->data['items'] = array_values($_POST['items']);
     $form->data['categories'] = A::$DB->getAll("SELECT id,idker,name FROM " . SECTION . "_categories ORDER BY level,sort");
     if (count($form->data['categories']) > 0) {
         $this->RESULT['html'] = $form->getContent();
     } else {
         $this->RESULT['html'] = AddLabel("Нет вариантов перемещения.");
     }
 }
Esempio n. 3
0
 /**
  * Обработчик действия: Отдает форму добавления столбца в структуру импорта.
  */
 function getAddColForm()
 {
     $form = new A_Form("module_shoplite_addcol.tpl");
     $cols = A::$DB->getCol("SELECT field FROM " . SECTION . "_cols");
     $form->data['fields'] = array();
     for ($i = 0; $i < 3; $i++) {
         if (!in_array('category' . $i, $cols)) {
             $form->data['fields'][] = array('field' => 'category' . $i, 'name' => 'Категория ур.' . ($i + 1), 'type' => 'string');
         }
     }
     if (!in_array('name', $cols)) {
         $form->data['fields'][] = array('field' => 'name', 'name' => 'Название', 'type' => 'string');
     }
     if (!in_array('content', $cols)) {
         $form->data['fields'][] = array('field' => 'content', 'name' => 'Описание', 'type' => 'text');
     }
     if (!in_array('description', $cols)) {
         $form->data['fields'][] = array('field' => 'description', 'name' => 'Аннотация', 'type' => 'text');
     }
     if (!in_array('art', $cols)) {
         $form->data['fields'][] = array('field' => 'art', 'name' => 'Артикул', 'type' => 'string');
     }
     if (A::$OPTIONS['modprices'] == 1 && !in_array('mprice', $cols)) {
         $form->data['fields'][] = array('field' => 'mprice', 'name' => 'Модификатор', 'type' => 'mprice');
     }
     if (!in_array('price', $cols)) {
         $form->data['fields'][] = array('field' => 'price', 'name' => 'Цена', 'type' => 'float');
     }
     if (!in_array('oldprice', $cols)) {
         $form->data['fields'][] = array('field' => 'oldprice', 'name' => 'Прошлая цена', 'type' => 'float');
     }
     if (A::$OPTIONS['onlyavailable'] == 1 && !in_array('iscount', $cols)) {
         $form->data['fields'][] = array('field' => 'iscount', 'name' => 'Количество', 'type' => 'int');
     }
     if (!in_array('active', $cols)) {
         $form->data['fields'][] = array('field' => 'active', 'name' => 'Активен', 'type' => 'bool');
     }
     if (!in_array('favorite', $cols)) {
         $form->data['fields'][] = array('field' => 'favorite', 'name' => 'Спецпредложение', 'type' => 'bool');
     }
     if (!in_array('new', $cols)) {
         $form->data['fields'][] = array('field' => 'new', 'name' => 'Новинка', 'type' => 'bool');
     }
     if (A::$OPTIONS['usetags'] == 1 && !in_array('tags', $cols)) {
         $form->data['fields'][] = array('field' => 'tags', 'name' => 'Теги', 'type' => 'string');
     }
     A::$DB->query("SELECT * FROM " . DOMAIN . "_fields WHERE item='" . SECTION . "' AND type<>'file' AND type<>'image' AND type<>'date' ORDER BY sort");
     while ($row = A::$DB->fetchRow()) {
         if (!in_array($row['field'], $cols)) {
             if ($row['type'] == 'format') {
                 $row['type'] = 'text';
             }
             $form->data['fields'][] = array('field' => $row['field'], 'name' => $row['name_' . DEFAULTLANG], 'type' => $row['type']);
         }
     }
     A::$DB->free();
     if (A::$OPTIONS['useimages']) {
         for ($i = 0; $i < 3; $i++) {
             if (!in_array('idimg' . $i, $cols)) {
                 $form->data['fields'][] = array('field' => 'idimg' . $i, 'name' => 'Фото ' . ($i + 1), 'type' => 'image');
             }
         }
     }
     if (A::$OPTIONS['usefiles']) {
         for ($i = 0; $i < 3; $i++) {
             if (!in_array('idfile' . $i, $cols)) {
                 $form->data['fields'][] = array('field' => 'idfile' . $i, 'name' => 'Файл ' . ($i + 1), 'type' => 'file');
             }
         }
     }
     $sort = A_Session::get(SECTION . "_sort", isset($_COOKIE[SECTION . '_sort']) ? $_COOKIE[SECTION . '_sort'] : A::$OPTIONS['sort']);
     if ($sort == 'sort') {
         $form->data['fields'][] = array('field' => 'sort', 'name' => 'Порядок', 'type' => 'int');
     }
     if (count($form->data['fields']) > 0) {
         $this->RESULT['html'] = $form->getContent();
     } else {
         $this->RESULT['html'] = AddLabel("Все поля уже заданы!");
     }
 }
Esempio n. 4
0
 /**
  * Обработчик действия: Отдает форму пермещения элементов.
  */
 function getMovePagesForm()
 {
     if (empty($_POST['pages'])) {
         return;
     }
     $form = new A_Form("module_pages_cmove.tpl");
     $form->data['pages'] = array_values($_POST['pages']);
     $form->data['idker'] = A::$DB->getOne("SELECT idker FROM " . SECTION . " WHERE id=" . (int) current($form->data['pages']));
     $form->data['dirs'] = array();
     $cid = (int) A_Session::get(SECTION . "_cid", 0);
     $this->getDirs($form->data['dirs'], 0, $cid);
     $form->data['dirs'] = array_multisort_key($form->data['dirs'], "level_sort");
     if ($cid > 0 && count($form->data['dirs']) == 0) {
         $row = A::$DB->getRow("SELECT id,idker,name,level,sort FROM " . SECTION . " WHERE id={$cid}");
         $row['level_sort'] = sprintf("%03d_%03d", $row['level'], $row['sort']);
         $form->data['dirs'][] = $row;
     }
     if (count($form->data['dirs']) > 0) {
         $this->RESULT['html'] = $form->getContent();
     } else {
         $this->RESULT['html'] = AddLabel("Нет вариантов перемещения.");
     }
 }