public function indexAction()
 {
     //http://www.xiguxigu.com/g/1
     $gid = $this->param('gid');
     $group = GroupData::getById($gid);
     if (!$group) {
         $url = ComTool::url("index");
         ComTool::redirect($url);
     }
     //根据群组id获取群组支持的分类,一级和二级
     $cats = CategoryData::groupCategorys($gid);
     $this->assign('cats', $cats);
     $this->assign('group', $group);
     $this->display();
 }
 public function indexAction()
 {
     $cid = intval($this->param('cid', 0));
     if (!$cid) {
         $url = ComTool::url("index");
         ComTool::redirect($url);
     }
     $category = CategoryData::getById($cid);
     if (!$category) {
         $url = ComTool::url("index");
         ComTool::redirect($url);
     }
     $curTime = time();
     $category['start_time'] = '09:00:00';
     $category['end_time'] = '24:00:00';
     $startTime = strtotime($category['start_time']);
     $endTime = strtotime($category['end_time']);
     $notStart = $curTime < $startTime ? true : false;
     //true为尚未开始
     $isOver = $curTime > $endTime ? true : false;
     //true为已结束
     $isOn = !$notStart && !$isOver;
     //过程中
     $this->assign('notStart', $notStart);
     $this->assign('isOver', $isOver);
     $this->assign('isOn', $isOn);
     $group = GroupData::getById($category['group_id']);
     $store = StoreData::getById($category['store_id']);
     $goods = GoodsData::getsByCid($cid);
     $cart = array();
     $cart = $this->getCart($cid);
     $this->assign('category', $category);
     $this->assign('group', $group);
     $this->assign('store', $store);
     $this->assign('goods', $goods);
     $this->assign('products', $cart['products']);
     $this->assign('totalPrice', $cart['totalPrice']);
     $this->display();
 }
Beispiel #3
0
<?php

$persons = CategoryData::getAll();
?>
      <div class="page-content">

        <!-- Header Bar -->
<?php 
Action::load("header");
?>
        <!-- End Header Bar -->

          <div class="row">
            <div class="col-lg-12">
<a href="./?r=team/newcat" class="btn btn-default pull-right">Agregar Categoria</a>
            <h1>Categorias</h1>
<?php 
if (count($persons) == 0) {
    ?>
  <p class="alert alert-danger">No hay Categorias</p>
<?php 
}
?>
              <div class="widget">
                <div class="widget-title">
                  <i class="fa fa-th-list"></i> Categorias
                </div>
                <div class="widget-body no-padding">

                  <div class="table-responsive">
<?php 
<?php

$category = CategoryData::getById($_GET["id"]);
$category->del();
Core::redir("./index.php?view=categories");
<div class="row">
	<div class="col-md-12">
<div class="btn-group pull-right">
	<a href="index.php?view=newcategory" class="btn btn-default"><i class='fa fa-th-list'></i> Nueva Categoria</a>
</div>
		<h1>Categorias</h1>
<br>
		<?php 
