/**
 * Function getVarsGrid returns all variables of Grid
 *
 * @access public
 * @param string proUid process ID
 * @param string dynUid dynaform ID
 * @return array
 */
function getVarsGrid($proUid, $dynUid)
{
    G::LoadClass('dynaformhandler');
    G::LoadClass('AppSolr');
    $dynaformFields = array();
    if (is_file(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') && filesize(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') > 0) {
        $dyn = new dynaFormHandler(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml');
        $dynaformFields[] = $dyn->getFields();
    }
    $dynaformFieldTypes = array();
    foreach ($dynaformFields as $aDynFormFields) {
        foreach ($aDynFormFields as $field) {
            if ($field->getAttribute('validate') == 'Int') {
                $dynaformFieldTypes[$field->nodeName] = 'Int';
            } elseif ($field->getAttribute('validate') == 'Real') {
                $dynaformFieldTypes[$field->nodeName] = 'Real';
            } else {
                $dynaformFieldTypes[$field->nodeName] = $field->getAttribute('type');
            }
        }
    }
    return $dynaformFieldTypes;
}
예제 #2
0
            foreach ($aFields as $key => $value) {
                $aVariables[] = $key;
            }

            echo Bootstrap::json_encode($aVariables);
            break;
        case 'getDynaformFieldList':
            G::LoadClass('dynaformhandler');
            $dynaformFields = array();
            $resultArray = array();
            $proUid = isset($_REQUEST['PRO_UID']) ? $_REQUEST['PRO_UID'] : '';
            $dynUid = isset($_REQUEST['DYN_UID']) ? $_REQUEST['DYN_UID'] : '';
            if (is_file(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') && filesize(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') > 0) {
                $dyn = new dynaFormHandler(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml');
                $dynaformFields[] = $dyn->getFields();
            }
            foreach ($dynaformFields as $aDynFormFields) {
                foreach ($aDynFormFields as $field) {
                    $resultArray[] = array("id" => $field->nodeName, "name" => $field->nodeName);
                }
            }
            echo Bootstrap::json_encode($resultArray);
            // var_dump($resultArray);
            break;
        /*
          case 'saveFile':
          global $G_PUBLISH;
          $G_PUBLISH = new Publisher();
          $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename'];
예제 #3
0
 /**
  * Search records in specified application delegation data
  *
  * @param string $AppUID
  *          application identifier
  * @throws ApplicationWithoutDelegationRecordsException
  * @return array array of arrays with the following information(
  *         $documentInformation,
  *         $dynaformFieldTypes,
  *         $lastUpdateDate,
  *         $maxPriority,
  *         $assignedUsers,
  *         $assignedUsersRead,
  *         $assignedUsersUnread,
  *         $draftUser,
  *         $participatedUsers,
  *         $participatedUsersStartedByUser,
  *         $participatedUsersCompletedByUser,
  *         $unassignedUsers,
  *         $unassignedGroups
  */
 public function getApplicationIndexData($AppUID)
 {
     G::LoadClass('memcached');
     // get all the application data
     $allAppDbData = $this->getApplicationDelegationData($AppUID);
     // check if the application record was found
     // this case occurs when the application doesn't have related delegation
     // records.
     if (empty($allAppDbData) || !isset($allAppDbData[0])) {
         throw new ApplicationWithoutDelegationRecordsException("Application without delegation records. APP_UID: " . $AppUID);
     }
     // copy the application information
     $documentInformation = $allAppDbData[0];
     // get the last delegate date using the del_delegate_date
     $index = $this->aaGetMaximun($allAppDbData, 'DEL_DELEGATE_DATE', 'DATE');
     $lastUpdateDate = $allAppDbData[$index]['DEL_DELEGATE_DATE'];
     // get the delegate with max priority => minimun value
     $index2 = $this->aaGetMinimun($allAppDbData, 'DEL_PRIORITY', 'NUMBER', 'DEL_THREAD_STATUS', 'OPEN');
     if ($index2 == null) {
         // get the last priority
         $maxPriority = $allAppDbData[$index]['DEL_PRIORITY'];
     } else {
         $maxPriority = $allAppDbData[$index2]['DEL_PRIORITY'];
     }
     $assignedUsers = array();
     $indexes = $this->aaSearchRecords($allAppDbData, array('DEL_THREAD_STATUS' => 'OPEN', 'DEL_FINISH_DATE' => 'NULL', 'APP_STATUS' => 'TO_DO', 'APP_THREAD_STATUS' => 'OPEN'));
     foreach ($indexes as $index) {
         $assignedUsers[] = array('USR_UID' => $allAppDbData[$index]['USR_UID'], 'DEL_INDEX' => $allAppDbData[$index]['DEL_INDEX']);
     }
     $assignedUsersRead = array();
     $indexes = $this->aaSearchRecords($allAppDbData, array('DEL_THREAD_STATUS' => 'OPEN', 'DEL_FINISH_DATE' => 'NULL', 'APP_STATUS' => 'TO_DO', 'APP_THREAD_STATUS' => 'OPEN', 'DEL_INIT_DATE' => 'NOTNULL'));
     foreach ($indexes as $index) {
         $assignedUsersRead[] = array('USR_UID' => $allAppDbData[$index]['USR_UID'], 'DEL_INDEX' => $allAppDbData[$index]['DEL_INDEX']);
     }
     $assignedUsersUnread = array();
     $indexes = $this->aaSearchRecords($allAppDbData, array('DEL_THREAD_STATUS' => 'OPEN', 'DEL_FINISH_DATE' => 'NULL', 'APP_STATUS' => 'TO_DO', 'APP_THREAD_STATUS' => 'OPEN', 'DEL_INIT_DATE' => 'NULL'));
     foreach ($indexes as $index) {
         $assignedUsersUnread[] = array('USR_UID' => $allAppDbData[$index]['USR_UID'], 'DEL_INDEX' => $allAppDbData[$index]['DEL_INDEX']);
     }
     $draftUser = array();
     $indexes = $this->aaSearchRecords($allAppDbData, array('DEL_THREAD_STATUS' => 'OPEN', 'DEL_FINISH_DATE' => 'NULL', 'APP_STATUS' => 'DRAFT', 'APP_THREAD_STATUS' => 'OPEN'));
     if (!empty($indexes)) {
         $draftUser = array('USR_UID' => $allAppDbData[$indexes[0]]['USR_UID'], 'DEL_INDEX' => $allAppDbData[$indexes[0]]['DEL_INDEX']);
     }
     $participatedUsers = array();
     foreach ($allAppDbData as $row) {
         $participatedUsers[] = array('USR_UID' => $row['USR_UID'], 'DEL_INDEX' => $row['DEL_INDEX']);
     }
     $participatedUsersStartedByUser = array();
     $indexes = $this->aaSearchRecords($allAppDbData, array('DEL_INDEX' => '1'));
     foreach ($indexes as $index) {
         $participatedUsersStartedByUser[] = array('USR_UID' => $allAppDbData[$index]['USR_UID'], 'DEL_INDEX' => $allAppDbData[$index]['DEL_INDEX']);
     }
     $participatedUsersCompletedByUser = array();
     $indexes = $this->aaSearchRecords($allAppDbData, array('APP_STATUS' => 'COMPLETED'));
     foreach ($indexes as $index) {
         $participatedUsersCompletedByUser[] = array('USR_UID' => $allAppDbData[$index]['USR_UID'], 'DEL_INDEX' => $allAppDbData[$index]['DEL_INDEX']);
     }
     // search information of unassigned users
     // the unassigned users are the self service users and groups.
     // the self service users are defined in the TASKs of the PROCESS.
     foreach ($allAppDbData as $row) {
         $unassignedUsersGroups = array();
         // use cache
         $oMemcache = PMmemcached::getSingleton($this->_solrInstance);
         $unassignedUsersGroups = $oMemcache->get($row['PRO_UID'] . "_" . $row['TAS_UID']);
         if (!$unassignedUsersGroups) {
             $unassignedUsersGroups = $this->getTaskUnassignedUsersGroupsData($row['PRO_UID'], $row['TAS_UID']);
             // add del_index
             foreach ($unassignedUsersGroups as $i => $newRow) {
                 $unassignedUsersGroups[$i]['DEL_INDEX'] = $row['DEL_INDEX'];
             }
             // store in cache
             $oMemcache->set($row['PRO_UID'] . "_" . $row['TAS_UID'], $unassignedUsersGroups);
         }
         // copy list of unassigned users and groups
         $unassignedUsers = array();
         $unassignedGroups = array();
         foreach ($unassignedUsersGroups as $unassignedUserGroup) {
             if ($unassignedUserGroup['TU_RELATION'] == 1) {
                 $unassignedUsers[] = array('USR_UID' => $unassignedUserGroup['USR_UID'], 'DEL_INDEX' => $unassignedUserGroup['DEL_INDEX']);
             } elseif ($unassignedUserGroup['TU_RELATION'] == 2) {
                 $unassignedGroups[] = array('USR_UID' => $unassignedUserGroup['USR_UID'], 'DEL_INDEX' => $unassignedUserGroup['DEL_INDEX']);
             }
         }
     }
     // Get DataTypes of dynaforms
     // use cache array to store the dynaform variables per process
     // use memory array to store information of Datatypes of Dynaforms
     // All the datatypes of the process => all variables in all dynaforms in the
     // process
     $dynaformFieldTypes = array();
     // get cache instance
     $oMemcache = PMmemcached::getSingleton($this->_solrInstance);
     $dynaformFieldTypes = $oMemcache->get($documentInformation['PRO_UID']);
     if (!$dynaformFieldTypes) {
         G::LoadClass('dynaformhandler');
         $dynaformFileNames = $this->getProcessDynaformFileNames($documentInformation['PRO_UID']);
         $dynaformFields = array();
         foreach ($dynaformFileNames as $dynaformFileName) {
             if (file_exists(PATH_DATA . '/sites/workflow/xmlForms/' . $dynaformFileName['DYN_FILENAME'] . '.xml')) {
                 $dyn = new dynaFormHandler(PATH_DATA . '/sites/workflow/xmlForms/' . $dynaformFileName['DYN_FILENAME'] . '.xml');
                 $dynaformFields[] = $dyn->getFields();
             }
         }
         foreach ($dynaformFields as $aDynFormFields) {
             foreach ($aDynFormFields as $field) {
                 // create array of fields and types
                 if ($field->getAttribute('validate') == 'Int') {
                     $dynaformFieldTypes[$field->nodeName] = 'Int';
                 } elseif ($field->getAttribute('validate') == 'Real') {
                     $dynaformFieldTypes[$field->nodeName] = 'Real';
                 } else {
                     $dynaformFieldTypes[$field->nodeName] = $field->getAttribute('type');
                 }
             }
         }
         // create cache of dynaformfields
         $oMemcache->set($documentInformation['PRO_UID'], $dynaformFieldTypes);
     }
     // return result values
     $result = array($documentInformation, $dynaformFieldTypes, $lastUpdateDate, $maxPriority, $assignedUsers, $assignedUsersRead, $assignedUsersUnread, $draftUser, $participatedUsers, $participatedUsersStartedByUser, $participatedUsersCompletedByUser, $unassignedUsers, $unassignedGroups);
     return $result;
 }
예제 #4
0
 public function createLanguagePlugin($plugin, $idLanguage)
 {
     if (!file_exists(PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . 'translations.php')) {
         throw new Exception('Translation.php not exist in plugin ' . $plugin);
     }
     G::LoadSystem('i18n_po');
     G::LoadClass("system");
     $language = new Language();
     $locale = $language;
     $targetLang = $idLanguage;
     $baseLang = 'en';
     $aLabels = array();
     $aMsgids = array('' => true);
     include PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . 'translations.php';
     $translatedText = array();
     if (file_exists(PATH_LANGUAGECONT . $plugin . "." . $idLanguage)) {
         //reading the .po file
         include PATH_LANGUAGECONT . $plugin . "." . $idLanguage;
         eval('$translatedText = $translation' . $plugin . ';');
     }
     //creating the .po file
     $sPOFile = PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . $plugin . '.' . $idLanguage . '.po';
     $poFile = new i18n_PO($sPOFile);
     $poFile->buildInit();
     //setting headers
     $poFile->addHeader('Project-Id-Version', $plugin);
     $poFile->addHeader('POT-Creation-Date', '');
     $poFile->addHeader('PO-Revision-Date', date('Y-m-d H:i:s'));
     $poFile->addHeader('Last-Translator', '');
     $poFile->addHeader('Language-Team', 'Colosa Developers Team <*****@*****.**>');
     $poFile->addHeader('MIME-Version', '1.0');
     $poFile->addHeader('Content-Type', 'text/plain; charset=utf-8');
     $poFile->addHeader('Content-Transfer_Encoding', '8bit');
     $poFile->addHeader('X-Poedit-Language', ucwords($idLanguage));
     $poFile->addHeader('X-Poedit-SourceCharset', 'utf-8');
     $poFile->addHeader('Content-Transfer-Encoding', '8bit');
     foreach ($translations as $id => $translation) {
         $msgid = trim($translation);
         $msgstr = trim($translation);
         foreach ($translatedText as $key => $value) {
             if ($id == $key) {
                 $msgstr = trim($value);
                 break;
             }
         }
         $poFile->addTranslatorComment('TRANSLATION');
         $poFile->addTranslatorComment('LABEL/' . $id);
         $poFile->addReference('LABEL/' . $id);
         $poFile->addTranslation(stripcslashes($msgid), stripcslashes($msgstr));
         $aMsgids[$msgid] = true;
     }
     $aXMLForms = glob(PATH_PLUGINS . $plugin . PATH_SEP . '*.xml');
     $aXMLForms2 = glob(PATH_PLUGINS . $plugin . PATH_SEP . '*/*.xml');
     $aXMLForms = array_merge($aXMLForms, $aXMLForms2);
     $aXMLForms3 = glob(PATH_PLUGINS . $plugin . PATH_SEP . '*/*/*.xml');
     $aXMLForms = array_merge($aXMLForms, $aXMLForms3);
     $aEnglishLabel = array();
     $aOptions = array();
     $nodesNames = array();
     G::loadSystem('dynaformhandler');
     foreach ($aXMLForms as $xmlFormPath) {
         $xmlFormFile = str_replace(chr(92), '/', $xmlFormPath);
         $xmlFormFile = str_replace(PATH_PLUGINS . $plugin . PATH_SEP, '', $xmlFormPath);
         $dynaForm = new dynaFormHandler($xmlFormPath);
         $dynaNodes = $dynaForm->getFields();
         //get all fields of each xmlform
         foreach ($dynaNodes as $oNode) {
             $sNodeName = $oNode->nodeName;
             $arrayNode = $dynaForm->getArray($oNode);
             //if has not native language translation
             if (!isset($arrayNode[$baseLang]) || !isset($arrayNode['type']) || isset($arrayNode['type']) && in_array($arrayNode['type'], $this->exceptionFields)) {
                 continue;
                 //just continue with the next node
             }
             // Getting the Base Origin Text
             if (!is_array($arrayNode[$baseLang])) {
                 $originNodeText = trim($arrayNode[$baseLang]);
             } else {
                 $langNode = $arrayNode[$baseLang][0];
                 $originNodeText = $langNode['__nodeText__'];
             }
             // Getting the Base Target Text
             if (isset($arrayNode[$targetLang])) {
                 if (!is_array($arrayNode[$targetLang])) {
                     $targetNodeText = trim($arrayNode[$targetLang]);
                 } else {
                     $langNode = $arrayNode[$targetLang][0];
                     $targetNodeText = $langNode['__nodeText__'];
                 }
             } else {
                 $targetNodeText = $originNodeText;
             }
             $nodeName = $arrayNode['__nodeName__'];
             $nodeType = $arrayNode['type'];
             $msgid = $originNodeText;
             // if the nodeName already exists in the po file, we need to create other msgid
             if (isset($aMsgids[$msgid])) {
                 $msgid = '[' . $xmlFormFile . '?' . $nodeName . '] ' . $originNodeText;
             }
             $poFile->addTranslatorComment($xmlFormFile . '?' . $nodeName);
             $poFile->addTranslatorComment($xmlFormFile);
             $poFile->addReference($nodeType . ' - ' . $nodeName);
             $poFile->addTranslation(stripslashes($msgid), stripslashes($targetNodeText));
             $aMsgids[$msgid] = true;
             //if this node has options child nodes
             if (isset($arrayNode[$baseLang]) && isset($arrayNode[$baseLang][0]) && isset($arrayNode[$baseLang][0]['option'])) {
                 $originOptionNode = $arrayNode[$baseLang][0]['option'];
                 //get the options
                 $targetOptionExists = false;
                 if (isset($arrayNode[$targetLang]) && isset($arrayNode[$targetLang][0]) && isset($arrayNode[$targetLang][0]['option'])) {
                     $targetOptionNode = $arrayNode[$targetLang][0]['option'];
                     $targetOptionExists = true;
                 }
                 if (!is_array($originOptionNode)) {
                     if (is_string($originOptionNode)) {
                         $poFile->addTranslatorComment($xmlFormFile . '?' . $nodeName . '-' . $originOptionNode);
                         $poFile->addTranslatorComment($xmlFormFile);
                         $poFile->addReference($nodeType . ' - ' . $nodeName . ' - ' . $originOptionNode);
                         $poFile->addTranslation(stripslashes($msgid), stripslashes($originOptionNode));
                     }
                 } else {
                     foreach ($originOptionNode as $optionNode) {
                         $optionName = $optionNode['name'];
                         $originOptionValue = $optionNode['__nodeText__'];
                         if ($targetOptionExists) {
                             $targetOptionValue = getMatchDropdownOptionValue($optionName, $targetOptionNode);
                             if ($targetOptionValue === false) {
                                 $targetOptionValue = $originOptionValue;
                             }
                         } else {
                             $targetOptionValue = $originOptionValue;
                         }
                         $msgid = '[' . $xmlFormFile . '?' . $nodeName . '-' . $optionName . ']';
                         $poFile->addTranslatorComment($xmlFormFile . '?' . $nodeName . '-' . $optionName);
                         $poFile->addTranslatorComment($xmlFormFile);
                         $poFile->addReference($nodeType . ' - ' . $nodeName . ' - ' . $optionName);
                         $poFile->addTranslation($msgid, stripslashes($targetOptionValue));
                     }
                 }
             }
         }
         //end foreach
     }
 }
예제 #5
0
 /**
  * Search records in specified application delegation data
  *
  * @param string $AppUID
  *          application identifier
  * @param string $allAppDbData
  *          array of rows (array) with application data
  * @throws ApplicationWithoutDelegationRecordsException
  * @return array array of arrays with the following information(
  *         $documentInformation,
  *         $dynaformFieldTypes,
  *         $lastUpdateDate,
  *         $maxPriority,
  *         $delLastIndex,
  *         $assignedUsers,
  *         $assignedUsersRead,
  *         $assignedUsersUnread,
  *         $draftUser,
  *         $participatedUsers,
  *         $participatedUsersStartedByUser,
  *         $participatedUsersCompletedByUser,
  *         $unassignedUsers,
  *         $unassignedGroups
  */
 public function getApplicationIndexData($AppUID, $allAppDbData)
 {
     //G::LoadClass ('memcached');
     // get all the application data
     //$allAppDbData = $this->getApplicationDelegationData ($AppUID);
     // check if the application record was found
     // this case occurs when the application doesn't have related delegation
     // records.
     if (empty($allAppDbData) || !isset($allAppDbData[0])) {
         throw new ApplicationWithoutDelegationRecordsException(date('Y-m-d H:i:s:u') . " Application without delegation records. APP_UID: " . $AppUID . "\n");
     }
     // copy the application information
     $documentInformation = $allAppDbData[0];
     // get the last delegate date using the del_delegate_date
     $index = $this->aaGetMaximun($allAppDbData, 'DEL_DELEGATE_DATE', 'DATE');
     $lastUpdateDate = $allAppDbData[$index]['DEL_DELEGATE_DATE'];
     // get the delegate with max priority => minimun value
     $index2 = $this->aaGetMinimun($allAppDbData, 'DEL_PRIORITY', 'NUMBER', 'DEL_THREAD_STATUS', 'OPEN');
     if ($index2 == null) {
         // get the last priority
         $maxPriority = $allAppDbData[$index]['DEL_PRIORITY'];
     } else {
         $maxPriority = $allAppDbData[$index2]['DEL_PRIORITY'];
     }
     //get last delegation
     //in the case of parallel cases see the open cases
     $delLastIndex = array();
     $appStatus = $allAppDbData[0]['APP_STATUS'];
     if ($appStatus == 'COMPLETED' || $appStatus == 'CANCELLED' || $appStatus == 'PAUSED') {
         //case closed
         //get the last delegation
         //The correct would be to get all the cases paused in parallel cases
         $index = $this->aaGetMaximun($allAppDbData, 'DEL_INDEX', 'NUMBER');
         $delLastIndex[] = $allAppDbData[$index]['DEL_INDEX'];
     } else {
         //case is vigent
         $indexes = $this->aaSearchRecords($allAppDbData, array('DEL_THREAD_STATUS' => 'OPEN', 'DEL_FINISH_DATE' => 'NULL'));
         foreach ($indexes as $index) {
             $delLastIndex[] = $allAppDbData[$index]['DEL_INDEX'];
         }
         if (count($indexes) == 0) {
             //verify if is a paused case
             //show the last delegation
             //the correct would be to identify multiple cases if paused
             $index = $this->aaGetMaximun($allAppDbData, 'DEL_INDEX', 'NUMBER');
             $delLastIndex[] = $allAppDbData[$index]['DEL_INDEX'];
         }
     }
     $assignedUsers = array();
     $indexes = $this->aaSearchRecords($allAppDbData, array('DEL_THREAD_STATUS' => 'OPEN', 'DEL_FINISH_DATE' => 'NULL', 'APP_STATUS' => 'TO_DO', 'APP_TYPE' => ''));
     foreach ($indexes as $index) {
         $assignedUsers[] = array('USR_UID' => $allAppDbData[$index]['USR_UID'], 'DEL_INDEX' => $allAppDbData[$index]['DEL_INDEX']);
     }
     $assignedUsersRead = array();
     $indexes = $this->aaSearchRecords($allAppDbData, array('DEL_THREAD_STATUS' => 'OPEN', 'DEL_FINISH_DATE' => 'NULL', 'APP_STATUS' => 'TO_DO', 'DEL_INIT_DATE' => 'NOTNULL'));
     foreach ($indexes as $index) {
         $assignedUsersRead[] = array('USR_UID' => $allAppDbData[$index]['USR_UID'], 'DEL_INDEX' => $allAppDbData[$index]['DEL_INDEX']);
     }
     $assignedUsersUnread = array();
     $indexes = $this->aaSearchRecords($allAppDbData, array('DEL_THREAD_STATUS' => 'OPEN', 'DEL_FINISH_DATE' => 'NULL', 'APP_STATUS' => 'TO_DO', 'DEL_INIT_DATE' => 'NULL'));
     foreach ($indexes as $index) {
         $assignedUsersUnread[] = array('USR_UID' => $allAppDbData[$index]['USR_UID'], 'DEL_INDEX' => $allAppDbData[$index]['DEL_INDEX']);
     }
     $draftUser = array();
     $indexes = $this->aaSearchRecords($allAppDbData, array('DEL_THREAD_STATUS' => 'OPEN', 'DEL_FINISH_DATE' => 'NULL', 'APP_STATUS' => 'DRAFT'));
     if (!empty($indexes)) {
         $draftUser = array('USR_UID' => $allAppDbData[$indexes[0]]['USR_UID'], 'DEL_INDEX' => $allAppDbData[$indexes[0]]['DEL_INDEX']);
     }
     $participatedUsers = array();
     foreach ($allAppDbData as $row) {
         $participatedUsers[] = array('USR_UID' => $row['USR_UID'], 'DEL_INDEX' => $row['DEL_INDEX']);
     }
     $participatedUsersStartedByUser = array();
     $indexes = $this->aaSearchRecords($allAppDbData, array('DEL_INDEX' => '1'));
     foreach ($indexes as $index) {
         $participatedUsersStartedByUser[] = array('USR_UID' => $allAppDbData[$index]['USR_UID'], 'DEL_INDEX' => $allAppDbData[$index]['DEL_INDEX']);
     }
     $participatedUsersCompletedByUser = array();
     $indexes = $this->aaSearchRecords($allAppDbData, array('APP_STATUS' => 'COMPLETED'));
     foreach ($indexes as $index) {
         $participatedUsersCompletedByUser[] = array('USR_UID' => $allAppDbData[$index]['USR_UID'], 'DEL_INDEX' => $allAppDbData[$index]['DEL_INDEX']);
     }
     $pausedUsers = array();
     $indexes = $this->aaSearchRecords($allAppDbData, array('APP_TYPE' => 'PAUSE'));
     foreach ($indexes as $index) {
         if ($allAppDbData[$index]['APP_DISABLE_ACTION_USER'] == null || $allAppDbData[$index]['APP_DISABLE_ACTION_USER'] == 0) {
             $pausedUsers[] = array('USR_UID' => $allAppDbData[$index]['USR_UID'], 'DEL_INDEX' => $allAppDbData[$index]['DEL_INDEX']);
         }
     }
     // search information of unassigned users
     // the unassigned users are the self service users and groups.
     // the self service users are defined in the TASKs of the PROCESS.
     $unassignedUsers = array();
     $unassignedGroups = array();
     //filter only the delegations that are in selfservice status
     // `USR_UID` = '' AND `DEL_FINISH_DATE` IS NULL
     $indexes = $this->aaSearchRecords($allAppDbData, array('USR_UID' => 'NULL', 'DEL_FINISH_DATE' => 'NULL'));
     foreach ($indexes as $index) {
         $unassignedUsersGroups = array();
         // use cache
         //$oMemcache = PMmemcached::getSingleton ($this->_solrInstance);
         //$unassignedUsersGroups = $oMemcache->get ("SOLR_UNASSIGNED_USERS_GROUPS_" . $allAppDbData [$index] ['PRO_UID'] . "_" . $allAppDbData [$index] ['TAS_UID']);
         //if (! $unassignedUsersGroups) {
         $unassignedUsersGroups = $this->getTaskUnassignedUsersGroupsData($allAppDbData[$index]['PRO_UID'], $allAppDbData[$index]['TAS_UID']);
         // if the task has unassigned users or groups add del_index of delegation
         //foreach ($unassignedUsersGroups as $i => $newRow) {
         //  $unassignedUsersGroups [$i] ['DEL_INDEX'] = $allAppDbData [$index] ['DEL_INDEX'];
         //}
         // store in cache
         //$oMemcache->set ("SOLR_UNASSIGNED_USERS_GROUPS_" . $allAppDbData [$index] ['PRO_UID'] . "_" . $allAppDbData [$index] ['TAS_UID'], $unassignedUsersGroups);
         //}
         // copy list of unassigned users and groups
         foreach ($unassignedUsersGroups as $unassignedUserGroup) {
             //unassigned users
             if ($unassignedUserGroup['TU_RELATION'] == 1) {
                 $unassignedUsers[] = array('USR_UID' => $unassignedUserGroup['USR_UID'], 'DEL_INDEX' => $allAppDbData[$index]['DEL_INDEX']);
             } elseif ($unassignedUserGroup['TU_RELATION'] == 2) {
                 $unassignedGroups[] = array('USR_UID' => $unassignedUserGroup['USR_UID'], 'DEL_INDEX' => $allAppDbData[$index]['DEL_INDEX']);
             }
         }
     }
     // Get DataTypes of dynaforms
     // use cache array to store the dynaform variables per process
     // use memory array to store information of Datatypes of Dynaforms
     // All the datatypes of the process => all variables in all dynaforms in the
     // process
     $dynaformFieldTypes = array();
     // get cache instance
     //$oMemcache = PMmemcached::getSingleton ($this->_solrInstance);
     //$dynaformFieldTypes = $oMemcache->get ("SOLR_DYNAFORM_FIELD_TYPES_" . $documentInformation ['PRO_UID']);
     //if (! $dynaformFieldTypes) {
     G::LoadClass('dynaformhandler');
     $dynaformFileNames = $this->getProcessDynaformFileNames($documentInformation['PRO_UID']);
     $dynaformFields = array();
     foreach ($dynaformFileNames as $dynaformFileName) {
         if (is_file(PATH_DYNAFORM . $dynaformFileName['DYN_FILENAME'] . '.xml') && filesize(PATH_DYNAFORM . $dynaformFileName['DYN_FILENAME'] . '.xml') > 0) {
             $dyn = new dynaFormHandler(PATH_DYNAFORM . $dynaformFileName['DYN_FILENAME'] . '.xml');
             $dynaformFields[] = $dyn->getFields();
         }
         if (is_file(PATH_DYNAFORM . $dynaformFileName['DYN_FILENAME'] . '.xml') && filesize(PATH_DYNAFORM . $dynaformFileName['DYN_FILENAME'] . '.xml') == 0) {
             throw new ApplicationWithCorruptDynaformException(date('Y-m-d H:i:s:u') . "Application with corrupt dynaform. APP_UID: " . $AppUID . "\n");
         }
     }
     foreach ($dynaformFields as $aDynFormFields) {
         foreach ($aDynFormFields as $field) {
             // create array of fields and types
             if ($field->getAttribute('validate') == 'Int') {
                 $dynaformFieldTypes[$field->nodeName] = 'Int';
             } elseif ($field->getAttribute('validate') == 'Real') {
                 $dynaformFieldTypes[$field->nodeName] = 'Real';
             } else {
                 $dynaformFieldTypes[$field->nodeName] = $field->getAttribute('type');
             }
         }
     }
     // create cache of dynaformfields
     //$oMemcache->set ("SOLR_DYNAFORM_FIELD_TYPES_" . $documentInformation ['PRO_UID'], $dynaformFieldTypes);
     //}
     // return result values
     $result = array($documentInformation, $dynaformFieldTypes, $lastUpdateDate, $maxPriority, $delLastIndex, $assignedUsers, $assignedUsersRead, $assignedUsersUnread, $draftUser, $participatedUsers, $participatedUsersStartedByUser, $participatedUsersCompletedByUser, $unassignedUsers, $unassignedGroups, $pausedUsers);
     return $result;
 }
예제 #6
0
 /**
  * Verify if a DynaForm is assigned some Steps
  *
  * @param string $dynaFormUid Unique id of DynaForm
  * @param string $processUid  Unique id of Process
  *
  * return bool Return true if a DynaForm is assigned some Steps, false otherwise
  */
 public function dynaFormDepends($dynUid, $proUid)
 {
     $oCriteria = new \Criteria();
     $oCriteria->addSelectColumn(\DynaformPeer::DYN_TYPE);
     $oCriteria->add(\DynaformPeer::DYN_UID, $dynUid);
     $oCriteria->add(\DynaformPeer::PRO_UID, $proUid);
     $oDataset = \DynaformPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $dataDyna = $oDataset->getRow();
     if ($dataDyna['DYN_TYPE'] == 'grid') {
         $formsDepend = array();
         \G::LoadSystem('dynaformhandler');
         $oCriteria = new \Criteria('workflow');
         $oCriteria->addSelectColumn(\DynaformPeer::DYN_UID);
         $oCriteria->addSelectColumn(\ContentPeer::CON_VALUE);
         $oCriteria->add(\DynaformPeer::PRO_UID, $proUid);
         $oCriteria->add(\DynaformPeer::DYN_TYPE, "xmlform");
         $oCriteria->add(\ContentPeer::CON_CATEGORY, 'DYN_TITLE');
         $oCriteria->add(\ContentPeer::CON_LANG, SYS_LANG);
         $oCriteria->addJoin(\DynaformPeer::DYN_UID, \ContentPeer::CON_ID, \Criteria::INNER_JOIN);
         $oDataset = \DynaformPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($oDataset->next()) {
             $dataForms = $oDataset->getRow();
             $dynHandler = new \dynaFormHandler(PATH_DYNAFORM . $proUid . PATH_SEP . $dataForms["DYN_UID"] . ".xml");
             $dynFields = $dynHandler->getFields();
             foreach ($dynFields as $field) {
                 $sType = \Step::getAttribute($field, 'type');
                 if ($sType == 'grid') {
                     $sxmlgrid = \Step::getAttribute($field, 'xmlgrid');
                     $aGridInfo = explode("/", $sxmlgrid);
                     if ($aGridInfo[0] == $proUid && $aGridInfo[1] == $dynUid) {
                         $formsDepend[] = $dataForms["CON_VALUE"];
                     }
                 }
             }
         }
         if (!empty($formsDepend)) {
             $message = "You can not delete the grid '{$dynUid}', because it is in the ";
             $message .= count($formsDepend) == 1 ? 'form' : 'forms';
             $message .= ': ' . implode(', ', $formsDepend);
             return $message;
         }
     } else {
         $flagDepend = false;
         $stepsDepends = \Step::verifyDynaformAssigStep($dynUid, $proUid);
         $messageSteps = '(0) Depends in steps';
         if (!empty($stepsDepends)) {
             $flagDepend = true;
             $countSteps = count($stepsDepends);
             $messTemp = '';
             foreach ($stepsDepends as $value) {
                 $messTemp .= ", the task '" . $value['CON_VALUE'] . "' position " . $value['STEP_POSITION'];
             }
             $messageSteps = "({$countSteps}) Depends in steps in" . $messTemp;
         }
         $stepSupervisorsDepends = \StepSupervisor::verifyDynaformAssigStepSupervisor($dynUid, $proUid);
         $messageStepsSupervisors = '(0) Depends in steps supervisor';
         if (!empty($stepSupervisorsDepends)) {
             $flagDepend = true;
             $countSteps = count($stepSupervisorsDepends);
             $messageStepsSupervisors = "({$countSteps}) Depends in steps supervisor";
         }
         $objectPermissionDepends = \ObjectPermission::verifyDynaformAssigObjectPermission($dynUid, $proUid);
         $messageObjectPermission = '(0) Depends in permissions';
         if (!empty($objectPermissionDepends)) {
             $flagDepend = true;
             $countSteps = count($objectPermissionDepends);
             $messageObjectPermission = "({$countSteps}) Depends in permissions";
         }
         $caseTrackerDepends = \CaseTrackerObject::verifyDynaformAssigCaseTracker($dynUid, $proUid);
         $messageCaseTracker = '(0) Depends in case traker';
         if (!empty($caseTrackerDepends)) {
             $flagDepend = true;
             $countSteps = count($caseTrackerDepends);
             $messageCaseTracker = "({$countSteps}) Depends in case traker";
         }
         $dynaformDepends = \Dynaform::verifyDynaformAssignDynaform($dynUid, $proUid);
         $messageDynaform = '(0) Depends in case traker';
         if (!empty($dynaformDepends)) {
             $flagDepend = true;
             $countSteps = count($dynaformDepends);
             $messageDynaform = "({$countSteps}) Depends in dynaform";
         }
         if ($flagDepend) {
             $message = "You can not delete the dynaform '{$dynUid}', because it has the following dependencies: \n\n";
             $message .= $messageSteps . ".\n" . $messageStepsSupervisors . ".\n";
             $message .= $messageObjectPermission . ".\n" . $messageCaseTracker . "\n";
             $message .= $messageDynaform;
             return $message;
         }
         return '';
     }
 }
예제 #7
0
 /**
  * Get the uids of the grids into a xml form
  *
  * @param      string $sproUid   the uid of the process
  * @param      string $sdbsUid   the uid of the db connection
  * @author krlos <*****@*****.**>
  */
 function lookingforUidGrids($sproUid, $sObjUID)
 {
     require_once "classes/model/DynaformPeer.php";
     G::LoadSystem('dynaformhandler');
     $uidsGrids = array();
     $oC = new Criteria('workflow');
     $oC->add(DynaformPeer::DYN_UID, $sObjUID);
     $oC->add(DynaformPeer::PRO_UID, $sproUid);
     $oDataset = DynaformPeer::doSelectRS($oC);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $aRow = $oDataset->getRow();
     if ($aRow['DYN_TYPE'] == 'xmlform') {
         $oC1 = new Criteria('workflow');
         $oC1->add(DynaformPeer::PRO_UID, $sproUid);
         $oC1->add(DynaformPeer::DYN_TYPE, "xmlform");
         $oDataset = DynaformPeer::doSelectRS($oC1);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         while ($oDataset->next()) {
             $aRow1 = $oDataset->getRow();
             $dynHandler = new dynaFormHandler(PATH_DYNAFORM . $sproUid . "/" . $sObjUID . ".xml");
             $dynFields = $dynHandler->getFields();
             $sxmlgrid = '';
             $sType = '';
             $check = 0;
             foreach ($dynFields as $field) {
                 $sType = $this->getAttribute($field, 'type');
                 if ($sType == 'grid') {
                     $sxmlgrid = $this->getAttribute($field, 'xmlgrid');
                     //print_r($sxmlgrid);print"<hr>";
                     $aGridInfo = explode("/", $sxmlgrid);
                     $uidsGrids[] = $aGridInfo[1];
                 }
             }
         }
         return $uidsGrids;
     }
 }
예제 #8
0
 function export()
 {
     //G::LoadThirdParty('pear', 'Benchmark/Timer');
     G::LoadSystem('i18n_po');
     G::LoadClass("system");
     //echo G::getMemoryUsage();
     //$timer = new Benchmark_Timer();
     //$timer->start();
     //creating the .po file
     $sPOFile = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . MAIN_POFILE . '.' . $_GET['LOCALE'] . '.po';
     $poFile = new i18n_PO($sPOFile);
     $poFile->buildInit();
     $language = new Language();
     $locale = $_GET['LOCALE'];
     $_TARGET_LANG = $_GET['LOCALE'];
     $_BASE_LANG = 'en';
     if (strpos($locale, Translation::$localeSeparator) !== false) {
         list($LAN_ID, $IC_UID) = explode(Translation::$localeSeparator, $_GET['LOCALE']);
         $iCountry = new IsoCountry();
         $iCountryRecord = $iCountry->findById($IC_UID);
         if (!isset($iCountryRecord['IC_UID'])) {
             throw new Exception("Country Target ID '{$_GET['LAN_ID']}' doesn't exist!");
         }
         $sCountry = $iCountryRecord['IC_NAME'];
     } else {
         $LAN_ID = $locale;
         $sCountry = $IC_UID = '';
     }
     $langRecord = $language->findById($LAN_ID);
     if (!isset($langRecord['LAN_NAME'])) {
         throw new Exception("Language Target ID \"{$LAN_ID}\" doesn't exist!");
     }
     $sLanguage = $langRecord['LAN_NAME'];
     //setting headers
     $poFile->addHeader('Project-Id-Version', 'ProcessMaker ' . System::getVersion());
     $poFile->addHeader('POT-Creation-Date', '');
     $poFile->addHeader('PO-Revision-Date', date('Y-m-d H:i:s'));
     $poFile->addHeader('Last-Translator', '');
     $poFile->addHeader('Language-Team', 'Colosa Developers Team <*****@*****.**>');
     $poFile->addHeader('MIME-Version', '1.0');
     $poFile->addHeader('Content-Type', 'text/plain; charset=utf-8');
     $poFile->addHeader('Content-Transfer_Encoding', '8bit');
     $poFile->addHeader('X-Poedit-Language', ucwords($sLanguage));
     $poFile->addHeader('X-Poedit-Country', ucwords($sCountry));
     $poFile->addHeader('X-Poedit-SourceCharset', 'utf-8');
     $poFile->addHeader('Content-Transfer-Encoding', '8bit');
     //$timer->setMarker('end making po headers');
     //export translation
     $aLabels = array();
     $aMsgids = array();
     // selecting all translations records of base language 'en' on TRANSLATIONS table
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(TranslationPeer::TRN_CATEGORY);
     $oCriteria->addSelectColumn(TranslationPeer::TRN_ID);
     $oCriteria->addSelectColumn(TranslationPeer::TRN_VALUE);
     $oCriteria->add(TranslationPeer::TRN_LANG, 'en');
     $oDataset = TranslationPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $targetLangRecords = array();
     // retrieve the translation for the target language
     if ($LAN_ID != 'en') {
         // only if it is different language than base language 'en'
         $c = new Criteria('workflow');
         $c->addSelectColumn(TranslationPeer::TRN_CATEGORY);
         $c->addSelectColumn(TranslationPeer::TRN_ID);
         $c->addSelectColumn(TranslationPeer::TRN_VALUE);
         $c->add(TranslationPeer::TRN_LANG, $_GET['LOCALE']);
         $ds = TranslationPeer::doSelectRS($c);
         $ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         while ($ds->next()) {
             $row = $ds->getRow();
             $targetLangRecords[$row['TRN_CATEGORY'] . '/' . $row['TRN_ID']] = $row['TRN_VALUE'];
         }
     }
     // get the respective translation for each english label
     while ($oDataset->next()) {
         $aRow1 = $oDataset->getRow();
         $trnCategory = trim($aRow1['TRN_CATEGORY']);
         # Validation, validate that the TRN_CATEGORY contains valid characteres
         preg_match("/^[0-9a-zA-Z_-]+/", $trnCategory, $sTestResult);
         // IF the translations id "TRN_ID" has invalid characteres or has not accepted categories
         if ($sTestResult[0] !== $trnCategory || $trnCategory != 'LABEL' && $trnCategory != 'JAVASCRIPT') {
             $oTranslation = new Translation();
             $oTranslation->remove($aRow1['TRN_CATEGORY'], $aRow1['TRN_ID'], 'en');
             //remove not accepted translations
             continue;
             //jump to next iteration
         }
         // retrieve the translation for the target language
         if ($LAN_ID != 'en') {
             // only if it is different language than base language 'en'
             if (isset($targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']])) {
                 $msgstr = $targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']] != '' ? $targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']] : $aRow1['TRN_VALUE'];
             } else {
                 $msgstr = $aRow1['TRN_VALUE'];
             }
         } else {
             //if not just copy the same
             $msgstr = $aRow1['TRN_VALUE'];
         }
         $msgid = trim($aRow1['TRN_VALUE']);
         $msgstr = trim($msgstr);
         if (isset($aMsgids[$msgid])) {
             $msgid = '[' . $aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID'] . '] ' . $msgid;
         }
         $poFile->addTranslatorComment('TRANSLATION');
         $poFile->addTranslatorComment($aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']);
         $poFile->addReference($aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']);
         $poFile->addTranslation(stripcslashes($msgid), stripcslashes($msgstr));
         $aMsgids[$msgid] = true;
     }
     //$timer->setMarker('end making 1th .po from db');
     //now find labels in xmlforms
     /************/
     $aExceptionFields = array('', 'javascript', 'hidden', 'phpvariable', 'private', 'toolbar', 'xmlmenu', 'toolbutton', 'cellmark', 'grid');
     //find all xml files into PATH_XMLFORM
     $aXMLForms = glob(PATH_XMLFORM . '*/*.xml');
     //from a sublevel to
     $aXMLForms2 = glob(PATH_XMLFORM . '*/*/*.xml');
     $aXMLForms = array_merge($aXMLForms, $aXMLForms2);
     $aEnglishLabel = array();
     $aOptions = array();
     $nodesNames = array();
     G::loadSystem('dynaformhandler');
     foreach ($aXMLForms as $xmlFormPath) {
         $xmlFormFile = str_replace(chr(92), '/', $xmlFormPath);
         $xmlFormFile = str_replace(PATH_XMLFORM, '', $xmlFormPath);
         $dynaForm = new dynaFormHandler($xmlFormPath);
         $dynaNodes = $dynaForm->getFields();
         //get all fields of each xmlform
         foreach ($dynaNodes as $oNode) {
             $sNodeName = $oNode->nodeName;
             //$arrayNode = $dynaForm->getArray($oNode, Array('type', $_BASE_LANG, $_BASE_LANG));
             $arrayNode = $dynaForm->getArray($oNode);
             //if has not native language translation
             if (!isset($arrayNode[$_BASE_LANG]) || !isset($arrayNode['type']) || isset($arrayNode['type']) && in_array($arrayNode['type'], $aExceptionFields)) {
                 continue;
                 //just continue with the next node
             }
             // Getting the Base Origin Text
             if (!is_array($arrayNode[$_BASE_LANG])) {
                 $originNodeText = trim($arrayNode[$_BASE_LANG]);
             } else {
                 $langNode = $arrayNode[$_BASE_LANG][0];
                 $originNodeText = $langNode['__nodeText__'];
             }
             // Getting the Base Target Text
             if (isset($arrayNode[$_TARGET_LANG])) {
                 if (!is_array($arrayNode[$_TARGET_LANG])) {
                     $targetNodeText = trim($arrayNode[$_TARGET_LANG]);
                 } else {
                     $langNode = $arrayNode[$_TARGET_LANG][0];
                     $targetNodeText = $langNode['__nodeText__'];
                 }
             } else {
                 $targetNodeText = $originNodeText;
             }
             $nodeName = $arrayNode['__nodeName__'];
             $nodeType = $arrayNode['type'];
             $msgid = $originNodeText;
             // if the nodeName already exists in the po file, we need to create other msgid
             if (isset($aMsgids[$msgid])) {
                 $msgid = '[' . $xmlFormFile . '?' . $nodeName . '] ' . $originNodeText;
             }
             $poFile->addTranslatorComment($xmlFormFile . '?' . $nodeName);
             $poFile->addTranslatorComment($xmlFormFile);
             $poFile->addReference($nodeType . ' - ' . $nodeName);
             $poFile->addTranslation(stripslashes($msgid), stripslashes($targetNodeText));
             $aMsgids[$msgid] = true;
             //if this node has options child nodes
             if (isset($arrayNode[$_BASE_LANG]) && isset($arrayNode[$_BASE_LANG][0]) && isset($arrayNode[$_BASE_LANG][0]['option'])) {
                 $originOptionNode = $arrayNode[$_BASE_LANG][0]['option'];
                 //get the options
                 $targetOptionExists = false;
                 if (isset($arrayNode[$_TARGET_LANG]) && isset($arrayNode[$_TARGET_LANG][0]) && isset($arrayNode[$_TARGET_LANG][0]['option'])) {
                     $targetOptionNode = $arrayNode[$_TARGET_LANG][0]['option'];
                     $targetOptionExists = true;
                 }
                 if (!is_array($originOptionNode)) {
                     if (is_string($originOptionNode)) {
                         $poFile->addTranslatorComment($xmlFormFile . '?' . $nodeName . '-' . $originOptionNode);
                         $poFile->addTranslatorComment($xmlFormFile);
                         $poFile->addReference($nodeType . ' - ' . $nodeName . ' - ' . $originOptionNode);
                         $poFile->addTranslation(stripslashes($msgid), stripslashes($originOptionNode));
                     }
                 } else {
                     foreach ($originOptionNode as $optionNode) {
                         $optionName = $optionNode['name'];
                         $originOptionValue = $optionNode['__nodeText__'];
                         if ($targetOptionExists) {
                             $targetOptionValue = getMatchDropdownOptionValue($optionName, $targetOptionNode);
                             if ($targetOptionValue === false) {
                                 $targetOptionValue = $originOptionValue;
                             }
                         } else {
                             $targetOptionValue = $originOptionValue;
                         }
                         $msgid = '[' . $xmlFormFile . '?' . $nodeName . '-' . $optionName . ']';
                         $poFile->addTranslatorComment($xmlFormFile . '?' . $nodeName . '-' . $optionName);
                         $poFile->addTranslatorComment($xmlFormFile);
                         $poFile->addReference($nodeType . ' - ' . $nodeName . ' - ' . $optionName);
                         $poFile->addTranslation($msgid, stripslashes($targetOptionValue));
                     }
                 }
             }
         }
         //end foreach
     }
     //
     //$timer->setMarker('end xml files processed');
     //$profiling = $timer->getProfiling();
     //$timer->stop(); $timer->display();
     //echo G::getMemoryUsage();
     //die;
     //g::pr($profiling);
     G::streamFile($sPOFile, true);
 }
예제 #9
0
    /**
     * Function getVarsGrid returns all variables of Grid
     *
     * @access public
     * @param string proUid process ID
     * @param string dynUid dynaform ID
     * @return array
     */
    public static function getVarsGrid ($proUid, $dynUid)
    {
        $dynaformFields = array ();
        $aFieldsNames = array();
        $aFields = array();
        $aInvalidTypes = array("title", "subtitle", "file", "button", "reset", "submit", "javascript");
        $aMultipleSelectionFields = array("listbox", "checkgroup", "grid");

        if (is_file( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) {
            $dyn = new \dynaFormHandler( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' );
            $dynaformFields[] = $dyn->getFields();

            $fields = $dyn->getFields();

            foreach ($fields as $field) {
                if ($field->getAttribute("type") !== "grid") {
                    continue;
                }
                if (! in_array($field->getAttribute("type"), $aInvalidTypes) && ! in_array($field->tagName, $aFieldsNames)) {
                    $aFieldsNames[] = $field->tagName;
                    $aFields[] = array (
                        'sName' => $field->tagName,
                        'sType' => $field->getAttribute("type"),
                        'sLabel' => ($field->getAttribute("type") != 'grid' ? $label : '[ ' . G::LoadTranslation('ID_GRID') . ' ]')
                    );
                }
            }
        }

        return $aFields;
    }