Exemplo n.º 1
0
if (class_exists('module_company', false) && defined('COMPANY_UNIQUE_CONFIG') && COMPANY_UNIQUE_CONFIG && (int) $template_id > 0 && module_company::can_i('view', 'Company') && module_company::is_enabled()) {
    ?>

        <tr>
            <th class="width2">
                <?php 
    echo _l('Choose Company');
    ?>

            </th>
            <td>
                <?php 
    $company_template_rel = array();
    foreach (module_company::get_companys() as $company) {
        // does this one have a custom template yet?
        $custom_template = module_company::template_get_company($template_id, $template, $company['company_id']);
        if ($custom_template) {
            $company_template_rel[$company['company_id']] = $company['name'] . ' ' . _l('(custom)');
        } else {
            $company_template_rel[$company['company_id']] = $company['name'];
        }
    }
    echo print_select_box($company_template_rel, 'company_id', $company_id, '', _l('Default'));
    ?>

                <script type="text/javascript">
                    $(function(){
                        $('#company_id').change(function(){
                            change_detected = false;
                            window.location.href='<?php 
    echo module_template::link_open($template_id);
Exemplo n.º 2
0
 public static function get_template($template_id)
 {
     if (self::db_table_exists('template')) {
         $data = get_single("template", "template_id", $template_id);
         if ($data && $data['template_id'] && $data['template_id'] == $template_id) {
             // hook in here to load any custom company templates.
             if (class_exists('module_company', false) && is_callable('module_company::template_get_company')) {
                 $custom_data = module_company::template_get_company($data['template_id'], $data);
                 if ($custom_data) {
                     $data = $custom_data;
                 }
             }
         }
         return $data;
     } else {
         return array();
     }
 }