Пример #1
0
 public function __construct($data = array())
 {
     parent::__construct($data);
     //extra properties define
     $this->setPropertiesDefine(array('customer_no' => array('description' => '规则:xxx-xx-33'), 'create_time' => array('setter' => function () {
         return time();
     }), 'op_user_id' => array('setter' => function () {
         return Auth::instance()->getLoginUserId();
     }, 'options' => function () {
         $tmp = User::find()->all(true);
         return array_combine(array_column($tmp, 'id'), array_column($tmp, 'name'));
     }), 'source' => array('options' => function () {
         $tmp = CustomerSource::find('state = ?', CustomerSource::STATE_ENABLED)->all(true);
         return array_combine(array_column($tmp, 'id'), array_column($tmp, 'name'));
     }, 'display' => function (self $item) {
         $tmp = CustomerSource::findOneByPk($item->source);
         if (!$tmp) {
             return '';
         }
         return $tmp->state == CustomerSource::STATE_ENABLED ? $tmp->name : '<del>' . $tmp->name . '</del>';
     }), 'type' => array('options' => function () {
         $tmp = CustomerType::find('state = ?', CustomerType::STATE_ENABLED)->all(true);
         return array_combine(array_column($tmp, 'id'), array_column($tmp, 'name'));
     }, 'display' => function (self $item) {
         $tmp = CustomerType::findOneByPk($item->type);
         if (!$tmp) {
             return '';
         }
         return $tmp->state == CustomerType::STATE_ENABLED ? $tmp->name : '<del>' . $tmp->name . '</del>';
     })));
 }
Пример #2
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;
 }
Пример #3
0
 public static function getLoginUserName()
 {
     $u = Auth::instance()->getLoginInfo();
     return $u['name'];
 }
Пример #4
0
<div id="col-aside">
	<?php 
echo $this->getSideMenu();
?>
</div>
<div id="col-main">
	<form action="<?php 
echo $this->getUrl('BusinessOrder/addSampleProduceOrder', array('id' => $business_order->id));
?>
" class="frm" rel="async" method="post">
		<input type="hidden" name="business_order_id" value="<?php 
echo $business_order->id;
?>
">
		<input type="hidden" name="boss_head_employee_id" value="<?php 
echo Auth::instance()->getLoginUserId();
?>
">

		<table class="frm-tbl">
			<caption><?php 
echo $sample_produce_order->id ? '更新' : '新增';
?>
样品生产单</caption>
			<tbody>
				<tr>
					<td class="col-label">生产单号</td>
					<td>
						<input type="text" name="order_no" class="txt" value="<?php 
echo $sample_produce_order->order_no ?: $business_order->order_no;
?>
 public function update($get, $post)
 {
     $order = SampleProduceOrder::findOneByPk($get['id']) ?: new SampleProduceOrder();
     if ($post) {
         if ($post['produce_type'] == SampleProduceOrder::TYPE_ORDER) {
             if ($post['business_order_no']) {
                 $post['business_order_id'] = BusinessOrder::find('order_no=?', $post['business_order_no'])->ceil('id');
             }
             if (!$post['business_order_id']) {
                 return new Result('您输入的订单号没有对应的订单:' . $post['business_order_no']);
             }
         }
         $org_id = $order->boss_head_employee_id;
         $order->setValues($post);
         if (!$order->id) {
             $order->boss_head_employee_id = Auth::instance()->getLoginUserId();
         } else {
             $order->boss_head_employee_id = $org_id;
         }
         $result = parent::update($get, $post);
         if ($result->isSuccess()) {
             return new Result('操作成功', true);
         }
     }
     $customer_list = Customer::find()->all();
     $current_contact_list = array();
     if ($order->id) {
         $current_contact_list = CustomerContact::find('customer_id =?', $order->contact->customer_id)->all();
     }
     $all_contact_list = CustomerContact::find()->all(true);
     $all_contact_list = array_group($all_contact_list, 'customer_id');
     return array('order' => $order, 'customer_list' => $customer_list, 'all_contact_list' => $all_contact_list, 'current_contact_list' => $current_contact_list);
 }
Пример #6
0
<?php

//todo 这里的系统入口判断的是单个的权限,并不是整个系统的,因此会出现:如果入口没有权限, 那么系统入口的权限也就没有了。
use www\Auth;
use function Lite\func\h;
$login_user = Auth::instance()->getLoginInfo();
?>
<div id="welcome">
	<?php 
if ($login_user) {
    ?>
	<span class="user">
        <?php 
    echo h($login_user['name']);
    ?>
    </span>
	<div class="user-panel">
		<div class="avatar-wrap">
			<?php 
    echo $this->getImg($login_user['photo'] ?: 'default_avatar.png', array('max-width' => 90, 'max-height' => 90));
    ?>
		</div>
		<div class="user-pannel-ext">
			<p style="min-height:60px"><?php 
    echo h($login_user['name']);
    ?>
</p>
			<p>
				<a href="<?php 
    echo $this->getUrl('user/updatePassword');
    ?>
Пример #7
0
 public function logout()
 {
     Auth::instance()->logout();
     return new Result('退出成功', true, null, Router::getUrl('index/login'));
 }