Example #1
0
 function ElemInit()
 {
     global $cfg, $sections, $hidden_sections, $_stat, $_sites, $intlang;
     $row = array();
     $modules_in_row = array();
     $i = 0;
     $id = (int) get('id');
     if ($id) {
         $row = sql_getRow("SELECT * FROM `admin_groups` WHERE id='" . $id . "'");
         $row['rights'] = unserialize($row['rights']);
     }
     // ALLOW ->	DEL		INS		UPD		SELECT
     // none  ->	0		0		0		0			=  0
     // view  ->	0		0		0		1           =  1
     // edit	 ->	0		1		1		1           =  7
     // del	 ->	1		1		1		1           = 15
     $row['radios'] = array('0' => '', '1' => '', '7' => '', '15' => '');
     // если указаны скрытые модули - надо их также вывести
     // для возможности задания прав группам пользователей.
     if (isset($hidden_sections)) {
         $sections = array_merge($sections, $hidden_sections);
     }
     foreach ($sections as $key => $section) {
         $row['menu'][$i]['title'] = utf($section[langId()]);
         $row['menu'][$i]['i'] = $i;
         foreach ($section['modules'] as $module_key => $module) {
             if (count(explode("/", $module_key)) > 1) {
                 $arr = explode("/", $module_key);
                 $module = $arr[0];
             }
             if (!is_module_auth($module_key)) {
                 continue;
             }
             // set the title
             unset($title);
             $title = $module[langID()];
             if (!isset($title)) {
                 switch ($module) {
                     case 'stat':
                         $title = $_stat[$module_key][langID()];
                         break;
                     case 'sites':
                         $title = $_sites[$module_key][langID()];
                         break;
                 }
             }
             if (!in_array($module . '_' . $title, $modules_in_row)) {
                 $row['menu'][$i]['rows'][] = array('menu' => $i, 'name' => 'fld[rights][' . $module_key . ']', 'title' => utf($title), 'selected' => !empty($row['rights'][$module_key]) ? $row['rights'][$module_key] : 0);
                 $modules_in_row[] = $module . '_' . $title;
             }
         }
         $i++;
     }
     foreach ($this->elem_str as $str_key => $str_val) {
         $row['str_' . $str_key] = $str_val[$intlang];
     }
     $table = $this->Parse($row, 'admin_groups.editform.tmpl');
     $this->elem_fields['columns']['table'] = array('type' => 'words', 'value' => $table);
     return parent::ElemInit();
 }
Example #2
0
 function ElemInit()
 {
     $id_user = (int) get('id', 0, 'pg');
     global $site_domains;
     $user_roles = array();
     $user_roles_tmp = sql_getRows("SELECT * FROM auth_users_roles WHERE user_id = " . (int) $id_user);
     $roles = sql_getRows("SELECT * FROM acl_roles");
     foreach ($user_roles_tmp as $v) {
         $user_roles[$v['root_id']][$v['role_id']] = true;
     }
     unset($user_roles_tmp);
     // рисуем таблицу
     $data = '<table class="ajax_table_main" cellspacing="1">';
     $data .= '<tr class="ajax_table_header_row">';
     $data .= '<th class="ajax_table_header_cell">&nbsp;</th>';
     foreach ($roles as $role) {
         $data .= '<th class="ajax_table_header_cell" style="text-align: center;">' . $role['description'] . '</th>';
     }
     $data .= '</tr>';
     foreach ($site_domains as $site) {
         foreach ($site['langs'] as $l) {
             $data .= '<tr class="ajax_table_row">';
             $data .= '<td class="ajax_table_cell" style="text-align: left; vertical-align: middle">' . $site['descr'] . (count($site['langs']) > 1 ? ' (' . $l['descr'] . ')' : '') . '<br /><a target="_blank" href="http://' . $site['name'] . '/' . (count($site['langs']) > 1 ? $l['name'] : '') . '">' . $site['name'] . '</a></td>';
             reset($roles);
             foreach ($roles as $role) {
                 $role_checked = isset($user_roles[$l['root_id']][$role['id']]) ? "checked" : null;
                 $data .= '<td class="ajax_table_cell" style="text-align: center;"><input type="checkbox" name="fld[sites][' . $l['root_id'] . '][roles][' . $role['id'] . ']" value="1" ' . $role_checked . ' /></td>';
             }
             $data .= '</tr>';
         }
     }
     $data .= '</table>';
     $this->elem_fields['columns']['data']['value'] = $data;
     return parent::ElemInit();
 }
