Location: PHPKode > projects > Blandware AtLeap Lite - CMS on PHP > atleaplite/include/convert.php
<?php
/*
 *  Copyright 2008 Blandware (http://www.blandware.com)
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

/**
 * Contains some convert utilities.
 *
 * @package     AtleapLite
 * @author      Roman Puchkovskiy
 * @license     http://www.apache.org/licenses/LICENSE-2.0  Apache License, Version 2.0
 */

/**
 * Passes data from form object to dao object.
 *
 * @param object $form          object from which to get values
 * @param object $dao           dao object to which to store values
 * @param object $descriptor    does convertion job
 */
function formToDao(&$form, &$dao, &$descriptor) {
    $descriptor->formToDao($form, $dao);
}

/**
 * Passes data from dao object to form object.
 *
 * @param object $dao           dao object from which to get values
 * @param object $form          object to which to store values
 * @param object $descriptor    does convertion job
 */
function daoToForm(&$dao, &$form, &$descriptor) {
    $descriptor->daoToForm($dao, $form);
}

/**
 * Extracts data from form object to assoc array.
 *
 * @param object $form          object from which to get values
 * @param object $descriptor    does convertion job
 * @return array assoc array which maps property names (as in form object) to
 * their values
 */
function formToArray(&$form, &$descriptor) {
    return $descriptor->formToArray($form);
}

/**
 * Passes data from assoc array to form object.
 *
 * @param array $array          assoc array which maps property names (as in
 * form object) to their values
 * @param object $form          object to which to store values
 * @param object $descriptor    does convertion job
 */
function arrayToForm(&$array, &$form, &$descriptor) {
    $descriptor->arrayToForm($array, $form);
}

/**
 * Passes data from assoc array to dao object.
 *
 * @param array $array          assoc array which maps property names (as in
 * form object) to their values
 * @param object $dao           object to which to store values
 * @param object $descriptor    does convertion job
 */
function arrayToDao(&$array, &$dao, &$descriptor) {
    $descriptor->arrayToDao($array, $dao);
}

/**
 * Extracts data from form object to assoc array.
 *
 * @param object $dao           object from which to get values
 * @param object $descriptor    does convertion job
 * @return array assoc array which maps property names (as in form object) to
 * their values
 */
function daoToArray(&$dao, &$descriptor) {
    return $descriptor->daoToArray($dao);
}

?>
Return current item: Blandware AtLeap Lite - CMS on PHP