本文整理汇总了PHP中Workflow类的典型用法代码示例。如果您正苦于以下问题:PHP Workflow类的具体用法?PHP Workflow怎么用?PHP Workflow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Workflow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert
public function insert()
{
$id = parent::insert(true);
import("@.Workflow.Workflow");
$workflow = new Workflow($this->workflowAlias);
$rs = $workflow->doNext($id, null, false, false);
}
示例2: updateReview
public function updateReview(DB $db, APIRequest $request, APIResponse $response)
{
$this->vars->review = new PerformanceReview();
$this->vars->review->loadById($db, $request->get('reviewId'));
//validate?
foreach ($request->post('questions') as $questionId => $answerPost) {
$answer = new ReviewAnswer();
if (!$answer->loadOneWhere($db, 'question_id = ? and review_id = ?', [$questionId, $this->vars->review->id])) {
$answer->questionId = $questionId;
$answer->reviewId = $this->vars->review->id;
}
$answer->text = $answerPost['text'];
$answer->scale = $answerPost['scale'];
$answer->store($db);
}
if ($_POST['action'] == 'submit') {
$this->vars->review->submitted = 'yes';
$this->vars->review->submittedYmdt = gmdate('Y-m-d H:i:s');
$this->vars->review->submit($db);
$updater = new WorkflowUpdater();
$workflow = new Workflow();
$workflow->loadOneWhere($db, 'table_row_id = ? and type = ?', [$this->vars->review->id, 'review']);
$updater->complete($db, $workflow);
}
$response->success();
}
示例3: newWorkflow
public static function newWorkflow($type)
{
$wf = new Workflow();
$wf->ui_type = $type;
$wf->save();
return $wf;
}
示例4: run
public function run()
{
$bomModel = D("ProduceBoms");
$stockoutModel = D("Stockout");
$stockoutDetailModel = D("StockoutDetail");
$theBoms = $bomModel->where("plan_id=" . $this->mainrowId)->select();
$stockoutModel->startTrans();
$theStockout = array("bill_id" => makeBillCode("CK"), "source_id" => $this->mainrowId, "source_model" => "ProducePlan", "dateline" => CTS, "total_num" => 0, "stock_manager" => 0, "shipment_id" => 0, "status" => 0, "memo" => "ProducePlan #" . $this->mainrowId);
$stockoutId = $stockoutModel->add($theStockout);
if (!$stockoutId) {
Log::write("SQL Error:" . $stockoutModel->getLastSql(), Log::SQL);
$stockoutModel->rollback();
$this->response(array("type" => "message", "msg" => "Server Error.", "error" => 1));
}
$totalNum = 0;
foreach ($theBoms as $k => $v) {
$totalNum += $v["num"];
$theDetail = array("stockout_id" => $stockoutId, "factory_code_all" => $v["factory_code_all"], "goods_id" => $v["goods_id"], "stock_id" => 0, "num" => $v["num"]);
if (!$stockoutDetailModel->add($theDetail)) {
//@todo
Log::write("SQL Error:" . $stockoutModel->getLastSql(), Log::SQL);
$stockoutModel->rollback();
$this->response(array("type" => "message", "msg" => "Server Error.", "error" => 1));
}
}
$stockoutModel->where("id=" . $stockoutId)->save(array("total_num" => $totalNum));
// echo $stockoutModel->getLastSql();exit;
$stockoutModel->commit();
$workflow = new Workflow("stockout");
$workflow->doNext($stockoutId, false, true, false);
// print_r($theBoms);exit;
}
示例5: select
public function select($options = array())
{
$data = parent::select($options);
if (!$data) {
return $data;
}
foreach ($data as $k => $v) {
if ($v["stock_manager"]) {
$data[$k]["stock_manager_name"] = toTruename($v["stock_manager"]);
} else {
$data[$k]["stock_manager_name"] = "";
}
$data[$k]["sponsor"] = toTruename($v["user_id"]);
$ids[] = $v["id"];
}
// print_r($data);exit;
if ($this->workflowAlias) {
import("@.Workflow.Workflow");
$workflow = new Workflow($this->workflowAlias);
$processData = $workflow->getListProcess($ids);
foreach ($data as $k => $v) {
$data[$k]["processes"] = $processData[$v[$this->workflowMainRowField]];
}
}
return $data;
}
示例6: newPlan
public function newPlan($data)
{
$rows = $data["rows"];
unset($data["rows"]);
$this->startTrans();
$id = $this->add($data);
if (!$id) {
Log::write("SQL Error:" . $this->getLastSql(), Log::SQL);
$this->rollback();
return false;
}
$detailModel = D("ProducePlanDetail");
foreach ($rows as $row) {
$row["plan_id"] = $id;
$rs = $detailModel->add($row);
if (!$rs) {
Log::write("SQL Error:" . $this->getLastSql(), Log::SQL);
$this->rollback();
return false;
}
}
$this->commit();
$workflow = new Workflow($this->workflowAlias);
$workflow->doNext($id, "", true);
return $id;
}
示例7: newBill
public function newBill($data)
{
if (!$data["rows"]) {
return;
}
if (!$this->checkFactoryCodeAll($data["rows"])) {
$this->error = "factory_code_not_full";
return false;
}
$this->startTrans();
$purchaseId = $this->add($data);
if (!$purchaseId) {
$this->error = "insert purchase bill failed";
Log::write("SQL Error:" . $this->getLastSql(), Log::SQL);
$this->rollback();
return false;
}
$detailModel = D("PurchaseDetail");
foreach ($data["rows"] as $row) {
$row["purchase_id"] = $purchaseId;
$row["price"] = $row["amount"];
if (!$detailModel->add($row)) {
$this->error = "insert purchase bill detail failed";
Log::write("SQL Error:" . $detailModel->getLastSql(), Log::SQL);
$this->rollback();
return false;
}
}
$this->commit();
$workflow = new Workflow($this->workflowAlias);
$workflow->doNext($purchaseId, "", true);
return $purchaseId;
}
示例8: run
public function run()
{
DB::table('workflow')->delete();
$flow = new Workflow();
$flow->id = '1';
$flow->workFlowName = 'Small Value Procurement (Below P50,000)';
$flow->totalDays = '45';
$flow->save();
$flow = new Workflow();
$flow->id = '2';
$flow->workFlowName = 'Small Value Procurement (Above P50,000 Below P500,000)';
$flow->totalDays = '120';
$flow->save();
$flow = new Workflow();
$flow->id = '3';
$flow->workFlowName = 'Bidding (Above P500,000)';
$flow->totalDays = '200';
$flow->save();
$flow = new Workflow();
$flow->id = '4';
$flow->workFlowName = 'Pakyaw';
$flow->totalDays = '200';
$flow->save();
$flow = new Workflow();
$flow->id = '5';
$flow->workFlowName = 'Direct Contracting';
$flow->totalDays = '200';
$flow->save();
}
示例9: read
public function read()
{
$mainrowId = $_GET["id"];
$workflowAlias = $_GET["workflowAlias"];
$modelName = ucfirst($workflowAlias);
$model = D($modelName);
$workflow = new Workflow($workflowAlias);
$process = $workflow->getItemProcesses($modelName, $mainrowId, $model->relationModels);
$this->response($process);
}
示例10: makeStepsAndProgressBarViewFromWorkflow
/**
* @param Workflow $workflow
* @return ByTimeWorkflowStepsAndProgressBarForWizardView|
* OnSaveWorkflowStepsAndProgressBarForWizardView
* @throws NotSupportedException
*/
public static function makeStepsAndProgressBarViewFromWorkflow(Workflow $workflow)
{
$type = $workflow->getType();
if ($type == Workflow::TYPE_BY_TIME) {
return new ByTimeWorkflowStepsAndProgressBarForWizardView();
} elseif ($type == Workflow::TYPE_ON_SAVE) {
return new OnSaveWorkflowStepsAndProgressBarForWizardView();
} else {
throw new NotSupportedException();
}
}
示例11: run
public function run()
{
$stockin = D("Stockin");
$stockin->where("id=" . $this->mainrowId)->save(array("status" => 2));
$theStockin = $stockin->find($this->mainrowId);
if ($theStockin["source_model"]) {
//若外部生成,走外部下一流程
$workflow = new Workflow(lcfirst($theStockin["source_model"]), $this->action);
$workflow->doNext($theStockin["source_id"], "", true, 3);
}
}
示例12: run
public function run()
{
$model = D("Stockout");
$theStockout = $model->find($this->mainrowId);
$model->where("id=" . $this->mainrowId)->save(array("status" => 2));
if ($this->context["sourceModel"]) {
$sourceNode = $this->getNodeByAlias(lcfirst($this->context["sourceModel"]), "Complete");
$workflow = new Workflow($this->context["sourceWorkflow"], $this->context);
$workflow->doNext($theStockout["source_id"], $sourceNode["id"], true, 3);
}
}
示例13: record
public function record($data)
{
$data["create_dateline"] = CTS;
$data["status"] = 0;
$data["user_id"] = getCurrentUid();
$lastId = $this->add($data);
if (!$lastId) {
Log::write($this->getLastSql(), Log::SQL);
return false;
}
$workflow = new Workflow("financePay");
$workflow->doNext($lastId, "", true);
return $lastId;
}
示例14: index
public function index()
{
//获取所有节点
if (!$_GET["mainrow_id"]) {
return parent::index();
}
//仅获取当前数据的下一ID
// $map = array();
// $this->_filter($map);
import("@.Workflow.Workflow");
$workflow = new Workflow($_GET["workflow_alias"]);
$process = $workflow->getCurrentProcess($_GET["mainrow_id"]);
$this->response(reIndex($process["nextNode"]));
}
示例15: run
public function run()
{
$stockout = D("Stockout");
$stockoutId = $stockout->makeStockoutPaper("Orders", $this->mainrowId, "saler_id", "order_id");
//流程上下文
$this->context = array("sourceModel" => "Orders", "sourceWorkflow" => "orders", "sourceId" => $this->mainrowId, "sourceMainrowField" => "order_id");
$this->updateStatus("Orders", $this->mainrowId, 1);
// $orderModel = D("Orders");
// $orderModel->where("id=".$this->mainrowId)->save(array("status" => 1));
// print_r($this->context);exit;
//新建出库工作流
import("@.Workflow.Workflow");
$workflow = new Workflow("stockout", $this->context);
$workflow->doNext($stockoutId, "", true, true);
}