/**
  * 删除样品包装
  * @param $get
  * @return Result
  */
 public function delete($get)
 {
     $id = $get['id'];
     $sample_id = $get['sample_id'];
     SamplePackage::delByPk($id);
     return new Result('操作成功', true, null, Router::getUrl('SamplePackage/showSamplePackageList', array('sample_id' => $sample_id)));
 }
 /**
  * 跟新订单
  * @param $get
  * @param $post
  * @return \Lite\Core\Result|void
  */
 public function update($get, $post)
 {
     $id = $get['id'];
     $order = $id ? BusinessOrder::findOneByPk($id) : new BusinessOrder();
     if ($post) {
         $post['order_no'] = $order->order_no ?: BusinessOrder::generateOrderNo();
         $r = Result::convert(parent::update($get, $post));
         if ($r->isSuccess()) {
             $data = $r->getData();
             $r->setJumpUrl(Router::getUrl('BusinessOrder/info', array('id' => $data['id'])));
         }
         return $r;
     }
     $pay_type_list = PayType::find('state = ?', PayType::STATE_ENABLED)->all();
     $default_customer_list = Customer::find()->order(' id asc ')->limit(10)->all();
     if ($order->customer_id) {
         $order_customer = Customer::find('id = ?', $order->customer_id)->all();
         if ($order_customer) {
             $default_customer_list = array_merge($default_customer_list, $order_customer);
         }
     }
     $default_customer_contact_list = array();
     if ($order->customer_id) {
         $default_customer_contact_list = CustomerContact::find('customer_id = ?', $order->customer_id)->all(true);
     }
     return array('order' => $order, 'order_type_list' => $order->getPropertiesDefine('order_type')['options'], 'pay_type_list' => $pay_type_list, 'default_customer_list' => $default_customer_list, 'default_customer_contact_list' => $default_customer_contact_list);
 }
Example #3
0
 public function index($search)
 {
     $result = Result::convert(parent::index($search));
     $result->addData(array('operation_link_list' => array(function (User $item) {
         return '<a href="' . Router::getUrl('user/updatePassword', array('id' => $item->id)) . '" rel="popup">修改密码</a>';
     })));
     return $result;
 }
Example #4
0
 /**
  * @param $get
  * @param $post
  * @return \Lite\Core\Result
  */
 public function update($get, $post)
 {
     if ($post) {
         $post['op_user_id'] = Auth::instance()->getLoginUserId();
     }
     $result = parent::update($get, $post);
     if ($post) {
         $data = $result->getData();
         $result->setJumpUrl(Router::getUrl('Customer/info', array('id' => $data['id'])));
     }
     return $result;
 }
Example #5
0
 public function updateUserGroupAccess($get, $post)
 {
     $user_group_id = $get['user_group_id'] ?: $post['user_group_id'];
     if (Router::isPost()) {
         $ex = Model::transaction(function () use($post, $user_group_id) {
             $con = "user_group_id = '" . addslashes($user_group_id) . "'";
             UserGroupAuth::deleteWhere(0, $con);
             $data = array();
             if ($post['act_bids']) {
                 foreach ($post['act_bids'] as $act_id) {
                     $data[] = array('user_group_id' => $user_group_id, 'action_id' => $act_id, 'type' => UserGroupAuth::TYPE_BLACK);
                 }
             }
             if ($post['act_wids']) {
                 foreach ($post['act_wids'] as $act_id) {
                     $data[] = array('user_group_id' => $user_group_id, 'action_id' => $act_id, 'type' => UserGroupAuth::TYPE_BLACK);
                 }
             }
             if ($data) {
                 UserGroupAuth::insertMany($data);
             }
         });
         return new Result(!$ex ? '操作成功' : $ex->getMessage(), !$ex, null, Router::getUrl('UserGroup'));
     }
     if (!$user_group_id) {
         $tmp = UserGroup::find()->one();
         $user_group_id = $tmp->id;
     }
     $act_list = AccessAction::find()->all(true);
     $act_ids = array_column($act_list, 'id');
     //user_group values
     $w_user_group_values = $b_user_group_values = array();
     if ($act_ids) {
         $user_group_values = UserGroupAuth::find('action_id IN ? AND user_group_id = ?', $act_ids, $user_group_id)->all(true);
         foreach ($user_group_values as $val) {
             if ($val['type'] == UserGroupAuth::TYPE_WHITE) {
                 $w_user_group_values[$val['action_id']] = $val;
             } else {
                 $b_user_group_values[$val['action_id']] = $val;
             }
         }
     }
     array_orderby($act_list, 'desc', SORT_DESC);
     $white_list = $black_list = array();
     foreach ($act_list as $act) {
         $a = $this->convertPathToArray('全部/' . $act['desc'], array($act['id'], $act['uri'], !!$w_user_group_values[$act['id']]));
         $white_list = array_merge_recursive($white_list, $a);
         $b = $this->convertPathToArray('全部/' . $act['desc'], array($act['id'], $act['uri'], !!$b_user_group_values[$act['id']]));
         $black_list = array_merge_recursive($black_list, $b);
     }
     return array('user_group_id' => $user_group_id, 'auth_list' => array($white_list, $black_list), 'user_group_list' => UserGroup::find()->all());
 }
