예제 #1
0
    /**
     *
     * @param string $folderName
     * @param strin(32) $folderParent
     * @return Ambigous <>|number
     */
    public function createFolder ($folderName, $folderParent = "/", $action = "createifnotexists")
    {
        $validActions = array ("createifnotexists","create","update");
        if (! in_array( $action, $validActions )) {
            $action = "createifnotexists";
        }

        //Clean Folder and Parent names (delete spaces...)
        $folderName = trim( $folderName );
        $folderParent = trim( $folderParent );
        //Try to Load the folder (Foldername+FolderParent)
        $oCriteria = new Criteria( 'workflow' );
        $oCriteria->add( AppFolderPeer::FOLDER_NAME, $folderName );
        $oCriteria->add( AppFolderPeer::FOLDER_PARENT_UID, $folderParent );
        $oDataset = AppFolderPeer::doSelectRS( $oCriteria );
        $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
        $oDataset->next();
        if ($aRow = $oDataset->getRow()) {
            //Folder exist, then return the ID
            $response['success'] = false;
            $response['message'] = $response['error'] = "Can't create folder <br /> A folder with same name already exist. <br /> $folderName";
            $response['folderUID'] = $aRow['FOLDER_UID'];
            //return ($aRow ['FOLDER_UID']);
            return ($response);
        } else {
            //Folder doesn't exist. Create and return the ID
            $folderUID = G::GenerateUniqueID();
            $tr = new AppFolder();
            $tr->setFolderUid( $folderUID );
            $tr->setFolderParentUid( $folderParent );
            $tr->setFolderName( $folderName );
            $tr->setFolderCreateDate( 'now' );
            $tr->setFolderUpdateDate( 'now' );
            if ($tr->validate()) {
                // we save it, since we get no validation errors, or do whatever else you like.
                $res = $tr->save();
                $response['success'] = true;
                $response['message'] = "Folder successfully created. <br /> $folderName";
                $response['folderUID'] = $folderUID;
                return ($response);
                //return $folderUID;
            } else {
                // Something went wrong. We can now get the validationFailures and handle them.
                $msg = '';
                $validationFailuresArray = $tr->getValidationFailures();
                foreach ($validationFailuresArray as $objValidationFailure) {
                    $msg .= $objValidationFailure->getMessage() . "<br/>";
                }
                $response['success'] = false;
                $response['message'] = $response['error'] = "Can't create folder \n A  \n " . $msg;
                return ($response);
            }
        }
    }
     $oCriteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_NAME);
     $oCriteria->add(ProcessCategoryPeer::CATEGORY_NAME, $catName);
     $oDataset = ProcessCategoryPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $row = $oDataset->getRow();
     $response = isset($row['CATEGORY_NAME']) ? 'false' : 'true';
     echo $response;
     break;
 case 'saveNewCategory':
     try {
         require_once 'classes/model/ProcessCategory.php';
         $catName = trim($_REQUEST['category']);
         $pcat = new ProcessCategory();
         $pcat->setNew(true);
         $pcat->setCategoryUid(G::GenerateUniqueID());
         $pcat->setCategoryName($catName);
         $pcat->save();
         G::auditLog("CreateCategory", "Category Name: " . $catName);
         echo '{success: true}';
     } catch (Exception $ex) {
         echo '{success: false, error: ' . $ex->getMessage() . '}';
     }
     break;
 case 'checkEditCategoryName':
     require_once 'classes/model/ProcessCategory.php';
     $catUID = $_REQUEST['cat_uid'];
     $catName = $_REQUEST['cat_name'];
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_NAME);
     $oCriteria->add(ProcessCategoryPeer::CATEGORY_NAME, $catName);
예제 #3
0
<?php

