/** * Prints the single leaf item * Since this is a slave, this can only EVER be called by AJAX. * * @param int $startUid UID in which we start * @param int $bank Bank UID * @param int $pid UID of the parent item * * @return string HTML Code */ public function printChildleafsByLoop($startUid, $bank, $pid) { // Check for valid parameters if (!is_numeric($startUid) || !is_numeric($bank)) { if (TYPO3_DLOG) { \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('printChildleafsByLoop (CommerceTeam\\Commerce\\Tree\\Leaf\\Slave) gets passed invalid parameters.', COMMERCE_EXTKEY, 3); } return ''; } // Set the bank $this->view->setBank($bank); $this->data->setBank($bank); // Set the TreeName $this->view->setTreeName($this->treeName); // init vars $out = ''; // get the Parent Item and set it as the starting child to print $child = $this->data->getChildByUid($startUid); $child['item_parent'] = $pid; // Abort if the starting Category is not found if (null == $child) { if (TYPO3_DLOG) { \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('printChildleafsByLoop (CommerceTeam\\Commerce\\Tree\\Leaf\\Slave) cannot find the starting category by its uid.', COMMERCE_EXTKEY, 3); } return ''; } /******************** * Printing the Item *******************/ // Give class 'expanded' if it is $exp = $this->data->isExpanded($child['uid']); $cssExpanded = $exp ? 'expanded' : ''; // Add class 'last' if it is $isLast = $this->isLast($child, $pid); $cssLast = $isLast ? ' last' : ''; $cssClass = $cssExpanded . ' ' . $cssLast; // start the element $out .= '<li class="' . $cssClass . '"> <div>'; // a slave can never be a bank $isBank = false; $hasChildren = $this->hasChildren($child); // pm icon $out .= $this->view->PMicon($child, $isLast, $exp, $isBank, $hasChildren); // icon $out .= $this->view->getIcon($child); // title $out .= $this->view->wrapTitle($child['title'], $child) . '</div>'; /****************** * Done printing *****************/ // Print the children from the child leafs if the current leaf is expanded if ($exp) { $out .= '<ul>'; for ($i = 0; $i < $this->leafcount; ++$i) { /** * Slave. * * @var \CommerceTeam\Commerce\Tree\Leaf\Slave $leaf */ $leaf =& $this->leafs[$i]; $out .= $leaf->printChildleafsByParent($child['uid'], $bank); } $out .= '</ul>'; } // close the list item $out .= '</li>'; return $out; }