Example #6
0
 public function file($get)
 {
     if (Router::isPost()) {
         $file = $_FILES['file'];
         if (empty($file['name'])) {
             return new Result('请选择文件', false);
         }
         $url_prefix = Config::get('upload/url');
         $uploader = new Uploader(array('upload_dir' => Config::get('upload/path'), 'file_name_converter' => Config::get('upload/file_name_converter'), 'max_size' => Config::get('upload/max_size'), 'file_type' => Config::get('upload/file_type')));
         $result = $uploader->upload($errors);
         if ($errors) {
             return new Result(array_first($errors));
         }
         return new Result('上传成功', true, array('url' => $url_prefix . $result['file'], 'name' => $result['file'], 'value' => $result['file']));
     }
     return new Result('请选择上传文件');
 }
Example #7
0
 public function uploadImage()
 {
     if (Router::isPost()) {
         $file = $_FILES['file'];
         if (empty($file['name'])) {
             return new Result('请选择文件', false);
         }
         $ext = $this->getFileExt($file['type']);
         if (!$ext) {
             return new Result('文件类型不符合,请重新选择文件上传', false);
         }
         $rsp = Request::postFiles(Config::get('upload/host'), array(), array('file' => $file['tmp_name']));
         $result = json_decode($rsp, true);
         if ($result['code'] == '0') {
             return new Result('图片上传成功', null, array('src' => Config::get('upload/url') . $result['data'], 'value' => $result['data']));
         }
         return new Result('图片上传失败,请稍候重试', null, $rsp);
     }
     return array('UPLOAD_PAGE_URL' => Router::getUrl('index/uploadImage'));
 }
Example #8
0
    public static function checkAuth($controller, $action)
    {
        if (!$controller || !$action) {
            return;
        }
        $result = self::isAuthAction($controller, $action);
        if (!$result) {
            if (!self::instance()->isLogin()) {
                $url = Router::getUrl('index/login');
                $html = <<<EOT
<!doctype html>
<html lang="en">
<head>
\t<meta charset="UTF-8">
\t<title>Document</title>
\t<script>top.location.href="{$url}";</script>
</head>
<body>
\t正在登录系统...
</body>
</html>
EOT;
                die($html);
            } else {
                //暂时不返回
                $viewer = new ViewBase();
                echo $viewer->render('index/deny.php', true);
                die;
            }
        }
    }
Example #9
0
	</span>
	<h1>拒绝访问</h1>
	<p class="desc">
		您没有当前页面访问权限 <br/>
		申请更多权限,请咨询ERP系统管理人员。<br/>
		<a href="/">返回首页</a>
	</p>
	<div class="tech-info">
		<p>技术支持信息:</p>
		<ul>
			<li><span>UID:</span><?php 
echo $user_info['id'];
?>
</li>
			<li><span>Host:</span><?php 
echo $sys_id;
?>
</li>
			<li><span>CONTROLLER:</span><?php 
echo Router::getController();
?>
</li>
			<li><span>ACTION:</span><?php 
echo Router::getAction();
?>
</li>
		</ul>
	</div>
</div>
</body>
</html>
Example #10
0
				<?php 
    }
    ?>
			</tr>
			<?php 
}
?>

			<tr>
				<td></td>
				<td class="col-action">
					<?php 