if ($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) {
    G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
    //G::header('location: ../login/login');
    die;
}
require_once "classes/model/ProcessCategory.php";
$fields['CATEGORY_UID'] = G::GenerateUniqueID();
$fields['CATEGORY_PARENT'] = '';
$fields['CATEGORY_NAME'] = '';
$fields['CATEGORY_ICON'] = '';
$G_MAIN_MENU = 'workflow';
$G_SUB_MENU = 'processCategory';
$G_ID_MENU_SELECTED = '';
$G_ID_SUB_MENU_SELECTED = '';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'processCategory/processCategoryNew', '', $fields, 'processCategorySave');
G::RenderPage('publishBlank', 'blank');
예제 #4
0
 /**
  * CALENDAR
  * getting default list
  *
  * @param string $httpData->PRO_UID (opional)
  */
 public function calendarEdit($httpData)
 {
     global $RBAC;
     //$RBAC->requirePermissions('PM_SETUP_ADVANCE');
     G::LoadClass('configuration');
     G::LoadClass('calendar');
     $CalendarUid = str_replace('"', '', isset($_GET['id']) ? $_GET['id'] : G::GenerateUniqueID());
     $calendarObj = new calendar();
     if (isset($_GET['id']) && $_GET['id'] != "") {
         $fields = $calendarObj->getCalendarInfoE($CalendarUid);
         $fields['OLD_NAME'] = $fields['CALENDAR_NAME'];
     }
     // For a new Calendar
     if (!isset($fields['CALENDAR_UID'])) {
         $fields['CALENDAR_UID'] = $CalendarUid;
         $fields['OLD_NAME'] = '';
         //Default Business Hour
         $fields['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_DAY'] = 7;
         $fields['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_START'] = "09:00";
         $fields['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_END'] = "17:00";
     }
     // Copy Calendar
     if (isset($_GET['cp']) && $_GET['cp'] == 1) {
         $fields['CALENDAR_UID'] = G::GenerateUniqueID();
         $fields['CALENDAR_NAME'] = G::LoadTranslation("ID_COPY_OF") . " " . $fields['CALENDAR_NAME'];
         $fields['OLD_NAME'] = $fields['CALENDAR_NAME'];
     }
     $c = new Configurations();
     $configPage = $c->getConfiguration('additionalTablesList', 'pageSize', '', $_SESSION['USER_LOGGED']);
     $Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
     $this->includeExtJS('admin/calendarEdit');
     $this->setView('admin/calendarEdit');
     $businessDayArray = array();
     for ($i = 0; $i < sizeof($fields['BUSINESS_DAY']); $i++) {
         $businessDayArray[$i] = $fields['BUSINESS_DAY'][$i + 1];
     }
     $fields['BUSINESS_DAY'] = $businessDayArray;
     //validating if the calendar is new, it means that we don't have the $_GET array
     $fields['HOLIDAY'] = isset($_GET['id']) && $_GET['id'] != '' ? $fields['HOLIDAY'] : array();
     $holidayArray = array();
     for ($i = 0; $i < sizeof($fields['HOLIDAY']); $i++) {
         $holidayArray[$i] = $fields['HOLIDAY'][$i + 1];
     }
     $_GET['id'] = isset($_GET['id']) && $_GET['id'] != '' ? $_GET['id'] : '';
     $fields['HOLIDAY'] = $holidayArray;
     $fields['NEWCALENDAR'] = 'NO';
     if (isset($_GET['id']) && $_GET['id'] == '') {
         $fields['CALENDAR_UID'] = G::GenerateUniqueID();
         $fields['NEWCALENDAR'] = 'YES';
     }
     $this->setJSVar('CALENDAR_UID', $fields['CALENDAR_UID']);
     $this->setJSVar('fields', $fields);
     G::RenderPage('publish', 'extJs');
 }
예제 #5
0
    die;
}
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'CALENDAR';
$CalendarUid = str_replace('"', '', isset($_GET['id']) ? $_GET['id'] : G::GenerateUniqueID());
//TODO: Add validation before save for all fields
G::LoadClass('calendar');
$calendarObj = new calendar();
if (isset($_GET['id']) && $_GET['id'] != "") {
    $fields = $calendarObj->getCalendarInfoE($CalendarUid);
    $fields['OLD_NAME'] = $fields['CALENDAR_NAME'];
}
if (!isset($fields['CALENDAR_UID'])) {
    //For a new Calendar
    $fields['CALENDAR_UID'] = $CalendarUid;
    $fields['OLD_NAME'] = '';
    //Default Business Hour
    $fields['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_DAY'] = 7;
    $fields['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_START'] = "09:00";
    $fields['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_END'] = "17:00";
}
if (isset($_GET['cp']) && $_GET['cp'] == 1) {
    // Copy Calendar
    $fields['CALENDAR_UID'] = G::GenerateUniqueID();
    $fields['CALENDAR_NAME'] = G::LoadTranslation("ID_COPY_OF") . " " . $fields['CALENDAR_NAME'];
}
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/calendarEdit', '', $fields, 'calendarSave');
G::RenderPage('publishBlank', 'blank');
예제 #6
0
<?php

