2015-01-22 15:27:35 -04:00
|
|
|
<?php
|
|
|
|
|
namespace ProcessMaker\Services\Api\Project;
|
|
|
|
|
|
|
|
|
|
use \ProcessMaker\Services\Api;
|
|
|
|
|
use \Luracast\Restler\RestException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Project\WebEntryEvent Api Controller
|
|
|
|
|
*
|
|
|
|
|
* @protected
|
|
|
|
|
*/
|
|
|
|
|
class WebEntryEvent extends Api
|
|
|
|
|
{
|
2017-05-22 16:38:38 -04:00
|
|
|
/**
|
|
|
|
|
* @var \ProcessMaker\BusinessModel\WebEntryEvent $webEntryEvent
|
|
|
|
|
*/
|
2015-01-22 15:27:35 -04:00
|
|
|
private $webEntryEvent;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructor of the class
|
|
|
|
|
*
|
|
|
|
|
* return void
|
|
|
|
|
*/
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$this->webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
|
|
|
|
|
|
|
|
|
|
$this->webEntryEvent->setFormatFieldNameInUppercase(false);
|
|
|
|
|
$this->webEntryEvent->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @url GET /:prj_uid/web-entry-events
|
2017-05-22 11:26:15 -04:00
|
|
|
* @access protected
|
|
|
|
|
* @class AccessControl {@permission PM_FACTORY}
|
2015-01-22 15:27:35 -04:00
|
|
|
*
|
|
|
|
|
* @param string $prj_uid {@min 32}{@max 32}
|
|
|
|
|
*/
|
|
|
|
|
public function doGetWebEntryEvents($prj_uid)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$response = $this->webEntryEvent->getWebEntryEvents($prj_uid);
|
|
|
|
|
|
|
|
|
|
return $response;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @url GET /:prj_uid/web-entry-event/:wee_uid
|
2017-05-22 12:11:45 -04:00
|
|
|
* @class AccessControl {@permission PM_FACTORY}
|
2015-01-22 15:27:35 -04:00
|
|
|
*
|
|
|
|
|
* @param string $prj_uid {@min 32}{@max 32}
|
|
|
|
|
* @param string $wee_uid {@min 32}{@max 32}
|
|
|
|
|
*/
|
|
|
|
|
public function doGetWebEntryEvent($prj_uid, $wee_uid)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$response = $this->webEntryEvent->getWebEntryEvent($wee_uid);
|
|
|
|
|
|
|
|
|
|
return $response;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @url GET /:prj_uid/web-entry-event/event/:evn_uid
|
2017-05-22 12:11:45 -04:00
|
|
|
* @class AccessControl {@permission PM_FACTORY}
|
2015-01-22 15:27:35 -04:00
|
|
|
*
|
|
|
|
|
* @param string $prj_uid {@min 32}{@max 32}
|
|
|
|
|
* @param string $evn_uid {@min 32}{@max 32}
|
|
|
|
|
*/
|
|
|
|
|
public function doGetWebEntryEventEvent($prj_uid, $evn_uid)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$response = $this->webEntryEvent->getWebEntryEventByEvent($prj_uid, $evn_uid);
|
|
|
|
|
|
|
|
|
|
return $response;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @url POST /:prj_uid/web-entry-event
|
2017-05-22 12:11:45 -04:00
|
|
|
* @class AccessControl {@permission PM_FACTORY}
|
2015-01-22 15:27:35 -04:00
|
|
|
*
|
|
|
|
|
* @param string $prj_uid {@min 32}{@max 32}
|
|
|
|
|
* @param array $request_data
|
|
|
|
|
*
|
|
|
|
|
* @status 201
|
|
|
|
|
*/
|
|
|
|
|
public function doPostWebEntryEvent($prj_uid, array $request_data)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$arrayData = $this->webEntryEvent->create($prj_uid, $this->getUserId(), $request_data);
|
|
|
|
|
|
|
|
|
|
$response = $arrayData;
|
|
|
|
|
|
|
|
|
|
return $response;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @url PUT /:prj_uid/web-entry-event/:wee_uid
|
2017-05-22 12:11:45 -04:00
|
|
|
* @class AccessControl {@permission PM_FACTORY}
|
2015-01-22 15:27:35 -04:00
|
|
|
*
|
|
|
|
|
* @param string $prj_uid {@min 32}{@max 32}
|
|
|
|
|
* @param string $wee_uid {@min 32}{@max 32}
|
|
|
|
|
* @param array $request_data
|
|
|
|
|
*/
|
|
|
|
|
public function doPutWebEntryEvent($prj_uid, $wee_uid, array $request_data)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$arrayData = $this->webEntryEvent->update($wee_uid, $this->getUserId(), $request_data);
|
2017-05-30 15:41:04 -04:00
|
|
|
return $this->webEntryEvent->getWebEntryEvent($wee_uid);
|
2015-01-22 15:27:35 -04:00
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @url DELETE /:prj_uid/web-entry-event/:wee_uid
|
2017-05-22 12:11:45 -04:00
|
|
|
* @class AccessControl {@permission PM_FACTORY}
|
2015-01-22 15:27:35 -04:00
|
|
|
*
|
|
|
|
|
* @param string $prj_uid {@min 32}{@max 32}
|
|
|
|
|
* @param string $wee_uid {@min 32}{@max 32}
|
|
|
|
|
*/
|
|
|
|
|
public function doDeleteWebEntryEvent($prj_uid, $wee_uid)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$this->webEntryEvent->delete($wee_uid);
|
2017-05-30 15:41:04 -04:00
|
|
|
return ['success' => true];
|
2015-01-22 15:27:35 -04:00
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-05-22 16:38:38 -04:00
|
|
|
|
|
|
|
|
/**
|
2017-06-02 19:01:42 -04:00
|
|
|
* Get the web entry URL.
|
|
|
|
|
*
|
2017-05-22 16:38:38 -04:00
|
|
|
* @url GET /:prj_uid/web-entry-event/:wee_uid/generate-link
|
2017-06-02 19:01:42 -04:00
|
|
|
* @access protected
|
2017-05-22 16:38:38 -04:00
|
|
|
* @class AccessControl {@permission PM_FACTORY}
|
|
|
|
|
*/
|
|
|
|
|
public function generateLink($prj_uid, $wee_uid)
|
|
|
|
|
{
|
|
|
|
|
try {
|
2017-06-02 15:11:44 -04:00
|
|
|
$link = $this->webEntryEvent->generateLink($prj_uid, $wee_uid);
|
|
|
|
|
return ["link" => $link];
|
2017-05-22 16:38:38 -04:00
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-01-22 15:27:35 -04:00
|
|
|
}
|
|
|
|
|
|