Example #3
0
 function ElemInit()
 {
     $id = (int) get('id', 0);
     $root_id = domainRootID();
     if ($id) {
         // если нет своего value, то вывести value из языка по умолчанию
         # получаем данные по id
         $row = sql_getRow('SELECT id,module,name,def,value FROM strings WHERE id=' . $id);
         if (!$row['value'] || !$row['def']) {
             # получаем данные для такого module, name
             $temp_row = sql_getRow('SELECT * FROM strings WHERE module="' . $row['module'] . '" AND name="' . $row['name'] . '" AND lang="' . LANG_DEFAULT . '" AND root_id=' . getMainRootID());
             if ($temp_row) {
                 if ($temp_row['value']) {
                     $row['value'] = $temp_row['value'];
                 }
                 if ($temp_row['def']) {
                     $row['def'] = $temp_row['def'];
                 }
             }
         }
         $this->elem_fields['columns']['value']['value'] = h($row['value']);
         $this->elem_fields['columns']['def'] = array('type' => 'hidden', 'value' => h($row['def']));
     }
     $this->elem_fields['columns']['root_id'] = array('type' => 'select', 'func' => 'getRoots');
     if (!$id && $root_id) {
         $this->elem_fields['columns']['root_id']['value'] = $root_id;
     }
     $this->elem_fields['columns']['lang'] = array('type' => 'hidden');
     if (!$id) {
         $this->elem_fields['columns']['lang']['value'] = '';
     }
     return parent::ElemInit();
 }
Example #4
0
 function ElemInit()
 {
     global $multielemactions;
     $this->list_buttons['create'] =& $multielemactions['create'];
     $this->list_buttons['delete'] =& $multielemactions['delete'];
     $this->columns = array(array('select' => 'id', 'display' => 'ids', 'type' => 'checkbox', 'width' => '1px'), array('select' => 'name', 'display' => 'name', 'flags' => FLAG_SEARCH), array('select' => 'image_small', 'type' => 'smallimagepath', 'display' => 'image_small'), array('select' => 'image_large', 'type' => 'smallimagepath', 'display' => 'image_large'));
     TElems::ElemInit();
 }
Example #5
0
 function ElemInit()
 {
     $columns = sql_getRows("SHOW COLUMNS FROM `admins`", true);
     if (isset($columns['department_id'])) {
         $this->elem_fields['columns']['department_id'] = array('type' => 'input_treeid');
     }
     parent::ElemInit();
 }
Example #6
0
 function ElemInit()
 {
     $columns = sql_getRows("SHOW COLUMNS FROM `publications`", true);
     if (!isset($columns['allow_comments'])) {
         unset($this->elem_fields['columns']['allow_comments']);
     }
     return parent::ElemInit();
 }
Example #7
0
 function ElemInit()
 {
     $this->elem_str['image'] = array('Изображение', 'Image');
     $this->elem_str['x1'] = array('x1', 'x1');
     $this->elem_str['y1'] = array('y1', 'y1');
     $this->elem_str['x2'] = array('x2', 'x2');
     $this->elem_str['y2'] = array('y2', 'y2');
     parent::ElemInit();
 }
Example #8
0
 function ElemRedactBefore($fld)
 {
     if (!empty($fld['password']) && $fld['password'] == $fld['password2']) {
         $fld['password'] = md5($fld['password']);
         $this->elem_fields['columns']['password']['db_field'] = true;
     }
     if (!$fld['email']) {
         $fld['email'] = 'NULL';
     }
     return parent::ElemRedactBefore($fld);
 }
