Exemplo n.º 1
0
         $contents[] = array('text' => TEXT_INFO_DELETE_BLOCK_INTRO);
         $contents[] = array('text' => '<br /><b>' . $bInfo->module . '#' . $bInfo->block . '</b>');
     }
     $contents[] = array('align' => 'center', 'text' => '<br />' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . '&nbsp;<a href="' . zen_href_link(FILENAME_BLOCKS, 'page=' . $_GET['page'] . '&bID=' . $bInfo->id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
     break;
 default:
     $pages_outputs_string = '';
     foreach ($pages_options as $pages_option) {
         if (zen_addOnModules_page_match($bInfo->pages, $pages_option['id'])) {
             $pages_outputs_string .= $pages_option['text'] . '<br />';
         }
     }
     if (count($addon_pages_options) > 0) {
         $pages_outputs_string .= zen_image(DIR_WS_IMAGES . 'pixel_black.gif', '', '100%', '3') . '<br />';
         foreach ($addon_pages_options as $pages_option) {
             if (zen_addOnModules_page_match($bInfo->pages, $pages_option['id'])) {
                 $pages_outputs_string .= $pages_option['text'] . '<br />';
             }
         }
     }
     if ($bInfo->module == 'sideboxes') {
         $heading[] = array('text' => '<strong>' . TEXT_INFO_BOX . $bInfo->block . '</strong>');
         $contents[] = array('align' => 'left', 'text' => '<a href="' . zen_href_link(FILENAME_BLOCKS, 'page=' . $_GET['page'] . '&bID=' . $bInfo->id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a>');
         $contents[] = array('text' => '<strong>' . TEXT_INFO_BOX_DETAILS . '<strong>');
         $contents[] = array('text' => TEXT_INFO_BOX_NAME . ' <strong>' . $box_names[$bInfo->block] . '</strong> (' . $bInfo->block . ')');
         $contents[] = array('text' => TEXT_INFO_BOX_STATUS . ' ' . ($bInfo->status == '1' ? TEXT_ON : TEXT_OFF));
         $contents[] = array('text' => TEXT_INFO_BOX_LOCATION . ' ' . $bInfo->location);
         $contents[] = array('text' => TEXT_INFO_BOX_SORT_ORDER . ' ' . $bInfo->sort_order);
         $contents[] = array('text' => $bInfo->visible == '1' ? TEXT_VISIBLE_PAGES : TEXT_INVISIBLE_PAGES);
         $contents[] = array('text' => $pages_outputs_string);
         if (!(file_exists($boxes_directory . $bInfo->block) || file_exists($boxes_directory_template . $bInfo->block))) {
function zen_addOnModules_get_layout_location_blocks($layout_location, $page)
{
    global $db, $layout_location_blocks, $template_dir;
    $return = false;
    if (!is_array($layout_location_blocks)) {
        $layout_location_blocks = array();
    }
    if (!is_array($layout_location_blocks[$layout_location])) {
        $layout_location_blocks[$layout_location] = array();
    }
    $module_names = '';
    $enabled_addon_modules = zen_addOnModules_get_enabled_modules();
    $enabled_addon_modules[] = 'sideboxes';
    if (count($enabled_addon_modules) > 0) {
        for ($i = 0, $n = count($enabled_addon_modules); $i < $n; $i++) {
            $class = $enabled_addon_modules[$i];
            $module_names .= " '" . zen_db_prepare_input($class) . "',";
        }
        $module_names = trim($module_names, ',');
        $query = "\n      SELECT\n        *\n      FROM " . TABLE_BLOCKS . "\n      WHERE module IN (" . $module_names . ")\n      AND status = 1\n      AND location = :location\n      AND template = :template\n      ORDER BY sort_order, block\n      ;";
        $query = $db->bindVars($query, ':location', $layout_location, 'string');
        $query = $db->bindVars($query, ':template', $template_dir, 'string');
        $result = $db->Execute($query);
        while (!$result->EOF) {
            $module = $result->fields['module'];
            $block = $result->fields['block'];
            $pages = $result->fields['pages'];
            $visible = $result->fields['visible'];
            $display = false;
            if ($pages == '') {
                $display = true;
            } else {
                if ($page == FILENAME_DEFAULT) {
                    if (isset($_GET['cPath'])) {
                        global $current_category_id;
                        $page = zen_has_category_subcategories($current_category_id) ? FILENAME_DEFAULT . '_categories' : FILENAME_DEFAULT . '_products';
                    }
                    if (isset($_GET['manufacturers_id'])) {
                        $page = FILENAME_DEFAULT . '_products';
                    }
                }
                if ($page == FILENAME_ADDON) {
                    $perse_page_module = zen_addOnModules_persePageModule($_GET['module']);
                    $page = $perse_page_module['class'] . '#' . $perse_page_module['method'];
                }
                $page_match = zen_addOnModules_page_match($pages, $page);
                if ($visible == 1 && $page_match || $visible == 0 && !$page_match) {
                    $display = true;
                }
            }
            if ($display) {
                $layout_location_blocks[$layout_location][] = array('module' => $module, 'block' => $block, 'css_selector' => $result->fields['css_selector'], 'insert_position' => $result->fields['insert_position']);
            }
            $result->MoveNext();
        }
    }
    return $layout_location_blocks;
}