public function getDynaformTitle($idDynaform)
 {
     $d = new Dynaform();
     $d->setDynUid($idDynaform);
     $titleDynaform = $d->getDynTitle();
     return $titleDynaform;
 }
    public function getallDynaformsCriteria($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID)

    {

        //check OBJECT_PERMISSION table

        $this->verifyTable();



        $aObjectPermissions = $this->getAllObjects($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID);

        if (!is_array($aObjectPermissions)) {

            $aObjectPermissions = array(

                'DYNAFORMS' => array(-1),

                'INPUT_DOCUMENTS' => array(-1),

                'OUTPUT_DOCUMENTS' => array(-1)

            );

        }

        if (!isset($aObjectPermissions['DYNAFORMS'])) {

            $aObjectPermissions['DYNAFORMS'] = array(-1);

        } else {

            if (!is_array($aObjectPermissions['DYNAFORMS'])) {

                $aObjectPermissions['DYNAFORMS'] = array(-1);

            }

        }

        if (!isset($aObjectPermissions['INPUT_DOCUMENTS'])) {

            $aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);

        } else {

            if (!is_array($aObjectPermissions['INPUT_DOCUMENTS'])) {

                $aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);

            }

        }

        if (!isset($aObjectPermissions['OUTPUT_DOCUMENTS'])) {

            $aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);

        } else {

            if (!is_array($aObjectPermissions['OUTPUT_DOCUMENTS'])) {

                $aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);

            }

        }

        $oCriteria = new Criteria('workflow');

        $oCriteria->add(ApplicationPeer::APP_UID, $sApplicationUID);

        $oCriteria->addJoin(ApplicationPeer::PRO_UID, StepPeer::PRO_UID);

        $oCriteria->addJoin(StepPeer::STEP_UID_OBJ, DynaformPeer::DYN_UID);

        $oCriteria->add(StepPeer::STEP_TYPE_OBJ, 'DYNAFORM');

        $oCriteria->add(StepPeer::STEP_UID_OBJ, $aObjectPermissions['DYNAFORMS'], Criteria::IN);



        //These fields are missing now is completed

        $oCriteria->addSelectColumn(DynaformPeer::DYN_UID);

        $oCriteria->addSelectColumn(DynaformPeer::DYN_TYPE);

        $oCriteria->addSelectColumn(DynaformPeer::DYN_FILENAME);

        $oCriteria->addSelectColumn(ApplicationPeer::PRO_UID);

        ///-- Adding column STEP_POSITION for standardization

        $oCriteria->addSelectColumn(StepPeer::STEP_POSITION);



        $oCriteria->addAscendingOrderByColumn(StepPeer::STEP_POSITION);

        $oCriteria->setDistinct();





        $oDataset = DynaformPeer::doSelectRS($oCriteria);

        $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);

        $oDataset->next();

        $aInputDocuments = array();

        $aInputDocuments[] = array(

            'DYN_TITLE' => 'char'

        );



        while ($aRow = $oDataset->getRow()) {

            $o = new Dynaform();

            $o->setDynUid($aRow['DYN_UID']);

            $aFields['DYN_TITLE'] = $o->getDynTitle();

            $aFields['DYN_UID'] = $aRow['DYN_UID'];

            $aFields['EDIT'] = G::LoadTranslation('ID_EDIT');

            $aFields['PRO_UID'] = $sProcessUID;

            $aFields['APP_UID'] = $sApplicationUID;

            $aFields['TAS_UID'] = $sTasKUID;

            $aInputDocuments[] = $aFields;

            $oDataset->next();

        }



        $distinctArray = $aInputDocuments;

        $distinctArrayBase = $aInputDocuments;

        $distinctOriginal = array();

        foreach ($distinctArray as $distinctArrayKey => $distinctArrayValue) {

            $distinctOriginalPush = 1;

            foreach ($distinctOriginal as $distinctOriginalKey => $distinctOriginalValue) {

                if ($distinctArrayValue == $distinctOriginalValue) {

                    $distinctOriginalPush = 0;

                }

            }

            if ($distinctOriginalPush == 1) {

                $distinctOriginal[] = $distinctArrayValue;

            }

        }

        $aInputDocuments = $distinctOriginal;



        global $_DBArray;

        $_DBArray['Dynaforms'] = $aInputDocuments;

        $_SESSION['_DBArray'] = $_DBArray;

        G::LoadClass('ArrayPeer');

        $oCriteria = new Criteria('dbarray');

        $oCriteria->setDBArrayTable('Dynaforms');

        $oCriteria->setDistinct();

        //$oCriteria->addAscendingOrderByColumn(AppDocumentPeer::APP_DOC_CREATE_DATE);

        return $oCriteria;

    }