require_once "classes/model/AppFolder.php";
$fields['FOLDER_UID'] = G::GenerateUniqueID();
$fields['FOLDER_PARENT_UID'] = '';
$fields['FOLDER_NAME'] = '';
$fields['FOLDER_CREATE_DATE'] = '';
$fields['FOLDER_UPDATE_DATE'] = '';
$G_MAIN_MENU = 'workflow';
$G_SUB_MENU = 'appFolder';
$G_ID_MENU_SELECTED = '';
$G_ID_SUB_MENU_SELECTED = '';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'appFolder/appFolderEdit', '', $fields, 'appFolderSave');
G::RenderPage('publish');
예제 #7
0
function newFolder()
{
    require_once ("classes/model/AppFolder.php");
    $oPMFolder = new AppFolder ();
    //G::pr($_POST);
    if ($_POST ['dir']=="") {
        $_POST ['dir']="/";
    }
    if ($_POST ['dir']=="root") {
        $_POST ['dir']="/";
    }
    $folderStructure = $oPMFolder->getFolderStructure ($_POST ['dir']);
    //G::pr($folderStructure);
    $folderPath = $folderStructure ['PATH'];
    $parentUid = $_POST ['dir'];
    $folderUid = G::GenerateUniqueID ();

    $formNewFolder=array();

    $formNewFolder["xtype"]="form";
    $formNewFolder["id"]= "simpleform";
    $formNewFolder["labelWidth"]=125;
    $formNewFolder["url"]="../appFolder/appFolderAjax.php";
    $formNewFolder["dialogtitle"]= G::LoadTranslation('ID_CREATE_FOLDER');
    $formNewFolder["frame"]= true;
    $formNewFolder["items"]= array();

    $field=array();
    $field["xtype"]= "label";
    $field["fieldLabel"]= "Path";
    $field["name"]= "form[FOLDER_PATH]";
    $field["id"]= "form[FOLDER_PATH]";
    $field["width"]=175;
    $field["allowBlank"]=false;
    $field["value"]=$folderPath;
    $field["text"]=$folderPath;
    $formNewFolder["items"][]= $field;

    $field=array();
    $field["xtype"]= "hidden";
    $field["fieldLabel"]= "Uid";
    $field["name"]= "form[FOLDER_UID]";
    $field["id"]= "form[FOLDER_UID]";
    $field["width"]=175;
    $field["allowBlank"]=false;
    $field["value"]=$folderUid;
    $formNewFolder["items"][]= $field;

    $field=array();
    $field["xtype"]= "hidden";
    $field["fieldLabel"]= "Parent";
    $field["name"]= "form[FOLDER_PARENT_UID]";
    $field["id"]= "form[FOLDER_PARENT_UID]";
    $field["width"]=175;
    $field["allowBlank"]=false;
    $field["value"]=$parentUid;
    $formNewFolder["items"][]= $field;

    $field=array();
    $field["xtype"]= "textfield";
    $field["fieldLabel"]= "Name";
    $field["name"]= "form[FOLDER_NAME]";
    $field["id"]= "form[FOLDER_NAME]";
    $field["width"]=175;
    $field["allowBlank"]=false;
    $formNewFolder["items"][]= $field;

    $formNewFolder["buttons"]= array();

    $button                     = array();
    $button["text"]             = "Create";
    $button["handler"]          = 'handlerCreate';
    $formNewFolder["buttons"][] = $button;

    $button=array();
    $button["text"]= "Cancel";
    $button["handler"]= 'handlerCancel';
    $formNewFolder["buttons"][]= $button;

    $handlerCreate='function() {
                statusBarMessage("Please wait...", true,true);
                Ext.getCmp("simpleform").getForm().submit({
                    //reset: true,
                    reset: false,
                    waitTitle : "&nbsp;",
                    success: function(form, action) {
                        statusBarMessage(action.result.message, false, true);
                        try{
                            dirTree.getSelectionModel().getSelectedNode().reload();
                        } catch(e) {}
                        datastore.reload();
                        Ext.getCmp("dialog").destroy();
                    },
                    failure: function(form, action) {
                        if(!action.result) return;
                        Ext.Msg.alert("Error!", action.result.error);
                        statusBarMessage(action.result.error, false, false);
                    },
                    scope: Ext.getCmp("simpleform"),
                    // add some vars to the request, similar to hidden fields
                    params: {option: "new",
                            action: "appFolderSave",
                            dir: datastore.directory,
                            confirm: "true"}
                })
            }';

    $handlerCancel='function() { Ext.getCmp("dialog").destroy(); }';

    $response=G::json_encode($formNewFolder);
    //This will add the functions to the Json response without quotes!
    $response=str_replace('"handlerCreate"',$handlerCreate,$response);
    $response=str_replace('"handlerCancel"',$handlerCancel,$response);
    print_r($response);

    /*
     $oFolder = new AppFolder ();
     $folderStructure = $oPMFolder->getFolderStructure ($_POST ['folderID']);
     $Fields ['FOLDER_PATH'] = $folderStructure ['PATH'];
     $Fields ['FOLDER_PARENT_UID'] = $_POST ['folderID'];
     $Fields ['FOLDER_UID'] = G::GenerateUniqueID ();
     $G_PUBLISH = new Publisher ();

     $G_PUBLISH->AddContent ('xmlform', 'xmlform', 'appFolder/appFolderEdit', '', $Fields, 'appFolderSave');
     G::RenderPage ('publish', 'raw');
     */
}