Example #9
0
 /**
  * Вызывается перед сохранением в базу
  *
  * @param array $fld
  * @return array
  */
 function ElemRedactBefore($fld)
 {
     $fld = parent::ElemRedactBefore($fld);
     $error = "";
     $page_id = get('id', 0, 'gp');
     $page_pid = get('pid', 0, 'gp');
     if ($page_pid) {
         $parent = sql_getRow("SELECT dir, pids, level FROM " . $this->elem_table . " WHERE id=" . $page_pid);
     } else {
         $page_pid = sql_getValue("SELECT pid FROM `" . $this->elem_table . "` WHERE id=" . $page_id);
         $parent = sql_getRow("SELECT dir, pids, level FROM " . $this->elem_table . " WHERE id=" . $page_pid);
     }
     if (!$page_id) {
         // создание нового раздела
         $auto = sql_getRow("SHOW TABLE STATUS LIKE '" . $this->elem_table . "'");
         if ($auto['Auto_increment']) {
             $new_id = $auto['Auto_increment'];
         }
         if ($page_pid == $page_id) {
             $fld['level'] = 1;
         } else {
             $fld['level'] = $parent['level'] + 1;
         }
         $fld['priority'] = sql_getValue("SELECT MAX(priority) FROM `" . $this->elem_table . "` WHERE pid=" . $page_pid) + 1;
     }
     $page = $page_id ? $page_id : $new_id;
     if ($page_pid != $page_id) {
         # pids
         $pids = explode('/', $parent['pids']);
         if (!$pids[0]) {
             array_shift($pids);
         }
         if (!$pids[count($pids) - 1]) {
             array_pop($pids);
         }
         $pids[] = $page_pid;
         $fld['pids'] = '/' . join('/', $pids) . '/';
         # dir
         $fld['dir'] = $parent['dir'] . $page . '/';
     } else {
         # pids
         $fld['pids'] = '/' . $page_pid . '/';
         $fld['dir'] = '/' . $page . '/';
     }
     # изменим next у родителя
     sql_query("UPDATE tree SET next='1' WHERE id='" . (isset($parent['id']) ? $parent['id'] : $page_pid) . "'");
     # Проверка на существование dir
     $check = sql_getValue("SELECT id FROM " . $this->elem_table . " WHERE dir='" . $fld['dir'] . "'");
     if ($check && $check != $page_id) {
         $error_tab = $k;
         $error = "Раздел с таким URL уже существует";
     }
     return array('fld' => $fld, '_error_text' => $error);
 }
