Example #1
0
 public function testSaveDataFields()
 {
     mw()->database_manager->extended_save_set_permission(true);
     $val = 'hello there custom 1-' . rand();
     $val2 = 'hello there custom 2-' . rand();
     $params = array('title' => 'My post with data attributes 1', 'content_type' => 'post', 'data_fields_something_custom' => $val, 'data_fields_something_else_custom' => $val2, 'is_active' => 1);
     $id = save_content($params);
     $attributes = content_data($id);
     $this->assertEquals(intval($id) > 0, true);
     $this->assertEquals($attributes['something_custom'], $val);
     $this->assertEquals($attributes['something_else_custom'], $val2);
 }
Example #2
0
 public function testSave()
 {
     mw()->database_manager->extended_save_set_permission(true);
     $has_permission = mw()->database_manager->extended_save_has_permission();
     $params = array('title' => 'My post with data fields', 'content_type' => 'post', 'data_hi_there' => 'hello world', 'is_active' => 1);
     //saving
     $id = save_content($params);
     $data_fields = content_data($id);
     $this->assertEquals(intval($id) > 0, true);
     $this->assertEquals($data_fields['hi_there'], "hello world");
     $this->assertEquals(true, $has_permission);
 }
<?php

if (!isset($params['content-type'])) {
    return;
}
$template_config = mw()->template->get_config();
$data_fields_conf = false;
$data_fields_values = false;
if (!empty($template_config)) {
    if (isset($params['content-type'])) {
        if (isset($template_config['data-fields-' . $params['content-type']]) and is_array($template_config['data-fields-' . $params['content-type']])) {
            $data_fields_conf = $template_config['data-fields-' . $params['content-type']];
            if (isset($params['content-id'])) {
                $data_fields_values = content_data($params['content-id']);
            } else {
                if (isset($params['category-id'])) {
                    $data_fields_values = mw()->data_fields_manager->get_values('rel_type=categories&rel_id=' . $params['category-id']);
                }
            }
        }
    }
}
if (is_array($data_fields_conf)) {
    ?>

<div class="mw-ui-row">
  <div class="mw-ui-col">
    <div class="mw-ui-col-container">
      <?php 
    foreach ($data_fields_conf as $item) {
        ?>
        }
        break;
    case 'view':
        if (isset_content_id($id) == TRUE) {
            /** Thực hiện sửa content */
            $args = content_data_by_id($id);
            /** Hiển thị giao diện sửa content bằng array ở trên */
            function admin_content_page()
            {
                global $args;
                require_once BASEPATH . HM_ADMINCP_DIR . '/' . LAYOUT_DIR . '/' . 'content_view.php';
            }
        } else {
            /** Không tồn tại content có id như request, hiển thị giao diện 404 */
            function admin_content_page()
            {
                require_once BASEPATH . HM_ADMINCP_DIR . '/' . LAYOUT_DIR . '/' . 'admincp_404.php';
            }
        }
        break;
    default:
        $args = content_data($key);
        /** Hiển thị giao diện thêm tất cả content */
        function admin_content_page()
        {
            global $args;
            require_once BASEPATH . HM_ADMINCP_DIR . '/' . LAYOUT_DIR . '/' . 'content_all.php';
        }
}
/** fontend */
require_once BASEPATH . HM_ADMINCP_DIR . '/' . LAYOUT_DIR . '/' . 'layout.php';
Example #5
0
}
if ($module_template != false and $module_template != 'none') {
    $template_file = module_templates($config['module'], $module_template);
} else {
    $template_file = module_templates($config['module'], 'default');
}
if (isset($params['content-id'])) {
    $for_id = $params['content-id'];
}
if (isset($params['for'])) {
    $for = $params['for'];
}
if ($for_id == false and defined('CONTENT_ID')) {
    $for_id = CONTENT_ID;
}
$content_data = content_data($for_id);
$in_stock = true;
if (isset($content_data['qty']) and $content_data['qty'] != 'nolimit' and intval($content_data['qty']) == 0) {
    $in_stock = false;
}
if (isset($for_id) !== false and isset($for) !== false) {
    ?>

<div class="mw-add-to-cart-holder mw-add-to-cart-<?php 
    print $params['id'];
    ?>
" >
  <?php 
    if ($for == 'content' and intval($for_id) == 0) {
        $for_id = 0;
    }
Example #6
0
<?php

if (!is_admin()) {
    return;
}
$cont_id = 0;
if (isset($params['content-id'])) {
    $cont_id = $params['content-id'];
}
$data_fields = content_data($cont_id);
$out_of_stock = false;
?>

<div class="module-product-options-settings">


        <div class="mw-ui-row">
            <div class="mw-ui-col">
            <div class="mw-ui-col-container">
                <div class="mw-ui-field-holder">
        			<label class="mw-ui-label"><?php 
_e("Items in stock");
?>
 <span class="mw-help mw-help-right-top" data-help="<?php 
_e("How many items of this product you have in stock");
?>
?">?</span></label>
        			<select name="data_qty" class="mw-ui-field w100">
        				<option <?php 
if (!isset($data_fields['qty']) or $data_fields['qty'] == 'nolimit') {
    ?>