if (in_array(ControllerInterface::OP_UPDATE, $operation_list)) {
    ?>
					<a href="<?php 
    echo $this->getUrl($this->getController() . '/update', array($pk => $model_instance->{$pk}, 'ref' => Router::get('ref')));
    ?>
" class="btn">Update</a>
					<?php 
}
?>

					<?php 
if (in_array(ControllerInterface::OP_DELETE, $operation_list)) {
    ?>
					<a href="<?php 
    echo $this->getUrl($this->getController() . '/delete', array($pk => $model_instance->{$pk}));
    ?>
" rel="async" class="btn btn-danger">Delete</a>
					<?php 
}
<?php

use Lite\Core\Router;
use function Lite\func\h;
include $this->resolveTemplate('inc/header.inc.php');
$current_controller = Router::getController();
?>
	<div id="col-aside">
		<?php 
echo $this->getSideMenu();
?>
	</div>
	<div id="col-main">
		<form action="<?php 
echo $this->getUrl($current_controller . '/updateSampleProduceData', array('sample_id' => $data->sample_id));
?>
" class="frm" rel="async" method="post">
			<table class="frm-tbl">
				<tbody>
				<tr>
					<td class="col-label">泥浆体积</td>
					<td>
						<input type="number" step="0.01" name="clay_volume" class="txt" value="<?php 
echo $data->clay_volume;
?>
"/>ML
					</td>
				</tr>
				<tr>
					<td class="col-label">土坯重量</td>
					<td>
Example #12
0
';
		var UEDITOR_HOME_URL = '<?php 
echo Config::get('app/richeditor_home');
?>
';
		var UPLOAD_URL = '<?php 
echo Router::getUrl('upload/file', array('ref' => 'json'));
?>
';
		var UPLOAD_PROGRESS_URL = '<?php 
echo Router::getUrl('upload/progress', array('ref' => 'json'));
?>
';

		var CGI_ADD_SAMPLE = '<?php 
echo Router::getUrl('sample/quickAddSample', array('ref' => 'iframe'));
?>
';
		var CGI_SEARCH_SAMPLE = '<?php 
echo $this->getUrl('Sample/getSampleInfoByNo');
?>
';
	</script>
	<?php 
echo $this->getCss($cdn_url . 'ywj/ui/backend/default.css');
echo $this->getCss($cdn_url . 'ywj/ui/backend/theme-sidelayout.css');
echo $this->getCss($cdn_url . 'ywj/ui/backend/font-awesome.css');
echo $this->getCss('patch.css');
echo $this->getJs($cdn_url . 'seajs/sea.js');
echo $this->getJs($cdn_url . 'seajs/config.js');
echo $this->getJs($cdn_url . 'ywj/component/imagescale.js');
Example #13
0
 /**
  * 删除单件眼样品的工艺
  * @param $get
  * @return Result
  */
 public function deleteSampleTechnic($get)
 {
     $id = $get['id'];
     $sample_id = $get['sample_id'];
     SampleTechnic::delByPk($id);
     return new Result('操作成功', true, null, Router::getUrl('Sample/updateSampleTechnic', array('sample_id' => $sample_id)));
 }
Example #14
0
<?php

use Lite\Core\Router;
$ctrl = Router::getController();
$act = Router::getAction();
$tmp = strtolower($ctrl . '/' . $act);
$navs = array();
$navs[strtolower($tmp)] = 'active';
$ref = $_GET['ref'];
$__customer_id = $_GET['customer_id'];
$__id = $_GET['id'];
?>

<ul class="frm-tab" id="update-nav-tab">
	<li class="<?php 
echo $navs[strtolower('Customer/showCustomerContactList')];
?>
">
		<a href="<?php 
echo $this->getUrl('Customer/showCustomerContactList', array('ref' => $ref, 'customer_id' => $__customer_id, 'id' => $__id));
?>
">联系人信息</a>
	</li>
	<li class="<?php 
echo $navs[strtolower('Customer/showCustomerQualificationList')];
?>
">
		<a href="<?php 
echo $this->getUrl('Customer/showCustomerQualificationList', array('ref' => $ref, 'customer_id' => $__customer_id, 'id' => $__id));
?>
">资质信息</a>