本文整理汇总了PHP中Step::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Step::create方法的具体用法?PHP Step::create怎么用?PHP Step::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Step
的用法示例。
在下文中一共展示了Step::create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateStep
function CreateStep($data, $fields)
{
try {
$Step = new Step();
$result = $Step->create($fields);
$this->domain->addDomainValue('CREATED', $Step->getStepUid());
return $result;
} catch (Exception $e) {
$result = array('Exception!! ' => $e->getMessage());
if (isset($e->aValidationFailures)) {
$result['ValidationFailures'] = $e->aValidationFailures;
}
return $result;
}
}
示例2: postCreate
public function postCreate(Request $request)
{
$rules = ['title' => 'required', 'steps' => 'required|array', 'sourcecitations' => 'array'];
// Steps rules
//
if ($request->has('steps')) {
foreach ($request->get('steps') as $key => $val) {
$rules['steps.' . $key . '.title'] = 'required';
$rules['steps.' . $key . '.image'] = 'required_without:steps.' . $key . '.video';
$rules['steps.' . $key . '.video'] = 'required_without:steps.' . $key . '.image';
$rules['steps.' . $key . '.content'] = 'required';
}
}
// Sources & Citation's rules
//
if ($request->has('sourcecitations')) {
foreach ($request->get('sourcecitations') as $key => $val) {
$rules['sourcecitations.' . $key . '.link'] = 'required';
$rules['sourcecitations.' . $key . '.text'] = 'required';
}
}
$validator = Validator::make($request->all(), $rules);
if ($validator->fails()) {
flash($request)->error("Virheitä!");
return redirect()->to('guides/create')->withErrors($validator)->withInput();
}
$guide = Guide::create($request->all());
if ($request->has('steps')) {
foreach ($request->get('steps') as $index => $step) {
Step::create(['guide_id' => $guide->id, 'step' => $index, 'title' => $step['title'], 'content' => $step['content'], 'image' => $step['image'], 'video' => $step['video']]);
}
}
if ($request->has('sourcecitations')) {
foreach ($request->get('sourcecitations') as $sourcecitation) {
SourceCitation::create(['guide_id' => $guide->id, 'text' => $sourcecitation['text'], 'link' => $sourcecitation['link']]);
}
}
// TODO Rest of the creation
}
示例3: createStepRows
/**
* Create Step Rows from a Process
*
* @param $aStep array.
* @return void.
*/
public function createStepRows ($aStep)
{
foreach ($aStep as $key => $row) {
$oStep = new Step();
if (isset( $row['STEP_UID'] )) {
if ($oStep->StepExists( $row['STEP_UID'] )) {
$oStep->remove( $row['STEP_UID'] );
}
$res = $oStep->create( $row );
}
}
return;
}
示例4: createAll
/**
* Create Steps for a Task
*
* @param string $taskUid Unique id of Task
* @param string $processUid Unique id of Process
* @param array $arrayData Data
*
* return array Return data of the new Steps created
*/
public function createAll($taskUid, $processUid, $arrayData)
{
try {
$stepTrigger = new \ProcessMaker\BusinessModel\Step\Trigger();
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
unset($arrayData["STEP_UID"]);
//Verify data
$this->throwExceptionIfNotExistsTask($taskUid);
$this->throwExceptionIfNotExistsProcess($processUid);
if (!isset($arrayData["STEP_TYPE_OBJ"])) {
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepTypeObj"])));
}
$arrayData["STEP_TYPE_OBJ"] = trim($arrayData["STEP_TYPE_OBJ"]);
if ($arrayData["STEP_TYPE_OBJ"] == "") {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepTypeObj"])));
}
if (!isset($arrayData["STEP_UID_OBJ"])) {
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepUidObj"])));
}
$arrayData["STEP_UID_OBJ"] = trim($arrayData["STEP_UID_OBJ"]);
if ($arrayData["STEP_UID_OBJ"] == "") {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepUidObj"])));
}
if (!isset($arrayData["STEP_MODE"])) {
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepMode"])));
}
$arrayData["STEP_MODE"] = trim($arrayData["STEP_MODE"]);
if ($arrayData["STEP_MODE"] == "") {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepMode"])));
}
$this->throwExceptionIfHaveInvalidValueInTypeObj($arrayData["STEP_TYPE_OBJ"]);
$this->throwExceptionIfHaveInvalidValueInMode($arrayData["STEP_MODE"]);
$msg = $this->existsObjectUid($arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"], $this->arrayParamException["stepUidObj"]);
if ($msg != "") {
throw new \Exception($msg);
}
if ($this->existsRecord($taskUid, $arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"])) {
throw new \Exception(\G::LoadTranslation("ID_RECORD_EXISTS_IN_TABLE", array($taskUid . ", " . $arrayData["STEP_TYPE_OBJ"] . ", " . $arrayData["STEP_UID_OBJ"], "STEP")));
}
//Create
$step = new \Step();
$stepUid = $step->create(array(
"PRO_UID" => $processUid,
"TAS_UID" => $taskUid,
"STEP_POSITION" => $arrayData["STEP_POSITION"]
));
if (!isset($arrayData["STEP_POSITION"]) || $arrayData["STEP_POSITION"] == "") {
unset($arrayData["STEP_POSITION"]);
}
$arrayData = $this->updateAll($stepUid, $arrayData);
//Return
unset($arrayData["STEP_UID"]);
$arrayData = array_merge(array("STEP_UID" => $stepUid), $arrayData);
if (!$this->formatFieldNameInUppercase) {
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
}
return $arrayData;
} catch (\Exception $e) {
throw $e;
}
}
示例5: update
/**
* Update WebEntry-Event
*
* @param string $webEntryEventUid Unique id of WebEntry-Event
* @param string $userUidUpdater Unique id of updater User
* @param array $arrayData Data
*
* return array Return data of the WebEntry-Event updated
*/
public function update($webEntryEventUid, $userUidUpdater, array $arrayData)
{
try {
//Verify data
$process = new \ProcessMaker\BusinessModel\Process();
$validator = new \ProcessMaker\BusinessModel\Validator();
$validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData");
$validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
//Set data
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
$arrayDataBackup = $arrayData;
unset($arrayData["WEE_UID"]);
unset($arrayData["PRJ_UID"]);
unset($arrayData["WEE_WE_UID"]);
unset($arrayData["WEE_WE_TAS_UID"]);
//Set variables
$arrayWebEntryEventData = $this->getWebEntryEvent($webEntryEventUid, true);
$arrayFinalData = array_merge($arrayWebEntryEventData, $arrayData);
//Verify data
$this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid, $this->arrayFieldNameForException["webEntryEventUid"]);
$this->throwExceptionIfDataIsInvalid($webEntryEventUid, $arrayWebEntryEventData["PRJ_UID"], $arrayData);
//Update
$cnn = \Propel::getConnection("workflow");
$this->webEntryEventWebEntryUid = "";
$this->webEntryEventWebEntryTaskUid = "";
try {
//WebEntry
$option = "UPDATE";
if (isset($arrayData["WEE_STATUS"])) {
if ($arrayData["WEE_STATUS"] == "ENABLED") {
if ($arrayWebEntryEventData["WEE_STATUS"] == "DISABLED") {
$option = "INSERT";
}
} else {
if ($arrayWebEntryEventData["WEE_STATUS"] == "ENABLED") {
$option = "DELETE";
}
}
}
switch ($option) {
case "INSERT":
$this->createWebEntry($arrayFinalData["PRJ_UID"], $arrayFinalData["EVN_UID"], $arrayFinalData["ACT_UID"], $arrayFinalData["DYN_UID"], $arrayFinalData["USR_UID"], $arrayFinalData["WEE_TITLE"], $arrayFinalData["WEE_DESCRIPTION"], $userUidUpdater);
$arrayData["WEE_WE_UID"] = $this->webEntryEventWebEntryUid;
$arrayData["WEE_WE_TAS_UID"] = $this->webEntryEventWebEntryTaskUid;
break;
case "UPDATE":
if ($arrayWebEntryEventData["WEE_WE_UID"] != "") {
$task = new \Tasks();
//Task - Step
if (isset($arrayData["DYN_UID"]) && $arrayData["DYN_UID"] != $arrayWebEntryEventData["DYN_UID"]) {
//Delete
$step = new \Step();
$criteria = new \Criteria("workflow");
$criteria->add(\StepPeer::TAS_UID, $arrayWebEntryEventData["WEE_WE_TAS_UID"]);
$rsCriteria = \StepPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$result = $step->remove($row["STEP_UID"]);
}
//Add
$step = new \Step();
$stepUid = $step->create(array("PRO_UID" => $arrayWebEntryEventData["PRJ_UID"], "TAS_UID" => $arrayWebEntryEventData["WEE_WE_TAS_UID"]));
$result = $step->update(array("STEP_UID" => $stepUid, "STEP_TYPE_OBJ" => "DYNAFORM", "STEP_UID_OBJ" => $arrayData["DYN_UID"], "STEP_POSITION" => 1, "STEP_MODE" => "EDIT"));
}
//Task - User
if (isset($arrayData["USR_UID"]) && $arrayData["USR_UID"] != $arrayWebEntryEventData["USR_UID"]) {
//Unassign
$taskUser = new \TaskUser();
$criteria = new \Criteria("workflow");
$criteria->add(\TaskUserPeer::TAS_UID, $arrayWebEntryEventData["WEE_WE_TAS_UID"]);
$rsCriteria = \TaskUserPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$result = $taskUser->remove($row["TAS_UID"], $row["USR_UID"], $row["TU_TYPE"], $row["TU_RELATION"]);
}
//Assign
$result = $task->assignUser($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["USR_UID"], 1);
}
//Route
if (isset($arrayData["ACT_UID"]) && $arrayData["ACT_UID"] != $arrayWebEntryEventData["ACT_UID"]) {
//Delete
$result = $task->deleteAllRoutesOfTask($arrayWebEntryEventData["PRJ_UID"], $arrayWebEntryEventData["WEE_WE_TAS_UID"], true);
//Add
$workflow = \ProcessMaker\Project\Workflow::load($arrayWebEntryEventData["PRJ_UID"]);
$result = $workflow->addRoute($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["ACT_UID"], "SEQUENTIAL");
}
//WebEntry
$arrayDataAux = array();
if (isset($arrayData["DYN_UID"])) {
//.........这里部分代码省略.........
示例6: switch
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) {
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
require_once 'classes/model/Step.php';
$oStep = new Step();
$sStepUID = $oStep->create(array('PRO_UID' => $_POST['sProcess'], 'TAS_UID' => $_POST['sTask']));
$oStep->update(array('STEP_UID' => $sStepUID, 'STEP_TYPE_OBJ' => $_POST['sType'], 'STEP_UID_OBJ' => $_POST['sUID'], 'STEP_POSITION' => $oStep->getNextPosition($_POST['sTask']) - 1, 'STEP_MODE' => isset($_POST['sMode']) ? $_POST['sMode'] : 'EDIT'));
G::LoadClass('processMap');
$oProcessMap = new ProcessMap();
$oProcessMap->getStepsCriteria($_POST['sTask']);
} catch (Exception $oException) {
die($oException->getMessage());
}