Example #10
0
 function ElemInit()
 {
     global $watermark_img;
     if (isset($watermark_img) && !empty($watermark_img)) {
         $this->elem_fields['columns']['watermark'] = array('type' => 'words', 'value' => '
         <div class="checkBox">
             <input type="checkbox" value="1" id="checkbox_water" class="check" name="watermark"><label class="check" for="checkbox_water">Наложить водяной знак</label>
         </div>
         ');
     }
     parent::ElemInit();
 }
Example #11
0
 function ElemRedactB($fld)
 {
     $fld = parent::ElemRedactB($fld);
     // Пересчет цены в у.е
     if ($fld['price']) {
         $value = sql_getValue('SELECT value FROM currencies WHERE name="USD"');
         if ($value) {
             $fld['price_metr'] = $fld['price'] / $value;
         }
     }
     return $fld;
 }
Example #12
0
 function ElemInit()
 {
     global $site_domains;
     $count = 0;
     foreach ($site_domains as $site) {
         foreach ($site['langs'] as $lang) {
             $count++;
         }
     }
     if ($count < 2) {
         $this->elem_fields['columns']['root_ids'] = array('type' => 'hidden', 'value' => domainRootId());
     }
     return parent::ElemInit();
 }
Example #13
0
 function ElemInit()
 {
     // проверим сколько сайтов, если несколько то выводим колонку
     global $site_domains;
     $current = current($site_domains);
     if (count($site_domains) > 1 || count($current['langs']) > 1) {
         $columns = array_slice($this->elem_fields['columns'], 0, 2);
         $columns += array('root_id' => array('type' => 'select', 'func' => 'getRoots'));
         $columns += array_slice($this->elem_fields['columns'], 2);
         $this->elem_fields['columns'] = $columns;
     } else {
         $this->elem_fields['columns']['root_id'] = array('type' => 'hidden', 'display' => array('func' => 'getRootId'));
     }
     return parent::ElemInit();
 }
Example #14
0
 function ElemRedactBefore($fld)
 {
     if (isset($fld['root_id'])) {
         $root_id = $fld['root_id'];
         while ($pid = sql_getValue("SELECT pid FROM tree WHERE id = {$root_id}")) {
             if ($pid == $root_id) {
                 break;
             } else {
                 $root_id = $pid;
             }
         }
         $fld['root_id'] = $root_id ? $root_id : 'NULL';
     }
     return parent::ElemRedactBefore($fld);
 }
Example #15
0
 function ElemInit()
 {
     $id = (int) get('id', 0, 'pg');
     if ($id && ($row = sql_getRow("SELECT * FROM " . $this->elem_table . " WHERE id = " . (int) $id))) {
         $this->elem_fields['columns']['text']['value'] = "<h1>Текст:</h1><div class='tabContent'>" . $row['text'] . "</div>";
         $files = unserialize($row['attach']);
         if (!empty($files)) {
             $attach = "\n                    <h1>Файлы:</h1>\n                    <div class='tabContent'>\n                    <table class='ajax_table_main' style='width: 100%'>\n                    <tr>\n                        <th>Путь</td>\n                        <th>Размер (байт)</td>\n                    </tr>";
             foreach ($files as $file) {
                 $file['name'] = '/' . ltrim($file['name'], '/');
                 $attach .= "\n                        <tr>\n                            <td><a href='{$file['name']}'>{$file['name']}</a></td>\n                            <td>{$file['size']}</td>\n                        </tr>\n                    ";
             }
             $attach .= "</table></div>";
             $this->elem_fields['columns']['attach']['value'] = $attach;
         }
     }
     return parent::ElemInit();
 }
Example #16
0
 function ElemInit()
 {
     $this->columns = array(array('select' => 'id', 'display' => 'ids', 'type' => 'checkbox', 'width' => '1px'), array('select' => 'name', 'display' => 'name', 'flags' => FLAG_SEARCH), array('select' => 'imagepath', 'type' => 'smallimagepath', 'display' => 'imagepath', 'temp' => true), array('select' => 'smallimagepath', 'type' => 'smallimagepath', 'display' => 'smallimagepath', 'temp' => true), array('select' => 'priority'));
     TElems::ElemInit();
 }
Example #17
0
 function ElemInit()
 {
     $this->columns = array(array('select' => 'id', 'display' => 'id', 'type' => 'checkbox'), array('select' => 'url', 'display' => 'url', 'flags' => FLAG_SORT | FLAG_SEARCH), array('select' => 'active', 'display' => 'active', 'type' => 'visible', 'flags' => FLAG_SORT));
     TElems::ElemInit();
 }
Example #18
0
 function ElemInit()
 {
     $this->columns = array(array('select' => 'id', 'display' => 'ids', 'type' => 'checkbox', 'width' => '1px'), array('select' => 'name', 'display' => 'name', 'flags' => FLAG_SEARCH | FLAG_SORT), array('select' => 'date', 'as' => 'date', 'display' => 'date', 'width' => '1%', 'type' => 'datetime', 'flags' => FLAG_SORT));
     TElems::ElemInit();
 }
Example #19
0
 function ElemInit()
 {
     $this->elem_str = array('name' => array('Название формы', 'Title'), 'name_site' => array('Название формы (внутреннее)', 'Title (on site)'), 'db_table' => array('Название таблицы в БД', 'DB table name'), 'email' => array('Отправлять на адреса (через запятую)', 'Send to (comma-separated)'), 'is_popup' => array('Всплывающая форма', 'Popup form'), 'visible' => array('Отображать на странице', 'Visible'), 'submit_title' => array('Надпись на кнопке отправки формы', 'Submit title'), 'code' => array('Код для вставки', 'Code'), 'lang' => array('Язык формы', 'Lang'), 'get_code' => array('Получить код', 'Get code'), 'get_html_code' => array('HTML-код', 'HTML-code'));
     return parent::ElemInit();
 }
Example #20
0
 function ElemInit()
 {
     $this->columns = array(array('select' => 'id', 'display' => 'ids', 'type' => 'checkbox', 'width' => '1px'), array('select' => 'name', 'display' => 'name'), array('select' => 'visible', 'display' => 'visible', 'type' => 'visible'));
     TElems::ElemInit();
 }
Example #21
0
 function ElemInit()
 {
     $this->columns = array(array('select' => 'id', 'display' => 'ids', 'type' => 'checkbox'), array('select' => 'header', 'display' => 'header', 'type' => 'edit_extra'), array('select' => 'count', 'display' => 'count', 'type' => 'edit'), array('select' => 'value', 'display' => 'value', 'type' => 'edit'));
     TElems::ElemInit();
 }
Example #22
0
 function ElemInit()
 {
     $this->elem_str = array('x' => array('Широта', 'Lat'), 'y' => array('Долгота', 'Lng'), 'scale' => array('Масштаб', 'Scale'));
     return parent::ElemInit();
 }
Example #23
0
 function ElemInit()
 {
     $this->elem_str = array('name' => array('Название формы', 'Title'), 'db_table' => array('Название таблицы в БД', 'DB table name'), 'email' => array('Отправлять на адреса (через запятую)', 'Send to (comma-separated)'), 'visible' => array('Отображать на странице', 'Visible'));
     return parent::ElemInit();
 }
Example #24
0
 /**
  * Вызывается перед сохранением в базу
  *
  * @param array $fld
  * @return array
  */
 function ElemRedactBefore($fld)
 {
     $fld = parent::ElemRedactBefore($fld);
     $fld['footer_text'] = $fld['footer_text_radio'] ? $fld['footer_text_area'] : $fld['footer_text_fck'];
     return $fld;
 }
Example #25
0
 function ElemInit()
 {
     $this->columns = array(array('select' => 'id', 'display' => 'ids', 'type' => 'checkbox', 'width' => '1px'), array('select' => 'name', 'display' => 'name', 'flags' => FLAG_SEARCH), array('select' => 'count', 'type' => 'text', 'display' => 'count'));
     TElems::ElemInit();
 }
Example #26
0
 function ElemInit()
 {
     $this->columns = array(array('select' => 'id', 'display' => 'ids', 'type' => 'checkbox', 'width' => '1px'), array('select' => 'name', 'display' => 'name', 'flags' => FLAG_SEARCH), array('select' => 'image_small', 'type' => 'imagepath', 'display' => 'image_small'), array('select' => 'image_large', 'type' => 'imagepath', 'display' => 'image_large'));
     TElems::ElemInit();
 }
Example #27
0
 function ElemInit()
 {
     $this->columns = array(array('select' => 'name', 'display' => 'header', 'width' => '50%'), array('select' => 'value', 'as' => 'value', 'display' => 'value', 'type' => 'edit', 'width' => '50%'));
     TElems::ElemInit();
 }
Example #28
0
 function ElemInit()
 {
     // список вариантов ответа
     $id_quest = (int) get('id', 0, 'pg');
     $id_survey = (int) get('pid', 0, 'pg');
     $value = '';
     if (!empty($id_survey)) {
         $variants = array();
         if (!empty($id_quest) && !empty($id_survey)) {
             $variants = sql_getRows("SELECT * FROM surveys_quest_variants WHERE id_survey = " . $id_survey . " AND id_quest = " . $id_quest . " ORDER BY priority ASC");
         }
         $value .= '<script src="/admin/js_custom/jquery.tmpl.min.js" type="text/javascript"></script>';
         $value .= '<div class="variants" style="display: none;">';
         $value .= '<br /><fieldset id="quest_' . $id_quest . '">';
         $value .= '<legend>' . $this->elem_str['edit_variants'][0] . '</legend>';
         foreach ($variants as $variant) {
             $value .= '
             <div id="var_' . $variant['id'] . '">
                 <div class="elemBox">
                     <label class="float">' . $this->elem_str['variant_text'][0] . ':</label><input class="text" type="text" name="fld[vars][' . $variant['id'] . '][text]" value="' . htmlspecialchars($variant['text']) . '" style="width: 280px;">
                 </div>
                 <div class="elemBox">
                     <label class="float">' . $this->elem_str['priority'][0] . ':</label><input class="text" style="width:50px;" type="text" name="fld[vars][' . $variant['id'] . '][priority]" value="' . $variant['priority'] . '" size=5>
                 </div>
                 <div class="checkBox">
                     <input class="check" type="checkbox" name="fld[vars][' . $variant['id'] . '][free_form]" value="1" ' . ($variant['free_form'] ? 'checked' : '') . '><label class="check">' . $this->elem_str['free_form'][0] . '</label>
                 </div>
                 <div class="checkBox">
                     <input class="check" type="checkbox" name="fld[vars][' . $variant['id'] . '][delete]" value="1" ' . ($variant['delete'] ? 'checked' : '') . '><label class="check">' . $this->elem_str['btn_delete_variant'][0] . '</label>
                 </div>
                 <hr />
             </div>';
         }
         $value .= '<div class="vars_container margBottom"></div>';
         $value .= '<a class="button margBottom" href="javascript:void(0);" onclick="variant_append(' . $id_quest . ');"><span>' . $this->elem_str['btn_add_variant'][0] . '</span></a>';
         $value .= '</fieldset>';
         $value .= '</div>';
         // div.variants
         $value .= '
         <script type="text/x-jquery-tmpl" id="vars_tmpl">
             <div id="var_${uid}">
                 <div class="elemBox">
                     <label class="float">' . $this->elem_str['variant_text'][0] . ':</label><input class="text" type="text" name="fld[vars][${uid}][text]" style="width: 280px;">
                 </div>
                 <div class="elemBox">
                     <label class="float">' . $this->elem_str['priority'][0] . ':</label><input class="text" style="width:50px;" type="text" name="fld[vars][${uid}][priority]" size=5>
                 </div>
                 <div class="checkBox">
                     <input class="check" type="checkbox" name="fld[vars][${uid}][free_form]" value="1"><label class="check">' . $this->elem_str['free_form'][0] . '</label>
                 </div>
                 <a class="button" href="javascript:void(0);" onclick="variant_remove(\'${uid}\');">' . $this->elem_str['btn_delete_variant'][0] . '</a>
                 <div class="clear"></div>
                 <hr />
             </div>
         </script>';
         global $surveys_dictonaries;
         // список справочников из settings.cfg
         // catalog type select
         if (count($surveys_dictonaries)) {
             $value .= '
             <div id="variantsCatalog" style="display: none;">
                 <div class="elemBox">
                     <label class="float">' . $this->elem_str['catalog'][0] . ':</label>
                     <select name="fld[catalog]">';
             foreach ($surveys_dictonaries as $id => $dict) {
                 $value .= '<option value="' . $id . '">' . $dict['title'] . '</option>';
             }
             $value .= '
                     </select>
                 </div>
             </div>';
             // div.variantsCatalog
         }
     }
     $this->elem_fields['columns']['variants']['value'] = $value;
     return parent::ElemInit();
 }
Example #29
0
 function ElemInit()
 {
     $this->columns = array(array('select' => 'id', 'display' => 'ids', 'type' => 'checkbox', 'width' => '1px'), array('select' => 'name', 'display' => 'name'), array('select' => 'image', 'type' => 'image', 'display' => 'image', 'temp' => true), array('select' => 'id', 'display' => 'items', 'type' => 'items'), array('select' => 'priority'));
     TElems::ElemInit();
 }
Example #30
0
 function ElemInit()
 {
     $this->columns = array(array('select' => 'id', 'display' => 'ids', 'type' => 'checkbox', 'width' => '1px'), array('select' => 'composition_id', 'display' => 'composition_id', 'type' => 'type'), array('select' => 'elem_id', 'display' => 'elem_id', 'type' => 'product'), array('select' => 'count', 'display' => 'count', 'type' => 'count'));
     TElems::ElemInit();
 }