Ejemplo n.º 1
0
 public function validateTrigger(WorkflowRequest $req)
 {
     // Check if the current workflow request is not already deleted
     $wr = $req::getByID($req->getWorkflowRequestID());
     if (is_object($wr)) {
         return true;
     }
     return false;
 }
Ejemplo n.º 2
0
 /**
  * Creates a WorkflowProgress object (which will be assigned to a Page, File, etc... in our system.
  *
  * @param string $wpCategoryHandle
  * @param Workflow $wf
  * @param WorkflowRequest $wr
  *
  * @return self
  */
 public static function create($wpCategoryHandle, Workflow $wf, WorkflowRequest $wr)
 {
     $db = Database::connection();
     $wpDateAdded = Core::make('helper/date')->getOverridableNow();
     $wpCategoryID = $db->fetchColumn('select wpCategoryID from WorkflowProgressCategories where wpCategoryHandle = ?', array($wpCategoryHandle));
     $db->executeQuery('insert into WorkflowProgress (wfID, wrID, wpDateAdded, wpCategoryID) values (?, ?, ?, ?)', array($wf->getWorkflowID(), $wr->getWorkflowRequestID(), $wpDateAdded, $wpCategoryID));
     $wp = self::getByID($db->lastInsertId());
     $wp->addWorkflowProgressHistoryObject($wr);
     if (!$wf instanceof EmptyWorkflow) {
         $application = \Core::getFacadeApplication();
         $type = $application->make('manager/notification/types')->driver('workflow_progress');
         $notifier = $type->getNotifier();
         $subscription = $type->getSubscription($wp);
         $notified = $notifier->getUsersToNotify($subscription, $wp);
         $notification = $type->createNotification($wp);
         $notifier->notify($notified, $notification);
     }
     return $wp;
 }
Ejemplo n.º 3
0
 /**
  * Creates a WorkflowProgress object (which will be assigned to a Page, File, etc... in our system.
  *
  * @param string $wpCategoryHandle
  * @param Workflow $wf
  * @param WorkflowRequest $wr
  *
  * @return self
  */
 public static function create($wpCategoryHandle, Workflow $wf, WorkflowRequest $wr)
 {
     $db = Database::connection();
     $wpDateAdded = Core::make('helper/date')->getOverridableNow();
     $wpCategoryID = $db->fetchColumn('select wpCategoryID from WorkflowProgressCategories where wpCategoryHandle = ?', array($wpCategoryHandle));
     $db->executeQuery('insert into WorkflowProgress (wfID, wrID, wpDateAdded, wpCategoryID) values (?, ?, ?, ?)', array($wf->getWorkflowID(), $wr->getWorkflowRequestID(), $wpDateAdded, $wpCategoryID));
     $wp = self::getByID($db->lastInsertId());
     $wp->addWorkflowProgressHistoryObject($wr);
     return $wp;
 }
Ejemplo n.º 4
0
 /**
  * Creates a WorkflowProgress object (which will be assigned to a Page, File, etc... in our system.
  */
 public static function add($wpCategoryHandle, Workflow $wf, WorkflowRequest $wr)
 {
     $db = Loader::db();
     $wpDateAdded = Loader::helper('date')->getOverridableNow();
     $wpCategoryID = $db->GetOne('select wpCategoryID from WorkflowProgressCategories where wpCategoryHandle = ?', array($wpCategoryHandle));
     $db->Execute('insert into WorkflowProgress (wfID, wrID, wpDateAdded, wpCategoryID) values (?, ?, ?, ?)', array($wf->getWorkflowID(), $wr->getWorkflowRequestID(), $wpDateAdded, $wpCategoryID));
     $wp = self::getByID($db->Insert_ID());
     $wp->addWorkflowProgressHistoryObject($wr);
     return $wp;
 }