$users = CategoryData::getAll();
if (count($users) > 0) {
    // si hay usuarios
    ?>

			<table class="table table-bordered table-hover">
			<thead>
			<th>Nombre</th>
			<th></th>
			</thead>
			<?php 
    foreach ($users as $user) {
        ?>
				<tr>
				<td><?php 
        echo $user->name . " " . $user->lastname;
        ?>
</td>
				<td style="width:130px;"><a href="index.php?view=editcategory&id=<?php 
        echo $user->id;
        ?>
" class="btn btn-warning btn-xs">Editar</a> <a href="index.php?view=delcategory&id=<?php 
        echo $user->id;

<div class="panel panel-default">
    <div class="panel-heading">
        Categorias
    </div>
	<div class="list-group">
  <a class='list-group-item' href="index.php?view=resume"><?php 
if ($category == null) {
    ?>
<i class="glyphicon glyphicon-ok"></i> <?php 
}
?>
Todas</a>
<?php 
foreach (CategoryData::getAll() as $cat) {
    ?>
  <a class='list-group-item' href="index.php?view=resume&cat_id=<?php 
    echo $cat->id;
    ?>
"><?php 
    if ($category != null && $category->id == $cat->id) {
        ?>
<i class="glyphicon glyphicon-ok"></i> <?php 
    }
    echo $cat->name;
    ?>
</a>
<?php 
}
?>
Beispiel #7
0
<?php

$user = UserData::getById(Session::getUID());
$grades = CategoryData::getAllActive();
?>
<section class="content-header">
<a href='index.php?view=newcategory' class='btn btn-default pull-right'><i class='glyphicon glyphicon-plus-sign'></i> Agregar Categoria</a>
			<h1>Categorias</h1>
</section>
<section class="content">
<div class="row">

	<div class="col-md-12">
	<?php 
if (isset($_COOKIE["gradeupdated"])) {
    ?>
			<p class="alert alert-success"><i class='glyphicon glyphicon-ok-sign'></i> La categoria <b><?php 
    echo $_COOKIE["gradeupdated"];
    ?>
</b> ha sido actualizada exitosamente.</p>
		<?php 
    setcookie("gradeupdated", "", time() - 18600);
}
?>

	<?php 
if (isset($_COOKIE["gradedeleted"])) {
    ?>
			<p class="alert alert-danger"><i class='glyphicon glyphicon-minus-sign'></i> La categoria <b><?php 
    echo $_COOKIE["gradedeleted"];
    ?>
<?php

$user = CategoryData::getById($_GET["id"]);
?>
<div class="row">
	<div class="col-md-12">
	<h1>Editar Categoria</h1>
	<br>
		<form class="form-horizontal" method="post" id="addproduct" action="index.php?action=updatecategory" role="form">


  <div class="form-group">
    <label for="inputEmail1" class="col-lg-2 control-label">Nombre*</label>
    <div class="col-md-6">
      <input type="text" name="name" value="<?php 
echo $user->name;
?>
" class="form-control" id="name" placeholder="Nombre">
    </div>
  </div>

  <div class="form-group">
    <div class="col-lg-offset-2 col-lg-10">
    <input type="hidden" name="user_id" value="<?php 
echo $user->id;
?>
">
      <button type="submit" class="btn btn-success">Actualizar Categoria</button>
    </div>
  </div>
</form>
Beispiel #9
0
    <div class="controls col-md-8">
    <textarea name='description' class="form-control" style='width:280px;' id='input_description' placeholder='Descripcion de la imagen'></textarea>
    </div>
  </div><br>
  <div class="control-group row" id='tags'>
    <label class="control-label col-md-4" for="inputEmail">Etiquetas</label>
    <div class="controls col-md-8">
      <input type="text" class="form-control" name='tags' id="input_tags" style='width:280px;' placeholder="Etiqueta la imagen : divertido, asombroso, playa">
    </div>
  </div><br>
<!--  <div class="control-group row">
    <label class="control-label col-md-4" for="inputEmail">Categoria</label>
    <div class="controls col-md-4">
    <select name='category_id' class="form-control">
<?php 
        foreach (CategoryData::getAll() as $p) {
            ?>
    <option value="<?php 
            echo $p->id;
            ?>
"><?php 
            echo $p->name;
            ?>
</option>
<?php 
        }
        ?>
    </select>
    </div>
  </div>  <br>
  -->
Beispiel #10
0
<?php

if (count($_POST) > 0) {
    $user = new CategoryData();
    $user->name = $_POST["name"];
    $user->add();
    print "<script>window.location='index.php?view=categories';</script>";
}
Beispiel #11
0
<?php

$cat = CategoryData::getById($_GET["category_id"]);
$cat->del();
Core::redir("index.php?view=categories");
<?php

$grade = CategoryData::getById($_GET["id"]);
$name = $grade->name;
$grade->del();
setcookie("gradedeleted", $name);
header("Location: index.php?view=categories");
<?php

$grade = new CategoryData();
$grade->name = $_POST["name"];
$grade->add();
// setcookie("gradeadded",$grade->name);
header("Location: index.php?view=categories");
Beispiel #14
0
<?php

if (count($_POST) > 0) {
    $user = CategoryData::getById($_POST["user_id"]);
    $user->name = $_POST["name"];
    $user->update();
    print "<script>window.location='index.php?view=categories';</script>";
}
Beispiel #15
0
 public function getCategory()
 {
     return $this->category_id != null ? CategoryData::getById($this->category_id) : null;
 }
Beispiel #16
0
<?php

if (count($_SESSION["cart"]) == 1) {
    unset($_SESSION["cart"]);
} else {
    $products = $_SESSION["cart"];
    $news = array();
    foreach ($products as $product) {
        if ($product["product_id"] != $_GET["product_id"]) {
            array_push($news, $product);
        }
    }
    $_SESSION["cart"] = $news;
}
//print_r($products);
if ($_GET["href"] == "cart") {
    Core::redir("index.php?view=mycart");
} else {
    if ($_GET["href"] == "product") {
        $p = ProductData::getById($_GET["product_id"]);
        $cat = CategoryData::getById($p->category_id);
        Core::redir("index.php?view=productos&cat=" . $cat->short_name);
    }
}
Beispiel #17
0
 /**
  * 提交订单
  */
 public function goAction()
 {
     if (ComTool::isAjax()) {
         if (!$this->isLogin()) {
             ComTool::ajax(Cola::getConfig('_error.mustlogin'), '请先登录,即将跳转至登录页面');
         }
         $mobile = trim($this->post('mobile'));
         ComTool::checkEmpty($mobile, '请填写常用手机号');
         if (!ComTool::isMobile($mobile)) {
             ComTool::ajax(100001, '请填写正确的手机号');
         }
         $receiver = $this->post('receiver', '');
         ComTool::checkMaxLen($receiver, 16, "收货人姓名最多16位");
         $addrDesc = $this->post('addr_desc', '');
         ComTool::checkMaxLen($addrDesc, 32, "详细位置最多32位");
         $message = trim($this->post('message', ''));
         ComTool::checkMaxLen($message, 100, "留言最多100字");
         $curCategory = $this->post('cate', 0);
         $curCategory = intval(base64_decode($curCategory));
         if (!isset($_SESSION['cart'][$curCategory])) {
             ComTool::ajax(100001, '购物车为空');
         }
         $cart = $this->getCart($curCategory);
         if (!$cart) {
             ComTool::ajax(100001, '购物车为空');
         }
         $groupName = $this->post('group', '');
         if (!$groupName) {
             $category = CategoryData::getById($curCategory);
             $group = GroupData::getById($category['group_id']);
             $groupName = $group['name'];
         } else {
             $groupName = base64_decode($groupName);
         }
         $currUser = $this->getCurrentUser();
         $data = array();
         $orderId = ComTool::getOrderId();
         $data['id'] = $orderId;
         $data['user_id'] = $currUser['id'];
         $data['category_id'] = $curCategory;
         $data['user_name'] = $receiver;
         $data['user_tel'] = $mobile;
         $data['user_addr'] = "{$groupName} {$addrDesc}";
         $data['message'] = $message;
         $data['create_time'] = $data['update_time'] = time();
         $data['create_date'] = date("Y-m-d");
         $data['total_cost'] = $cart['totalPrice'];
         $data['status'] = '1';
         $res = OrderData::add($data);
         if ($res === false) {
             ComTool::ajax(100001, '服务器忙,请重试');
         }
         $sql = "insert into order_detail(order_id,good_id,good_name,amount,`price`,price_desc,`status`) values";
         foreach ($cart['products'] as $product) {
             $sql .= "('{$orderId}','{$product['id']}','{$product['name']}','{$product['quantity']}','{$product['price']}','{$product['price']}({$product['price_num']}{$product['price_unit']})','1'),";
         }
         $sql = trim($sql, ',');
         $res = OrderData::sql($sql);
         if ($res === false) {
             ComTool::ajax(100001, '服务器忙,请重试');
         }
         //TODO 清除此分类购物车的session
         ComTool::ajax(100000, 'ok');
     }
 }
Beispiel #18
0
<?php

$pacients = ProjectData::getAll();
$medics = CategoryData::getAll();
?>

<div class="row">
<div class="col-md-10">
<h1>Nueva Tarea</h1>
<form class="form-horizontal" role="form" method="post" action="./?action=addtask">
<div class="form-group">
    <label for="inputEmail1" class="col-lg-2 control-label">Titulo</label>
    <div class="col-lg-10">
      <input type="text" name="title" required class="form-control" id="inputEmail1" placeholder="Titulo">
    </div>
  </div>
  <div class="form-group">
    <label for="inputEmail1" class="col-lg-2 control-label">Descripcion</label>
    <div class="col-lg-10">
    <textarea class="form-control" rows="5" name="description" placeholder="Descripcion"></textarea>
    </div>
  </div>

  <div class="form-group">
    <label for="inputEmail1" class="col-lg-2 control-label">Proyecto</label>
    <div class="col-lg-4">
<select name="project_id" class="form-control">
<option value="">-- SELECCIONE --</option>
  <?php 
foreach ($pacients as $p) {
    ?>
Beispiel #19
0
<?php

$cat = new CategoryData();
$cat->name = $_POST["name"];
$cat->short_name = $_POST["short_name"];
if (isset($_POST["is_active"])) {
    $cat->is_active = 1;
} else {
    $cat->is_active = 0;
}
$cat->add();
Core::redir("index.php?view=categories");
      <input type="text" name="unit" class="form-control" id="unit" placeholder="Escriba el concepto">
    </div>
  </div>
  <div class="form-group">
    <label for="inputEmail1" class="col-lg-2 control-label">Costo*</label>
    <div class="col-md-6">
      <input type="text" name="price_out" class="form-control" id="price_out" placeholder="Agregar costo">
    </div>
  </div>
  <div class="form-group">
    <label for="inputEmail1" class="col-lg-2 control-label">Categoria</label>
    <div class="col-md-6">
<select name="category_id" class="form-control" id="category_id" required>
  <option value="">-- SELECCIONE CATEGORIA --</option>
<?php 
foreach (CategoryData::getAllActive() as $cat) {
    ?>
  <option value="<?php 
    echo $cat->id;
    ?>
"><?php 
    echo $cat->name;
    ?>
</option>
<?php 
}
?>
</select>
    </div>
  </div>
<p class="alert alert-info">* Campor obligatorios: Producto, Cantidad, Costo</p>
Beispiel #21
0
  <!-- Brand and toggle get grouped for better mobile display -->
  <div class="navbar-header">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
      <span class="sr-only">Toggle navigation</span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </button>
  </div>

  <!-- Collect the nav links, forms, and other content for toggling -->
  <div class="collapse navbar-collapse navbar-ex1-collapse">
    <ul class="nav navbar-nav">
      <li><a href="./"><i class="fa fa-home"></i> Inicio</a></li>
<?php 
$cats = CategoryData::getPublics();
if (count($cats) > 0) {
    ?>
      <li class="dropdown">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-th-list"></i> Productos<b class="caret"></b></a>
        <ul class="dropdown-menu">
<?php 
    foreach ($cats as $cat) {
        ?>
          <li><a href="index.php?view=productos&cat=<?php 
        echo $cat->short_name;
        ?>
"><?php 
        echo $cat->name;
        ?>
</a></li>
 public function getCategory()
 {
     return CategoryData::getById($this->category_id);
 }
Beispiel #23
0
<?php

if (isset($_GET["cat"])) {
    $cat = CategoryData::getByPreffix($_GET["cat"]);
    $products = ProductData::getPublicsByCategoryId($cat->id);
} else {
    if (isset($_GET["opt"])) {
        if ($_GET["opt"] == "news") {
            $products = ProductData::getNews();
        } else {
            if ($_GET["opt"] == "offers") {
                $products = ProductData::getOffers();
            }
        }
    } else {
        if (isset($_GET["act"]) && $_GET["act"] == "search") {
            $products = ProductData::getLike($_GET["q"]);
        }
    }
}
?>
<section>
  <div class="container">

  <div class="row">

  <div class="col-md-12">
    <div style="background:#333;font-size:25px;color:white;padding:5px;"><?php 
if (isset($_GET["act"]) && $_GET["act"] != "") {
    echo "Busqueda: " . $_GET["q"];
} else {
Beispiel #24
0
<?php

$product = ProductData::getById($_GET["id"]);
$categories = CategoryData::getAll();
if ($product != null) {
    ?>
<div class="row">
	<div class="col-md-8">
	<h1><?php 
    echo $product->name;
    ?>
 <small>Editar Producto</small></h1>
  <?php 
    if (isset($_COOKIE["prdupd"])) {
        ?>
    <p class="alert alert-info">La informacion del producto se ha actualizado exitosamente.</p>
  <?php 
        setcookie("prdupd", "", time() - 18600);
    }
    ?>
	<br><br>
		<form class="form-horizontal" method="post" id="addproduct" enctype="multipart/form-data" action="index.php?view=updateproduct" role="form">

  <div class="form-group">
    <label for="inputEmail1" class="col-lg-3 control-label">Imagen*</label>
    <div class="col-md-8">
      <input type="file" name="image" id="name" placeholder="">
<?php 
    if ($product->image != "") {
        ?>
  <br>
Beispiel #25
0
              <p>Proveedores</p>
            </div>
            <div class="icon">
              <i class="ion ion-person-add"></i>
            </div>
            <a href="./?view=providers" class="small-box-footer">Ver mas <i class="fa fa-arrow-circle-right"></i></a>
          </div>
        </div>
        <!-- ./col -->
        <div class="col-lg-3 col-xs-6">
          <!-- small box -->
          <div class="small-box bg-red">
            <div class="inner">
              <h3><?php 
echo count(CategoryData::getAll());
?>
</h3>

              <p>Categorias</p>
            </div>
            <div class="icon">
              <i class="ion ion-pie-graph"></i>
            </div>
            <a href="./?view=categories" class="small-box-footer">Ver mas <i class="fa fa-arrow-circle-right"></i></a>
          </div>
        </div>
        <!-- ./col -->
      </div>
      <!-- /.row -->
 /**
  * 添加分类
  */
 public function cateAction()
 {
     if (ComTool::isAjax()) {
         $group = $this->post('group');
         $store = $this->post('store');
         $level = $this->post('level');
         $parent = $this->post('parent');
         $name = $this->post('name');
         $ename = $this->post('ename');
         $desc = $this->post('desc');
         $limit = $this->post('limit');
         $days = $this->post('day');
         $start = $this->post('start');
         $end = $this->post('end');
         $orderway = $this->post('orderway');
         $status = $this->post('status');
         $deliver_desc = $this->post('deliver_desc');
         $data = array();
         $data['group_id'] = $group;
         $data['store_id'] = $store;
         $data['level'] = $level;
         $data['pid'] = $parent;
         $data['name'] = $name;
         $data['ename'] = $ename;
         $data['desc'] = $desc;
         $data['create_time'] = time();
         $data['update_time'] = time();
         $data['time_limit'] = $limit;
         $data['days'] = $days;
         $data['start_time'] = $start;
         $data['end_time'] = $end;
         $data['order_way'] = $orderway;
         $data['status'] = $status;
         $data['deliver_desc'] = $deliver_desc;
         $res = CategoryData::add($data);
         ComTool::result($res, '失败', '成功');
     }
     $parentCats = CategoryData::getParents();
     $allCats = CategoryData::getsAll();
     $groups = GroupData::getsAll();
     $stores = StoreData::getsAll();
     $this->assign('parentCats', $parentCats);
     $this->assign('allCats', $allCats);
     $this->assign('groups', $groups);
     $this->assign('stores', $stores);
     $this->display();
 }
Beispiel #27
0
 /**
  * 获取分类信息
  */
 public function getcategoryAction()
 {
     if (ComTool::isAjax()) {
         $ajax = $this->get('ajax');
         $ctype = $this->get('ctype');
         $id = intval($this->get('id', 0));
         if (empty($id)) {
             ComTool::ajax(100001, 'empty gid');
         }
         if ($ctype == 'p') {
             $cats = CategoryData::getl1CatsByGid($id);
         } elseif ($ctype == 'c') {
             $cats = CategoryData::getl2CatsByPid($id);
         }
         $this->assign('list', $cats);
         $this->assign('type', $this->get('type'));
         $html = $this->fetch("Index/layer/select.html");
         ComTool::ajax(100000, 'ok', $html);
     }
 }