public function add($order_id) { import('system/share/network/redirect'); AuthPlugins::required($this, array('销售经理', '销售顾问')); $order_id = abs(intval($order_id)); if (!$this->is_post() || !$order_id) { return false; } /* * 上传方案附件 */ import('system/share/io/filesystem'); FileSystem::init(); $file_path = FileSystem::Upload($_FILES['attachment'], false); if (!$file_path) { HTTPRedirect::flash_to('order/detail/' . $order_id, '文件上传失败:' . FileSystem::$message, $this->smarty); } /* * 写入方案表 */ parent::load('model', 'order'); $solution = new Solution(); $solution->order_id = $order_id; $solution->solution_code = trim(strip_tags($_POST['solution_code'])); $solution->name = trim(strip_tags($_POST['name'])); $solution->attachment = $file_path; $solution->price = abs(intval($_POST['price'])); $solution->save(); HTTPRedirect::flash_to('order/detail/' . $order_id, '添加方案成功', $this->smarty); }
public function work_plan() { parent::load('model', 'work'); parent::load('model', 'system/contrib/auth'); $smarty = parent::load('smarty'); if (!$this->is_post()) { return; } /* * ajax提交的工作计划信息 */ }
public function index($id_or_alias) { parent::load('model', 'system/contrib/auth'); parent::load('model', 'articles'); $articles = Article::get_by_category($id_or_alias); import('system/share/web/paginator'); $paginator = new Paginator($articles, $_GET['page'], 10); $category = CategoryTable::getInstance()->findByAlias($id_or_alias); $smarty = parent::load('smarty'); $smarty->assign('category', $category[0]); $smarty->assign('paginator', $paginator->output()); $smarty->assign('page_title', $category[0]->name); $smarty->display('article/list'); }
public function state() { $id = abs(intval($_GET['id'])); $state = abs(intval($_GET['state'])); echo $id; parent::load('model', 'forms'); import('system/share/network/redirect'); $form = FormsTable::getInstance()->find($id); if (!$form) { return false; } $form->state = $state; $form->save(); HTTPRedirect::flash_to('forms/' . $this->maps[$form->type], '操作成功', $this->smarty); }
public function add($order_id) { AuthPlugins::required($this, array('销售经理', '销售顾问')); $order_id = abs(intval($order_id)); $content = trim(nl2br(strip_tags($_POST['content']))); if (!$order_id || !$this->is_post() || !$content) { return false; } parent::load('model', 'Order.Communication'); $c = new Communication(); $c->order_id = $order_id; $c->content = $content; $c->user_id = User::info('id'); $c->save(); echo 'ok'; }
public function end($type, $order_id) { parent::load('model', 'work'); parent::load('model', 'order'); import('system/share/network/redirect'); $smarty = parent::load('smarty'); $work = OrderWork::get_by_order($order_id, $type); $workflow = Workflow::get_by_alias($this->available_next_type[$type]); if (!$work) { $message = sprintf('此订单的 %s 工作还没开始', $type); HTTPRedirect::flash_to('order/list/' . $workflow->id, $message, $smarty); } $work->process = 100; $work->save(); Order::set_workflow($order_id, $workflow); $message = '此工作已经完成, 将转入下一工作流程'; HTTPRedirect::flash_to('order/list/' . $workflow->id, $message, $smarty); }
public function decide_programe($order_id) { $workflow = Workflow::get_by_alias('程序验收完成'); import('system/share/io/filesystem'); FileSystem::init(); $http_path = FileSystem::Upload($_FILES['attachment']); if (!$_FILES['attachment'] || !$http_path) { HTTPRedirect::flash_to('customer', '请您上传首页确认书的扫描件', $this->smarty, 'cus_flash_to'); } $order = Order::get_by_id($order_id); $order->programe_decide_attachment = $http_path; $order->save(); Order::set_workflow($order_id, $workflow); $smarty = parent::load('smarty'); import('system/share/network/redirect'); $message = '程序验收完成,等待客户付尾款即可上线'; $flash_to = $userinfo['role']['0']['alias'] == '技术经理' ? 'order/list/' . $workflow->id : 'customer'; $template = $userinfo['role']['0']['alias'] == '技术经理' ? 'flash_to' : 'cus_flash_to'; HTTPRedirect::flash_to($flash_to, $message, $smarty, $template); }
public function change_password() { parent::load('model', 'system/contrib/auth.User'); $user = UserTable::getInstance()->find(User::info('id')); import('system/share/network/redirect'); if ($this->is_post()) { list($func, $random, $encryped) = explode('$', $user->password); /* * 验证原密码 */ if ($user->password && $user->password === User::generate_password($_POST['old_password'], $random, $func)) { $user->password = User::generate_password($_POST['new_password']); $user->save(); User::logout(); $message = '修改密码成功, 请重新登录'; HTTPRedirect::flash_to(url_reverse('auth_login'), $message, $this->smarty); } else { $message = '原密码不正确, 请重试'; HTTPRedirect::flash_to('accounts/change_password', $message, $this->smarty); } } $this->smarty->display('auth/change_password'); }
public function dispatch($order_id, $complete = false) { AuthPlugins::required($this, '技术经理'); $smarty = parent::load('smarty'); $order = Order::get_by_id($order_id); if ($complete && $this->is_post()) { $order->layouter_id = abs(intval($_POST['layouter'])); $order->programmer = abs(intval($_POST['programmer'])); $order->save(); } else { $samrty->assign('page_title', '选择设计师和程序员'); $smarty->assign('order', $order); $smarty->assign('layouter', Role::get_users_by_alias('布局师')); $smarty->assign('programmer', Role::get_users_by_alias('程序员')); $smarty->display('order/dispatch'); } }
public function workflow_edit($id) { parent::load('model', 'workflow'); parent::load('model', 'order'); parent::load('model', 'system/contrib/auth'); $workflow = WorkflowTable::getInstance()->find($id); $all_roles = RoleTable::getInstance()->findAll(); $workflow_roles = array_filter(explode(',', $workflow->roles)); $options = array(); foreach ($all_roles as $ar) { $options[$ar['id']] = $ar['name']; } if ($this->is_post()) { $workflow->roles = sprintf(',%s,', implode(',', $_POST['roles'])); $workflow->save(); HTTPRedirect::flash_to('manager/workflow_permission', '编辑工作流程权限成功', $this->smarty); } $this->smarty->assign('roles', $workflow_roles); $this->smarty->assign('workflow', $workflow); $this->smarty->assign('all_roles', $options); $this->smarty->display('manager/order/workflow_edit'); }
public function detail($id) { $smarty = parent::load('smarty'); $smarty->assign('page_title', '客户详情'); $id = abs(intval($id)); if (!$id) { $smarty->display(404); } parent::load('model', 'order'); $order = Order::get_by_id($id); $smarty->assign('order', $order); $smarty->display('customer/detail'); }
public function delete($id) { parent::load('model', 'articles'); parent::load('model', 'system/contrib/auth.User'); $article = ArticleTable::getInstance()->find($id); /* * 判断是否有权限修改此类文章 */ $has_role = Category::has_role($article->Category->id, User::info()); if (!$has_role || !User::has_role('人力资源') || !User::has_role('总经理')) { $this->smarty->display(403); Boot::shutdown(); } if ($article) { $article->delete(); $message = '删除成功'; } else { $message = '文章不存在'; } import('system/share/network/redirect'); HTTPRedirect::flash_to('', $message, $this->smarty); }