<?php
/**
 * Created by PhpStorm.
 * User: IOAN
 * Date: 12/3/2015
 * Time: 10:55 AM
 */
$cp_buttons = array();
$q = "SELECT * FROM domain_pages WHERE catdom_id='$domain_id' AND active='yes' ORDER BY order_seq ASC;";
$r = @mysql_query($q);
if($r && mysql_num_rows($r) > 0) {
    while($row = mysql_fetch_assoc($r)) {
        $cp_buttons[$row['page_id']] = array_map('stripslashes', $row);
    }
}

if(is_array($cp_buttons) && count($cp_buttons) > 0) {
    $optres['css'][] = $module_css_path . 'amodules/cp_buttons/css/cp_buttons.css';
    ?>
    <section class="cp-buttons" role="navigation">
        <div class="list-group">
                <?php
                foreach($cp_buttons as $cp_id=>$cp_data) {
                    $cp_url = $cp_data['friendly_url'] . '.html';
                    $cp_title = $cp_data['title_en'];
                    ?>
                    <div class="list-group-item">
                        <div class="cp-item-data">
                            <a href="<?=$cp_url;?>" class=""><?=$cp_title;?></a>
                        </div>

                    </div>
                    <?php
                }
                ?>
        </div>
    </section>
    <?php
}