Exemplo n.º 1
0
 public function __construct()
 {
     global $osC_Language, $osC_MessageStack;
     parent::__construct();
     if (isset($_GET['cID']) && is_numeric($_GET['cID'])) {
         $this->_page_contents = 'edit.php';
     } else {
         $this->_page_contents = 'new.php';
     }
     if (isset($_POST['subaction']) && $_POST['subaction'] == 'confirm') {
         $data = array('name' => $_POST['categories_name'], 'image' => isset($_FILES['categories_image']) ? $_FILES['categories_image'] : null, 'sort_order' => $_POST['sort_order']);
         if (!isset($_GET['cID'])) {
             $data['parent_id'] = $_POST['parent_id'];
         }
         $error = false;
         foreach ($data['name'] as $key => $value) {
             if (empty($value)) {
                 $osC_MessageStack->add($this->_module, sprintf($osC_Language->get('ms_warning_category_name_empty'), $osC_Language->getData($key, 'name')), 'warning');
                 $error = true;
             }
         }
         if ($error === false) {
             if (osC_Categories_Admin::save(isset($_GET['cID']) && is_numeric($_GET['cID']) ? $_GET['cID'] : null, $data)) {
                 $osC_MessageStack->add($this->_module, $osC_Language->get('ms_success_action_performed'), 'success');
             } else {
                 $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error');
             }
             osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module . '=' . $_GET[$this->_module]));
         }
     }
 }
Exemplo n.º 2
0
 public function __construct()
 {
     global $osC_Language, $osC_MessageStack;
     parent::__construct();
     $this->_page_contents = 'move.php';
     if (isset($_POST['subaction']) && $_POST['subaction'] == 'confirm') {
         if (osC_Categories_Admin::move($_GET['cID'], $_POST['new_category_id'])) {
             $osC_MessageStack->add($this->_module, $osC_Language->get('ms_success_action_performed'), 'success');
         } else {
             $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error');
         }
         osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module . '=' . $_GET[$this->_module]));
     }
 }
Exemplo n.º 3
0
 public static function getAll()
 {
     global $_module;
     if (!isset($_GET['search'])) {
         $_GET['search'] = '';
     }
     if (!empty($_GET['search'])) {
         $result = osC_Categories_Admin::find($_GET['search'], $_GET[$_module]);
     } else {
         $result = osC_Categories_Admin::getAll($_GET[$_module]);
     }
     $result['rpcStatus'] = RPC_STATUS_SUCCESS;
     echo json_encode($result);
 }
Exemplo n.º 4
0
 public function __construct()
 {
     global $osC_Language, $osC_MessageStack;
     parent::__construct();
     if (isset($_POST['batch']) && is_array($_POST['batch']) && !empty($_POST['batch'])) {
         $this->_page_contents = 'batch_move.php';
         if (isset($_POST['subaction']) && $_POST['subaction'] == 'confirm') {
             $error = false;
             foreach ($_POST['batch'] as $id) {
                 if (!osC_Categories_Admin::move($id, $_POST['new_category_id'])) {
                     $error = true;
                     break;
                 }
             }
             if ($error === false) {
                 $osC_MessageStack->add($this->_module, $osC_Language->get('ms_success_action_performed'), 'success');
             } else {
                 $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error');
             }
             osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module . '=' . $_GET[$this->_module]));
         }
     }
 }
Exemplo n.º 5
0
 function setStatus()
 {
     global $toC_Json, $osC_Language;
     if (isset($_REQUEST['categories_id']) && osC_Categories_Admin::setStatus($_REQUEST['categories_id'], isset($_REQUEST['flag']) ? $_REQUEST['flag'] : 1, isset($_REQUEST['product_flag']) ? $_REQUEST['product_flag'] : 0)) {
         $response = array('success' => true, 'feedback' => $osC_Language->get('ms_success_action_performed'));
     } else {
         $response = array('success' => false, 'feedback' => $osC_Language->get('ms_error_action_not_performed'));
     }
     echo $toC_Json->encode($response);
 }
Exemplo n.º 6
0
 function saveCategory()
 {
     global $toC_Json, $osC_Database, $osC_Language;
     $parent_id = isset($_REQUEST['parent_category_id']) ? end(explode('_', $_REQUEST['parent_category_id'])) : null;
     $data = array('parent_id' => $parent_id, 'sort_order' => $_REQUEST['sort_order'], 'image' => $_FILES['image'], 'name' => $_REQUEST['categories_name'], 'delimage' => isset($_REQUEST['delimage']) && $_REQUEST['delimage'] == 'on' ? '1' : '0', 'page_title' => $_REQUEST['page_title'], 'meta_keywords' => $_REQUEST['meta_keywords'], 'meta_description' => $_REQUEST['meta_description']);
     if (osC_Categories_Admin::save(isset($_REQUEST['categories_id']) && is_numeric($_REQUEST['categories_id']) ? $_REQUEST['categories_id'] : null, $data)) {
         $response = array('success' => true, 'feedback' => $osC_Language->get('ms_success_action_performed'));
     } else {
         $response = array('success' => false, 'feedback' => $osC_Language->get('ms_error_action_not_performed'));
     }
     header('Content-Type: text/html');
     echo $toC_Json->encode($response);
 }
Exemplo n.º 7
0
" method="post" enctype="multipart/form-data">

  <p><?php 
echo $osC_Language->get('introduction_edit_category');
?>
</p>

  <fieldset>
    <div><label><?php 
echo $osC_Language->get('field_name');
?>
</label>

<?php 
foreach ($osC_Language->getAll() as $l) {
    echo '<p>' . $osC_Language->showImage($l['code']) . '&nbsp;' . $l['name'] . '<br />' . osc_draw_input_field('categories_name[' . $l['id'] . ']', osC_Categories_Admin::get($osC_ObjectInfo->getInt('categories_id'), $l['id'], 'categories_name')) . '</p>';
}
?>

    </div>

<?php 
if (!osc_empty($osC_ObjectInfo->get('categories_image'))) {
    ?>

    <div><p><?php 
    echo osc_image('../' . DIR_WS_IMAGES . 'categories/' . $osC_ObjectInfo->get('categories_image'), $osC_ObjectInfo->get('categories_name'), HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT) . '<br />' . DIR_WS_CATALOG . 'images/categories/' . $osC_ObjectInfo->getProtected('categories_image');
    ?>
</p></div>

<?php 
Exemplo n.º 8
0
<?php

/*
  $Id: $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2009 osCommerce

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License v2 (1991)
  as published by the Free Software Foundation.
*/
$osC_ObjectInfo = new osC_ObjectInfo(osC_Categories_Admin::get($_GET['cID']));
$categories_array = array(array('id' => '0', 'text' => $osC_Language->get('top_category')));
foreach ($osC_CategoryTree->getArray() as $value) {
    $categories_array[] = array('id' => $value['id'], 'text' => $value['title']);
}
?>

<h1><?php 
echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()), $osC_Template->getPageTitle());
?>
</h1>

<?php 
if ($osC_MessageStack->exists($osC_Template->getModule())) {
    echo $osC_MessageStack->get($osC_Template->getModule());
}
?>