public static function getData($id)
 {
     global $lC_Database, $lC_Language, $lC_Vqmod;
     $lC_Language->loadIniFile('templates_modules_layout.php');
     $result = array();
     $Qboxes = $lC_Database->query('select id, title from :table_templates_boxes where modules_group = :modules_group order by title');
     $Qboxes->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
     $Qboxes->bindValue(':modules_group', $_GET['set']);
     $Qboxes->execute();
     while ($Qboxes->next()) {
         $result['boxes_array'][$Qboxes->valueInt('id')] = $Qboxes->value('title');
     }
     $Qtemplate = $lC_Database->query('select id from :table_templates where code = :code');
     $Qtemplate->bindTable(':table_templates', TABLE_TEMPLATES);
     $Qtemplate->bindValue(':code', $_GET['filter']);
     $Qtemplate->execute();
     $filter_id = $Qtemplate->valueInt('id');
     $pages_array = array(array('id' => $filter_id . '/*', 'text' => '*'));
     $d_boxes = new lC_DirectoryListing('../templates/' . $_GET['filter'] . '/content');
     $d_boxes->setRecursive(true);
     $d_boxes->setAddDirectoryToFilename(true);
     $d_boxes->setCheckExtension('php');
     $d_boxes->setExcludeEntries('.svn');
     foreach ($d_boxes->getFiles(false) as $box) {
         if ($box['is_directory'] === true) {
             $entry = array('id' => $filter_id . '/' . $box['name'] . '/*', 'text' => $box['name'] . '/*');
         } else {
             $page_filename = substr($box['name'], 0, strrpos($box['name'], '.'));
             $entry = array('id' => $filter_id . '/' . $page_filename, 'text' => $page_filename);
         }
         if ($_GET['filter'] != DEFAULT_TEMPLATE && $d_boxes->getSize() > 0) {
             $entry['group'] = '-- ' . $_GET['filter'] . ' --';
         }
         $pages_array[] = $entry;
     }
     if ($_GET['filter'] != DEFAULT_TEMPLATE) {
         $d_boxes = new lC_DirectoryListing('../templates/' . DEFAULT_TEMPLATE . '/content');
         $d_boxes->setRecursive(true);
         $d_boxes->setAddDirectoryToFilename(true);
         $d_boxes->setCheckExtension('php');
         $d_boxes->setExcludeEntries('.svn');
         foreach ($d_boxes->getFiles(false) as $box) {
             if ($box['is_directory'] === true) {
                 $entry = array('id' => $filter_id . '/' . $box['name'] . '/*', 'text' => $box['name'] . '/*');
             } else {
                 $page_filename = substr($box['name'], 0, strrpos($box['name'], '.'));
                 $entry = array('id' => $filter_id . '/' . $page_filename, 'text' => $page_filename);
             }
             $check_entry = $entry;
             $check_entry['group'] = '-- ' . $_GET['filter'] . ' --';
             if (!in_array($check_entry, $pages_array)) {
                 $entry['group'] = '-- ' . DEFAULT_TEMPLATE . ' --';
                 $pages_array[] = $entry;
             }
         }
     }
     $result['pages_array'] = $pages_array;
     require $lC_Vqmod->modCheck('includes/templates/' . $_GET['filter'] . '.php');
     $class = 'lC_Template_' . $_GET['filter'];
     $filter_template = new $class();
     $groups_array = array();
     foreach ($filter_template->getGroups($_GET['set']) as $group) {
         $groups_array[] = array('id' => $group, 'text' => $group);
     }
     $Qgroups = $lC_Database->query('select distinct b2p.boxes_group from :table_templates_boxes_to_pages b2p, :table_templates_boxes b where b2p.templates_id = :templates_id and b2p.templates_boxes_id = b.id and b.modules_group = :modules_group and b2p.boxes_group not in (:boxes_group) order by b2p.boxes_group');
     $Qgroups->bindTable(':table_templates_boxes_to_pages', TABLE_TEMPLATES_BOXES_TO_PAGES);
     $Qgroups->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
     $Qgroups->bindInt(':templates_id', $filter_id);
     $Qgroups->bindValue(':modules_group', $_GET['set']);
     $Qgroups->bindRaw(':boxes_group', '"' . implode('", "', $filter_template->getGroups($_GET['set'])) . '"');
     $Qgroups->execute();
     while ($Qgroups->next()) {
         if ($Qgroups->value('boxes_group') == null) {
             continue;
         }
         $groups_array[] = array('id' => $Qgroups->value('boxes_group'), 'text' => $Qgroups->value('boxes_group'));
     }
     if (!empty($groups_array)) {
         array_unshift($groups_array, array('id' => null, 'text' => $lC_Language->get('please_select')));
         $result['groups_dropdown'] = lc_draw_pull_down_menu('group', $groups_array, null, 'class="input with-small-padding"') . '  ';
     }
     if ($id != null) {
         $Qlayout = $lC_Database->query('select b2p.*, b.id as box_id, b.title as box_title, b.code as box_code from :table_templates_boxes_to_pages b2p, :table_templates_boxes b where b2p.id = :id and b2p.templates_boxes_id = b.id');
         $Qlayout->bindTable(':table_templates_boxes_to_pages', TABLE_TEMPLATES_BOXES_TO_PAGES);
         $Qlayout->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
         $Qlayout->bindInt(':id', $id);
         $Qlayout->execute();
         $result['modules_selected'] = $Qlayout->value('box_id');
         $result['pages_selected'] = $Qlayout->valueInt('templates_id') . '/' . $Qlayout->value('content_page');
         $result['page_specific'] = $Qlayout->valueInt('page_specific') === 1 ? true : false;
         $result['group_selected'] = $Qlayout->value('boxes_group');
         $result['sort_order'] = $Qlayout->valueInt('sort_order');
         $Qlayout->freeResult;
     }
     return $result;
 }