if (isset($_REQUEST['dynaformEditorParams'])) {
    $arrayParameterAux = @unserialize(rawurldecode($_REQUEST["dynaformEditorParams"]));
    if (!empty($arrayParameterAux) && isset($arrayParameterAux["DYNAFORM_NAME"])) {
        $arrayParameterAux["DYNAFORM_NAME"] = base64_decode($arrayParameterAux["DYNAFORM_NAME"]);
        $_SESSION["Current_Dynafom"]["Parameters"] = $arrayParameterAux;
        if (isset($_REQUEST['DYN_UID'])) {
            if (class_exists('Dynaform')) {
                require_once 'classes/model/Dynaform.php';
            }
            $dynaform = new Dynaform();
            $dynaform->load($_REQUEST['DYN_UID']);
            G::LoadClass('dynaformEditor');
            $editor = new dynaformEditor(array());
            $editor->file = $dynaform->getDynFilename();
            $editor->home = PATH_DYNAFORM;
            $editor->title = $dynaform->getDynTitle();
            $editor->dyn_uid = $dynaform->getDynUid();
            $editor->pro_uid = $dynaform->getProUid();
            $editor->dyn_type = $dynaform->getDynType();
            $editor->dyn_title = $dynaform->getDynTitle();
            $editor->dyn_description = $dynaform->getDynDescription();
            $editor->dyn_editor = 'processmap';
            $editor->_setUseTemporalCopy(true);
            $A = isset($_SESSION['Current_Dynafom']['Parameters']['URL']) ? $_SESSION['Current_Dynafom']['Parameters']['URL'] : '';
            $form = new Form($dynaform->getProUid() . '/' . $dynaform->getDynUid(), PATH_DYNAFORM, SYS_LANG, true);
            $properties = array('A' => $A, 'DYN_UID' => $dynaform->getDynUid(), 'PRO_UID' => $dynaform->getProUid(), 'DYN_TITLE' => $dynaform->getDynTitle(), 'DYN_TYPE' => $dynaform->getDynType(), 'DYN_DESCRIPTION' => $dynaform->getDynDescription(), 'WIDTH' => $form->width, 'MODE' => $form->mode, 'PRINTDYNAFORM' => $form->printdynaform, 'ADJUSTGRIDSWIDTH' => $form->adjustgridswidth, 'NEXTSTEPSAVE' => $form->nextstepsave);
            $tmp = $editor->_getTmpData();
            $tmp['Properties'] = $properties;
            $editor->_setTmpData($tmp);
        }
    }
$t->can_ok($obj, 'setDynDescription', 'setDynDescription() is callable');
//#6
$t->can_ok($obj, 'create', 'create() is callable');
//#7
$t->can_ok($obj, 'update', 'update() is callable');
//#8
$t->can_ok($obj, 'load', 'load() is callable');
//#9
$t->can_ok($obj, 'remove', 'remove() is callable');
//getDynUid
//#10
$t->is($obj->getDynUid(), '', 'getDynUid() return empty, when the instance doesnt have any row');
//getDynTitle
try {
    $obj = new Dynaform();
    $res = $obj->getDynTitle();
} catch (Exception $e) {
    //#11
    $t->isa_ok($e, 'Exception', 'getDynTitle() return error when DYN_UID is not defined');
    //#12
    $t->is($e->getMessage(), "Error in getDynTitle, the DYN_UID can't be blank", 'getDynTitle() return Error in getDynTitle, the DYN_UID cant be blank');
}
//setDynDescription
try {
    $obj = new Dynaform();
    $obj->setDynDescription('x');
} catch (Exception $e) {
    //#13
    $t->isa_ok($e, 'Exception', 'setDynDescription() return error when DYN_UID is not defined');
    //#14
    $t->is($e->getMessage(), "Error in setDynDescription, the DYN_UID can't be blank", 'setDynDescription() return Error in getAppTitle, the APP_UID cant be blank');
Exemple #5
0
 public function getDynaformHistory($PRO_UID, $TAS_UID, $APP_UID, $DYN_UID = "")
 {
     G::LoadClass('case');
     $oCase = new Cases();
     $oCase->verifyTable();
     $aObjectPermissions = $oCase->getAllObjects($PRO_UID, $APP_UID, $TAS_UID, $_SESSION['USER_LOGGED']);
     if (!is_array($aObjectPermissions)) {
         $aObjectPermissions = array('DYNAFORMS' => array(-1), 'INPUT_DOCUMENTS' => array(-1), 'OUTPUT_DOCUMENTS' => array(-1));
     }
     if (!isset($aObjectPermissions['DYNAFORMS'])) {
         $aObjectPermissions['DYNAFORMS'] = array(-1);
     } else {
         if (!is_array($aObjectPermissions['DYNAFORMS'])) {
             $aObjectPermissions['DYNAFORMS'] = array(-1);
         }
     }
     if (!isset($aObjectPermissions['INPUT_DOCUMENTS'])) {
         $aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
     } else {
         if (!is_array($aObjectPermissions['INPUT_DOCUMENTS'])) {
             $aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
         }
     }
     if (!isset($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
         $aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);
     } else {
         if (!is_array($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
             $aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);
         }
     }
     $c = new Criteria('workflow');
     $c->addSelectColumn(AppHistoryPeer::APP_UID);
     $c->addSelectColumn(AppHistoryPeer::DEL_INDEX);
     $c->addSelectColumn(AppHistoryPeer::PRO_UID);
     $c->addSelectColumn(AppHistoryPeer::TAS_UID);
     $c->addSelectColumn(AppHistoryPeer::DYN_UID);
     $c->addSelectColumn(AppHistoryPeer::USR_UID);
     $c->addSelectColumn(AppHistoryPeer::APP_STATUS);
     $c->addSelectColumn(AppHistoryPeer::HISTORY_DATE);
     $c->addSelectColumn(AppHistoryPeer::HISTORY_DATA);
     $c->addSelectColumn(UsersPeer::USR_FIRSTNAME);
     $c->addSelectColumn(UsersPeer::USR_LASTNAME);
     $c->addAsColumn('USR_NAME', "CONCAT(USR_LASTNAME, ' ', USR_FIRSTNAME)");
     $c->addJoin(AppHistoryPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
     //WHERE
     $c->add(AppHistoryPeer::DYN_UID, $aObjectPermissions['DYNAFORMS'], Criteria::IN);
     $c->add(AppHistoryPeer::PRO_UID, $PRO_UID);
     $c->add(AppHistoryPeer::APP_UID, $APP_UID);
     if (isset($DYN_UID) && $DYN_UID != "") {
         $c->add(AppHistoryPeer::DYN_UID, $DYN_UID);
     }
     //ORDER BY
     $c->clearOrderByColumns();
     $c->addDescendingOrderByColumn(AppHistoryPeer::HISTORY_DATE);
     //Execute
     $oDataset = AppHistoryPeer::doSelectRS($c);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $aDynHistory = array();
     $aDynHistory[] = array('DYN_TITLE' => 'char');
     while ($aRow = $oDataset->getRow()) {
         $o = new Dynaform();
         $o->setDynUid($aRow['DYN_UID']);
         $aRow['DYN_TITLE'] = $o->getDynTitle();
         $changedValues = unserialize($aRow['HISTORY_DATA']);
         $html = "<table border='0' cellpadding='0' cellspacing='0'>";
         $sw_add = false;
         foreach ($changedValues as $key => $value) {
             if ($value != null && !is_array($value)) {
                 $sw_add = true;
                 $html .= "<tr>";
                 $html .= "<td><b>{$key}:</b> </td>";
                 $html .= "<td>{$value}</td>";
                 $html .= "</tr>";
             }
             if (is_array($value)) {
                 $html .= "<tr>";
                 $html .= "<td><b>{$key} (grid):</b> </td>";
                 $html .= "<td>";
                 $html .= "<table>";
                 foreach ($value as $key1 => $value1) {
                     $html .= "<tr>";
                     $html .= "<td><b>{$key1}</b></td>";
                     $html .= "<td>";
                     if (is_array($value1)) {
                         $sw_add = true;
                         $html .= "<table>";
                         foreach ($value1 as $key2 => $value2) {
                             $html .= "<tr>";
                             $html .= "<td><b>{$key2}</b></td>";
                             $html .= "<td>{$value2}</td>";
                             $html .= "</tr>";
                         }
                         $html .= "</table>";
                     }
                     $html .= "</td>";
                     $html .= "</tr>";
                 }
                 $html .= "</table>";
                 $html .= "</td>";
                 $html .= "</tr>";
                 $html .= "</td>";
             }
         }
         $html .= "</table>";
         $aRow['FIELDS'] = $html;
         if ($sw_add) {
             $aDynHistory[] = $aRow;
         }
         $oDataset->next();
     }
     global $_DBArray;
     $_DBArray['DynaformsHistory'] = $aDynHistory;
     $_SESSION['_DBArray'] = $_DBArray;
     G::LoadClass('ArrayPeer');
     $oCriteria = new Criteria('dbarray');
     $oCriteria->setDBArrayTable('DynaformsHistory');
     $oCriteria->addDescendingOrderByColumn(AppHistoryPeer::HISTORY_DATE);
     return $oCriteria;
 }