function multiPageScreen_addToOptionsList($fid, $options)
{
    $formObject = new formulizeForm($fid);
    $elements = $formObject->getVar('elements');
    $elementCaptions = $formObject->getVar('elementCaptions');
    foreach ($elementCaptions as $key => $elementCaption) {
        $options[$elements[$key]] = printSmart(trans(strip_tags($elementCaption)));
        // need to pull out potential HTML tags from the caption
    }
    return $options;
}
示例#2
0
 function multiPageScreen_addToOptionsList($form_id, $options)
 {
     $formObject = new formulizeForm($form_id, true);
     // true causes all elements, even ones now shown to any user, to be included
     $elements = $formObject->getVar('elements');
     $elementCaptions = $formObject->getVar('elementCaptions');
     foreach ($elementCaptions as $key => $elementCaption) {
         $options[$elements[$key]] = printSmart(trans(strip_tags($elementCaption)));
         // need to pull out potential HTML tags from the caption
     }
     return $options;
 }
示例#3
0
function cloneEntry($entry, $frid, $fid, $copies, $callback = null)
{
    global $xoopsDB, $xoopsUser;
    include_once XOOPS_ROOT_PATH . "/modules/formulize/class/forms.php";
    $lsbpairs = array();
    if ($frid) {
        include_once XOOPS_ROOT_PATH . "/modules/formulize/class/frameworks.php";
        include_once XOOPS_ROOT_PATH . "/modules/formulize/include/extract.php";
        $thisframe = new formulizeFramework($frid);
        $links = $thisframe->getVar('links');
        // get the element ids of the elements that are linked selectboxes pointing to another form
        $lsbindexer = 0;
        foreach ($links as $link) {
            // not a common value link, and not a uid link (key is 0 for uid links)
            if (!$link->getVar('common') and $link->getVar('key1') and $link->getVar('relationship') > 1) {
                // 2 is one to many
                // 3 is many to one
                if ($link->getVar('relationship') == 2) {
                    // key1 is the textbox, key2 is the lsb
                    $lsbpairs[$link->getVar('key1')] = $link->getVar('key2');
                } else {
                    // key 1 is the lsb and key 2 is the textbox
                    $lsbpairs[$link->getVar('key2')] = $link->getVar('key1');
                }
            }
        }
        $entries_query = getData($frid, $fid, $entry);
        $ids = internalRecordIds($entries_query[0], "", "", true);
        // true causes the first key of the returned array to be the fids
        foreach ($ids as $fid => $entryids) {
            foreach ($entryids as $id) {
                $entries_to_clone[$fid][] = $id;
            }
        }
    } else {
        $entries_to_clone[$fid][] = $entry;
    }
    $dataHandlers = array();
    $entryMap = array();
    for ($copy_counter = 0; $copy_counter < $copies; $copy_counter++) {
        foreach ($entries_to_clone as $fid => $entries) {
            // never clone an entry in a form that is a single-entry form
            $thisform = new formulizeForm($fid);
            if ($thisform->getVar('single') != "off") {
                continue;
            }
            foreach ($entries as $thisentry) {
                if (!isset($dataHandlers[$fid])) {
                    $dataHandlers[$fid] = new formulizeDataHandler($fid);
                }
                $clonedEntryId = $dataHandlers[$fid]->cloneEntry($thisentry, $callback);
                $dataHandlers[$fid]->setEntryOwnerGroups(getEntryOwner($clonedEntryId, $fid), $clonedEntryId);
                $entryMap[$fid][$thisentry][] = $clonedEntryId;
            }
        }
    }
    // all entries have been made.  Now we need to fix up any linked selectboxes
    $element_handler = xoops_getmodulehandler('elements', 'formulize');
    foreach ($lsbpairs as $source => $lsb) {
        $sourceElement = $element_handler->get($source);
        $lsbElement = $element_handler->get($lsb);
        $dataHandlers[$lsbElement->getVar('id_form')]->reassignLSB($sourceElement->getVar('id_form'), $lsbElement, $entryMap);
    }
    return $entryMap;
}