本文整理汇总了PHP中Workflow::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Workflow::save方法的具体用法?PHP Workflow::save怎么用?PHP Workflow::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Workflow
的用法示例。
在下文中一共展示了Workflow::save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: newWorkflow
public static function newWorkflow($type)
{
$wf = new Workflow();
$wf->ui_type = $type;
$wf->save();
return $wf;
}
示例3: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(PropelPDO $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aRole !== null) {
if ($this->aRole->isModified() || $this->aRole->isNew()) {
$affectedRows += $this->aRole->save($con);
}
$this->setRole($this->aRole);
}
if ($this->aWorkflow !== null) {
if ($this->aWorkflow->isModified() || $this->aWorkflow->isNew()) {
$affectedRows += $this->aWorkflow->save($con);
}
$this->setWorkflow($this->aWorkflow);
}
if ($this->isNew()) {
$this->modifiedColumns[] = WorkflowRolePeer::ID;
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = WorkflowRolePeer::doInsert($this, $con);
$affectedRows += 1;
// we are assuming that there is only 1 row per doInsert() which
// should always be true here (even though technically
// BasePeer::doInsert() can insert multiple rows).
$this->setId($pk);
//[IMV] update autoincrement primary key
$this->setNew(false);
} else {
$affectedRows += WorkflowRolePeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例4: actionCreate
public function actionCreate()
{
$workflowModel = new Workflow();
$workflowModel->lastUpdated = time();
$stages = array();
if (isset($_POST['Workflow'], $_POST['WorkflowStages'])) {
$workflowModel->attributes = $_POST['Workflow'];
if (isset($_POST['colors']) && is_array($_POST['colors'])) {
// remove empty strings
$_POST['colors'] = array_filter($_POST['colors'], function ($a) {
return $a !== '';
});
$workflowModel->colors = $_POST['colors'];
}
if ($workflowModel->save()) {
$validStages = true;
for ($i = 0; $i < count($_POST['WorkflowStages']); $i++) {
$stages[$i] = new WorkflowStage();
$stages[$i]->workflowId = $workflowModel->id;
$stages[$i]->attributes = $_POST['WorkflowStages'][$i + 1];
$stages[$i]->stageNumber = $i + 1;
$stages[$i]->roles = $_POST['WorkflowStages'][$i + 1]['roles'];
if (empty($stages[$i]->roles) || in_array('', $stages[$i]->roles)) {
$stages[$i]->roles = array();
}
if (!$stages[$i]->validate()) {
$validStages = false;
}
}
if ($validStages) {
foreach ($stages as &$stage) {
$stage->save();
foreach ($stage->roles as $roleId) {
Yii::app()->db->createCommand()->insert('x2_role_to_workflow', array('stageId' => $stage->id, 'roleId' => $roleId, 'workflowId' => $workflowModel->id));
}
}
if ($workflowModel->save()) {
$this->redirect(array('view', 'id' => $workflowModel->id));
}
}
}
}
$this->render('create', array('model' => $workflowModel));
}
示例5: actionUpload
public function actionUpload()
{
parent::actionUpload();
$folder = $_SERVER['DOCUMENT_ROOT'] . Yii::app()->request->baseUrl . '/upload/';
// folder for uploaded files
$file = $folder . basename($_FILES['uploadfile']['name']);
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) {
$row = 0;
if (($handle = fopen($file, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
if ($row > 0) {
$model = Workflow::model()->findByPk((int) $data[0]);
if ($model === null) {
$model = new Workflow();
}
$model->workflowid = (int) $data[0];
$model->wfname = $data[1];
$model->wfdesc = $data[2];
$model->wfminstat = $data[3];
$model->wfmaxstat = $data[4];
$model->recordstatus = (int) $data[5];
try {
if (!$model->save()) {
$this->messages = $this->messages . Catalogsys::model()->getcatalog(' upload error at ' . $data[0]);
}
} catch (Exception $e) {
$this->messages = $this->messages . $e->getMessage();
}
}
$row++;
}
} else {
$this->messages = $this->messages . ' memory or harddisk full';
}
fclose($handle);
} else {
$this->messages = $this->messages . ' check your directory permission';
}
if ($this->messages == '') {
$this->messages = 'success';
}
echo $this->messages;
}
示例6: Workflow
<?php
$workflowID = $_POST['workflowID'];
if ($workflowID != '') {
$workflow = new Workflow(new NamedArguments(array('primaryKey' => $workflowID)));
} else {
$workflow = new Workflow();
}
$workflow->workflowName = '';
$workflow->resourceFormatIDValue = $_POST['resourceFormatID'];
$workflow->resourceTypeIDValue = $_POST['resourceTypeID'];
$workflow->acquisitionTypeIDValue = $_POST['acquisitionTypeID'];
try {
$workflow->save();
$workflowID = $workflow->primaryKey;
//first remove all step records, then we'll add them back
$workflow->removeSteps();
$stepNameArray = array();
$stepNameArray = explode(':::', $_POST['stepNames']);
$userGroupArray = array();
$userGroupArray = explode(':::', $_POST['userGroups']);
$priorStepArray = array();
$priorStepArray = explode(':::', $_POST['priorSteps']);
$seqOrderArray = array();
$seqOrderArray = explode(':::', $_POST['seqOrders']);
$stepIDArray = array();
$stepIDPriorArray = array();
foreach ($stepNameArray as $key => $value) {
if (trim($value)) {
$step = new Step();
$step->workflowID = $workflowID;
示例7: actionCreate
public function actionCreate()
{
$workflowModel = new Workflow();
$workflowModel->lastUpdated = time();
$stages = array();
$workflowAttr = filter_input(INPUT_POST, 'Workflow', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
$workflowStages = filter_input(INPUT_POST, 'WorkflowStages', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
if (!empty($workflowAttr) && !empty($workflowStages)) {
$workflowModel->attributes = $workflowAttr;
$colors = filter_input(INPUT_POST, 'colors', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
if (!empty($colors)) {
$colors = array_filter($colors, function ($a) {
return $a !== '';
});
$workflowModel->colors = $colors;
}
if ($workflowModel->save()) {
$validStages = true;
for ($i = 0; $i < count($workflowStages); $i++) {
$stages[$i] = new WorkflowStage();
$stages[$i]->workflowId = $workflowModel->id;
$stages[$i]->attributes = $workflowStages[$i + 1];
$stages[$i]->stageNumber = $i + 1;
$stages[$i]->roles = $workflowStages[$i + 1]['roles'];
if (empty($stages[$i]->roles) || in_array('', $stages[$i]->roles)) {
$stages[$i]->roles = array();
}
if (!$stages[$i]->validate()) {
$validStages = false;
}
}
if ($validStages) {
foreach ($stages as &$stage) {
$stage->save();
foreach ($stage->roles as $roleId) {
Yii::app()->db->createCommand()->insert('x2_role_to_workflow', array('stageId' => $stage->id, 'roleId' => $roleId, 'workflowId' => $workflowModel->id));
}
}
if ($workflowModel->save()) {
$this->redirect(array('view', 'id' => $workflowModel->id));
}
}
}
}
$this->render('create', array('model' => $workflowModel));
}