function loadAbeRequest($AbeRequestsUid)
{
    require_once 'classes/model/AbeRequests.php';
    $criteria = new Criteria();
    $criteria->add(AbeRequestsPeer::ABE_REQ_UID, $AbeRequestsUid);
    $resultRequests = AbeRequestsPeer::doSelectRS($criteria);
    $resultRequests->setFetchmode(ResultSet::FETCHMODE_ASSOC);
    $resultRequests->next();
    $abeRequests = $resultRequests->getRow();
    return $abeRequests;
}
Ejemplo n.º 2
0
 public function createOrUpdate($data)
 {
     $additionalFields = array();
     foreach ($data as $field => $value) {
         if (!in_array($field, $this->filterThisFields)) {
             $additionalFields[$field] = $value;
             unset($data[$field]);
         }
     }
     $connection = Propel::getConnection(AbeRequestsPeer::DATABASE_NAME);
     try {
         if (!isset($data['ABE_REQ_UID'])) {
             $data['ABE_REQ_UID'] = '';
         }
         if ($data['ABE_REQ_UID'] == '') {
             $data['ABE_REQ_UID'] = G::generateUniqueID();
             $data['ABE_REQ_DATE'] = date('Y-m-d H:i:s');
             $AbeRequestsInstance = new AbeRequests();
         } else {
             $AbeRequestsInstance = AbeRequestsPeer::retrieveByPK($data['ABE_REQ_UID']);
         }
         $AbeRequestsInstance->fromArray($data, BasePeer::TYPE_FIELDNAME);
         if ($AbeRequestsInstance->validate()) {
             $connection->begin();
             $result = $AbeRequestsInstance->save();
             $connection->commit();
             return $data['ABE_REQ_UID'];
         } else {
             $message = '';
             $validationFailures = $AbeRequestsInstance->getValidationFailures();
             foreach ($validationFailures as $validationFailure) {
                 $message .= $validationFailure->getMessage() . '. ';
             }
             throw new Exception('Error trying to update: ' . $message);
         }
     } catch (Exception $error) {
         $connection->rollback();
         throw $error;
     }
 }
Ejemplo n.º 3
0
    /**
     * 
     * @url GET /viewForm
     */
    public function viewForm($params)
    {
        //coment
        if (!isset($_REQUEST['REQ_UID'])) {
            $_REQUEST['REQ_UID'] = '';
        }

        $criteria = new Criteria();
        $criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID);
        $criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID);
        $criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID);
        $criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID);
        $criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD);

        $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID);
        $criteria->addSelectColumn(AbeRequestsPeer::APP_UID);
        $criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX);

        $criteria->addSelectColumn(AbeResponsesPeer::ABE_RES_UID);
        $criteria->addSelectColumn(AbeResponsesPeer::ABE_RES_DATA);


        $criteria->add(AbeRequestsPeer::ABE_REQ_UID, $_REQUEST['REQ_UID']);
        $criteria->addJoin(AbeRequestsPeer::ABE_UID, AbeConfigurationPeer::ABE_UID);
        $criteria->addJoin(AbeResponsesPeer::ABE_REQ_UID, AbeRequestsPeer::ABE_REQ_UID);
        $resultRes = AbeRequestsPeer::doSelectRS($criteria);
        $resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);

        $resultRes->next();
        $dataRes = Array();
        $message = 'The user has not responded to this request.';

        if ($dataRes = $resultRes->getRow()) {
            $_SESSION['CURRENT_DYN_UID'] = trim($dataRes['DYN_UID']);
            $dynaform = new Form($dataRes['PRO_UID'] . PATH_SEP . trim($dataRes['DYN_UID']), PATH_DYNAFORM, SYS_LANG, false);
            $dynaform->mode = 'view';

            if ($dataRes['ABE_RES_DATA'] != '') {
                $value = unserialize($dataRes['ABE_RES_DATA']);

                if (is_array($value)) {
                    $dynaform->values = $value;

                    foreach ($dynaform->fields as $fieldName => $field) {
                        if ($field->type == 'submit') {
                            unset($dynaform->fields[$fieldName]);
                        }
                    }

                    $message = $dynaform->render(PATH_CORE . 'templates/xmlform.html', $scriptCode);
                } else {
                    $response = $dynaform->render(PATH_CORE . 'templates/xmlform.html', $scriptCode);
                    $field = $dynaform->fields[$dataRes['ABE_ACTION_FIELD']];
                    $message = '<b>Type:   </b>' . $field->type . '<br>';

                    switch ($field->type) {
                        case 'dropdown':
                        case 'radiogroup':
                            $message .=$field->label . ' - ';
                            $message .= $field->options[$value];
                            break;
                        case 'yesno':
                            $message .= '<b>' . $field->label . ' </b>- ';
                            $message .= ($value == 1) ? 'Yes' : 'No';
                            break;
                        case 'checkbox':
                            $message .= '<b>' . $field->label . '</b> - ';
                            $message .= ($value == 'On') ? 'Check' : 'Uncheck';
                            break;
                    }
                }
            }
        }
        return $message;
    }
Ejemplo n.º 4
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      Connection $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *       rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(AbeRequestsPeer::ABE_REQ_UID, $pks, Criteria::IN);
         $objs = AbeRequestsPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Ejemplo n.º 5
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
  * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = AbeRequestsPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setAbeReqUid($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setAbeUid($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setAppUid($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setDelIndex($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setAbeReqSentTo($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setAbeReqSubject($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setAbeReqBody($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setAbeReqDate($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setAbeReqStatus($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setAbeReqAnswered($arr[$keys[9]]);
     }
 }