function getTextblocks($textblockIds, $idoffreetextblock, $view) { global $app_list_strings; if (empty($textblockIds) && $view == 'DetailView') { return array(); } $textblocks = array(); if ($idoffreetextblock) { if (!in_array($idoffreetextblock, $textblockIds)) { $freetext = new oqc_EditedTextBlock(); $freetext->retrieve($idoffreetextblock); $textblocks[] = $freetext; } } if (!empty($textblockIds)) { foreach ($textblockIds as $id) { $textblock = new oqc_Textblock(); $editedTextblock = new oqc_EditedTextBlock(); if ($textblock->retrieve($id)) { $textblocks[] = $textblock; } else { if ($editedTextblock->retrieve($id)) { $textblocks[] = $editedTextblock; } } } } else { // $GLOBALS['log']->error("creating empty textblock"); $newTextblock = new oqc_EditedTextBlock(); $newTextblock->id = create_guid(); $newTextblock->name = $app_list_strings["oqc"]["Textblocks"]["freeText"]; $newTextblock->description = ''; $textblocks[0] = $newTextblock; } return $textblocks; }
function get_all_linked_textblocks() { // return array_merge($this->get_linked_textblocks(), $this->get_linked_edited_textblocks()); $textblockIds = explode(' ', trim($this->textblocksequence)); $textblocks = array(); foreach ($textblockIds as $id) { $textblock = new oqc_Textblock(); $editedTextblock = new oqc_EditedTextBlock(); if ($textblock->retrieve($id)) { $textblocks[] = $textblock; } else { if ($editedTextblock->retrieve($id)) { $textblocks[] = $editedTextblock; } } } return $textblocks; }