示例#1
0
 public static function template_handle_save($template_id, $data)
 {
     // check if we're savniga company id and that this user has access to this company, and permissions to edit templates.
     $company_id = isset($_REQUEST['company_id']) ? (int) $_REQUEST['company_id'] : false;
     if ($company_id) {
         $company = self::get_company($company_id);
         if ($company) {
             $existing_template = module_template::get_template($template_id);
             if ($existing_template && $existing_template['template_id'] == $template_id) {
                 // we're saving a template for this particular company.
                 // if it's an empty template content then we remove this company template so it reverts to the system default.
                 if (isset($data['content']) && !strlen(trim($data['content']))) {
                     delete_from_db('company_template', array('company_id', 'template_id'), array($company_id, $template_id));
                     set_message('Company template successfully reset to default');
                     redirect_browser(module_template::link_open($template_id));
                 } else {
                     $sql = 'REPLACE INTO `' . _DB_PREFIX . "company_template` SET company_id = " . (int) $company_id . ", `template_id` = " . (int) $template_id . ", `description` = '" . mysql_real_escape_string(isset($data['description']) ? $data['description'] : '') . "', `content` = '" . mysql_real_escape_string(isset($data['content']) ? $data['content'] : '') . "', `wysiwyg` = '" . mysql_real_escape_string(isset($data['wysiwyg']) ? $data['wysiwyg'] : '') . "'";
                     query($sql);
                     set_message('Unique company template successfully updated');
                     redirect_browser(module_template::link_open($template_id) . '&company_id=' . $company_id);
                 }
             }
         }
     }
 }
示例#2
0
        $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);
    ?>
&company_id='+$(this).val();
                        });
                    });
                </script>
            </td>
        </tr>
        <?php 
}
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() && isset($company_id) && $company_id) {
    ?>

        <tr>
            <th class="width2">
                <?php 
示例#3
0
    </tr>
    </thead>
    <tbody>
    <?php 
$c = 0;
foreach ($templates as $template) {
    $template = module_template::get_template($template['template_id']);
    ?>

        <tr class="<?php 
    echo $c++ % 2 ? "odd" : "even";
    ?>
">
            <td class="row_action">
	            <?php 
    echo module_template::link_open($template['template_id'], true);
    ?>

            </td>
			<td>
				<?php 
    echo htmlspecialchars($template['description']);
    ?>

			</td>
        </tr>
	<?php 
}
?>

  </tbody>