CODE STYLE, workflow/engine/controllers/
FILES: caseSchedulerProxy.php dashboard.php home.php installer.php main.php
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,322 +1,337 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dashboard controller
|
* Dashboard controller
|
||||||
* @inherits Controller
|
* @inherits Controller
|
||||||
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Dashboard extends Controller {
|
class Dashboard extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
// Class properties
|
// Class properties
|
||||||
private $pmDashlet;
|
private $pmDashlet;
|
||||||
|
|
||||||
// Class constructor
|
// Class constructor
|
||||||
public function __construct() {
|
public function __construct ()
|
||||||
G::LoadClass('pmDashlet');
|
{
|
||||||
$this->pmDashlet = new PMDashlet();
|
G::LoadClass( 'pmDashlet' );
|
||||||
}
|
$this->pmDashlet = new PMDashlet();
|
||||||
|
|
||||||
// Functions for the dashboards users module - Start
|
|
||||||
|
|
||||||
public function index($httpData) {
|
|
||||||
try {
|
|
||||||
$this->setJSVar('dashletsInstances', $this->getDashletsInstancesForCurrentUser());
|
|
||||||
$this->includeExtJS('dashboard/index');
|
|
||||||
$this->includeExtJSLib('ux/portal');
|
|
||||||
G::RenderPage('publish', 'extJs');
|
|
||||||
}
|
}
|
||||||
catch (Exception $error) {
|
|
||||||
//ToDo: Display a error message
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function renderDashletInstance($data) {
|
// Functions for the dashboards users module - Start
|
||||||
try {
|
|
||||||
if (!isset($data->DAS_INS_UID)) {
|
|
||||||
$data->DAS_INS_UID = '';
|
|
||||||
}
|
|
||||||
if ($data->DAS_INS_UID == '') {
|
|
||||||
throw new Exception('Parameter "DAS_INS_UID" is empty.');
|
|
||||||
}
|
|
||||||
$this->pmDashlet->setup($data->DAS_INS_UID);
|
|
||||||
|
|
||||||
if (!isset($_REQUEST['w']) ) {
|
|
||||||
$width = 300;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$width = $_REQUEST['w'];
|
|
||||||
}
|
|
||||||
$this->pmDashlet->render($width);
|
|
||||||
}
|
|
||||||
catch (Exception $error) {
|
|
||||||
//ToDo: Show the error message
|
|
||||||
echo $error->getMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getDashletsInstancesForCurrentUser() {
|
public function index ($httpData)
|
||||||
try {
|
{
|
||||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
try {
|
||||||
throw new Exception('The session has expired.');
|
$this->setJSVar( 'dashletsInstances', $this->getDashletsInstancesForCurrentUser() );
|
||||||
}
|
$this->includeExtJS( 'dashboard/index' );
|
||||||
return $this->pmDashlet->getDashletsInstancesForUser($_SESSION['USER_LOGGED']);
|
$this->includeExtJSLib( 'ux/portal' );
|
||||||
|
G::RenderPage( 'publish', 'extJs' );
|
||||||
|
} catch (Exception $error) {
|
||||||
|
//ToDo: Display a error message
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $error) {
|
|
||||||
throw $error;
|
public function renderDashletInstance ($data)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (! isset( $data->DAS_INS_UID )) {
|
||||||
|
$data->DAS_INS_UID = '';
|
||||||
|
}
|
||||||
|
if ($data->DAS_INS_UID == '') {
|
||||||
|
throw new Exception( 'Parameter "DAS_INS_UID" is empty.' );
|
||||||
|
}
|
||||||
|
$this->pmDashlet->setup( $data->DAS_INS_UID );
|
||||||
|
|
||||||
|
if (! isset( $_REQUEST['w'] )) {
|
||||||
|
$width = 300;
|
||||||
|
} else {
|
||||||
|
$width = $_REQUEST['w'];
|
||||||
|
}
|
||||||
|
$this->pmDashlet->render( $width );
|
||||||
|
} catch (Exception $error) {
|
||||||
|
//ToDo: Show the error message
|
||||||
|
echo $error->getMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Functions for the dashboards users module - End
|
private function getDashletsInstancesForCurrentUser ()
|
||||||
|
{
|
||||||
// Functions for the dasboards administration module - Start
|
try {
|
||||||
|
if (! isset( $_SESSION['USER_LOGGED'] )) {
|
||||||
public function dashletsList() {
|
throw new Exception( 'The session has expired.' );
|
||||||
try {
|
}
|
||||||
$this->includeExtJS('dashboard/dashletsList');
|
return $this->pmDashlet->getDashletsInstancesForUser( $_SESSION['USER_LOGGED'] );
|
||||||
if (isset($_SESSION['__DASHBOARD_ERROR__'])) {
|
} catch (Exception $error) {
|
||||||
$this->setJSVar('__DASHBOARD_ERROR__', $_SESSION['__DASHBOARD_ERROR__']);
|
throw $error;
|
||||||
unset($_SESSION['__DASHBOARD_ERROR__']);
|
}
|
||||||
}
|
|
||||||
$this->setView('dashboard/dashletsList');
|
|
||||||
G::RenderPage('publish', 'extJs');
|
|
||||||
}
|
}
|
||||||
catch (Exception $error) {
|
|
||||||
//ToDo: Display a error message
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDashletsInstances($data) {
|
// Functions for the dashboards users module - End
|
||||||
$this->setResponseType('json');
|
|
||||||
$result = new stdclass();
|
|
||||||
$result->status = 'OK';
|
|
||||||
try {
|
|
||||||
if (!isset($data->start)) {
|
|
||||||
$data->start = null;
|
|
||||||
}
|
|
||||||
if (!isset($data->limit)) {
|
|
||||||
$data->limit = null;
|
|
||||||
}
|
|
||||||
$result->dashletsInstances = $this->pmDashlet->getDashletsInstances($data->start, $data->limit);
|
|
||||||
$result->totalDashletsInstances = $this->pmDashlet->getDashletsInstancesQuantity();
|
|
||||||
}
|
|
||||||
catch (Exception $error) {
|
|
||||||
$result->status = 'ERROR';
|
|
||||||
$result->message = $error->getMessage();
|
|
||||||
}
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function dashletInstanceForm($data) {
|
|
||||||
try {
|
// Functions for the dasboards administration module - Start
|
||||||
$this->includeExtJS('dashboard/dashletInstanceForm', false);
|
|
||||||
$this->setView('dashboard/dashletInstanceForm');
|
|
||||||
if (!isset($data->DAS_INS_UID)) {
|
public function dashletsList ()
|
||||||
$data->DAS_INS_UID = '';
|
{
|
||||||
}
|
try {
|
||||||
$dashlets = $this->getDashlets();
|
$this->includeExtJS( 'dashboard/dashletsList' );
|
||||||
$this->setJSVar('storeDasUID', $dashlets);
|
if (isset( $_SESSION['__DASHBOARD_ERROR__'] )) {
|
||||||
if ($data->DAS_INS_UID != '') {
|
$this->setJSVar( '__DASHBOARD_ERROR__', $_SESSION['__DASHBOARD_ERROR__'] );
|
||||||
$this->pmDashlet->setup($data->DAS_INS_UID);
|
unset( $_SESSION['__DASHBOARD_ERROR__'] );
|
||||||
$this->setJSVar('dashletInstance', $this->pmDashlet->getDashletInstance());
|
}
|
||||||
$this->setJSVar('additionalFields', PMDashlet::getAdditionalFields(get_class($this->pmDashlet->getDashletObject())));
|
$this->setView( 'dashboard/dashletsList' );
|
||||||
}
|
G::RenderPage( 'publish', 'extJs' );
|
||||||
else {
|
} catch (Exception $error) {
|
||||||
$dashletInstance = new stdclass();
|
//ToDo: Display a error message
|
||||||
$dashletInstance->DAS_UID = $dashlets[0][0];
|
}
|
||||||
$dashlet = new Dashlet();
|
|
||||||
$dashletFields = $dashlet->load($dashletInstance->DAS_UID);
|
|
||||||
$this->setJSVar('dashletInstance', $dashletInstance);
|
|
||||||
$this->setJSVar('additionalFields', PMDashlet::getAdditionalFields($dashletFields['DAS_CLASS']));
|
|
||||||
}
|
|
||||||
G::RenderPage('publish', 'extJs');
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
catch (Exception $error) {
|
|
||||||
$_SESSION['__DASHBOARD_ERROR__'] = $error->getMessage();
|
public function getDashletsInstances ($data)
|
||||||
G::header('Location: dashletsList');
|
{
|
||||||
die();
|
$this->setResponseType( 'json' );
|
||||||
|
$result = new stdclass();
|
||||||
|
$result->status = 'OK';
|
||||||
|
try {
|
||||||
|
if (! isset( $data->start )) {
|
||||||
|
$data->start = null;
|
||||||
|
}
|
||||||
|
if (! isset( $data->limit )) {
|
||||||
|
$data->limit = null;
|
||||||
|
}
|
||||||
|
$result->dashletsInstances = $this->pmDashlet->getDashletsInstances( $data->start, $data->limit );
|
||||||
|
$result->totalDashletsInstances = $this->pmDashlet->getDashletsInstancesQuantity();
|
||||||
|
} catch (Exception $error) {
|
||||||
|
$result->status = 'ERROR';
|
||||||
|
$result->message = $error->getMessage();
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function saveDashletInstance($data) {
|
public function dashletInstanceForm ($data)
|
||||||
$this->setResponseType('json');
|
{
|
||||||
$result = new stdclass();
|
try {
|
||||||
$result->status = 'OK';
|
$this->includeExtJS( 'dashboard/dashletInstanceForm', false );
|
||||||
try {
|
$this->setView( 'dashboard/dashletInstanceForm' );
|
||||||
$this->pmDashlet->saveDashletInstance(get_object_vars($data));
|
if (! isset( $data->DAS_INS_UID )) {
|
||||||
|
$data->DAS_INS_UID = '';
|
||||||
|
}
|
||||||
|
$dashlets = $this->getDashlets();
|
||||||
|
$this->setJSVar( 'storeDasUID', $dashlets );
|
||||||
|
if ($data->DAS_INS_UID != '') {
|
||||||
|
$this->pmDashlet->setup( $data->DAS_INS_UID );
|
||||||
|
$this->setJSVar( 'dashletInstance', $this->pmDashlet->getDashletInstance() );
|
||||||
|
$this->setJSVar( 'additionalFields', PMDashlet::getAdditionalFields( get_class( $this->pmDashlet->getDashletObject() ) ) );
|
||||||
|
} else {
|
||||||
|
$dashletInstance = new stdclass();
|
||||||
|
$dashletInstance->DAS_UID = $dashlets[0][0];
|
||||||
|
$dashlet = new Dashlet();
|
||||||
|
$dashletFields = $dashlet->load( $dashletInstance->DAS_UID );
|
||||||
|
$this->setJSVar( 'dashletInstance', $dashletInstance );
|
||||||
|
$this->setJSVar( 'additionalFields', PMDashlet::getAdditionalFields( $dashletFields['DAS_CLASS'] ) );
|
||||||
|
}
|
||||||
|
G::RenderPage( 'publish', 'extJs' );
|
||||||
|
return null;
|
||||||
|
} catch (Exception $error) {
|
||||||
|
$_SESSION['__DASHBOARD_ERROR__'] = $error->getMessage();
|
||||||
|
G::header( 'Location: dashletsList' );
|
||||||
|
die();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $error) {
|
|
||||||
$result->status = 'ERROR';
|
public function saveDashletInstance ($data)
|
||||||
$result->message = $error->getMessage();
|
{
|
||||||
|
$this->setResponseType( 'json' );
|
||||||
|
$result = new stdclass();
|
||||||
|
$result->status = 'OK';
|
||||||
|
try {
|
||||||
|
$this->pmDashlet->saveDashletInstance( get_object_vars( $data ) );
|
||||||
|
} catch (Exception $error) {
|
||||||
|
$result->status = 'ERROR';
|
||||||
|
$result->message = $error->getMessage();
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function deleteDashletInstance($data) {
|
public function deleteDashletInstance ($data)
|
||||||
$this->setResponseType('json');
|
{
|
||||||
$result = new stdclass();
|
$this->setResponseType( 'json' );
|
||||||
$result->status = 'OK';
|
$result = new stdclass();
|
||||||
try {
|
$result->status = 'OK';
|
||||||
if (!isset($data->DAS_INS_UID)) {
|
try {
|
||||||
$data->DAS_INS_UID = '';
|
if (! isset( $data->DAS_INS_UID )) {
|
||||||
}
|
$data->DAS_INS_UID = '';
|
||||||
if ($data->DAS_INS_UID == '') {
|
}
|
||||||
throw new Exception('Parameter "DAS_INS_UID" is empty.');
|
if ($data->DAS_INS_UID == '') {
|
||||||
}
|
throw new Exception( 'Parameter "DAS_INS_UID" is empty.' );
|
||||||
$this->pmDashlet->deleteDashletInstance($data->DAS_INS_UID);
|
}
|
||||||
|
$this->pmDashlet->deleteDashletInstance( $data->DAS_INS_UID );
|
||||||
|
} catch (Exception $error) {
|
||||||
|
$result->status = 'ERROR';
|
||||||
|
$result->message = $error->getMessage();
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
catch (Exception $error) {
|
|
||||||
$result->status = 'ERROR';
|
public function getAdditionalFields ($data)
|
||||||
$result->message = $error->getMessage();
|
{
|
||||||
|
$this->setResponseType( 'json' );
|
||||||
|
$result = new stdclass();
|
||||||
|
$result->status = 'OK';
|
||||||
|
try {
|
||||||
|
$dashlet = new Dashlet();
|
||||||
|
$dashletFields = $dashlet->load( $data->DAS_UID );
|
||||||
|
if (! is_null( $dashletFields )) {
|
||||||
|
$result->additionalFields = PMDashlet::getAdditionalFields( $dashletFields['DAS_CLASS'] );
|
||||||
|
} else {
|
||||||
|
throw new Exception( 'Dashlet "' . $data->DAS_UID . '" does not exist.' );
|
||||||
|
}
|
||||||
|
} catch (Exception $error) {
|
||||||
|
$result->status = 'ERROR';
|
||||||
|
$result->message = $error->getMessage();
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAdditionalFields($data) {
|
public function getOwnersByType ($data)
|
||||||
$this->setResponseType('json');
|
{
|
||||||
$result = new stdclass();
|
$this->setResponseType( 'json' );
|
||||||
$result->status = 'OK';
|
$result = new stdclass();
|
||||||
try {
|
$result->status = 'OK';
|
||||||
$dashlet = new Dashlet();
|
try {
|
||||||
$dashletFields = $dashlet->load($data->DAS_UID);
|
switch ($data->type) {
|
||||||
if (!is_null($dashletFields)) {
|
case 'EVERYBODY':
|
||||||
$result->additionalFields = PMDashlet::getAdditionalFields($dashletFields['DAS_CLASS']);
|
$result->total = 0;
|
||||||
}
|
$result->owners = array ();
|
||||||
else {
|
break;
|
||||||
throw new Exception('Dashlet "' . $data->DAS_UID . '" does not exist.');
|
case 'USER':
|
||||||
}
|
require_once 'classes/model/Users.php';
|
||||||
|
|
||||||
|
$users = array ();
|
||||||
|
|
||||||
|
$usersInstance = new Users();
|
||||||
|
$allUsers = $usersInstance->getAll();
|
||||||
|
foreach ($allUsers->data as $user) {
|
||||||
|
$users[] = array ('OWNER_UID' => $user['USR_UID'],'OWNER_NAME' => $user['USR_FIRSTNAME'] . ' ' . $user['USR_LASTNAME']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result->total = $allUsers->totalCount;
|
||||||
|
$result->owners = $users;
|
||||||
|
break;
|
||||||
|
case 'DEPARTMENT':
|
||||||
|
require_once 'classes/model/Department.php';
|
||||||
|
require_once 'classes/model/Content.php';
|
||||||
|
|
||||||
|
$departments = array ();
|
||||||
|
//SELECT
|
||||||
|
$criteria = new Criteria( 'workflow' );
|
||||||
|
$criteria->setDistinct();
|
||||||
|
$criteria->addSelectColumn( DepartmentPeer::DEP_UID );
|
||||||
|
$criteria->addSelectColumn( ContentPeer::CON_VALUE );
|
||||||
|
//FROM
|
||||||
|
$conditions = array ();
|
||||||
|
$conditions[] = array (DepartmentPeer::DEP_UID,ContentPeer::CON_ID
|
||||||
|
);
|
||||||
|
$conditions[] = array (ContentPeer::CON_CATEGORY,DBAdapter::getStringDelimiter() . 'DEPO_TITLE' . DBAdapter::getStringDelimiter()
|
||||||
|
);
|
||||||
|
$conditions[] = array (ContentPeer::CON_LANG,DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter()
|
||||||
|
);
|
||||||
|
$criteria->addJoinMC( $conditions, Criteria::LEFT_JOIN );
|
||||||
|
//WHERE
|
||||||
|
$criteria->add( DepartmentPeer::DEP_STATUS, 'ACTIVE' );
|
||||||
|
//ORDER BY
|
||||||
|
$criteria->addAscendingOrderByColumn( ContentPeer::CON_VALUE );
|
||||||
|
|
||||||
|
$dataset = DepartmentPeer::doSelectRS( $criteria );
|
||||||
|
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
|
$dataset->next();
|
||||||
|
while ($row = $dataset->getRow()) {
|
||||||
|
$departments[] = array ('OWNER_UID' => $row['DEP_UID'],'OWNER_NAME' => $row['CON_VALUE']
|
||||||
|
);
|
||||||
|
$dataset->next();
|
||||||
|
}
|
||||||
|
|
||||||
|
$result->total = DepartmentPeer::doCount( $criteria );
|
||||||
|
$result->owners = $departments;
|
||||||
|
break;
|
||||||
|
case 'GROUP':
|
||||||
|
require_once 'classes/model/Groupwf.php';
|
||||||
|
require_once 'classes/model/Content.php';
|
||||||
|
|
||||||
|
$groups = array ();
|
||||||
|
//SELECT
|
||||||
|
$criteria = new Criteria( 'workflow' );
|
||||||
|
$criteria->setDistinct();
|
||||||
|
$criteria->addSelectColumn( GroupwfPeer::GRP_UID );
|
||||||
|
$criteria->addSelectColumn( ContentPeer::CON_VALUE );
|
||||||
|
//FROM
|
||||||
|
$conditions = array ();
|
||||||
|
$conditions[] = array (GroupwfPeer::GRP_UID,ContentPeer::CON_ID
|
||||||
|
);
|
||||||
|
$conditions[] = array (ContentPeer::CON_CATEGORY,DBAdapter::getStringDelimiter() . 'GRP_TITLE' . DBAdapter::getStringDelimiter()
|
||||||
|
);
|
||||||
|
$conditions[] = array (ContentPeer::CON_LANG,DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter()
|
||||||
|
);
|
||||||
|
$criteria->addJoinMC( $conditions, Criteria::LEFT_JOIN );
|
||||||
|
//WHERE
|
||||||
|
$criteria->add( GroupwfPeer::GRP_STATUS, 'ACTIVE' );
|
||||||
|
//ORDER BY
|
||||||
|
$criteria->addAscendingOrderByColumn( ContentPeer::CON_VALUE );
|
||||||
|
|
||||||
|
$dataset = GroupwfPeer::doSelectRS( $criteria );
|
||||||
|
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
|
$dataset->next();
|
||||||
|
while ($row = $dataset->getRow()) {
|
||||||
|
$groups[] = array ('OWNER_UID' => $row['GRP_UID'],'OWNER_NAME' => $row['CON_VALUE']
|
||||||
|
);
|
||||||
|
$dataset->next();
|
||||||
|
}
|
||||||
|
|
||||||
|
$result->total = GroupwfPeer::doCount( $criteria );
|
||||||
|
$result->owners = $groups;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (Exception $error) {
|
||||||
|
$result->status = 'ERROR';
|
||||||
|
$result->message = $error->getMessage();
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
catch (Exception $error) {
|
|
||||||
$result->status = 'ERROR';
|
|
||||||
$result->message = $error->getMessage();
|
|
||||||
}
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getOwnersByType($data) {
|
private function getDashlets ()
|
||||||
$this->setResponseType('json');
|
{
|
||||||
$result = new stdclass();
|
try {
|
||||||
$result->status = 'OK';
|
require_once 'classes/model/Dashlet.php';
|
||||||
try {
|
|
||||||
switch ($data->type) {
|
|
||||||
case 'EVERYBODY':
|
|
||||||
$result->total = 0;
|
|
||||||
$result->owners = array();
|
|
||||||
break;
|
|
||||||
case 'USER':
|
|
||||||
require_once 'classes/model/Users.php';
|
|
||||||
|
|
||||||
$users = array();
|
$dashlets = array ();
|
||||||
|
|
||||||
$usersInstance = new Users();
|
//SELECT
|
||||||
$allUsers = $usersInstance->getAll();
|
$criteria = new Criteria( 'workflow' );
|
||||||
foreach ($allUsers->data as $user) {
|
$criteria->addSelectColumn( DashletPeer::DAS_UID );
|
||||||
$users[] = array('OWNER_UID' => $user['USR_UID'], 'OWNER_NAME' => $user['USR_FIRSTNAME'] . ' ' . $user['USR_LASTNAME']);
|
$criteria->addSelectColumn( DashletPeer::DAS_TITLE );
|
||||||
}
|
//ORDER BY
|
||||||
|
$criteria->addAscendingOrderByColumn( DashletPeer::DAS_TITLE );
|
||||||
|
|
||||||
$result->total = $allUsers->totalCount;
|
$dataset = DashletPeer::doSelectRS( $criteria );
|
||||||
$result->owners = $users;
|
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
break;
|
|
||||||
case 'DEPARTMENT':
|
|
||||||
require_once 'classes/model/Department.php';
|
|
||||||
require_once 'classes/model/Content.php';
|
|
||||||
|
|
||||||
$departments = array();
|
|
||||||
//SELECT
|
|
||||||
$criteria = new Criteria('workflow');
|
|
||||||
$criteria->setDistinct();
|
|
||||||
$criteria->addSelectColumn(DepartmentPeer::DEP_UID);
|
|
||||||
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
|
|
||||||
//FROM
|
|
||||||
$conditions = array();
|
|
||||||
$conditions[] = array(DepartmentPeer::DEP_UID, ContentPeer::CON_ID);
|
|
||||||
$conditions[] = array(ContentPeer::CON_CATEGORY, DBAdapter::getStringDelimiter() . 'DEPO_TITLE' . DBAdapter::getStringDelimiter());
|
|
||||||
$conditions[] = array(ContentPeer::CON_LANG, DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter());
|
|
||||||
$criteria->addJoinMC($conditions, Criteria::LEFT_JOIN);
|
|
||||||
//WHERE
|
|
||||||
$criteria->add(DepartmentPeer::DEP_STATUS, 'ACTIVE');
|
|
||||||
//ORDER BY
|
|
||||||
$criteria->addAscendingOrderByColumn(ContentPeer::CON_VALUE);
|
|
||||||
|
|
||||||
$dataset = DepartmentPeer::doSelectRS($criteria);
|
|
||||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$dataset->next();
|
|
||||||
while ($row = $dataset->getRow()) {
|
|
||||||
$departments[] = array('OWNER_UID' => $row['DEP_UID'], 'OWNER_NAME' => $row['CON_VALUE']);
|
|
||||||
$dataset->next();
|
$dataset->next();
|
||||||
}
|
while ($row = $dataset->getRow()) {
|
||||||
|
$dashlets[] = array ($row['DAS_UID'],$row['DAS_TITLE']
|
||||||
|
);
|
||||||
|
$dataset->next();
|
||||||
|
}
|
||||||
|
|
||||||
$result->total = DepartmentPeer::doCount($criteria);
|
} catch (Exception $error) {
|
||||||
$result->owners = $departments;
|
throw $error;
|
||||||
break;
|
}
|
||||||
case 'GROUP':
|
return $dashlets;
|
||||||
require_once 'classes/model/Groupwf.php';
|
|
||||||
require_once 'classes/model/Content.php';
|
|
||||||
|
|
||||||
$groups = array();
|
|
||||||
//SELECT
|
|
||||||
$criteria = new Criteria('workflow');
|
|
||||||
$criteria->setDistinct();
|
|
||||||
$criteria->addSelectColumn(GroupwfPeer::GRP_UID);
|
|
||||||
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
|
|
||||||
//FROM
|
|
||||||
$conditions = array();
|
|
||||||
$conditions[] = array(GroupwfPeer::GRP_UID, ContentPeer::CON_ID);
|
|
||||||
$conditions[] = array(ContentPeer::CON_CATEGORY, DBAdapter::getStringDelimiter() . 'GRP_TITLE' . DBAdapter::getStringDelimiter());
|
|
||||||
$conditions[] = array(ContentPeer::CON_LANG, DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter());
|
|
||||||
$criteria->addJoinMC($conditions, Criteria::LEFT_JOIN);
|
|
||||||
//WHERE
|
|
||||||
$criteria->add(GroupwfPeer::GRP_STATUS, 'ACTIVE');
|
|
||||||
//ORDER BY
|
|
||||||
$criteria->addAscendingOrderByColumn(ContentPeer::CON_VALUE);
|
|
||||||
|
|
||||||
$dataset = GroupwfPeer::doSelectRS($criteria);
|
|
||||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$dataset->next();
|
|
||||||
while ($row = $dataset->getRow()) {
|
|
||||||
$groups[] = array('OWNER_UID' => $row['GRP_UID'], 'OWNER_NAME' => $row['CON_VALUE']);
|
|
||||||
$dataset->next();
|
|
||||||
}
|
|
||||||
|
|
||||||
$result->total = GroupwfPeer::doCount($criteria);
|
|
||||||
$result->owners = $groups;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception $error) {
|
|
||||||
$result->status = 'ERROR';
|
|
||||||
$result->message = $error->getMessage();
|
|
||||||
}
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getDashlets() {
|
// Functions for the dasboards administration module - End
|
||||||
try {
|
}
|
||||||
require_once 'classes/model/Dashlet.php';
|
|
||||||
|
|
||||||
$dashlets = array();
|
|
||||||
|
|
||||||
//SELECT
|
|
||||||
$criteria = new Criteria('workflow');
|
|
||||||
$criteria->addSelectColumn(DashletPeer::DAS_UID);
|
|
||||||
$criteria->addSelectColumn(DashletPeer::DAS_TITLE);
|
|
||||||
//ORDER BY
|
|
||||||
$criteria->addAscendingOrderByColumn(DashletPeer::DAS_TITLE);
|
|
||||||
|
|
||||||
$dataset = DashletPeer::doSelectRS($criteria);
|
|
||||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$dataset->next();
|
|
||||||
while ($row = $dataset->getRow()) {
|
|
||||||
$dashlets[] = array($row['DAS_UID'], $row['DAS_TITLE']);
|
|
||||||
$dataset->next();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception $error) {
|
|
||||||
throw $error;
|
|
||||||
}
|
|
||||||
return $dashlets;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Functions for the dasboards administration module - End
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Home controller
|
* Home controller
|
||||||
*
|
*
|
||||||
@@ -9,184 +10,180 @@
|
|||||||
|
|
||||||
class Home extends Controller
|
class Home extends Controller
|
||||||
{
|
{
|
||||||
private $userID;
|
private $userID;
|
||||||
private $userName;
|
private $userName;
|
||||||
private $userFullName;
|
private $userFullName;
|
||||||
private $userRolName;
|
private $userRolName;
|
||||||
private $userUxType;
|
private $userUxType;
|
||||||
private $userUxBaseTemplate;
|
private $userUxBaseTemplate;
|
||||||
|
|
||||||
private $appListStart = 0;
|
private $appListStart = 0;
|
||||||
private $appListLimit = 15;
|
private $appListLimit = 15;
|
||||||
|
|
||||||
private $clientBrowser;
|
private $clientBrowser;
|
||||||
private $lastSkin;
|
private $lastSkin;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct ()
|
||||||
{
|
{
|
||||||
//die($_SESSION['user_experience']);
|
//die($_SESSION['user_experience']);
|
||||||
// setting client browser information
|
// setting client browser information
|
||||||
$this->clientBrowser = G::getBrowser();
|
$this->clientBrowser = G::getBrowser();
|
||||||
|
|
||||||
// getting the ux type from user o group conf.
|
// getting the ux type from user o group conf.
|
||||||
$this->userUxType = isset($_SESSION['user_experience'])? $_SESSION['user_experience']: 'SIMPLIFIED';
|
$this->userUxType = isset( $_SESSION['user_experience'] ) ? $_SESSION['user_experience'] : 'SIMPLIFIED';
|
||||||
$this->lastSkin = isset($_SESSION['user_last_skin']) ? $_SESSION['user_last_skin'] : 'classic';
|
$this->lastSkin = isset( $_SESSION['user_last_skin'] ) ? $_SESSION['user_last_skin'] : 'classic';
|
||||||
$this->userUxBaseTemplate = (is_dir(PATH_CUSTOM_SKINS . 'uxs')) ? PATH_CUSTOM_SKINS . 'simplified' . PATH_SEP . 'templates' : 'home';
|
$this->userUxBaseTemplate = (is_dir( PATH_CUSTOM_SKINS . 'uxs' )) ? PATH_CUSTOM_SKINS . 'simplified' . PATH_SEP . 'templates' : 'home';
|
||||||
|
|
||||||
if (isset($_SESSION['USER_LOGGED']) && !empty($_SESSION['USER_LOGGED'])) {
|
if (isset( $_SESSION['USER_LOGGED'] ) && ! empty( $_SESSION['USER_LOGGED'] )) {
|
||||||
$this->userID = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : null;
|
$this->userID = isset( $_SESSION['USER_LOGGED'] ) ? $_SESSION['USER_LOGGED'] : null;
|
||||||
$this->userName = isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '';
|
$this->userName = isset( $_SESSION['USR_USERNAME'] ) ? $_SESSION['USR_USERNAME'] : '';
|
||||||
$this->userFullName = isset($_SESSION['USR_FULLNAME']) ? $_SESSION['USR_FULLNAME'] : '';
|
$this->userFullName = isset( $_SESSION['USR_FULLNAME'] ) ? $_SESSION['USR_FULLNAME'] : '';
|
||||||
$this->userRolName = isset($_SESSION['USR_ROLENAME']) ? $_SESSION['USR_ROLENAME'] : '';
|
$this->userRolName = isset( $_SESSION['USR_ROLENAME'] ) ? $_SESSION['USR_ROLENAME'] : '';
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function login($httpData)
|
|
||||||
{
|
|
||||||
//start new session
|
|
||||||
@session_destroy ();
|
|
||||||
session_start ();
|
|
||||||
session_regenerate_id ();
|
|
||||||
|
|
||||||
$data = isset($httpData->d) ? unserialize(base64_decode($httpData->d)) : '';
|
|
||||||
$template = $this->clientBrowser['name'] == 'msie' ? 'login_ie' : 'login_standard';
|
|
||||||
$skin = $this->clientBrowser['name'] == 'msie' ? $this->lastSkin : 'simplified';
|
|
||||||
|
|
||||||
if (!is_array($data)) {
|
|
||||||
$data = array('u'=>'', 'p'=>'', 'm'=>'');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->setVar('msg', $data['m']);
|
|
||||||
$this->setVar('usr', $data['u']);
|
|
||||||
$this->setVar('pwd', $data['p']);
|
|
||||||
$this->setVar('skin', $skin);
|
|
||||||
|
|
||||||
$this->setView($this->userUxBaseTemplate . PATH_SEP . $template);
|
|
||||||
$this->render();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* getting default list
|
|
||||||
* @param string $httpData (opional)
|
|
||||||
*/
|
|
||||||
|
|
||||||
public function index($httpData)
|
|
||||||
{
|
|
||||||
if ($this->userUxType == 'SINGLE') {
|
|
||||||
$this->indexSingle($httpData);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once 'classes/model/UsersProperties.php';
|
|
||||||
G::LoadClass('process');
|
|
||||||
G::LoadClass('case');
|
|
||||||
|
|
||||||
$userProperty = new UsersProperties();
|
|
||||||
$process = new Process();
|
|
||||||
$case = new Cases();
|
|
||||||
G::loadClass('system');
|
|
||||||
$sysConf = System::getSystemConfiguration(PATH_CONFIG . 'env.ini');
|
|
||||||
|
|
||||||
//Get ProcessStatistics Info
|
|
||||||
$start = 0;
|
|
||||||
$limit = '';
|
|
||||||
|
|
||||||
$proData = $process->getAllProcesses($start, $limit);
|
|
||||||
$processList = $case->getStartCasesPerType($_SESSION['USER_LOGGED'], 'category');
|
|
||||||
$switchLink = $userProperty->getUserLocation($_SESSION['USER_LOGGED']);
|
|
||||||
|
|
||||||
if (substr($sysConf['default_skin'], 0, 2) == 'ux') {
|
|
||||||
$_SESSION['_defaultUserLocation'] = $switchLink;
|
|
||||||
$switchLink = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . $sysConf['default_skin'] . '/main';
|
|
||||||
}
|
|
||||||
|
|
||||||
unset($processList[0]);
|
|
||||||
|
|
||||||
//Get simplified options
|
|
||||||
global $G_TMP_MENU;
|
|
||||||
|
|
||||||
$mnu = new Menu();
|
|
||||||
$mnu->load('simplified');
|
|
||||||
$arrayMnuOption = array();
|
|
||||||
$mnuNewCase = array();
|
|
||||||
|
|
||||||
if (!empty($mnu->Options)) {
|
|
||||||
foreach ($mnu->Options as $index => $value) {
|
|
||||||
$option = array(
|
|
||||||
'id' => $mnu->Id[$index],
|
|
||||||
'url' => $mnu->Options[$index],
|
|
||||||
'label' => $mnu->Labels[$index],
|
|
||||||
'icon' => $mnu->Icons[$index],
|
|
||||||
'class' => $mnu->ElementClass[$index]
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($mnu->Id[$index] != 'S_NEW_CASE') {
|
|
||||||
$arrayMnuOption[] = $option;
|
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
$mnuNewCase = $option;
|
|
||||||
|
public function login ($httpData)
|
||||||
|
{
|
||||||
|
//start new session
|
||||||
|
@session_destroy();
|
||||||
|
session_start();
|
||||||
|
session_regenerate_id();
|
||||||
|
|
||||||
|
$data = isset( $httpData->d ) ? unserialize( base64_decode( $httpData->d ) ) : '';
|
||||||
|
$template = $this->clientBrowser['name'] == 'msie' ? 'login_ie' : 'login_standard';
|
||||||
|
$skin = $this->clientBrowser['name'] == 'msie' ? $this->lastSkin : 'simplified';
|
||||||
|
|
||||||
|
if (! is_array( $data )) {
|
||||||
|
$data = array ('u' => '','p' => '','m' => ''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
$this->setVar( 'msg', $data['m'] );
|
||||||
|
$this->setVar( 'usr', $data['u'] );
|
||||||
|
$this->setVar( 'pwd', $data['p'] );
|
||||||
|
$this->setVar( 'skin', $skin );
|
||||||
|
|
||||||
|
$this->setView( $this->userUxBaseTemplate . PATH_SEP . $template );
|
||||||
|
$this->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setView($this->userUxBaseTemplate . PATH_SEP . 'index');
|
/**
|
||||||
|
* getting default list
|
||||||
|
*
|
||||||
|
* @param string $httpData (opional)
|
||||||
|
*/
|
||||||
|
|
||||||
$this->setVar('usrUid', $this->userID);
|
public function index ($httpData)
|
||||||
$this->setVar('userName', $this->userName);
|
{
|
||||||
$this->setVar('processList', $processList);
|
if ($this->userUxType == 'SINGLE') {
|
||||||
$this->setVar('canStartCase', $case->canStartCase($_SESSION ['USER_LOGGED']));
|
$this->indexSingle( $httpData );
|
||||||
$this->setVar('userUxType', $this->userUxType);
|
return;
|
||||||
$this->setVar('clientBrowser', $this->clientBrowser['name']);
|
}
|
||||||
$this->setVar('switchLink', $switchLink);
|
|
||||||
$this->setVar('arrayMnuOption', $arrayMnuOption);
|
|
||||||
$this->setVar('mnuNewCase', $mnuNewCase);
|
|
||||||
|
|
||||||
$this->render();
|
require_once 'classes/model/UsersProperties.php';
|
||||||
}
|
G::LoadClass( 'process' );
|
||||||
|
G::LoadClass( 'case' );
|
||||||
|
|
||||||
public function indexSingle($httpData)
|
$userProperty = new UsersProperties();
|
||||||
{
|
$process = new Process();
|
||||||
require_once 'classes/model/Step.php';
|
$case = new Cases();
|
||||||
G::LoadClass('applications');
|
G::loadClass( 'system' );
|
||||||
|
$sysConf = System::getSystemConfiguration( PATH_CONFIG . 'env.ini' );
|
||||||
|
|
||||||
$apps = new Applications();
|
//Get ProcessStatistics Info
|
||||||
$step = new Step;
|
$start = 0;
|
||||||
|
$limit = '';
|
||||||
|
|
||||||
$cases = $apps->getAll($this->userID, 0, 1, 'todo');
|
$proData = $process->getAllProcesses( $start, $limit );
|
||||||
|
$processList = $case->getStartCasesPerType( $_SESSION['USER_LOGGED'], 'category' );
|
||||||
|
$switchLink = $userProperty->getUserLocation( $_SESSION['USER_LOGGED'] );
|
||||||
|
|
||||||
if (!isset($cases['data'][0])) {
|
if (substr( $sysConf['default_skin'], 0, 2 ) == 'ux') {
|
||||||
//the current user has not any aplication to do
|
$_SESSION['_defaultUserLocation'] = $switchLink;
|
||||||
$this->setView($this->userUxBaseTemplate . PATH_SEP .'indexSingle');
|
$switchLink = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . $sysConf['default_skin'] . '/main';
|
||||||
$this->setVar('default_url', $this->userUxBaseTemplate . "/" . 'error?no=2');
|
}
|
||||||
$this->render();
|
|
||||||
exit();
|
unset( $processList[0] );
|
||||||
|
|
||||||
|
//Get simplified options
|
||||||
|
global $G_TMP_MENU;
|
||||||
|
|
||||||
|
$mnu = new Menu();
|
||||||
|
$mnu->load( 'simplified' );
|
||||||
|
$arrayMnuOption = array ();
|
||||||
|
$mnuNewCase = array ();
|
||||||
|
|
||||||
|
if (! empty( $mnu->Options )) {
|
||||||
|
foreach ($mnu->Options as $index => $value) {
|
||||||
|
$option = array ('id' => $mnu->Id[$index],'url' => $mnu->Options[$index],'label' => $mnu->Labels[$index],'icon' => $mnu->Icons[$index],'class' => $mnu->ElementClass[$index]
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($mnu->Id[$index] != 'S_NEW_CASE') {
|
||||||
|
$arrayMnuOption[] = $option;
|
||||||
|
} else {
|
||||||
|
$mnuNewCase = $option;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setView( $this->userUxBaseTemplate . PATH_SEP . 'index' );
|
||||||
|
|
||||||
|
$this->setVar( 'usrUid', $this->userID );
|
||||||
|
$this->setVar( 'userName', $this->userName );
|
||||||
|
$this->setVar( 'processList', $processList );
|
||||||
|
$this->setVar( 'canStartCase', $case->canStartCase( $_SESSION['USER_LOGGED'] ) );
|
||||||
|
$this->setVar( 'userUxType', $this->userUxType );
|
||||||
|
$this->setVar( 'clientBrowser', $this->clientBrowser['name'] );
|
||||||
|
$this->setVar( 'switchLink', $switchLink );
|
||||||
|
$this->setVar( 'arrayMnuOption', $arrayMnuOption );
|
||||||
|
$this->setVar( 'mnuNewCase', $mnuNewCase );
|
||||||
|
|
||||||
|
$this->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
$lastApp = $cases['data'][0];
|
public function indexSingle ($httpData)
|
||||||
$_SESSION['INDEX'] = $lastApp['DEL_INDEX'];
|
{
|
||||||
$_SESSION['APPLICATION'] = $lastApp['APP_UID'];
|
require_once 'classes/model/Step.php';
|
||||||
$_SESSION['PROCESS'] = $lastApp['PRO_UID'];
|
G::LoadClass( 'applications' );
|
||||||
$_SESSION['TASK'] = $lastApp['TAS_UID'];
|
|
||||||
|
|
||||||
$steps = $apps->getSteps($lastApp['APP_UID'], $lastApp['DEL_INDEX'], $lastApp['TAS_UID'], $lastApp['PRO_UID']);
|
$apps = new Applications();
|
||||||
$lastStep = array_pop($steps);
|
$step = new Step();
|
||||||
$lastStep['title'] = G::LoadTranslation('ID_FINISH');
|
|
||||||
$steps[] = $lastStep;
|
|
||||||
|
|
||||||
$this->setView($this->userUxBaseTemplate . PATH_SEP . 'indexSingle');
|
$cases = $apps->getAll( $this->userID, 0, 1, 'todo' );
|
||||||
|
|
||||||
$this->setVar('usrUid', $this->userID);
|
if (! isset( $cases['data'][0] )) {
|
||||||
$this->setVar('userName', $this->userName);
|
//the current user has not any aplication to do
|
||||||
$this->setVar('steps', $steps);
|
$this->setView( $this->userUxBaseTemplate . PATH_SEP . 'indexSingle' );
|
||||||
$this->setVar('default_url', "cases/cases_Open?APP_UID={$lastApp['APP_UID']}&DEL_INDEX={$lastApp['DEL_INDEX']}&action=todo");
|
$this->setVar( 'default_url', $this->userUxBaseTemplate . "/" . 'error?no=2' );
|
||||||
|
$this->render();
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
$this->render();
|
$lastApp = $cases['data'][0];
|
||||||
}
|
$_SESSION['INDEX'] = $lastApp['DEL_INDEX'];
|
||||||
|
$_SESSION['APPLICATION'] = $lastApp['APP_UID'];
|
||||||
|
$_SESSION['PROCESS'] = $lastApp['PRO_UID'];
|
||||||
|
$_SESSION['TASK'] = $lastApp['TAS_UID'];
|
||||||
|
|
||||||
public function appList($httpData)
|
$steps = $apps->getSteps( $lastApp['APP_UID'], $lastApp['DEL_INDEX'], $lastApp['TAS_UID'], $lastApp['PRO_UID'] );
|
||||||
|
$lastStep = array_pop( $steps );
|
||||||
|
$lastStep['title'] = G::LoadTranslation( 'ID_FINISH' );
|
||||||
|
$steps[] = $lastStep;
|
||||||
|
|
||||||
|
$this->setView( $this->userUxBaseTemplate . PATH_SEP . 'indexSingle' );
|
||||||
|
|
||||||
|
$this->setVar( 'usrUid', $this->userID );
|
||||||
|
$this->setVar( 'userName', $this->userName );
|
||||||
|
$this->setVar( 'steps', $steps );
|
||||||
|
$this->setVar( 'default_url', "cases/cases_Open?APP_UID={$lastApp['APP_UID']}&DEL_INDEX={$lastApp['DEL_INDEX']}&action=todo" );
|
||||||
|
|
||||||
|
$this->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function appList ($httpData)
|
||||||
{
|
{
|
||||||
// setting default list applications types [default: todo]
|
// setting default list applications types [default: todo]
|
||||||
$httpData->t = isset($httpData->t)? $httpData->t : 'todo';
|
$httpData->t = isset( $httpData->t ) ? $httpData->t : 'todo';
|
||||||
|
|
||||||
// setting main list title
|
// setting main list title
|
||||||
switch ($httpData->t) {
|
switch ($httpData->t) {
|
||||||
@@ -200,116 +197,120 @@ class Home extends Controller
|
|||||||
$title = 'Unassigned Inbox';
|
$title = 'Unassigned Inbox';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$title = ucwords($httpData->t);
|
$title = ucwords( $httpData->t );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// getting apps data
|
// getting apps data
|
||||||
$cases = $this->getAppsData($httpData->t);
|
$cases = $this->getAppsData( $httpData->t );
|
||||||
|
|
||||||
// settings html template
|
// settings html template
|
||||||
$this->setView($this->userUxBaseTemplate . PATH_SEP . 'appList');
|
$this->setView( $this->userUxBaseTemplate . PATH_SEP . 'appList' );
|
||||||
|
|
||||||
// settings vars and rendering
|
// settings vars and rendering
|
||||||
$this->setVar('cases', $cases['data']);
|
$this->setVar( 'cases', $cases['data'] );
|
||||||
$this->setVar('cases_count', $cases['totalCount']);
|
$this->setVar( 'cases_count', $cases['totalCount'] );
|
||||||
$this->setVar('title', $title);
|
$this->setVar( 'title', $title );
|
||||||
$this->setVar('appListStart', $this->appListLimit);
|
$this->setVar( 'appListStart', $this->appListLimit );
|
||||||
$this->setVar('appListLimit', 10);
|
$this->setVar( 'appListLimit', 10 );
|
||||||
$this->setVar('listType', $httpData->t);
|
$this->setVar( 'listType', $httpData->t );
|
||||||
|
|
||||||
$this->render();
|
$this->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getApps($httpData)
|
public function getApps ($httpData)
|
||||||
{
|
|
||||||
$cases = $this->getAppsData($httpData->t, $httpData->start, $httpData->limit);
|
|
||||||
|
|
||||||
$this->setView($this->userUxBaseTemplate . PATH_SEP . 'applications');
|
|
||||||
$this->setVar('cases', $cases['data']);
|
|
||||||
$this->render();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAppsData($type, $start=null, $limit=null)
|
|
||||||
{
|
{
|
||||||
require_once ( "classes/model/AppNotes.php" );
|
$cases = $this->getAppsData( $httpData->t, $httpData->start, $httpData->limit );
|
||||||
G::LoadClass('applications');
|
|
||||||
|
$this->setView( $this->userUxBaseTemplate . PATH_SEP . 'applications' );
|
||||||
|
$this->setVar( 'cases', $cases['data'] );
|
||||||
|
$this->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAppsData ($type, $start = null, $limit = null)
|
||||||
|
{
|
||||||
|
require_once ("classes/model/AppNotes.php");
|
||||||
|
G::LoadClass( 'applications' );
|
||||||
|
|
||||||
$apps = new Applications();
|
$apps = new Applications();
|
||||||
$appNotes = new AppNotes();
|
$appNotes = new AppNotes();
|
||||||
|
|
||||||
$start = empty($start) ? $this->appListStart : $start;
|
$start = empty( $start ) ? $this->appListStart : $start;
|
||||||
$limit = empty($limit) ? $this->appListLimit : $limit;
|
$limit = empty( $limit ) ? $this->appListLimit : $limit;
|
||||||
|
|
||||||
$notesStart = 0;
|
$notesStart = 0;
|
||||||
$notesLimit = 4;
|
$notesLimit = 4;
|
||||||
|
|
||||||
$cases = $apps->getAll($this->userID, $start, $limit, $type);
|
$cases = $apps->getAll( $this->userID, $start, $limit, $type );
|
||||||
//g::pr($cases['data']); die;
|
//g::pr($cases['data']); die;
|
||||||
|
|
||||||
|
|
||||||
// formating & complitting apps data with 'Notes'
|
// formating & complitting apps data with 'Notes'
|
||||||
foreach ($cases['data'] as $i => $row) {
|
foreach ($cases['data'] as $i => $row) {
|
||||||
// Formatting
|
// Formatting
|
||||||
$appTitle = str_replace('#', '', $row['APP_TITLE']);
|
$appTitle = str_replace( '#', '', $row['APP_TITLE'] );
|
||||||
|
|
||||||
if (is_numeric($appTitle)) {
|
if (is_numeric( $appTitle )) {
|
||||||
$cases['data'][$i]['APP_TITLE'] = G::LoadTranslation('ID_CASE'). ' ' . $appTitle;
|
$cases['data'][$i]['APP_TITLE'] = G::LoadTranslation( 'ID_CASE' ) . ' ' . $appTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($row['DEL_DELEGATE_DATE'])) {
|
if (isset( $row['DEL_DELEGATE_DATE'] )) {
|
||||||
$cases['data'][$i]['DEL_DELEGATE_DATE'] = G::getformatedDate($row['DEL_DELEGATE_DATE'],
|
$cases['data'][$i]['DEL_DELEGATE_DATE'] = G::getformatedDate( $row['DEL_DELEGATE_DATE'], 'M d, yyyy - h:i:s' );
|
||||||
'M d, yyyy - h:i:s');
|
|
||||||
}
|
}
|
||||||
if (isset($row['APP_DEL_PREVIOUS_USER'])) {
|
if (isset( $row['APP_DEL_PREVIOUS_USER'] )) {
|
||||||
$cases['data'][$i]['APP_DEL_PREVIOUS_USER'] = ucwords($row['APP_DEL_PREVIOUS_USER']);
|
$cases['data'][$i]['APP_DEL_PREVIOUS_USER'] = ucwords( $row['APP_DEL_PREVIOUS_USER'] );
|
||||||
}
|
}
|
||||||
// Completting with Notes
|
// Completting with Notes
|
||||||
$notes = $appNotes->getNotesList($row['APP_UID'], '', $notesStart, $notesLimit);
|
$notes = $appNotes->getNotesList( $row['APP_UID'], '', $notesStart, $notesLimit );
|
||||||
$notes = $notes['array'];
|
$notes = $notes['array'];
|
||||||
|
|
||||||
$cases['data'][$i]['NOTES_COUNT'] = $notes['totalCount'];
|
$cases['data'][$i]['NOTES_COUNT'] = $notes['totalCount'];
|
||||||
$cases['data'][$i]['NOTES_LIST'] = $notes['notes'];
|
$cases['data'][$i]['NOTES_LIST'] = $notes['notes'];
|
||||||
}
|
}
|
||||||
return $cases;
|
return $cases;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function startCase($httpData)
|
public function startCase ($httpData)
|
||||||
{
|
{
|
||||||
G::LoadClass('case');
|
G::LoadClass( 'case' );
|
||||||
$case = new Cases();
|
$case = new Cases();
|
||||||
$aData = $case->startCase($httpData->id, $_SESSION['USER_LOGGED']);
|
$aData = $case->startCase( $httpData->id, $_SESSION['USER_LOGGED'] );
|
||||||
|
|
||||||
$_SESSION['APPLICATION'] = $aData['APPLICATION'];
|
$_SESSION['APPLICATION'] = $aData['APPLICATION'];
|
||||||
$_SESSION['INDEX'] = $aData['INDEX'];
|
$_SESSION['INDEX'] = $aData['INDEX'];
|
||||||
$_SESSION['PROCESS'] = $aData['PROCESS'];
|
$_SESSION['PROCESS'] = $aData['PROCESS'];
|
||||||
$_SESSION['TASK'] = $httpData->id;
|
$_SESSION['TASK'] = $httpData->id;
|
||||||
$_SESSION['STEP_POSITION'] = 0;
|
$_SESSION['STEP_POSITION'] = 0;
|
||||||
$_SESSION['CASES_REFRESH'] = true;
|
$_SESSION['CASES_REFRESH'] = true;
|
||||||
|
|
||||||
// Execute Events
|
// Execute Events
|
||||||
require_once 'classes/model/Event.php';
|
require_once 'classes/model/Event.php';
|
||||||
$event = new Event();
|
$event = new Event();
|
||||||
$event->createAppEvents($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['TASK']);
|
$event->createAppEvents( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['TASK'] );
|
||||||
|
|
||||||
$oCase = new Cases();
|
$oCase = new Cases();
|
||||||
$aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']);
|
$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
|
||||||
//../cases/cases_Open?APP_UID={$APP.APP_UID}&DEL_INDEX={$APP.DEL_INDEX}&action=todo
|
//../cases/cases_Open?APP_UID={$APP.APP_UID}&DEL_INDEX={$APP.DEL_INDEX}&action=todo
|
||||||
$aNextStep['PAGE'] = '../cases/cases_Open?APP_UID='.$aData['APPLICATION'].'&DEL_INDEX='.$aData['INDEX'].'&action=draft';
|
$aNextStep['PAGE'] = '../cases/cases_Open?APP_UID=' . $aData['APPLICATION'] . '&DEL_INDEX=' . $aData['INDEX'] . '&action=draft';
|
||||||
$_SESSION ['BREAKSTEP'] ['NEXT_STEP'] = $aNextStep;
|
$_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep;
|
||||||
|
|
||||||
$this->redirect($aNextStep['PAGE']);
|
$this->redirect( $aNextStep['PAGE'] );
|
||||||
}
|
|
||||||
|
|
||||||
public function error($httpData)
|
|
||||||
{
|
|
||||||
$httpData->no = isset($httpData->no) ? $httpData->no : 0;
|
|
||||||
|
|
||||||
switch ($httpData->no) {
|
|
||||||
case 2: $tpl = $this->userUxBaseTemplate . PATH_SEP . 'noAppsMsg'; break;
|
|
||||||
default: $tpl = $this->userUxBaseTemplate . PATH_SEP . 'error';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setView($tpl);
|
public function error ($httpData)
|
||||||
$this->render();
|
{
|
||||||
}
|
$httpData->no = isset( $httpData->no ) ? $httpData->no : 0;
|
||||||
|
|
||||||
|
switch ($httpData->no) {
|
||||||
|
case 2:
|
||||||
|
$tpl = $this->userUxBaseTemplate . PATH_SEP . 'noAppsMsg';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$tpl = $this->userUxBaseTemplate . PATH_SEP . 'error';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setView( $tpl );
|
||||||
|
$this->render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user