protected function NavBar_Create() { $this->navBar = new Bs\Navbar($this, 'navbar'); //$this->objMenu->AddCssClass('navbar-ryaa'); $url = __PHP_ASSETS__ . '/_devtools/start_page.php'; $this->navBar->HeaderText = QHtml::RenderTag("img", ["class" => "logo", "src" => __IMAGE_ASSETS__ . "/qcubed_logo_footer.png", "alt" => "Logo"], null, true); $this->navBar->HeaderAnchor = $url; $this->navBar->StyleClass = Bs\Bootstrap::NavbarInverse; $objList = new Bs\NavbarList($this->navBar); $objListMenu = new Bs\NavbarDropdown('List'); $objEditMenu = new Bs\NavbarDropdown('New'); // Add all the lists and edits in the drafts directory $list = scandir(__DOCROOT__ . __FORMS__); foreach ($list as $name) { if ($offset = strpos($name, '_list.php')) { $objListMenu->AddItem(new Bs\NavbarItem(substr($name, 0, $offset), null, __FORMS__ . '/' . $name)); } elseif ($offset = strpos($name, '_edit.php')) { $objEditMenu->AddItem(new Bs\NavbarItem(substr($name, 0, $offset), null, __FORMS__ . '/' . $name)); } } $objList->AddMenuItem($objListMenu); $objList->AddMenuItem($objEditMenu); /* $objRandomMenu = new Bs\NavbarDropdown('Contribute'); $objList->AddMenuItem (new Bs\NavbarItem("Login", __SUBDIRECTORY__ . '/private/login.html', 'navbarLogin')); */ }
/** * Returns the html for the control. * @return string * @throws \QCallerException */ public function GetControlHtml() { $strHtml = \QHtml::RenderString($this->Name); if (!$this->blnAsButton) { $strHtml .= ' <span class="caret"></span>'; $strHtml = $this->RenderTag("a", ["href" => "#", "data-toggle" => "dropdown", "aria-haspopup" => "true", "aria-expanded" => "false"], null, $strHtml); } else { if (!$this->blnSplit) { $strHtml .= ' <span class="caret"></span>'; $strHtml = $this->RenderTag("button", ["data-toggle" => "dropdown", "aria-haspopup" => "true", "aria-expanded" => "false"], null, $strHtml); } else { $strHtml = $this->RenderTag("button", null, null, $strHtml); $strClass = "btn dropdown-toggle " . $this->strButtonSize . " " . $this->strButtonStyle; $strHtml .= \QHtml::RenderTag("button", ["class" => $strClass, "data-toggle" => "dropdown", "aria-haspopup" => "true", "aria-expanded" => "false"]); } } if ($this->HasDataBinder()) { $this->CallDataBinder(); } if ($this->GetItemCount()) { $strListHtml = ''; foreach ($this->GetAllItems() as $objItem) { $strListHtml .= $this->GetItemHtml($objItem); } $strHtml .= \QHtml::RenderTag("ul", ["id" => $this->ControlId . "_list", "class" => "dropdown-menu", "aria-labelledby" => $this->ControlId], $strListHtml); } if ($this->HasDataBinder()) { $this->RemoveAllItems(); } return $strHtml; }
protected function RenderButton($attrOverride) { if (!$this->blnInline) { $strHtml = parent::RenderButton($attrOverride); return \QHtml::RenderTag('div', ['class' => 'checkbox'], $strHtml); } }
public function GetItemText() { $strHtml = \QApplication::HtmlEntities($this->strName); if ($strAnchor = $this->strAnchor) { $strHtml = \QHtml::RenderTag('a', ['href' => $strAnchor], $strHtml, false, true); } return $strHtml; }
protected function GetIndicatorsHtml() { $strToReturn = ''; for ($intIndex = 0; $intIndex < $this->GetItemCount(); $intIndex++) { if ($intIndex == 0) { $strToReturn .= \QHtml::RenderTag('li', ['data-target' => '#' . $this->strControlId, 'data-slide-to' => $intIndex, 'class' => "active"]); } else { $strToReturn .= \QHtml::RenderTag('li', ['data-target' => '#' . $this->strControlId, 'data-slide-to' => $intIndex]); } } return $strToReturn; }
/** * Render as an HTML link (anchor tag) * * @param string $strLabel Text to link to * @param string|null $strActionParameter Action parameter for this rendering of the control. Will be sent to the ActionParameter of the action. * @param null|array $attributes Array of attributes to add to the tag for the link. * @param string $strTag Tag to use. Defaults to 'a'. * * @return string */ public function RenderAsLink($strLabel, $strActionParameter = null, $attributes = [], $strTag = 'a', $blnHtmlEntities = true) { $defaults['href'] = 'javascript:;'; $defaults['data-qpxy'] = $this->strControlId; if ($strActionParameter) { $defaults['data-qap'] = $strActionParameter; } $attributes = array_merge($defaults, $attributes); // will only apply defaults that are not in attributes if ($blnHtmlEntities) { $strLabel = QApplication::HtmlEntities($strLabel); } return QHtml::RenderTag($strTag, $attributes, $strLabel); }
/** * Rendered the children of this control * @param bool $blnDisplayOutput Send the output to client? * * @return null|string */ protected function RenderChildren($blnDisplayOutput = true) { $strToReturn = ""; foreach ($this->GetChildControls() as $objControl) { if (!$objControl->Rendered) { $renderMethod = $objControl->strPreferredRenderMethod; $strToReturn .= QHtml::RenderTag('div', null, $objControl->{$renderMethod}(false)); } } if ($blnDisplayOutput) { print $strToReturn; return null; } else { return $strToReturn; } }
protected function GetControlHtml() { $attrOverrides['id'] = $this->strLinkUrl ? $this->strControlId . '_img' : $this->strControlId; // if a link, the parent tag will be the main tag $attrOverrides['src'] = $this->mixImageStandard instanceof QImageBase ? $this->mixImageStandard->RenderAsImgSrc(false) : $this->mixImageStandard; if (!$this->AltText) { $attrOverrides['alt'] = $this->ToolTip; } $strHtml = $this->RenderTag('img', $attrOverrides, null, null, true); if ($this->strLinkUrl) { $linkOverrides['href'] = $this->strLinkUrl; $linkOverrides['id'] = $this->strControlId; $linkOverrides['name'] = $this->strControlId; $this->GetLinkStyler()->ToolTip = $this->ToolTip; // copy tooltip $strLinkAttributes = $this->GetLinkStyler()->RenderHtmlAttributes($linkOverrides); $strHtml = QHtml::RenderTag('a', $strLinkAttributes, $strHtml); } return $strHtml; }
/** * Returns the html corresponding to a given item. You have many ways of rendering an item: * - Specify a template that will get evaluated for each item. See EvaluateTemplate for more info. * - Specify a HtmlCallback callable to be called for each item to get the html for the item. * - Override this routine. * - Specify the item's tag name, and then use the helper functions or callbacks to return just the * attributes and/or inner html of the object. * * @param $objItem * @return string * @throws QCallerException */ protected function GetItemHtml($objItem) { if ($this->strTemplate) { return $this->EvaluateTemplate($this->strTemplate); } elseif ($this->itemHtmlCallback) { if (is_string($this->itemHtmlCallback)) { $strMethod = $this->itemHtmlCallback; return $this->objForm->{$strMethod}($objItem, $this->intCurrentItemIndex); } else { return call_user_func($this->itemHtmlCallback, $objItem, $this->intCurrentItemIndex); } } if (!$this->strItemTagName) { throw new QCallerException("You must specify an item tag name before rendering the list."); } $strToReturn = QHtml::RenderTag($this->strItemTagName, $this->GetItemAttributes($objItem), $this->GetItemInnerHtml($objItem)); return $strToReturn; }
/** * Return the html for the table. * * @return string */ protected function GetControlHtml() { $this->DataBind(); if (empty($this->objDataSource) && $this->blnHideIfEmpty) { $this->objDataSource = null; return ''; } $strHtml = $this->RenderCaption(); // Column tags (if applicable) if ($this->blnRenderColumnTags) { $strHtml .= $this->GetColumnTagsHtml(); } // Header Row (if applicable) if ($this->blnShowHeader) { $strHtml .= QHtml::RenderTag('thead', null, $this->GetHeaderRowHtml()); } // Footer Row (if applicable) if ($this->blnShowFooter) { $strHtml .= QHtml::RenderTag('tfoot', null, $this->GetFooterRowHtml()); } // DataGrid Rows $strRows = ''; $this->intCurrentRowIndex = 0; if ($this->objDataSource) { foreach ($this->objDataSource as $objObject) { $strRows .= $this->GetDataGridRowHtml($objObject, $this->intCurrentRowIndex); $this->intCurrentRowIndex++; } } $strHtml .= QHtml::RenderTag('tbody', null, $strRows); $strHtml = $this->RenderTag('table', null, null, $strHtml); $this->objDataSource = null; return $strHtml; }
/** * Render as a single column. This implementation simply wraps the columns in divs. * @return string */ public function RenderButtonColumn() { $count = $this->ItemCount; $strToReturn = ''; for ($intIndex = 0; $intIndex < $count; $intIndex++) { $strHtml = $this->GetItemHtml($this->objListItemArray[$intIndex], $intIndex, $this->GetHtmlAttribute('tabindex'), $this->blnWrapLabel); $strToReturn .= QHtml::RenderTag('div', null, $strHtml); } $strToReturn = $this->RenderTag('div', ['id' => $this->strControlId], null, $strToReturn); return $strToReturn; }
public function chkSelectAll_Render($blnWithLabel = false) { $colIndex = $this->GetColIndex(); $controlId = 'chkSelectAll' . $colIndex . $this->objDataGrid->ControlId; $this->chkSelectAll = $this->objDataGrid->GetChildControl($controlId); if (null === $this->chkSelectAll) { $this->chkSelectAll = new QCheckBox($this->objDataGrid, $controlId); $this->chkSelectAll->Name = QApplication::Translate('Select All'); $colIndex = $this->GetColIndex(); $strControlIdStart = 'chkSelect' . $colIndex . $this->objDataGrid->ControlId . 'n'; $strControlIdStartLen = strlen($strControlIdStart); //Since a QDataGridLegacyColumn isn't a control, we can't include external js files, or have EndScripts //so we'll just have to include all the code in the onclick itself //hopefully this won't result in much duplication, since there shouldn't be too many //of these on a single form $strJavascript = "var datagrid = document.getElementById('{$this->objDataGrid->ControlId}');var selectAll = document.getElementById('{$this->chkSelectAll->ControlId}');var childInputs = datagrid.getElementsByTagName('input');for(var i = 0; i < childInputs.length; i++){var subid = childInputs[i].id.substring({$strControlIdStartLen}, 0);if(subid == '{$strControlIdStart}')childInputs[i].checked = selectAll.checked;}"; $this->chkSelectAll->AddAction(new QClickEvent(), new QJavaScriptAction($strJavascript)); } $strOutput = $this->chkSelectAll->Render(false); if ($blnWithLabel) { $strOutput = QHtml::RenderTag('label', null, $this->strName . ' ' . $strOutput); } return $strOutput; }
/** * Render the button code. Broken out to allow QRadioButton to use it too. * * @param $attrOverride * @return string */ protected function RenderButton($attrOverride) { if ($this->blnChecked) { $attrOverride['checked'] = 'checked'; } if (strlen($this->strText)) { $strText = $this->blnHtmlEntities ? QApplication::HtmlEntities($this->strText) : $this->strText; if (!$this->blnWrapLabel) { $strLabelAttributes = ' for="' . $this->strControlId . '"'; } else { $strLabelAttributes = $this->RenderLabelAttributes(); } $strCheckHtml = QHtml::RenderLabeledInput($strText, $this->strTextAlign == QTextAlign::Left, $this->RenderHtmlAttributes($attrOverride), $strLabelAttributes, $this->blnWrapLabel); if (!$this->blnWrapLabel) { // Additionally wrap in a span so we can associate the label with the checkbox visually and apply the styles $strCheckHtml = QHtml::RenderTag('span', $this->RenderLabelAttributes(), $strCheckHtml); } } else { $strCheckHtml = $this->RenderTag('input', $attrOverride, null, null, true); } return $strCheckHtml; }
/** * Return the text html of the item. * * @param mixed $objItem * @return string */ protected function GetItemText($objItem) { $strHtml = QApplication::HtmlEntities($objItem->Text); if ($strAnchor = $objItem->Anchor) { $strHtml = QHtml::RenderTag('a', ['href' => $strAnchor], $strHtml, false, true); } return $strHtml; }
/** * Renders the given html with an anchor wrapper that will make it toggle the currently drawn item. This should be called * from your drawing callback when drawing the heading. This could span the entire heading, or just a portion. * * @param $strHtml */ public function RenderToggleHelper($strHtml, $blnRenderOutput = true) { if ($this->intCurrentItemIndex == $this->intCurrentOpenItem) { $strClass = ''; $strExpanded = 'true'; } else { $strClass = 'collapsed'; $strExpanded = 'false'; } $strCollapseId = $this->strControlId . '_collapse_' . $this->intCurrentItemIndex; $strOut = \QHtml::RenderTag('a', ['class' => $strClass, 'data-toggle' => 'collapse', 'data-parent' => '#' . $this->strControlId, 'href' => '#' . $strCollapseId, 'aria-expanded' => $strExpanded, 'aria-controls' => $strCollapseId], $strHtml, false, true); if ($blnRenderOutput) { echo $strOut; } else { return $strOut; } }
/** * Returns the HTML for the tab header. This includes the names and the control logic to record what the * user clicked. * * @return string */ protected function GetTabHeaderHtml() { $strHtml = ''; $childControls = $this->GetChildControls(); for ($i = 0, $cnt = count($childControls); $i < $cnt; ++$i) { $strControlId = $childControls[$i]->ControlId; if (array_key_exists($key = $strControlId, $this->objTabHeadersArray) || array_key_exists($key = $i, $this->objTabHeadersArray)) { $objHeader = $this->objTabHeadersArray[$key]; if ($objHeader instanceof QControl) { $strText = $objHeader->GetControlHtml(); } else { $strText = (string) $objHeader; } } elseif ($strName = $childControls[$i]->Name) { $strText = $strName; } else { $strText = 'Tab ' . ($i + 1); } $strAnchor = QHtml::RenderTag('a', ['href' => '#' . $strControlId], $strText, false, true); $strHtml .= QHtml::RenderTag('li', null, $strAnchor); } return QHtml::RenderTag('ul', null, $strHtml); }
public function FetchCellObject($item) { $aParams = $this->GetCheckboxParams($item); $aParams['type'] = 'checkbox'; return QHtml::RenderTag('input', $aParams, null, true); }
protected function GetHelpBlock() { $strHtml = ""; if ($this->strValidationError) { $strHtml .= \QHtml::RenderTag('p', ['class' => 'help-block', 'id' => $this->strControlId . '_error'], $this->strValidationError); } elseif ($this->strWarning) { $strHtml .= \QHtml::RenderTag('p', ['class' => 'help-block', 'id' => $this->strControlId . '_warning'], $this->strWarning); } elseif ($this->strInstructions) { $strHtml .= \QHtml::RenderTag('p', ['class' => 'help-block', 'id' => $this->strControlId . '_help'], $this->strInstructions); } return $strHtml; }
/** * Renders the control with an attached name * * This will call {@link QControlBase::GetControlHtml()} for the bulk of the work, but will add layout html as well. It will include * the rendering of the Controls' name label, any errors or warnings, instructions, and html before/after (if specified). * As this is the parent class of all controls, this method defines how ALL controls will render when rendered with a name. * If you need certain controls to display differently, override this function in that control's class. * * @param boolean $blnDisplayOutput true to send to display buffer, false to just return then html * @throws QCallerException * @return string HTML of rendered Control */ public function RenderWithName($blnDisplayOutput = true) { //////////////////// // Call RenderHelper $this->RenderHelper(func_get_args(), __FUNCTION__); //////////////////// $aWrapperAttributes = array(); if (!$this->blnUseWrapper) { //there is no wrapper --> add the special attribute data-qrel to the name control $aWrapperAttributes['data-qrel'] = $this->strControlId; if (!$this->blnDisplay) { $aWrapperAttributes['style'] = 'display: none'; } } // Custom Render Functionality Here // Because this example RenderWithName will render a block-based element (e.g. a DIV), let's ensure // that IsBlockElement is set to true $this->blnIsBlockElement = true; // Render the Left side $strLabelClass = "form-name"; if ($this->blnRequired) { $strLabelClass .= ' required'; } if (!$this->Enabled) { $strLabelClass .= ' disabled'; } if ($this->strInstructions) { $strInstructions = '<br/>' . QHtml::RenderTag('span', ['class' => "instructions"], QHtml::RenderString($this->strInstructions)); } else { $strInstructions = ''; } $strLabel = QHtml::RenderTag('label', null, QHtml::RenderString($this->strName)); $strToReturn = QHtml::RenderTag('div', ['class' => $strLabelClass], $strLabel . $strInstructions); // Render the Right side $strMessage = ''; if ($this->strValidationError) { $strMessage = sprintf('<span class="error">%s</span>', QHtml::RenderString($this->strValidationError)); } else { if ($this->strWarning) { $strMessage = sprintf('<span class="warning">%s</span>', QHtml::RenderString($this->strWarning)); } } try { $strToReturn .= sprintf('<div class="form-field">%s%s%s%s</div>', $this->strHtmlBefore, $this->GetControlHtml(), $this->strHtmlAfter, $strMessage); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } // render control dressing, which is essentially a wrapper. Not sure why we are not just rendering a wrapper here! $strToReturn = QHtml::RenderTag('div', $aWrapperAttributes, $strToReturn); //////////////////////////////////////////// // Call RenderOutput, Returning its Contents return $this->RenderOutput($strToReturn, $blnDisplayOutput, false); //////////////////////////////////////////// }
/** * Override to return sortable column info. * * @param $objColumn * @return string */ protected function GetHeaderCellContent($objColumn) { $blnSortable = false; $strCellValue = $objColumn->FetchHeaderCellValue(); if ($objColumn->HtmlEntities) { $strCellValue = QApplication::HtmlEntities($strCellValue); } $strCellValue = QHtml::RenderTag('span', null, $strCellValue); // wrap in a span for positioning if ($this->strSortColumnId === $objColumn->Id) { if ($this->intSortDirection == self::SortAscending) { $strCellValue = $strCellValue . ' ' . QHtml::RenderTag('i', ['class' => 'fa fa-sort-desc fa-lg']); } else { $strCellValue = $strCellValue . ' ' . QHtml::RenderTag('i', ['class' => 'fa fa-sort-asc fa-lg']); } $blnSortable = true; } else { if ($objColumn->OrderByClause) { // sortable, but not currently being sorted $strCellValue = $strCellValue . ' ' . QHtml::RenderTag('i', ['class' => 'fa fa-sort fa-lg', 'style' => 'opacity:0.8']); $blnSortable = true; } } if ($blnSortable) { // Wrap header cell in an html5 block-link to help with assistive technologies. $strCellValue = QHtml::RenderTag('div', null, $strCellValue); $strCellValue = QHtml::RenderTag('a', ['href' => 'javascript:;'], $strCellValue); // action will be handled by qcubed.js click handler in qcubed.datagrid2() } return $strCellValue; }
/** * Render as a single column. This implementation simply wraps the rows in divs. * @return string */ public function RenderButtonColumn() { $count = $this->ItemCount; $strToReturn = ''; $groupAttributes = null; if ($this->strButtonGroupClass) { $groupAttributes = ["class" => $this->strButtonGroupClass]; } for ($intIndex = 0; $intIndex < $count; $intIndex++) { $strHtml = $this->GetItemHtml($this->GetItem($intIndex), $intIndex, $this->GetHtmlAttribute('tabindex'), $this->blnWrapLabel); $strToReturn .= QHtml::RenderTag('div', $groupAttributes, $strHtml); } return $this->RenderTag('div', null, null, $strToReturn); }
public function dtg_LinkRender($item) { return QHtml::RenderTag('a', ['href' => $item], urldecode($item)); }
/** * Helper function to render the current attributes and styles in a tag. Overrides will be merged in with * current values before creating the output, but they will not affect the current values. * * @param $strTag * @param null|array $attributeOverrides key/value pairs of values for attribute overrides * @param null|array $styleOverrides key/value pairs of values for style overrides * @param null|string $strInnerHtml inner html to render. Will NOT be escaped. * @param bool $blnIsVoidElement true if it should not have innerHtml or a closing tag. * @return string HTML out. Attributes will be escaped as needed, but innerHtml will be raw, so be careful. */ protected function RenderTag($strTag, $attributeOverrides = null, $styleOverrides = null, $strInnerHtml = null, $blnIsVoidElement = false, $blnNoSpace = false) { $strAttributes = $this->RenderHtmlAttributes($attributeOverrides, $styleOverrides); return QHtml::RenderTag($strTag, $strAttributes, $strInnerHtml, $blnIsVoidElement, $blnNoSpace); }
/** * Return the inner html for the select box. * @return string */ protected function RenderInnerHtml() { $strHtml = ''; $intItemCount = $this->GetItemCount(); if (!$intItemCount) { return ''; } $groups = array(); for ($intIndex = 0; $intIndex < $intItemCount; $intIndex++) { $objItem = $this->GetItem($intIndex); // Figure Out Groups (if applicable) if ($strGroup = $objItem->ItemGroup) { $groups[$strGroup][] = $objItem; } else { $groups[''][] = $objItem; } } foreach ($groups as $strGroup => $items) { if (!$strGroup) { foreach ($items as $objItem) { $strHtml .= $this->GetItemHtml($objItem); } } else { $strGroupHtml = ''; foreach ($items as $objItem) { $strGroupHtml .= $this->GetItemHtml($objItem); } $strHtml .= QHtml::RenderTag('optgroup', ['label' => QApplication::HtmlEntities($strGroup)], $strGroupHtml); } } return $strHtml; }